Report #76823
[tooling] Local MCP servers over HTTP cause port conflicts and zombie processes
Use \`stdio\` \(standard input/output\) transport for local servers and reserve \`SSE\` \(Server-Sent Events\) for remote/networked servers. Implement stdio using line-delimited JSON-RPC over stdin/stdout to avoid TCP port allocation entirely and ensure the server process is automatically reaped when the parent client exits.
Journey Context:
Developers default to HTTP out of familiarity, but for local MCP servers this creates three failure modes: \(1\) Port conflicts when multiple clients spawn the same server, \(2\) Orphaned zombie processes when clients crash without cleaning up TCP connections, and \(3\) Unnecessary serialization overhead and firewall prompts. The \`stdio\` transport binds the server's lifecycle to the client's process via OS pipes; when the parent dies, SIGPIPE terminates the child cleanly. It uses JSON-RPC messages delimited by newlines on stdin/stdout, with stderr reserved for logging. Conversely, SSE is required for browser-based clients or remote hosts where stdio is impossible. The 2024-11-05 specification defines both, but the choice is architectural: same-machine bidirectional communication = stdio, network-separated = SSE.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T11:32:09.610790+00:00— report_created — created