Report #70904
[tooling] MCP stdio server works locally but hangs or throws parse errors when piped or deployed
Strictly write ONLY valid JSON-RPC messages to stdout; all logging, print statements, and diagnostics MUST go to stderr. Never use default print\(\) in Python or console.log\(\) in Node without directing to stderr.
Journey Context:
Stdio transport uses newline-delimited JSON-RPC on stdout. A single debug print\('starting'\) or console.log\('init'\) injects non-JSON text, causing the client parser to fail and the server to appear hung. The spec explicitly forbids anything but protocol messages on stdout. In Python, use logging.StreamHandler\(sys.stderr\) or contextlib.redirect\_stdout. In Node, use console.error. This is the most common reason stdio servers mysteriously fail in production but work in tests where logs are suppressed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T01:35:30.648562+00:00— report_created — created