[BUG] MCP reconnection fails with different patterns for direct command vs interactive menu

Resolved 💬 6 comments Opened Aug 8, 2025 by skhrshin Closed Jan 10, 2026

Environment

  • Platform (select one):
  • [x] Anthropic API
  • [ ] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 1.0.71 (Claude Code)
  • Operating System: Linux (WSL2) - 6.6.87.2-microsoft-standard-WSL2
  • Terminal: VSCode integrated terminal

Bug Description

Two different MCP reconnection methods exhibit different failure patterns:

  1. Direct command (/mcp reconnect <server-name>): Shows "Successfully reconnected" but always disconnects immediately
  2. Interactive menu (/mcp <server-name> → Reconnect): Fails on first attempt, succeeds on second attempt

The issue is reproducible with MCP's official Rust SDK example.

Steps to Reproduce

Setup: Build MCP's official Rust SDK counter example

# Clone the official MCP Rust SDK
git clone https://github.com/modelcontextprotocol/rust-sdk.git /tmp/rust-sdk
cd /tmp/rust-sdk

# Build the counter example
cargo build --example servers_counter_stdio

Configure Claude Code

Create or update .mcp.json in your project directory:

{
  "mcpServers": {
    "counter-test": {
      "command": "cargo",
      "args": ["run", "--manifest-path", "/tmp/rust-sdk/Cargo.toml", "--example", "servers_counter_stdio"]
    }
  }
}

Pattern A: Direct reconnect command

  1. Start Claude Code in the project directory
  2. Initial connection to counter-test succeeds
  3. Use /mcp reconnect counter-test to reconnect
  4. Claude Code displays "Successfully reconnected to counter-test"
  5. However, the connection is immediately closed
  6. Repeat /mcp reconnect counter-test multiple times
  7. All attempts show "Successfully reconnected" but immediately disconnect

Pattern B: Interactive reconnect via menu

  1. Start Claude Code in the project directory
  2. Initial connection to counter-test succeeds
  3. Use /mcp counter-test to open interactive menu
  4. Select "Reconnect" option
  5. Claude Code displays "Reconnected to counter-test." (note: different message)
  6. First reconnection fails silently (connection is lost)
  7. Repeat /mcp counter-test and select "Reconnect" again
  8. Second reconnection succeeds and remains stable

Expected Behavior

MCP server reconnection should succeed on the first attempt.

Actual Behavior

  • Direct command (/mcp reconnect counter-test): Always shows "Successfully reconnected to counter-test" but immediately disconnects
  • Interactive menu (/mcp counter-test → Reconnect): First attempt fails silently, second attempt succeeds
  • Different success messages indicate different code paths:
  • Direct: "Successfully reconnected to counter-test" (misleading - connection always fails)
  • Interactive: "Reconnected to counter-test." (accurate - but only on second attempt)
  • Pattern is 100% reproducible

Additional Context

Workaround: Use /mcp counter-test and select Reconnect from the menu twice - the second attempt will succeed.
The direct /mcp reconnect counter-test command never works and should be avoided.

View original on GitHub ↗

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