Feature request: `claude mcp restart` command for reconnecting hanging MCP servers
Problem
MCP servers frequently hang, disconnect, or become unresponsive during long Claude Code sessions. Common causes include:
- SSE connections dropping (e.g., Baserow MCP returning "Invalid request parameters" after being connected)
- npx-spawned processes stalling silently
- HTTP/SSE servers timing out without proper error propagation
- OAuth tokens expiring mid-session (e.g., Zoho MCP)
Currently, the only recovery options are:
- VS Code: Manually find and restart the server in the MCP panel UI
- CLI:
claude mcp remove <name>+claude mcp add <name>(loses config, error-prone) - Nuclear: Reload entire VS Code window (
Ctrl+Shift+P→ Reload Window)
None of these are programmatic. When running automated workflows (e.g., a /start-session command that pings all MCPs), there's no way to recover from failures without human intervention in the UI.
Proposed Solution
Add a restart subcommand to claude mcp:
# Restart a specific server
claude mcp restart <name>
# Restart only servers that fail health check
claude mcp restart --failed
# Restart all servers
claude mcp restart --all
Behavior: Kill the existing MCP server process (or close the SSE/HTTP connection), then re-spawn/reconnect using the existing configuration. No config modification needed.
Health check integration: claude mcp list already performs health checks and reports ✓ Connected / ✗ Failed to connect. The restart --failed variant would use this same health check to identify which servers need restarting.
Real-World Example
This morning, starting a session with 21 configured MCP servers:
claude mcp listshowed 20/21 connected, 1 known-disabled- However, 3 servers (Baserow, Supabase, Apify) returned MCP errors when actually queried via tools
- The health check in
claude mcp listshowed them as "Connected" but they were functionally broken - Required manual reconnection in VS Code MCP panel for each one
- After reconnecting, all 3 recovered immediately
A claude mcp restart --failed (or even claude mcp restart baserow supabase apify) would have saved several minutes of manual troubleshooting.
Additional Context
- Platform: Windows 11, VS Code extension + CLI
- MCP server count: 21 configured (mix of stdio, SSE, HTTP transports)
- Frequency: Happens ~2-3 times per week across different servers
- Claude Code version: v2.1.74
This would also enable building self-healing automation — e.g., a startup command that detects failed MCPs and auto-restarts them before proceeding.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗