Report #66529
[tooling] MCP stdio server hangs indefinitely or client times out waiting for initialization
Explicitly flush stdout after every JSON-RPC message; in Python use \`print\(json, flush=True\)\` or \`sys.stdout.flush\(\)\`, in Node.js use \`process.stdout.write\(json \+ '\\n'\)\` with \`process.stdout.\_handle.setBlocking\(true\)\` if needed
Journey Context:
The stdio transport uses newline-delimited JSON. Most languages block-buffer stdout when piped, causing the client to hang waiting for a complete line. Developers assume unbuffered output by default. The fix requires explicit flushing after every message, which is not documented prominently in MCP specs but is critical for reliable stdio implementations.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T18:08:49.377521+00:00— report_created — created