[BUG] SSE MCP server disconnection crashes session instead of graceful degradation

Resolved 💬 2 comments Opened Jan 16, 2026 by semikolon Closed Feb 27, 2026

Description

When an SSE-based MCP server's underlying connection fails (e.g., Docker VM dies, network becomes unreachable), Claude Code crashes/exits completely instead of marking the server as failed and continuing the session.

Expected Behavior

According to #1026 and #15232, when an MCP server disconnects:

  • Session should continue running
  • Disconnected server should show red indicator
  • Tools become unavailable but session stays alive
  • /mcp reconnect <server> can restore

Actual Behavior

Session exits completely to terminal prompt with no error output.

Steps to Reproduce

  1. Configure an SSE-based MCP server (e.g., Graphiti at localhost:8000)
  2. Start Claude Code session and use the MCP server
  3. Kill the underlying service (e.g., docker stop the container the MCP server depends on)
  4. Observe: Session crashes instead of graceful degradation

Environment

  • Claude Code version: 2.1.x
  • OS: macOS 15.x (Sequoia)
  • MCP Server: Graphiti (SSE transport at localhost:8000)

Evidence

Multiple sessions crashed simultaneously when Docker Desktop's VM terminated unexpectedly:

  • Two project sessions: Silent exit, no error output
  • One session: Showed garbled output after exit (background monitor continuing)
  • Status bars showed "MCP server failed" / "2 MCP servers need auth" before exit

Analysis

The crash appears to be in Claude Code's SSE transport error handling. When the network fails catastrophically:

  1. Normal timeout (handled): Connection idle → 5-min timeout → graceful disconnect
  2. Network death (NOT handled): TCP connection broken → fetch() throws unhandled exception → Node.js process crashes

This is consistent with known SSE issues:

  • #3033: MCP Server Timeout Configuration Ignored in SSE Connections
  • typescript-sdk#270: SSE closes after 300 seconds idle
  • trigger.dev#2134: SSE connection drops - Body Timeout Error

Suggested Fix

The SSE transport client should wrap all network operations in try-catch and handle disconnection gracefully, marking the server as failed rather than crashing the process.

Workaround

None currently. Considering migration from SSE to HTTP transport (SSE is deprecated in MCP spec).

Related Issues

  • #1026 - Feature Request: Add Ability to Reconnect MCP Servers
  • #15232 - Auto-reconnect or programmatic reconnect for MCP servers
  • #3033 - MCP Server Timeout Configuration Ignored in SSE Connections

View original on GitHub ↗

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