MCP error -32000: Connection closed - Node.js uncaught exception

Resolved 💬 8 comments Opened Jul 9, 2025 by kaovilai Closed Jan 4, 2026

Description

Encountered an uncaught exception error with MCP connection closing unexpectedly.

Error Details

node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^

KF [McpError]: MCP error -32000: Connection closed
    at tn1._onclose (file:///Users/tkaovila/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1325:15216)
    at _transport.onclose (file:///Users/tkaovila/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1325:14535)
    at J.C.client.transport.onclose (file:///Users/tkaovila/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1948:7649)
    at l9.onCloseHandler (file:///Users/tkaovila/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:1337:8286)
    at l9.emit (node:events:507:28)
    at l9.emit (node:domain:489:12)
    at l9.emitClose (file:///Users/tkaovila/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:71:69553)
    at Socket.oqA (file:///Users/tkaovila/.npm-global/lib/node_modules/@anthropic-ai/claude-code/cli.js:71:80025)
    at Socket.emit (node:events:507:28)
    at Socket.emit (node:domain:489:12) {
  code: -32000,
  data: undefined
}

Node.js v24.2.0

Environment

  • Node.js version: v24.2.0
  • Claude Code installed globally via npm
  • Platform: darwin (macOS)
  • OS Version: Darwin 24.5.0

Expected Behavior

The MCP connection should handle disconnections gracefully without causing an uncaught exception.

Actual Behavior

The application crashes with an uncaught exception when the MCP connection is closed.

Additional Context

The error appears to be related to the MCP (Model Context Protocol) transport layer closing unexpectedly, triggering an unhandled promise rejection.

View original on GitHub ↗

This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗