Skip to content

fix: MCP toolset resolution for runtime and config#3252

Merged
teknium1 merged 1 commit intomainfrom
hermes/hermes-7e1dfbda
Mar 26, 2026
Merged

fix: MCP toolset resolution for runtime and config#3252
teknium1 merged 1 commit intomainfrom
hermes/hermes-7e1dfbda

Conversation

@teknium1
Copy link
Copy Markdown
Contributor

Summary

Salvage of #3203 by @kshitijk4poor with follow-up fixes.

MCP server tools (e.g. exa, web-search-prime) were discovered and registered in the tool registry, but never made it into the model's tool list. The gateway had its own inline toolset resolution that only read platform_toolsets from config — which never contains MCP server names. Same issue affected the CLI entry point.

Changes

From #3203 (cherry-picked, author preserved):

  • Replace duplicated gateway toolset resolution in _run_agent() and _run_background_task() with calls to the shared _get_platform_tools()
  • Extend _get_platform_tools() to include globally enabled MCP servers at runtime (include_default_mcp_servers=True), while config-editing flows pass False to avoid persisting implicit MCP defaults
  • Add homeassistant to PLATFORMS dict (was missing, caused KeyError)
  • Consolidate duplicate config YAML reads in gateway
  • Add regression tests for MCP inclusion, HomeAssistant, and config persistence

Follow-up fixes:

  • Remove redundant platform_key reassignment in _run_background_task()
  • Fix CLI entry point (cli.py) to also use _get_platform_tools() — MCP tools were invisible in CLI mode too

Tests

Full suite: 6209 passed, 1 pre-existing failure (unrelated test_429_exhausts_all_retries_before_raising).

Closes #3203

Gateway sessions had their own inline toolset resolution that only read
platform_toolsets from config, which never includes MCP server names.
MCP tools were discovered and registered but invisible to the model.

- Replace duplicated gateway toolset resolution in _run_agent() and
  _run_background_task() with calls to the shared _get_platform_tools()
- Extend _get_platform_tools() to include globally enabled MCP servers
  at runtime (include_default_mcp_servers=True), while config-editing
  flows use include_default_mcp_servers=False to avoid persisting
  implicit MCP defaults into platform_toolsets
- Add homeassistant to PLATFORMS dict (was missing, caused KeyError)
- Fix CLI entry point to use _get_platform_tools() as well, so MCP
  tools are visible in CLI mode too
- Remove redundant platform_key reassignment in _run_background_task

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

⚠️ Supply Chain Risk Detected

This PR contains patterns commonly associated with supply chain attacks. This does not mean the PR is malicious — but these patterns require careful human review before merging.

⚠️ WARNING: Outbound network calls (POST/PUT)

Outbound POST/PUT requests in new code could be data exfiltration. Verify the destination URLs are legitimate.

Matches (first 10):

70:+        with urllib.request.urlopen(req, timeout=10) as resp:

Automated scan triggered by supply-chain-audit. If this is a false positive, a maintainer can approve after manual review.

@teknium1 teknium1 merged commit 62f8aa9 into main Mar 26, 2026
3 of 4 checks passed
StreamOfRon pushed a commit to StreamOfRon/hermes-agent that referenced this pull request Mar 29, 2026
Gateway sessions had their own inline toolset resolution that only read
platform_toolsets from config, which never includes MCP server names.
MCP tools were discovered and registered but invisible to the model.

- Replace duplicated gateway toolset resolution in _run_agent() and
  _run_background_task() with calls to the shared _get_platform_tools()
- Extend _get_platform_tools() to include globally enabled MCP servers
  at runtime (include_default_mcp_servers=True), while config-editing
  flows use include_default_mcp_servers=False to avoid persisting
  implicit MCP defaults into platform_toolsets
- Add homeassistant to PLATFORMS dict (was missing, caused KeyError)
- Fix CLI entry point to use _get_platform_tools() as well, so MCP
  tools are visible in CLI mode too
- Remove redundant platform_key reassignment in _run_background_task

Co-authored-by: kshitijk4poor <kshitijk4poor@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants