Skip to content

fix(tui): discover profile MCP before desktop agent snapshot - #51865

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

fix(tui): discover profile MCP before desktop agent snapshot#51865
stavytskyi wants to merge 1 commit into
NousResearch:mainfrom
stavytskyi:fix/dashboard-profile-mcp-discovery

Conversation

@stavytskyi

@stavytskyi stavytskyi commented Jun 24, 2026

Copy link
Copy Markdown

Summary

  • Discover MCP tools for the currently bound profile inside tui_gateway.server._make_agent before constructing AIAgent.
  • Preserve the no-MCP fast path by skipping discovery when the selected profile has no mcp_servers section.
  • Add regression coverage for dashboard/Desktop sessions opened under a profile different from the dashboard process launch profile.

Why

Desktop/dashboard sessions can be created for a profile that differs from the dashboard process' launch HERMES_HOME. The dashboard startup MCP discovery only covers that launch profile. When the user opens a chat under another profile, AIAgent snapshots its tools during construction; if that profile's MCP servers were not discovered first, the model never receives the MCP tool schemas for that session even though the profile has mcp_servers and matching toolsets configured.

Prior art / duplicate check

This is intentionally a follow-up to the already-merged Desktop MCP discovery fix in #44512, not a duplicate of it.

  • fix(desktop): load MCP tools for dashboard /api/ws backends #44512 starts MCP discovery for the dashboard /api/ws backend, fixing the case where Desktop never started MCP discovery at all.
  • This PR covers the remaining profile-scoped case: the dashboard process may have already discovered MCP tools for its launch profile, but a newly-created Desktop session can be bound to a different profile. _make_agent() must discover MCP tools while that selected profile is bound, before AIAgent snapshots its tools.

I also checked the related open PRs (#42703, #43189, #38301, #50615, #51322). They cover dashboard startup, websocket/API/CLI startup timing, or cold-start waits; none specifically guarantees per-selected-profile MCP discovery immediately before Desktop/TUI agent snapshot.

Test plan

  • REPO=<path-to-hermes-agent>; cd "$REPO" && PYTHONPATH="$REPO" "$REPO/venv/bin/python" -m pytest tests/tui_gateway/test_make_agent_provider.py -q -o 'addopts='

Result: 13 passed, 1 warning in 1.73s.

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

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists 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.

2 participants