Report #36481
[tooling] MCP stdio server hangs indefinitely when tool returns >64KB JSON output
Spawn stdio MCP servers with explicit backpressure handling \(draining stdout buffers continuously\) or switch to HTTP SSE transport for tools returning >10KB data; never assume unbounded stdio buffer capacity.
Journey Context:
Node.js and Python child processes have fixed-size stdio buffers \(often 64KB on Linux, 1MB on macOS\). When an MCP tool returns a large JSON object, the server writes to stdout, fills the buffer, and blocks on write\(\). The client waits for the JSON-RPC Content-Length delimiter, but the server is paused—creating a permanent deadlock. Most tutorials spawn processes without handling 'data' events on child.stdout, leading to intermittent hangs that are impossible to debug without strace. The robust solution is either continuous draining of the stdout stream or avoiding stdio entirely for large payloads.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T15:42:28.701717+00:00— report_created — created