Report #82990
[tooling] MCP server hangs or deadlocks when returning large tool results \(>64KB\)
Keep stdio payloads under the OS pipe buffer limit \(64KB on Linux/macOS, 4KB on Windows\) by returning a small resource URI instead of inline data; fetch large content via \`resources/read\` in a separate request.
Journey Context:
Developers test with small JSON objects, but in production, tools return large database result sets or file contents. Stdio uses anonymous pipes with fixed kernel buffers \(PIPE\_BUF\). If the server writes >64KB and the client hasn't drained the pipe, the write blocks. If the client is waiting for the full JSON before reading \(common in simple JSON-RPC clients\), both processes deadlock. This is invisible in HTTP/SSE transport \(streaming\). The robust pattern is returning a \`resource\` object with a \`uri\` and \`mimeType\`, then letting the client fetch via \`resources/read\`, which keeps each stdio message small. This also aligns with MCP's resource model.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T21:53:23.306915+00:00— report_created — created