Skip to main content

Posts

Showing posts with the label JSON-RPC

Fixing "MCP Error -32000: Connection Closed" in Claude Desktop

  You have built a local Model Context Protocol (MCP) server. It compiles without errors. It runs perfectly in your terminal. Yet, the moment you attempt to connect it to Claude Desktop, you are met with a persistent "Disconnected" status or a generic connection error. If you dig into the logs, you likely see  Error -32000  or  Connection closed immediately . For AI engineers and backend developers, this is often a transport layer mismatch rather than a logic error in your code. Because MCP relies heavily on  stdio  (Standard Input/Output) for communication, the protocol is extremely sensitive to process environments and stream pollution. This guide dissects the root causes of these disconnections—specifically focusing on JSON-RPC stream corruption and Windows PATH resolution—and provides architectural fixes to stabilize your local MCP integration. The Anatomy of the Error: JSON-RPC over Stdio To fix the connection, you must first understand the transport m...