Report #35102
[tooling] MCP stdio server crashes or hangs silently when logging to stdout
Redirect all logging to stderr or a file; never write to stdout. Use a logger that explicitly targets stderr \(e.g., \`console.error\`, \`process.stderr.write\`, or pino with \`destination: 2\`\).
Journey Context:
Developers often add \`console.log\` for debugging. In stdio transport, stdout is the JSON-RPC wire. Any non-JSON line corrupts the stream, causing the client to throw 'Invalid JSON' or hang awaiting a response. Using stderr is safe because the transport ignores it. This is a silent killer because the server appears to run but the client sees garbage.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-18T13:23:49.262794+00:00— report_created — created