Skip to content

feat(mcp): surface degraded MCP server status instead of silently reporting 0 tools #154

Description

@ericlake

Summary

When an MCP server connection fails (auth errors, connectivity issues, etc.), Aura currently swallows the failure and reports Connected successfully, 0 tools discovered. This makes a degraded MCP server indistinguishable from one that simply has no tools, leaving users unaware of the problem.

Current Behavior

When an MCP server fails to connect (e.g., 401 auth error), the logs show the error but then contradict it:

WARN  aura::mcp: HTTP Streamable MCP connection failed: MCP initialization error: ...
ERROR rmcp::transport::worker: worker quit with fatal: Transport channel closed, when Client(reqwest::Error { kind: Status(401, None), ... })
INFO  aura::mcp: pagerduty - Connected successfully, 0 tools discovered

The server appears fully functional with no tools to the end user.

Expected Behavior

  • The Connected successfully log should not be emitted when the connection actually failed — this is a bug
  • Aura should track and surface degraded MCP server status to the user (e.g., via an aura.mcp_status SSE event or similar mechanism)
  • The status should include the failure reason when possible (auth failure, connection refused, timeout, etc.)
  • Users should be able to distinguish between "server has no tools" vs "server is configured but unavailable"

Activity

  1. Baijack-star commented on May 21, 2026

    @Baijack-star

    I traced this through the current MCP init path. The contradictory log comes from a real error being converted into a zero-tool success before server_info is written.

    Relevant path:

    • crates/aura/src/mcp.rs initialize_from_config() logs "{server_name} - Connected successfully, {tools_count} tools discovered" for any Ok(tools_count) returned by connect_and_discover_tools().
    • connect_http_streamable() calls try_connect_http_streamable(). For 401-ish errors it returns Err(McpInitError(...)), but for other failures it does:
      • warn!(" HTTP Streamable MCP connection failed: {}", e);
      • Ok(0)
    • That Ok(0) is indistinguishable from a valid MCP server that connected and legitimately returned an empty tools/list response. So initialize_from_config() records ConnectionStatus::Connected, tools_count: 0, and emits the misleading success line.

    I think the smallest safe fix is to stop using Ok(0) for transport/discovery failures. Let try_connect_http_streamable() errors bubble as Err(BuilderError::McpInitError(...)), including connection refused, timeout, closed channel, unexpected content type, and non-401 HTTP failures. A real empty server should only be represented by Ok(0) after client.discover_tools().await succeeds and returns an empty list.

    Suggested acceptance tests:

    1. HTTP streamable server returns 401 during initialize/list-tools: server_info["pagerduty"].status is Failed(...), not Connected, and no Connected successfully, 0 tools discovered log is emitted.
    2. HTTP streamable endpoint is unreachable or closes the transport: same Failed(...) status, with a reason containing the connection/transport error.
    3. HTTP streamable server initializes and returns an empty tools array: status remains Connected with tools_count == 0.
    4. Summary logs count failed connections separately from successful zero-tool servers.

    For the SSE/UI part, Aura already has ConnectionStatus and server_info, so the event can be a thin projection of that state rather than a separate health model. A shape like aura.mcp_status with { server_name, transport, status: "connected" | "failed", tools_count, reason } would cover the user-facing distinction this issue asks for.

    If useful, I can help turn this into a focused patch or regression-test packet. Contact: jackshao1981@gmail.com. No payment details needed in the issue thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't workingenhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions