Skip to content

Auto-Reconnect for MCP Servers #10129

@athatcher-asp

Description

@athatcher-asp

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

MCP servers using SSE (Server-Sent Events) transport frequently experience connection drops due to idle timeouts (~5 minutes), requiring constant manual reconnection. This significantly disrupts development workflow when using remote MCP servers.

Specific Example:
The official Atlassian Remote MCP Server (https://mcp.atlassian.com/v1/sse) uses the deprecated SSE transport protocol, which lacks heartbeat/keep-alive messages. This causes connections to timeout after approximately 5 minutes of inactivity, resulting in:

  • Failed MCP tool calls mid-session
  • "Connection closed" errors
  • Need to manually reconnect via /mcp menu every 5-10 minutes

This is a known issue with SSE-based MCP servers (see: triggerdotdev/trigger.dev#2134, #3033).

Proposed Solution

Add automatic reconnection for MCP servers when connection failures are detected.

Proposed Behavior:

  1. Detection: Automatically detect when an MCP server connection:

    • Times out
    • Returns connection errors
    • Becomes unresponsive
  2. Reconnection: Automatically attempt to reconnect with:

    • Exponential backoff strategy
    • Configurable retry attempts
    • Configurable retry delays
  3. User Notification (optional):

    • Silent reconnection in background (preferred for known-flaky servers)
    • OR notify user of reconnection attempts
    • Show reconnection status in /mcp menu

Proposed Configuration:

{
  "mcpServers": {
    "Atlassian": {
      "command": "npx",
      "args": ["-y", "mcp-remote@latest", "https://mcp.atlassian.com/v1/sse"],
      "autoReconnect": {
        "enabled": true,
        "maxRetries": 10,           // -1 for infinite
        "initialRetryDelay": 2000,  // milliseconds
        "maxRetryDelay": 30000,     // milliseconds
        "backoffMultiplier": 1.5,
        "silent": true              // Don't show notifications
      }
    }
  }
}

Alternative Solutions

Current Workaround:

Users must manually:

  1. Notice when operations fail
  2. Run /mcp command
  3. Select the disconnected server
  4. Choose "Reconnect"
  5. Repeat every 5-10 minutes

This interrupts flow and reduces productivity, especially when working extensively with Jira/Confluence/Compass through the Atlassian MCP.

Other Alternatives Considered:

  • Wrapper scripts to restart MCP processes - doesn't work for SSE timeouts since the process doesn't exit
  • Keep-alive ping mechanisms - can't be implemented client-side for remote servers
  • Switching to community MCP servers - not always feasible due to security/support concerns
  • Manual reconnection (current state) - significantly degrades user experience

Priority

High - Significant impact on productivity

Feature Category

MCP server integration

Use Case Example

Example scenario:

  1. I'm working on a React app with a Node.js backend, using Claude Code to help with development
  2. I need to frequently reference and update Jira tickets, link related issues, and update Confluence documentation
  3. I have the Atlassian Remote MCP Server configured to access Jira and Confluence
  4. Every 5-10 minutes, the SSE connection times out due to inactivity
  5. My next attempt to use an MCP tool (e.g., "update Jira ticket CPDE-1234") fails with "Connection closed"
  6. I must stop my work, run /mcp, select "Atlassian", click "Reconnect", wait for connection, then retry my command
  7. This happens 6-12 times per hour during active development sessions

With auto-reconnect:

  • The connection drop would be detected automatically
  • Claude Code would silently reconnect in the background (2-5 seconds)
  • My MCP tool call would either succeed after auto-reconnect or I'd get a clear "reconnecting..." message
  • I could continue working without manual intervention
  • My development flow remains uninterrupted

Additional Context

Technical Context:

  • SSE (Server-Sent Events) transport was deprecated in MCP protocol version 2.0.9
  • Replaced by Streamable HTTP in MCP protocol version 2025-03-26
  • Microsoft dropped SSE support in Copilot Studio as of August 2025
  • HTTP servers and proxies automatically close idle SSE connections (typically after 5 minutes)

Related Issues:

Current Workaround Limitations:

While server-side fixes (like Atlassian upgrading from SSE to Streamable HTTP) would address specific cases, auto-reconnect provides:

  • Immediate relief for users of existing flaky MCP servers
  • Handles other connection issues beyond SSE limitations (network drops, VPN disconnects, corporate firewalls)
  • Improves reliability for all MCP server types
  • Creates a more resilient MCP integration experience overall

Affected MCP Servers:

  • Atlassian Remote MCP (official)
  • Trigger.dev
  • Other services using SSE transport
  • Any MCP server experiencing intermittent network issues

Current Claude Code Version: v1.0.64+
Severity: High - Significantly impacts daily workflow for users of remote MCP servers

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions