Documentation menu

Troubleshooting

Fixing MCP error -32000 (Connection closed)

MCP error -32000: Connection closed means your client started the server and the connection closed before the server answered. With a local server, that almost always means the process exited during startup. The error message never says why. The server's stderr does.

What -32000 means

In the official MCP SDKs, -32000 is the ConnectionClosed code. When the transport closes, every request still waiting for a reply fails with it, starting with initialize. The client is reporting a symptom: the other side went away. Nothing in the message tells you whether the server crashed, was never found, or exited on purpose.

Find the real error

1. Run the command yourself. Copy the exact command and arguments from your client config into a terminal. A working stdio server prints nothing and waits for input; stop it with Ctrl+C. If it prints an error and returns to the prompt, that error is your -32000.

npx -y your-mcp-package

2. Read your client's log.

  • Claude Desktop writes each server's stderr to ~/Library/Logs/Claude/mcp-server-NAME.log on macOS:
    tail -n 20 -F ~/Library/Logs/Claude/mcp*.log
  • Cursor: open the Output panel and pick MCP Logs from the dropdown.
  • Claude Code: /mcp marks a server that failed to start. Start a session with claude --debug=mcp and read the server's stderr in ~/.claude/debug/<session-id>.txt.

3. Or paste the command into the MCPVault tester. It runs the server in a disposable, isolated container, attempts the handshake, and reports the stage that failed with the server's stderr. No install on your machine.

Causes and fixes

You seeCauseFix
“…environment variable is required”, “Missing credentials”The server checks for an API key or URL at startup and exits without it.Add the variable to the server's env block in your client config. For MCPVault verification, add it under Verification environment on your listing's edit page.
npm error could not determine executable to runThe package has no binary, or more than one, so npx cannot pick a command.Name the binary: npx -y --package=<package> <binary>. Check the package's bin field for the name.
Exits at once with no output, or prints usage and exitsThe default command is a CLI. The MCP server sits behind a subcommand.Use the subcommand from the README, often mcp, serve or stdio.
/usr/bin/env: ‘bun’: No such file or directoryThe script's first line asks for a runtime that is not installed, here Bun.Install the runtime, or ask the maintainer to publish a Node build.
Python traceback during importA dependency version the package did not pin, or a missing extra.Pin the working version or add the extra, for example uvx --from "package[mcp]" <command>.
Connection closed after a log line or bannerThe server wrote non-JSON text to stdout. Over stdio, stdout carries only MCP messages.Send every log line to stderr.

Why 149 listings failed verification

MCPVault verifies a listing by starting the server and completing a live MCP handshake. On 27 September 2026 we sorted the 149 claimed listings that were not verified by what stopped them:

  • 73 had no command that starts a server: no install command at all, or one that only installs.
  • 42 started and exited before answering. A missing API key or URL was the most common reason we saw.
  • 17 were command-line tools, project scaffolders or multi-step installs, not stdio servers.
  • 7 shipped only as a Docker image.
  • 10 had never been tested because of a queueing bug on our side. Of the 9 with a usable command, 3 passed.

The same day we found a bug on our side: our test worker replaced the server's exit code and stderr with its own crash message, so owners saw a generic failure instead of the line that named the missing variable. It is fixed, and failures now show the server's own error.

Before you publish a server

  • Make the default command start the stdio server, or document the subcommand in the first lines of the README.
  • When a required variable is missing, print its exact name to stderr, then exit with a non-zero code.
  • Keep stdout for MCP messages only.
  • Pin the dependencies your server imports at startup.
  • Test the published package, not your checkout: npx -y or uvx from a clean shell.