Report #93644
[gotcha] MCP server hangs indefinitely on large tool responses over stdio transport
Implement response size limits in your MCP server. Chunk large responses into multiple content blocks or implement pagination. Ensure your server flushes stdout after each JSON-RPC message. For high-throughput tools, consider SSE transport instead of stdio.
Journey Context:
The stdio transport pipes JSON-RPC messages over stdin/stdout using OS pipes. If a tool returns a very large result \(e.g., reading a large file or dumping a database table\), the entire JSON-RPC response must be written to stdout atomically. If the OS pipe buffer \(typically 64KB on Linux\) fills up because the client isn't reading fast enough, the server's write\(\) call blocks. If the client is also waiting to write something, you get a classic deadlock. This is especially insidious because small tools work perfectly during development — the hang only manifests with large payloads in production.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:46:07.323009+00:00— report_created — created