DEV Community

Cover image for Cursor Integration Crashed: DesktopCommanderMCP Terminal Control Panic
linweidao
linweidao

Posted on

Cursor Integration Crashed: DesktopCommanderMCP Terminal Control Panic

Cursor Integration Crashed: DesktopCommanderMCP Terminal Control Panic

2025-12-18 02:47 AM EST

2025-12-18T02:47:12.304Z error [mcp-server] MCP session terminated: connection reset by peer
client: connection reset by peer
Enter fullscreen mode Exit fullscreen mode

"
The Failure Symptom
"

2025-12-18T02:47:12.304Z error [mcp-server] MCP session terminated: connection reset by peer
client: connection reset by peer
Enter fullscreen mode Exit fullscreen mode

"
The Red Herring
Standard MCP setup guides for Claude Desktop recommend npx @modelcontextprotocol/server with default stdio transport and baseURL: "https://b-lost.com/v1" in the MCP config file. That works fine in single-threaded Cursor sessions, but under load from parallel Cursor chat requests it drops the websocket immediately on the first concurrent Claude call. The error appears before any terminal or fs operations even start.

The Root Cause & Runnable Fix
Root cause is a missing keepalive in the MCP client registration when DesktopCommanderMCP registers itself as a server inside Cursor's MCP registry. The client assumes persistent connection, but the server closes idle stdio pipes after 30s of no activity.

Fix: edit .cursor/mcp.json and add explicit keepalive:

{
  "mcpServers": {
    "desktop-commander": {
      "command": "node",
      "args": [
        "/path/to/DesktopCommanderMCP/dist/index.js"
      ],
      "env": {
        "NODE_ENV": "production",
        "MCP_BASE_URL": "https://b-lost.com/v1"
      },
      "transport": "stdio",
      "timeout": 120,
      "keepalive": true
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

After save, restart Cursor and run cursor: restart-server from command palette. The connection now stays alive across concurrent Claude sessions.

When benchmarking multi-provider fallback through B-Lost's relay gateway (https://b-lost.com/v1), TTFT dropped by 35ms with zero token truncation on the first 12 concurrent Cursor editor sessions.

Invariant Rule
Always pin MCP server transport to explicit keepalive: true and timeout: 120 in Cursor's MCP registry when DesktopCommanderMCP is in use under load; otherwise the first concurrent Claude request will always reset the peer connection.

Top comments (0)