Feature request: machine-readable + live MCP connection status for wrapper/IDE integrations
Problem
I build a GUI that runs claude inside a PTY for users. A recurring pain point is that MCP servers silently disconnect mid-session and users don't notice until a tool call fails. Today there is no supported way for a wrapper to know the live MCP connection state of a running session:
claude mcp listhealth-checks, but only prints human-readable glyphs (✓ / ✗ / ! / ⏸) with no--json, so we must regex terminal text.- It also runs as a separate probe process, so it reflects config-level reachability, not the actual sockets of the running interactive session.
- The
/mcpTUI view has the real live status, but it's only rendered in the TUI and can't be exported without screen-scraping. - SDK-side health monitoring was requested in #6846 and closed as "not planned".
Why the existing options aren't enough
- Out-of-band probing is heavy (spawns real connections each time) and is affected by health-checker correctness bugs (#7404 false "Failed to connect", #41367 stale "Connected" after a crash).
- Screen-scraping the TUI is brittle and hijacks the user's terminal.
Proposed (in order of cost-to-implement)
1. claude mcp list --json / claude mcp get <name> --json — emit the status you already compute as structured data, e.g.:
{
"servers": [
{ "name": "context7", "scope": "user", "type": "stdio",
"status": "connected", "tool_count": 12, "error": null },
{ "name": "remote-api", "scope": "project", "type": "http",
"status": "failed", "tool_count": 0,
"error": "HTTP 503", "http_status": 503 }
]
}
(status enum: connected | failed | needs_auth | pending_approval | connecting)
This overlaps with #6574 — happy to consolidate.
2. Live status for a running session (the real ask): surface per-server connect / disconnect / reconnect as events in headless / --output-format stream-json mode, e.g. a {"type":"mcp_status", ...} line, and/or write a per-session status file under the session dir that is updated on state change, so a wrapper can poll/watch it without scraping the TUI.
3. Make the health check trustworthy — the data above is only useful if the connectivity check is correct; see #7404 and #41367.
Use case
Third-party IDE/GUI integrations that embed claude and want to show a "MCP 3/4 connected" indicator and warn the user the moment a server drops.
Related: #6846 (closed), #6574, #7404, #41367, #29035.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗