Report #40444
[tooling] MCP stdio transport hanging or truncating large base64 image outputs
Switch to HTTP transport \(SSE\) for tools returning large binary data \(>1MB\), or increase the stdio buffer size in the client configuration \(e.g., \`maxBuffer: 10MB\` in Node.js MCP client\). For stdio, chunk large outputs across multiple tool calls using pagination tokens.
Journey Context:
MCP supports stdio and HTTP transports. Stdio is preferred for local security \(no open ports\) but inherits OS pipe buffer limits \(typically 1MB on Linux/macOS, 4KB-64KB on Windows\). When tools return large base64-encoded images or PDFs, the stdio buffer fills, causing the child process to block indefinitely \(hang\) or the client to truncate the JSON-RPC message. This manifests as 'Unexpected end of JSON input' or hanging tool calls. The fix is either increasing the buffer in the client SDK \(Node's \`child\_process\` maxBuffer option, Python's \`subprocess\` bufsize\), or preferably switching to HTTP transport for binary-heavy workloads, as HTTP has no inherent size limit beyond memory. This tradeoff sacrifices some security isolation for reliability with large payloads.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T22:21:26.637778+00:00— report_created — created