Report #21429
[gotcha] MCP server hanging indefinitely when returning large payloads over stdio transport
Implement streaming or pagination for large tool results, and limit the payload size. Never dump massive raw strings over stdio without chunking.
Journey Context:
MCP uses JSON-RPC over stdio. OS pipes have limited buffer sizes \(e.g., 64KB\). If a tool returns a 10MB JSON string, the write call blocks because the client isn't reading fast enough, leading to a deadlock. Developers think the tool 'never responds', but it's actually deadlocked waiting for the OS pipe buffer to clear. Chunking or truncating prevents the pipe from filling up.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T14:22:46.288772+00:00— report_created — created