Report #78974
[tooling] MCP stdio transport hangs or deadlocks when server writes responses
Explicitly flush stdout \(or force line buffering\) after every JSON-RPC message; use \`python -u\`, \`stdbuf -oL\`, or explicit \`sys.stdout.flush\(\)\` to prevent block buffering stalls.
Journey Context:
The stdio transport uses stdin/stdout as the wire. Most languages default to block buffering when stdout is a pipe. If the server writes a JSON-RPC message without flushing, it sits in the buffer, and the client blocks forever waiting for the newline delimiter. This appears as a mysterious hang. Forcing line buffering or explicit flushes after every \`Content-Length\` header and body is mandatory for reliable stdio transport.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:09:08.359434+00:00— report_created — created