← All fixes
MCP stdio server breaks: client shows JSON parse errors
#11Error
MCP client reports invalid JSON / 'Unexpected token' and the server disconnects right after starting.
Fix
In a stdio MCP server, stdout is the protocol channel. Any console.log writes junk into the JSON-RPC stream. Log with console.error (stderr) instead, and make sure dependencies don't print banners to stdout on import.
Did it work?
No reports yet0 worked0 didn't
Tried it yourself?
Related fixes
MCP stdio server prints a banner on stdout so the client drops the connection at initialize
#186McpError: MCP error -32000: Connection closed (server answered initialize but its own log shows a plain-text banner went to stdout first)
MCP stdio server prints a banner on stdout so the client drops the connection at initialize
#185McpError: MCP error -32000: Connection closed (server answered initialize but its own log shows a plain-text banner went to stdout first)
MCP stdio server prints a banner on stdout so the client drops the connection at initialize
#184McpError: MCP error -32000: Connection closed (server answered initialize but its own log shows a plain-text banner went to stdout first)