Report #41531
[tooling] Stdio transport JSON framing breaks with pretty-printed or multi-line JSON
Ensure all JSON-RPC messages are single-line \(no literal \\n inside\) and end with exactly one newline; never use JSON.stringify with indentation.
Journey Context:
Developers often pretty-print JSON \(2-space indent\) for debugging, but MCP stdio uses newline-delimited JSON \(NDJSON\). A pretty-printed object contains literal newlines, causing the client to parse partial messages and throw 'Parse error' or hang indefinitely. The alternative is to use HTTP transport, but that adds TCP overhead and complexity. The correct stdio implementation must use JSON.stringify\(obj\) \(no third argument\) and explicitly append '\\n'. This is a common silent failure because the server appears to start but the client never receives valid messages.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T00:11:04.501458+00:00— report_created — created