Skip to content

Bug: Exa MCP Server - hermes mcp test passes but tool calls fail #36264

Closed as not planned

Description

@tuananh4865

Bug: Exa MCP Server - Test Passes But Tool Calls Fail

Hermes Version: v0.15.x
MCP Server: exa (HTTP transport)
Config: https://mcp.exa.ai/mcp?tools=web_search_exa,web_fetch_exa,web_search_advanced_exa

Symptom

  • hermes mcp test exa → ✅ Connected, discovers 3 tools
  • Actual tool calls via mcp_exa_web_search_exa → ❌ "MCP server 'exa' is not connected"

Steps to Reproduce

  1. Configure exa MCP: hermes mcp add exa --url "https://mcp.exa.ai/mcp?tools=web_search_exa,web_fetch_exa,web_search_advanced_exa"
  2. Run hermes mcp test exa → shows ✅ Connected, discovers 3 tools
  3. Call any exa tool (e.g., mcp_exa_web_search_exa) → fails with "MCP server 'exa' is not connected"

Expected

Both test AND tool calls should succeed for HTTP-based MCP servers.

Environment

  • Hermes v0.15.x (latest)
  • macOS
  • HTTP transport MCP server (Exa)

Root Cause (suspected)

HTTP transport MCP servers: hermes mcp test uses HTTP GET to verify connectivity, but actual tool calls use JSON-RPC over HTTP POST. The test succeeds but tool calls fail because the transport layer doesn't properly bridge to the JSON-RPC protocol for HTTP-based servers like Exa.

Additional Context

Other HTTP-based MCP servers likely affected. The issue seems to be in how Hermes handles the transport layer for HTTP vs stdio MCP servers.

Activity

  1. added
    type/bugSomething isn't working
    P2Medium — degraded but workaround exists
    tool/mcpMCP client and OAuth
    on Jun 1, 2026
  2. DavidMetcalfe commented on Jun 28, 2026

    @DavidMetcalfe

    This is the same root cause as #37768. In register_mcp_servers() (tools/mcp_tool.py), the skip condition checks k not in _servers — so a server that disconnects and remains in _servers with session=None is permanently skipped on subsequent startups. The tool handlers then return "not connected" forever until the agent restarts.

    Two open PRs address this:

    Both use the same logic change: allow reconnection when getattr(_servers[k], "session", None) is None.

    Neither PR has been reviewed or merged yet. The fix is straightforward but has two edge cases worth addressing before merge:

    1. TOCTOU race — the session is None check runs inside _lock, but the background MCPServerTask mutates session without holding _lock. A stale server could reconnect between the check and the connection attempt, spawning duplicate tasks.
    2. Old task cleanup — neither PR cancels the lingering MCPServerTask._task before creating a new connection, which could lead to resource leaks and two concurrent loops fighting over the same server entry.

    Recommendation: land one of these PRs (likely #37899 for better test coverage) with the above two issues addressed. Happy to help polish the fix if needed.

  3. teknium1 commented on Jul 13, 2026

    @teknium1
    Collaborator

    This is implemented on current main; closing via automated hermes-sweeper review.

    • 43a425632 (fix(mcp): wake stale cached servers on session startup) detects cached MCP entries with session is None and signals their existing reconnect task rather than treating their _servers presence as permanently connected.
    • Current implementation: tools/mcp_tool.py:4910-4926.
    • Regression coverage: tests/tools/test_mcp_register_wakes_stale.py:14-59 verifies stale cached entries are woken while healthy entries are not.
    • The implementation explicitly credits the related approaches in fix(mcp): reconnect stale server entries #37772 and fix(mcp): reconnect stale server entries in register_mcp_servers (#37768) #37899, noted in the issue discussion.
    • Shipped in v2026.7.7 (Hermes Agent v0.18.1).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Medium — degraded but workaround existssweeper:implemented-on-mainSweeper: behavior already present on current maintool/mcpMCP client and OAuthtype/bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions