Feature request: programmatic MCP server reconnection (disable/re-enable via hook or API)

Resolved 💬 2 comments Opened Apr 2, 2026 by stevehockey Closed May 11, 2026

Problem

When an MCP server restarts (e.g. after a deployment), all connected Claude Code sessions lose their MCP tool connections. The only way to restore the connection is for a human to manually:

  1. Type /mcp
  2. Select the MCP server
  3. Click "Disable"
  4. Type /mcp again
  5. Click "Enable"

In a multi-agent setup with 10+ Claude Code sessions connected to the same MCP server, this manual process must be repeated for every session after every server restart. This is extremely tedious and doesn't scale.

Current workarounds

  • PreToolUse hooks can detect the server is back and re-register the agent via REST API, but they cannot force the MCP client to reconnect to pick up new/changed tools.
  • /nexus-reconnect skill re-registers via REST but the MCP transport layer remains stale until manually toggled.
  • The /mcp UI shows "Error: SDK auth failed:" with an empty message after server restarts, even though the connection is actually working (Status: connected, Auth: authenticated, Tools: 32). This appears to be a cosmetic bug.

Proposed solution

Allow programmatic MCP reconnection through one of these mechanisms:

  1. Hook event: A new hook event (e.g. MCPReconnect) that fires when an MCP server connection drops, allowing the hook to trigger a reconnect after a delay.
  1. CLI command: claude mcp reconnect <server-name> that can be called from a hook or script.
  1. Auto-reconnect with backoff: When an MCP server connection drops, automatically attempt to reconnect with exponential backoff (e.g. 5s, 10s, 30s, 60s) instead of requiring manual intervention.

Option 3 would be the most user-friendly and would solve the problem without any user action.

Environment

  • Claude Code CLI v2.1.89
  • MCP transport: Streamable HTTP
  • 10+ concurrent Claude Code sessions sharing one MCP server
  • Server restarts ~2-3 times per day during active development

View original on GitHub ↗

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