Menu

AI

MCP error -32000: Connection closed: How to Fix It (Claude Desktop, Cursor, Claude Code)

MCP error -32000 Connection closed means the server or stream ended before a reply. Find why it exited, fix the launch command and stop stdout output.

By: Irina ShvayaNovember 2, 2026

MCP error -32000: Connection closed: How to Fix It (Claude Desktop, Cursor, Claude Code)

This fix is part of MCP troubleshooting, within The MCP Guide. Still stuck? Request a free MCP readiness review.

MCP error -32000: Connection closed means the client was waiting on your MCP server and the connection ended first. For a local stdio server, that almost always means the server process exited, either at startup or mid-request. The fastest fix is to run the exact command and args from your config in a terminal and read what it prints before it quits. Then check the server's own log file.

Checked against: the source of the @modelcontextprotocol/sdk 1.32.2 npm package, the MCP 2026-07-28 base protocol page, the stdio transport spec, the MCP debugging guide and the Claude Code MCP docs on 2 November 2026. eSEOspace did not reproduce this error in each client.

Key Takeaways

  • In the official TypeScript SDK, code -32000 is named ConnectionClosed, and the SDK raises it with the text "Connection closed" when the transport closes.
  • It is a local SDK error, not a message your server sent. The spec says local errors such as SDK timeouts "are not currently assigned codes."
  • The 2026-07-28 spec marks -32000 to -32019 as a legacy range, so other servers may use -32000 for their own errors.
  • Common causes are a crash at startup, a wrong command, missing environment variables, and text printed to stdout.
  • The server's stderr log usually shows the real stack trace.

What this error means

The JSON-RPC 2.0 spec reserves -32000 to -32099 for "implementation-defined server-errors." MCP's TypeScript SDK picked -32000 for a closed connection. In the 1.32.2 package, the error class formats messages as MCP error <code>: <message>, which is exactly the text you see.

The SDK throws it for every request still waiting when the transport closes. It also uses the same code for "Request was cancelled" in some paths. So the code alone tells you the connection is gone, not why.

The 2026-07-28 base protocol page adds an important caveat. It calls -32000 to -32019 "legacy" and says receivers "MUST NOT assume any specific meaning" for those codes. A remote server might send -32000 for an unrelated server error. Always read the message text with the code.

For stdio servers, the transport spec says that if the server process exits unexpectedly, the client "SHOULD restart it," and in-flight requests "are simply lost."

Quick fix

  1. Run the server by hand. Copy command and args from your config into a terminal. A missing module, bad flag or Python traceback appears right away.
  2. Read the server's stderr log. In Claude Desktop that is mcp-server-SERVERNAME.log.
  3. Check required environment variables. A server that needs an API key often exits when the key is missing. Add it under env.
  4. Remove stdout output. Any print() or console.log() in a stdio server breaks the stream. See stdout logging breaks the server.
  5. Use absolute paths. The debugging guide warns that the working directory may be / on macOS.
  6. Restart the client fully and try again.

Fix by client / OS

Claude Desktop

Logs live in ~/Library/Logs/Claude (macOS), %APPDATA%\Claude\logs (Windows) and ~/.config/Claude/logs (Linux). Look in mcp.log for the time the connection closed, then open the server's own log for the same minute. If the server ran under the app's built-in Node runtime as a desktop extension, a bug report on SAP's Fiori MCP server shows a case where pointing command at a system Node fixed a silent exit. Treat that as one user's report.

Cursor

Cursor's MCP docs say Cursor "isolates server failures," so other servers keep working. Open Output, choose MCP Logs, and look for "connection errors, authentication issues, or server crashes." Toggle the server off and on under Customize to restart it.

Claude Code

The Claude Code MCP docs say a stdio server whose first connection fails is marked as failed with no automatic retry. Select Reconnect in /mcp after fixing it. For servers that drop later, Claude Code retries, and after five failed attempts shows MCP server "<name>" disconnected · open /mcp to reconnect. claude mcp get <name> prints the error on an Issue: line.

VS Code

Run MCP: List Servers, pick the server and choose Show Output, as the VS Code MCP management page describes. Use Restart Server after a fix.

Where to find the logs

ClientWhere
Claude Desktopmcp.log and mcp-server-SERVERNAME.log in the Claude logs folder
CursorOutput panel, MCP Logs
Claude Code/mcp, claude mcp list, claude mcp get <name>
VS CodeMCP: List Servers > Show Output
Remote serverYour own host's logs; stderr is not sent to the client over HTTP

If it still fails

  • It closes after exactly one minute. That is probably a timeout, not a crash. The SDK's default request timeout is 60,000 ms. See MCP request timed out.
  • It closes only on large results. The 1.32.2 SDK's stdio reader drops and closes when its buffer passes 10 MB. Return smaller results or paginate.
  • It works in the Inspector. Test in the MCP Inspector. If it passes there, read works in Inspector but not in Claude.
  • It is a remote server. A closed HTTP connection can be a proxy timeout or a crashed host. Check host logs and the streamable HTTP transport rules.

Decode any other code with the MCP error code lookup. If you build servers for clients and want them to fail cleanly, see MCP error handling or talk to us about MCP development.

More in the MCP Guide

Free tools: MCP Error Code Lookup · MCP Config Generator

Latest research: State of MCP: October 2026

Frequently asked questions

Is -32000 a standard MCP error code?

No. JSON-RPC reserves the range for implementations. The TypeScript SDK uses it for a closed connection, and the 2026-07-28 spec now treats -32000 to -32019 as a legacy range with no fixed meaning.

Why does the error appear right after I add the server?

The server probably exits during startup. Common reasons are a wrong path, a missing package, a missing API key or a Node version the package does not support.

Can stdout logging cause Connection closed?

It can. The stdio spec says a server "MUST NOT write anything to its stdout that is not a valid MCP message." Depending on the client, stray output causes parse errors, dropped messages or a closed connection.

How do I tell a crash from a timeout?

A crash shows a stack trace or exit in the server's stderr log, often within seconds. A timeout shows -32001 and "Request timed out" in the TypeScript SDK, usually after 60 seconds.

You Might Also like to Read

Get a FREE Website Audit

Enter your website and get a 20–30 page SEO, GEO, AEO & CRO audit within 24 hours. Completely free.

Don't have a site yet? Get in touch →

Ready to speak with a marketing expert?
Give us a call! (916) 866-7893

Websites Launched
1407
Websites Launched
Marketing Experts
29
Marketing Experts
Hours of Dedicated Work
204533
Hours of Dedicated Work
Irina S.Benjamin G.Jeanette M.David G.