fix: MCP toolset resolution for runtime and config (#3252)

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>
This commit is contained in:
Teknium
2026-03-26 13:39:41 -07:00
committed by GitHub
parent 2c719f0701
commit 62f8aa9b03
6 changed files with 262 additions and 132 deletions

9
cli.py
View File

@@ -7288,12 +7288,9 @@ def main(
else:
toolsets_list.append(str(t))
else:
# Check config for CLI toolsets, fallback to hermes-cli
config_cli_toolsets = CLI_CONFIG.get("platform_toolsets", {}).get("cli")
if config_cli_toolsets and isinstance(config_cli_toolsets, list):
toolsets_list = config_cli_toolsets
else:
toolsets_list = ["hermes-cli"]
# Use the shared resolver so MCP servers are included at runtime
from hermes_cli.tools_config import _get_platform_tools
toolsets_list = sorted(_get_platform_tools(CLI_CONFIG, "cli"))
parsed_skills = _parse_skills_argument(skills)