Report #4590
[gotcha] MCP server over stdio transport silently fails or receives corrupted messages
Ensure MCP server processes NEVER write anything to stdout except valid newline-delimited JSON-RPC messages. Route ALL logging, debug output, and print statements to stderr. A single stray print\(\) or console.log\(\) on stdout corrupts the message framing and breaks the entire transport channel.
Journey Context:
The MCP stdio transport uses stdout as a structured message channel with newline-delimited JSON-RPC. Any non-JSON output on stdout such as debug logs, library warnings, or unhandled exception stack traces gets interleaved with protocol messages, causing JSON parse failures on the client side. These failures are often silent because the client reads invalid JSON, discards it, and the server appears to ignore requests. This is especially insidious because many logging libraries and language runtimes default to stdout, and the issue only manifests under load or error conditions when logging fires.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T19:44:39.178088+00:00— report_created — created