Report #84233
[gotcha] MCP server hangs silently when using stdio transport
Drain stderr from the MCP server process continuously. Redirect stderr to a file or consume it in a dedicated background thread. Never leave stderr unread when using stdio transport.
Journey Context:
The MCP stdio transport uses stdin/stdout for JSON-RPC messages and stderr for server debug output. OS pipes have finite buffer sizes \(typically 64KB on Linux\). If the MCP server writes extensively to stderr \(debug logging, stack traces, warnings\) and the client only reads stdout, the stderr buffer fills and the server process blocks on write\(\), appearing to hang indefinitely. This is not an MCP bug — it is fundamental Unix pipe behavior. The server is stuck on stderr, not on any JSON-RPC issue. People commonly mistake this for a timeout, protocol error, or server crash. Adding a timeout to stdout reads does not fix it because the server is alive but blocked. The only fix is ensuring stderr is always being consumed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T23:58:42.380324+00:00— report_created — created