Skip to content

fix(dashboard): discover MCP tools at startup so TUI sessions have them available - #42704

Closed
oreoluwa wants to merge 1 commit into
NousResearch:mainfrom
oreoluwa:fix/dashboard-mcp-discovery
Closed

fix(dashboard): discover MCP tools at startup so TUI sessions have them available#42704
oreoluwa wants to merge 1 commit into
NousResearch:mainfrom
oreoluwa:fix/dashboard-mcp-discovery

Conversation

@oreoluwa

@oreoluwa oreoluwa commented Jun 9, 2026

Copy link
Copy Markdown

Problem

When running hermes dashboard, the dashboard process (web_server.py) never calls discover_mcp_tools() at startup. This means MCP server tools are never registered in the process, and every TUI session launched from the dashboard has an empty MCP tool list regardless of which MCP servers are configured.

The root cause: get_tool_definitions() resolves an MCP server name (e.g. "my-server") by looking up the "my-server" → "mcp-my-server" alias that discover_mcp_tools() registers. Without discovery, validate_toolset() returns False for every MCP server name and the tools are silently dropped.

Every other entrypoint already handles this correctly — tui_gateway/entry.py starts a daemon thread for MCP discovery at startup. But it appears the dashboard was simply missed.

Fix

Mirror what entry.py does: start a daemon thread in _lifespan that calls discover_mcp_tools(), guarded so it only runs when MCP servers are actually configured.

# Discover MCP tools at dashboard startup so they are available in TUI sessions.
try:
    from hermes_cli.mcp_config import _get_mcp_servers
    if _get_mcp_servers():
        def _discover_mcp_background() -> None:
            try:
                from tools.mcp_tool import discover_mcp_tools
                discover_mcp_tools()
            except Exception:
                logger.warning("Background MCP tool discovery failed", exc_info=True)
        threading.Thread(
            target=_discover_mcp_background,
            name="dashboard-mcp-discovery",
            daemon=True,
        ).start()
except Exception:
    logger.warning("Could not start MCP discovery thread", exc_info=True)

Behaviour after fix

MCP tools are discovered within ~1 second of dashboard startup (before any WebSocket session connects), so all TUI sessions get the full MCP tool list for every configured server without any manual /reload-mcp call.

🤖 Generated with Claude Code

…em available

The `hermes dashboard` path (web_server.py) never called `discover_mcp_tools()`
at startup, so MCP server tools were never registered in the dashboard process.
Every other entrypoint (tui_gateway/entry.py) already does this correctly —
the dashboard was simply missed.

Without discovery, `validate_toolset("hospitable")` returns False because the
`"hospitable" -> "mcp-hospitable"` alias is never registered, and all MCP tools
are silently dropped from every TUI session's tool list.

The fix mirrors entry.py exactly: start a daemon thread at lifespan startup
that calls `discover_mcp_tools()`, guarded so it only runs when MCP servers
are configured.
@alt-glitch alt-glitch added type/bug Something isn't working comp/cli CLI entry point, hermes_cli/, setup wizard tool/mcp MCP client and OAuth P2 Medium — degraded but workaround exists duplicate This issue or pull request already exists labels Jun 9, 2026
@alt-glitch alt-glitch added comp/dashboard Web dashboard / control panel UI (dashboard/, landing) and removed comp/cli CLI entry point, hermes_cli/, setup wizard labels Jun 26, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for identifying the dashboard MCP-discovery gap. This is now redundant; automated hermes-sweeper review verified the complete fix on current main.

  • 73969771a (fix(desktop): discover MCP tools for dashboard /api/ws backends) starts shared, config-gated background discovery from hermes_cli/main.py:12175 before the dashboard server starts.
  • tui_gateway/server.py:4501 waits for that discovery thread before the dashboard agent snapshots its tools.
  • 3f19df2a5 further covers late MCP connections with a cache-safe pre-first-turn refresh in tui_gateway/server.py:4370.
  • Current regression coverage includes tests/test_tui_gateway_ws.py:10 for dashboard/WebSocket startup discovery.

The duplicate cross-reference to #43189 aligns with this result; that PR's maintainer discussion records #44512 as the superseding implementation.

@teknium1 teknium1 closed this Jul 14, 2026
@teknium1 teknium1 added the sweeper:implemented-on-main Sweeper: behavior already present on current main label Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/dashboard Web dashboard / control panel UI (dashboard/, landing) duplicate This issue or pull request already exists P2 Medium — degraded but workaround exists sweeper:implemented-on-main Sweeper: behavior already present on current main tool/mcp MCP client and OAuth type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants