Add automatic MCP server health check on session start
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
Summary
There's currently no way to automatically check and notify users about disconnected MCP servers when a session starts. MCP servers using OAuth authentication can silently disconnect when tokens expire, and users only discover this when a tool call fails mid-workflow.
Problem
- MCP servers using OAuth flows can disconnect between sessions due to token expiry
- Users have no way to know which servers are disconnected until they try to use them
- Hooks (SessionStart) can run shell commands but cannot check MCP connection status or reliably force the AI to report on it
- No CLI command exists to query MCP server connection state (e.g., claude mcp status)
Proposed Solution
One or more of the following:
- Auto health check setting — A setting like "mcpHealthCheck": ["my-mcp1", "my-mcp2"] that checks specified MCP servers on session start and notifies the user of any that are disconnected.
- claude mcp status CLI command — A command that returns connection status for all/specified MCP servers, usable from hooks.
- Built-in session start notification — Automatically display disconnected MCP servers to the user when a session begins, similar to how tool availability is shown.
Use Case
Teams sharing Claude Code configurations across multiple developers with OAuth-based MCP servers. Currently there's no scalable, reliable way to surface connection issues at session start.
Alternative Solutions
- SessionStart hook with directive message — Used a hook to echo a message instructing the AI to check MCP tool availability and report disconnected servers. Unreliable because the AI doesn't always act on hook output.
- Persistent memory (MEMORY.md) — Saved instructions in the AI's memory to check MCP servers on startup. User-specific and doesn't scale when sharing configurations across teams.
- Manual /mcp check — Running /mcp manually at the start of every session. Works but defeats the purpose of automation.
None of these approaches are reliable or scalable. A built-in solution is needed.
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
A team uses Claude Code with OAuth-based MCP servers like Jira and an internal service. OAuth tokens expire periodically. When a developer starts a new session:
- They begin working and ask Claude to fetch a Jira ticket
- The tool call fails because the OAuth token expired overnight
- They run /mcp, re-authenticate, and retry
- This cycle repeats across sessions and team members
Expected behavior: On session start, the user is automatically notified: "MCP servers disconnected: jira". Run /mcp to re-authenticate." — before they hit a failure mid-workflow.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗