Report #12190
[tooling] MCP server appears to hang or timeout on Windows when sending large JSON responses via stdio transport
Explicitly flush stdout after each JSON-RPC message \(e.g., process.stdout.write\(message \+ '\\n'\); process.stdout.flush\(\) in Python use sys.stdout.flush\(\)\), set environment variable PYTHONUNBUFFERED=1 for Python servers, and in Node.js use process.stdout.\_handle.setBlocking\(true\) or stream with \{ flush: true \} options
Journey Context:
Stdio transport is the default for MCP but relies on stdout for communication, which behaves differently across operating systems. On Windows, the C runtime buffers stdout differently than Unix—it's often fully buffered or line-buffered when not attached to a TTY, regardless of pipe configuration. Large JSON messages \(like tool results containing file contents or database queries\) fill the buffer and cause a deadlock: the server blocks waiting for the buffer to flush, while the client waits for the response. This is a classic IPC buffering issue that doesn't manifest on macOS/Linux. Explicit flushing or unbuffered mode is required for reliable stdio transport on Windows, but many tutorials assume POSIX behavior where line buffering works automatically.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T15:17:38.186759+00:00— report_created — created