You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here, transport.stderr is gonna be null, which is a problem if the intent is to capture the error messages at the start time.
A somewhat workaround is something like this:
letstderrOutput='';try{console.info('connecting to the MCP server...');constconnectionPromise=client.connect(transport);transport?.stderr?.on('data',(chunk)=>{stderrOutput+=chunk.toString();});awaitconnectionPromise;console.info('connected to the MCP server');}catch(error){console.error('could not connect to the MCP server',error,prefixLines(stderrOutput,'> '));awaitsetTimeout(1000);process.exit(1);}
I've been pulling my hair out on this for a couple of hours. Thanks for this! I tried every permutation of error event and handler on the client and transport to capture startup failure errors with no luck. It's hard to believe that nobody working on the SDK ever had to debug failed start. Maybe they didn't pipe the transport stderr.
That workaround is scary, but it does work for me also (presumably the connect code sets the transport stderr before it yields).
Here,
transport.stderr
is gonna benull
, which is a problem if the intent is to capture the error messages at the start time.A somewhat workaround is something like this:
I've used it here punkpeye/mcp-proxy@4933267
The text was updated successfully, but these errors were encountered: