[BUG] stdio MCP server stuck disconnected/cycling after --resume — headless sessions have no recovery path

Status Open
Maintainer reply None cached
Activity 0 comments · opened Jul 24, 2026

Environment

  • Claude Code CLI on Debian 13, headless long-lived sessions under tmux (systemd --user supervised), stdio MCP server (user scope)
  • Sessions are restarted by a supervisor with claude --resume <session> (context-resuming), unattended — no human at the terminal

Bug

After a --resume restart, the session's stdio MCP server intermittently comes back DISCONNECTED and stays cycling (shows "connecting…"/disconnected; tools unavailable), instead of converging to connected. The session itself is healthy and keeps taking turns — with the MCP tool surface silently absent.

For unattended/agentic use this is a severe failure class: our agents' only inbound-message path is an MCP server, so a session that resumes with the MCP down is functionally deaf while looking alive from the outside. We have repeatedly diagnosed exactly this after supervisor restarts; the same server connects fine when the session is started fresh (not resumed), and an interactive /mcp reconnect also recovers it — but an unattended session can drive neither.

What is missing

  1. Reconnection that CONVERGES: on resume, reconnect stdio servers with backoff until connected (or a bounded, loudly-reported failure), instead of leaving a permanent disconnected/cycling state.
  2. A programmatic recovery path for headless sessions: a CLI flag or slash-command-equivalent that a supervisor (or the model itself via a Bash tool) can invoke to force MCP reconnect — today /mcp is interactive-only.
  3. A machine-readable signal (exit code / status file / hook event) that MCP servers failed to connect after resume, so supervisors can react without pane-scraping.

Workaround today

We ship every agent a standing rule: on wake with MCP tools unavailable, retry briefly, then disarm its liveness monitor and end the turn, so an external watchdog restarts the whole session (~15 min penalty per event). That compensates but wastes full restarts on what should be an in-session reconnect.

View original on GitHub ↗