[FEATURE] Expose MCP server connection status to statusLine commands and hooks
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
Custom status line commands and hooks cannot tell whether an MCP server is connected, failed or pending. I'd like that state added to the JSON that statusLine commands receive on stdin, plus a hook event for connection failures.
This has now been requested at least three times (#34420, #31227, #5511). All three were closed automatically by the stale bot after inactivity, not by a maintainer decision, and the bot asked for a new issue if this is still relevant. It is, and the number of independent requests points to a real need. I'm opening this one with a concrete failure case and a proposed shape for the data.
Problem
My status line has a health indicator for the mcp-atlassian server. Because MCP state isn't available to it, the script can only check that the server is configured and that the Jira REST API answers with valid credentials. That produced a false "atlassian up": the MCP server failed to start (CONNECT_TIMEOUT after 30000ms) while Jira and the credentials were fine. I only found out when I needed the tools and they were missing. /mcp showed the real state, but only when I opened it.
What I checked (docs: hooks, statusline, mcp, cli-reference)
- The statusLine stdin JSON has no MCP field.
- Hook inputs include mcp_server only for MCP tool calls, with no connection state.
- SessionStart runs before MCP servers connect, so a hook can't read their state then either.
- No hook event fires on MCP connection failure.
claude mcp listprints status as text and probes servers each time, so it is too heavy to call from a status line, and the text format isn't a documented contract.
Proposed Solution
Request
Add an mcp_servers array to the statusLine stdin JSON, for example:
[{"name": "mcp-atlassian", "status": "connected" | "pending" | "failed" | "needs-auth" | "disabled", "error": "CONNECT_TIMEOUT ..."}]
It should reflect the live state, so a reconnect through /mcp updates it.
Why it matters
Users who depend on an MCP server for their workflow, such as Jira or GitLab, want to see at a glance that it is down before they start work that needs it.
Related
- #34420 Feature request: include MCP server status in statusLine command stdin data
- #31227 Expose active MCP servers/plugins in statusLine input JSON
- #5511 Add MCP Server and Tool Definition Metrics to Statusline JSON
- #65707 Render statusline before MCP/plugin initialization completes (related, closed as duplicate)
Environment
Claude Code on Windows 11, PowerShell status line command, mcp-atlassian server configured at user scope.
Alternative Solutions
- Add a hook event (for example McpServerStatusChange) that fires on connection, failure and reconnect, with the server name, status and error. I found no existing issue for this one.
- a
--jsonoutput mode forclaude mcp list.
Priority
High - Significant impact on productivity
Feature Category
MCP server integration
Use Case Example
I run a custom status line (PowerShell) that shows health indicators for the tools I rely on: docker, and the mcp-atlassian server I use to read and update Jira tickets.
Today:
- I start a session and the mcp-atlassian server times out on connect (CONNECT_TIMEOUT after 30000ms).
- My status line still shows "atlassian up", because it can only check that the server is configured and that the Jira REST API answers. It can't see whether the MCP server actually connected.
- I ask Claude to read a ticket and find the Jira tools missing. I have to run /mcp to see the failure and reconnect.
With this feature:
- The statusLine stdin JSON includes mcp_servers with each server's status, for example {"name": "mcp-atlassian", "status": "failed", "error": "CONNECT_TIMEOUT"}.
- My script shows "atlassian DOWN (failed)" in red as soon as the session starts.
- I run /mcp to reconnect before I start the work. When it connects, the status line goes back to "atlassian up".
A hook event for status changes would let me also trigger a notification or a retry when a server drops mid-session.
Additional Context
I have searched existing requests and this feature hasn't been requested yet - it was, multiple times, but always closed due to inactivity - please see the references above.