// Error · Connect tools to agents (MCP, CLI, auth)
MCP server won’t connect: “Connection closed” / MCP error -32000
When a client drops an MCP server right after launching it, the launch command usually failed or the server printed logs to stdout.
verified 2026-10-102 official sources
Scenario: Connect tools to agents (MCP, CLI, auth) →
Symptoms
- The client shows “Connection closed”, “MCP error -32000” or a failed server status
- The tool list is empty and the log only shows the launch command
Common causes
- The command is not found in the client’s environment (GUI apps have a different PATH from your terminal, so
npxoruvxis missing) - In stdio mode the server writes logs to stdout, corrupting the JSON-RPC stream
- A required environment variable (API key etc.) is missing and the server exits at start-up
- On Windows, calling
npxdirectly fails and must be wrapped incmd /c
How to fix
- Run the exact command from your config in a terminal and make sure it starts without errors
- Test the server on its own with MCP Inspector:
npx @modelcontextprotocol/inspector <your command>and check that tools are listed - Use an absolute path for
command(e.g. the output ofwhich npx) and pass required variables explicitly inenv - In the server code, write logs to stderr only when using stdio
- Read the client’s own MCP log (location differs per client; see its docs) and start from the first error
Notes
- Never paste secrets into public issues while debugging
Official references
Compiled from official documentation and public discussions on 2026-10-10; not yet reproduced in our own environment. Follow the official docs if they differ.