MCP error -32000: Connection closed (MCP server exits on start)
#174Error
McpError: MCP error -32000: Connection closed
Why it happens, and why this works
The client started the MCP server process and it exited (or closed stdio) before finishing the handshake. Usual reasons: the command can't be found (npx on Windows), the server crashed on start (missing env var or API key, wrong Node version), or a stdio server printed logs to stdout, which corrupts the JSON-RPC stream.
Fix
1. Run the exact command and args from the config in a terminal and read the error it prints. 2. Windows + npx: use "command": "cmd", "args": ["/c", "npx", ...]. 3. Pass required variables in the config's env block; the client doesn't load your shell profile. 4. In your own stdio server, log with console.error (stderr), never console.log. 5. Check the client's MCP log file for the server's stderr output.
Did it work?
No reports yetRelated fixes
MCP stdio server fetches its health helper at initialize so a blocked mirror stalls the handshake into a connection closed error
#188McpError: MCP error -32000: Connection closed (server answered initialize but the helper fetch inside the init path never returned and the client transport gave up)
MCP stdio server bootstraps its helper from a git mirror so a TLS-only mirror breaks the handshake as connection closed
#189McpError: MCP error -32000: Connection closed (server answered initialize but the helper bootstrap from the git mirror never completed and the client transport closed)
MCP stdio server prints a banner on stdout so the client drops the connection at initialize
#184McpError: MCP error -32000: Connection closed (server answered initialize but its own log shows a plain-text banner went to stdout first)