Claude Code SDK doesn't expose MCP server health monitoring API

Resolved 💬 5 comments Opened Aug 29, 2025 by junhongwang418 Closed Jan 7, 2026

I was working on implementing proper MCP server health monitoring in my shift-mcp-server (https://github.com/fadeaway-ai/shift-mcp-server) and discovered that the Claude Code SDK doesn't expose the underlying MCP server health API that exists in the CLI.

When I use claude mcp list from the command line, I get beautiful health status output showing which servers are connected, disconnected, or connecting. This health check functionality clearly exists in Claude Code's internals, but the SDK package (@anthropic-ai/claude-code) doesn't export these methods for programmatic use.

This is particularly frustrating because I need to monitor MCP server health from within my application to provide real-time status updates to users. Without access to the health API, I'm forced to implement a workaround by spawning a child process to run claude mcp list and parse the CLI output - which feels like a terrible hack for something that should be a simple SDK method call.

I noticed that other implementations like AnthropicCoder (the VS Code extension) seem to have direct access to MCP health monitoring functions. They can programmatically check server status, connection state, and even trigger reconnections. This suggests the underlying API exists and works well, it's just not exposed through the public SDK.

The lack of this API means developers building on top of Claude Code have to choose between:

  1. Parsing CLI output (fragile and inefficient)
  2. Implementing their own parallel health monitoring (redundant and complex)
  3. Flying blind without health status (poor user experience)

This connects to the broader issue of SDK completeness mentioned in #4040 where the SDK is missing features available in the CLI. Having programmatic access to MCP server health would enable much richer integrations and better user experiences in applications that depend on MCP servers.

Success looks like:

  • [ ] The Claude Code SDK exports methods for checking MCP server health status
  • [ ] Developers can programmatically query which servers are connected/disconnected
  • [ ] The API returns structured data (not just formatted strings) about server health
  • [ ] Documentation exists showing how to use these health monitoring APIs
  • [ ] The SDK provides event hooks or callbacks for MCP server status changes

View original on GitHub ↗

This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗