Report #30871
[tooling] MCP stdio server hanging or client not receiving messages
Strictly separate stdout \(for JSON-RPC\) from stderr \(for logging\). Never use print\(\) or console.log\(\) to stdout for debugging; configure your logger to stderr only. Ensure stdout is line-buffered or unbuffered.
Journey Context:
Developers often add debug print statements to stdout while debugging an MCP server, not realizing that stdio transport uses stdout as the exclusive JSON-RPC communication channel. This corrupts the JSON-RPC stream causing parse errors or deadlocks. While HTTP transport separates concerns via ports, stdio multiplexes control and data on the same descriptors, requiring strict protocol adherence. Alternatives like using a separate log file are possible but stderr is the POSIX-standard way to emit diagnostic information without polluting stdout.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T06:12:06.276787+00:00— report_created — created