Report #78094
[tooling] MCP stdio server hangs after first message or client receives truncated JSON
Implement LSP-style header framing: write \`Content-Length: \\r\\n\\r\\n\` followed by exactly that many bytes. Do not use NDJSON \(newline-delimited\) or plain \`console.log\`.
Journey Context:
Most developers assume stdio transport is line-delimited JSON because it's common in CLI tools. However, MCP uses the same framing as LSP: HTTP-style headers with a mandatory \`Content-Length\` header followed by a double CRLF and then the JSON body. If you simply \`console.log\(JSON.stringify\(msg\)\)\` in Node.js, the client waits forever for a Content-Length header that never arrives, causing a deadlock.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T13:40:49.341627+00:00— report_created — created