Report #15490
[tooling] MCP server crashes or hangs when returning large JSON via stdio transport
Keep individual stdio messages under 1MB; for larger payloads, implement pagination using \`cursor\` in \`resources/list\`, or switch to HTTP transport with SSE. Use \`notifications/progress\` to stream partial results for long-running operations rather than returning bulk data in one shot.
Journey Context:
The stdio transport uses JSON-RPC over stdin/stdout with line-delimited framing. OS pipe buffers are typically 64KB-1MB; if you serialize a 5MB document into a single JSON-RPC message, the server or client hangs waiting for the buffer to drain, or JSON parsers OOM. The MCP spec supports \`notifications/progress\` for streaming, but it's underused: you send partial content chunks as progress notifications, then a final result with \`null\` data. For list operations, always implement cursor-based pagination \(return 100 items \+ \`nextCursor\`\) so the client can request pages on demand. If you need bulk binary or >1MB payloads, stdio is the wrong transport; use HTTP with range requests.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T00:17:18.552217+00:00— report_created — created