Skip to content
English

Switch theme

// 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 npx or uvx is 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 npx directly fails and must be wrapped in cmd /c

How to fix

  1. Run the exact command from your config in a terminal and make sure it starts without errors
  2. Test the server on its own with MCP Inspector: npx @modelcontextprotocol/inspector <your command> and check that tools are listed
  3. Use an absolute path for command (e.g. the output of which npx) and pass required variables explicitly in env
  4. In the server code, write logs to stderr only when using stdio
  5. 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.

Data updated: Problems & errors