feat(mcp): expose MCP server status across all protocols - #133
feat(mcp): expose MCP server status across all protocols#133Million-mo wants to merge 6 commits into
Conversation
Add read-only MCP server connection status visibility so clients can detect when MCP servers are connected, disconnected, or failed. Changes: - Add server_type field to MCPStatus model (transport type: stdio/sse/http/acp) - Add GET /config/mcp-servers OpenCode route (complements existing GET /mcp) - Add agentpool://mcp-servers/status MCP resource for MCP protocol clients - Include mcp_servers metadata in ACP initialize response via field_meta - Update to_mcp_status() converter to pass through server_type Closes Leoyzen#132
There was a problem hiding this comment.
Code Review
This pull request introduces features to expose MCP server connection statuses, including a new GET /config/mcp-servers endpoint, an agentpool://mcp-servers/status resource, and metadata inclusion during agent initialization. Feedback suggests adding a guard check for state.agent is None in the new endpoint to prevent potential AttributeError crashes, and explicitly checking pool.mcp is not None in acp_agent.py to ensure type safety.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
- config_routes: guard state.agent is None before calling get_mcp_server_info() - acp_agent: explicitly check pool.mcp is not None for type safety
This line was inadvertently included in the previous commit via a stash pop artifact. It causes Import Linter CI to fail because TYPE_CHECKING imports are excluded from analysis, making many ignore_imports entries no longer match.
- test_config_routes: 3 tests for GET /config/mcp-servers (statuses, agent None guard, multiple servers with server_type) - test_mcp_status_resource: 2 tests for agentpool://mcp-servers/status FastMCP resource (JSON output, empty when no providers) - test_acp_initialize_mcp_meta: 2 tests for ACP initialize field_meta (mcp_servers populated, None when no providers)
Same fix as PR Leoyzen#128 — replace openai:gpt-4o-mini with TestModelConfig so the test doesn't need real API credentials in CI.
|
Unit tests failure is a flaky test ( |
Summary
Implements Phase 1 of issue #132 — read-only MCP server status visibility across all protocols.
Previously, when an MCP server disconnected (subprocess crash, network failure, timeout), clients had no way to detect it. They could only observe tool call failures or tools disappearing from the list, with no way to distinguish "server not connected" from "tool not supported."
This PR exposes
MCPResourceProvider.get_status()(which already existed but was only used byGET /mcp) through three additional protocol surfaces:Changes
1.
MCPStatusmodel enhancement (models/mcp.py)server_type: strfield to expose transport type (stdio/sse/http/acp)2. OpenCode route (
config_routes.py)GET /config/mcp-serversendpoint following the existing/config/*route conventionGET /mcpbut at a discoverable config-adjacent path3. MCP protocol resource (
mcp_server/server.py)agentpool://mcp-servers/statusFastMCP resourceresources/readto get JSON with all server statusespool.mcp.get_mcp_providers()→provider.get_status()chain4. ACP initialize metadata (
acp_agent.py)initializeresponse now includesfield_meta.mcp_serversarray{name, status, display_name, server_type, error}5. Converter update (
converters.py)to_mcp_status()now passes throughserver_typefromMCPServerStatusVerification
ruff check— all checks passedruff format --check— all files formattedmypy— no issues found in 5 source filesCloses #132