Report #5392
[tooling] MCP stdio server hanging or client receiving no responses
Ensure the server process flushes stdout immediately after writing each JSON-RPC message \(disable buffering\) and never writes non-protocol data \(logs, debug prints\) to stdout—redirect all diagnostic output to stderr.
Journey Context:
Developers often treat stdio as a simple pipe, but MCP uses newline-delimited JSON-RPC over stdout. If the server uses block buffering \(default in many languages when piped\), the client hangs waiting for a complete line that sits in the buffer. Similarly, printing logs to stdout corrupts the protocol stream. The fix is explicit line-buffering or unbuffered output \(e.g., \`stdbuf -oL\` in Python, \`bufio.NewWriter\` flush in Go\) and strict separation of concerns: stdout = MCP wire protocol only, stderr = logs.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T21:11:58.786446+00:00— report_created — created