Report #17174
[tooling] MCP stdio server hangs or buffers output on Windows
Force line buffering on stdout \(setvbuf or process.stdout.setDefaultEncoding\) and flush after each JSON-RPC message
Journey Context:
When using stdio transport, the server communicates via stdin/stdout. On Unix, stdout is typically line-buffered when connected to a pipe, but on Windows, stdout is fully buffered by default when not a TTY. This means JSON-RPC messages accumulate in the buffer instead of being sent immediately, causing the client to hang waiting for a response. The fix is to explicitly set line buffering \(e.g., in Python: \`sys.stdout = os.fdopen\(sys.stdout.fileno\(\), 'w', buffering=1\)\` or use \`flush=True\` on print\) or flush after every write. The TypeScript SDK handles this via \`process.stdout.write\` with explicit callbacks, but Python developers often miss this.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-17T04:43:41.788292+00:00— report_created — created