You add a new MCP server, restart the client, and get this:
MCP error -32000: Connection closed
Not much to go on. And it's easy to start blaming the tool or the SDK, but that's usually the wrong place to look. What the message really says is that the client spawned your server as a child process, the process died (or never got going), and the pipe closed before the handshake finished. That's it.
So skip the guessing and ask one thing: why did the process exit? Here's the order I'd check things in. [ADD: one line on where you first ran into this, e.g. which client or server.]
Start by running the command by hand
Open your MCP config, copy the command and args, and run them in a plain terminal:
npx -y @modelcontextprotocol/server-filesystem /Users/me/projects A working stdio server is boring. It prints a line to stderr or nothing at all, then sits there waiting for input on stdin. If you instead get a stack trace, "command not found", or a complaint about a missing key, congratulations, that's your -32000, and the error text tells you what to fix.
Absolute paths beat clever PATH setups
Desktop apps don't start from your shell, so they often don't see the PATH you have in your terminal. If you use nvm, fnm or asdf, this is very likely what's happening. Point to the exact binary and script instead:
{ "mcpServers": { "my-tools": { "command": "/Users/me/.nvm/versions/node/v22.11.0/bin/node", "args": ["/Users/me/code/my-tools/dist/server.js"] } } } Windows needs a wrapper around npx
On Windows, npx is actually a .cmd file, and many clients can't launch that directly. Wrap it with cmd /c:
{ "command": "cmd", "args": ["/c", "npx", "-y", "@modelcontextprotocol/server-filesystem", "C:\\Users\\me\\Documents"] } Also worth knowing: if Node lives only inside WSL, your native Windows app can't see it.
Environment variables don't come along for free
Your shell's environment isn't passed to the server. If it needs an API key at startup, it has to be in the config, or it will crash on launch:
"env": { "WEATHER_API_KEY": "your-key-here", "PYTHONUNBUFFERED": "1" } Don't write to stdout
With stdio, stdout belongs to the protocol. Only MCP messages go there. Send your logs to stderr instead, using console.error in Node or print(..., file=sys.stderr) in Python. Some clients ignore a stray print and some choke on it, and the spec says not to do it. So even if it works on your machine today, call it a bug. [ADD: a time a stray print or log line broke something for you, if you have one.]
Check the client logs
Don't skip this one. The answer is often sitting in a log file:
- Claude Desktop on macOS:
~/Library/Logs/Claude/mcp*.log. On Windows:%APPDATA%\Claude\logs. - Claude Code: run
/mcpinside a session, or launch withclaude --debug. - Cursor: open the MCP section in settings and check the Output panel.
Look at the last few lines before the disconnect. They usually name the problem outright.
Still stuck? Take the client out of the picture
Run the server through MCP Inspector:
npx @modelcontextprotocol/inspector node /absolute/path/to/server.js If it fails there, the bug is in your server. If it runs fine there but fails in your client, the problem is the client config: paths, env vars, or the Windows wrapper.
Don't confuse -32000 with -32001
They look alike but mean different things. -32000 is "connection closed", meaning the process is gone, either from a crash or a bad launch. -32001 is "request timeout", meaning the process is still alive but didn't answer in time, which usually points to a slow tool. Different errors, different fixes.
I wrote a longer guide on the DNotifier blog if you want more. It has a minimal stdio server that won't trigger -32000, a section on the HTTP transport, and an explanation of how LangChain's MCP adapters run into the same error: MCP Error -32000: Connection Closed.
