Skip to content

The agent that grows with you

fix(config): accept mcp-<server> names in saved platform_toolsets checks

a6925703cc2e8aa815b
diff --git a/hermes_cli/toolset_validation.py b/hermes_cli/toolset_validation.py
index 2eed2b6a704..264ad1bae8d 100644
--- a/hermes_cli/toolset_validation.py
+++ b/hermes_cli/toolset_validation.py
@@ -52,8 +52,9 @@ def _platform_default_is_valid(
def saved_toolset_resolver(config: dict) -> Callable[[str], bool]:
"""``is_valid_toolset`` for a saved ``platform_toolsets`` list, mirroring what
- ``tools_config._get_platform_tools`` lets through: registered toolsets, any configured MCP server
- (a disabled one is inactive, not a typo), ``hermes-<platform>`` plugin-platform bundles and the
+ ``tools_config._get_platform_tools`` lets through: registered toolsets, any configured MCP server by
+ its bare or ``mcp-<server>`` toolset name (a disabled one is inactive, not a typo; the prefixed
+ alias is registered only after MCP discovery), ``hermes-<platform>`` plugin-platform bundles and the
``no_mcp`` sentinel. The manifest scan and the plugin lookup (which may run plugin discovery)
happen only for a name the cheaper checks cannot place."""
from functools import cache
@@ -61,8 +62,8 @@ def saved_toolset_resolver(config: dict) -> Callable[[str], bool]:
from toolsets import validate_toolset
mcp_servers = config.get("mcp_servers")
- known = {str(name) for name in mcp_servers} if isinstance(mcp_servers, dict) else set()
- known.add("no_mcp")
+ servers = {str(name) for name in mcp_servers} if isinstance(mcp_servers, dict) else set()
+ known = servers | {f"mcp-{name}" for name in servers} | {"no_mcp"}
@cache
def platform_bundles() -> frozenset:
@@ -74,7 +75,8 @@ def saved_toolset_resolver(config: dict) -> Callable[[str], bool]:
def plugin_names() -> frozenset:
from hermes_cli.plugins import get_plugin_toolset_keys_nowait, get_portable_mcp_server_names_nowait
- return frozenset(get_plugin_toolset_keys_nowait() | get_portable_mcp_server_names_nowait())
+ portable = get_portable_mcp_server_names_nowait()
+ return frozenset(get_plugin_toolset_keys_nowait() | portable | {f"mcp-{name}" for name in portable})
return lambda name: (validate_toolset(name) or name in known
or name in platform_bundles() or name in plugin_names())
diff --git a/tests/hermes_cli/test_config_check_diagnostics.py b/tests/hermes_cli/test_config_check_diagnostics.py
index c0fca7b681b..423f798a563 100644
--- a/tests/hermes_cli/test_config_check_diagnostics.py
+++ b/tests/hermes_cli/test_config_check_diagnostics.py
@@ -28,7 +28,7 @@ def test_config_check_and_migrate_agree_on_stale_platform_toolsets(tmp_path, mon
stale = _write_home(
tmp_path / "stale",
"platform_toolsets:\n"
- " cli: [hermes-cli, messaging, linear, ghost]\n"
+ " cli: [hermes-cli, messaging, linear, mcp-linear, mcp-ghost, ghost]\n"
" teams: [hermes-teams]\n"
"mcp_servers:\n"
" linear:\n"
@@ -41,9 +41,9 @@ def test_config_check_and_migrate_agree_on_stale_platform_toolsets(tmp_path, mon
# A malformed mcp_servers section must not crash the check.
clean = _write_home(tmp_path / "clean", "platform_toolsets:\n cli: [hermes-cli]\nmcp_servers: [a]\n")
- for home, expected in ((stale, {"messaging", "ghost"}), (clean, set()), (stale, {"messaging", "ghost"})):
+ for home, expected in ((stale, {"messaging", "ghost", "mcp-ghost"}), (clean, set()), (stale, {"messaging", "ghost", "mcp-ghost"})):
output = _check(home, monkeypatch, capsys)
- for name in ("messaging", "ghost", "linear", "hermes-teams"):
+ for name in ("messaging", "ghost", "mcp-ghost", "linear", "mcp-linear", "hermes-teams"):
assert (f"unknown toolset '{name}'" in output) is (name in expected), (home.name, name)
results = {"warnings": []}