Bug Description
hermes mcp add <name> --url <url> does not register an MCP server. It silently falls through into an interactive Hermes chat session, with no error and no indication that the subcommand was not dispatched. The --help for the subcommand works correctly, which makes the bug look like a runtime/network problem rather than a dispatch problem.
Steps to Reproduce
hermes mcp add example --url 'https://example.com/mcp'
Expected Behavior
The MCP server example is added to the configuration; hermes mcp list shows it.
Actual Behavior
The command opens an interactive Hermes chat prompt. hermes mcp list shows no new entry. The bug is independent of the URL, of MCP, and of any network state — any invocation of hermes mcp add exhibits it (including the stdio form, since the trigger is the absence of --command, not the chosen transport).
Affected Component
- CLI (interactive chat) / MCP subcommand dispatch
Operating System
Reproduces on Linux, macOS, and Windows. Does not depend on platform.
Python Version
3.11+ (the bug is in argparse construction; behavior is identical on every supported Python).
Hermes Version
Reproduces on current main at commit cfd86dc (also reported against v0.12.0).
Debug Report
Not applicable — this is a static argparse construction bug. It can be reproduced in three lines without invoking Hermes' runtime, network, config, or MCP layers; hermes debug share would not surface useful state. Minimal repro:
import argparse
parser = argparse.ArgumentParser()
sub = parser.add_subparsers(dest='command')
mcp = sub.add_parser('mcp'); mcp_sub = mcp.add_subparsers(dest='mcp_action')
add = mcp_sub.add_parser('add'); add.add_argument('name'); add.add_argument('--url'); add.add_argument('--command')
args = parser.parse_args(['mcp', 'add', 'foo', '--url', 'https://example.com/mcp'])
print(args.command) # → None (should be 'mcp')
Root Cause
There is an argparse dest collision between the top-level subparser and the mcp add subparser:
hermes_cli/_parser.py registers the top-level subparsers with dest="command" so the dispatcher in hermes_cli/main.py can route on args.command.
hermes_cli/main.py:9610 registers mcp_add_p.add_argument("--command", ...) for the stdio command. Without an explicit dest=, argparse derives dest="command" from the flag name.
- When the user runs
hermes mcp add ... --url ... (no --command), argparse still writes args.command = None for that subparser flag, overwriting the top-level value of "mcp".
- The dispatcher at
hermes_cli/main.py:10455 then sees args.command is None and falls through to cmd_chat. cmd_mcp_add is never reached.
Proposed Fix
Give the mcp add --command flag an explicit, non-colliding dest:
- mcp_add_p.add_argument("--command", help="Stdio command (e.g. npx)")
+ mcp_add_p.add_argument("--command", dest="mcp_command", help="Stdio command (e.g. npx)")
…and update cmd_mcp_add in hermes_cli/mcp_config.py to read from the new dest:
- command = getattr(args, "command", None)
+ command = getattr(args, "mcp_command", None)
The user-facing CLI flag --command is unchanged; only the in-memory namespace attribute moves.
PR with the fix and a parser regression test attached.
PR Ready
I'd like to fix this myself and submit a PR.
Bug Description
hermes mcp add <name> --url <url>does not register an MCP server. It silently falls through into an interactive Hermes chat session, with no error and no indication that the subcommand was not dispatched. The--helpfor the subcommand works correctly, which makes the bug look like a runtime/network problem rather than a dispatch problem.Steps to Reproduce
Expected Behavior
The MCP server
exampleis added to the configuration;hermes mcp listshows it.Actual Behavior
The command opens an interactive Hermes chat prompt.
hermes mcp listshows no new entry. The bug is independent of the URL, of MCP, and of any network state — any invocation ofhermes mcp addexhibits it (including the stdio form, since the trigger is the absence of--command, not the chosen transport).Affected Component
Operating System
Reproduces on Linux, macOS, and Windows. Does not depend on platform.
Python Version
3.11+ (the bug is in argparse construction; behavior is identical on every supported Python).
Hermes Version
Reproduces on current
mainat commitcfd86dc(also reported againstv0.12.0).Debug Report
Not applicable — this is a static argparse construction bug. It can be reproduced in three lines without invoking Hermes' runtime, network, config, or MCP layers;
hermes debug sharewould not surface useful state. Minimal repro:Root Cause
There is an argparse
destcollision between the top-level subparser and themcp addsubparser:hermes_cli/_parser.pyregisters the top-level subparsers withdest="command"so the dispatcher inhermes_cli/main.pycan route onargs.command.hermes_cli/main.py:9610registersmcp_add_p.add_argument("--command", ...)for the stdio command. Without an explicitdest=, argparse derivesdest="command"from the flag name.hermes mcp add ... --url ...(no--command), argparse still writesargs.command = Nonefor that subparser flag, overwriting the top-level value of"mcp".hermes_cli/main.py:10455then seesargs.command is Noneand falls through tocmd_chat.cmd_mcp_addis never reached.Proposed Fix
Give the
mcp add --commandflag an explicit, non-collidingdest:…and update
cmd_mcp_addinhermes_cli/mcp_config.pyto read from the new dest:The user-facing CLI flag
--commandis unchanged; only the in-memory namespace attribute moves.PR with the fix and a parser regression test attached.
PR Ready
I'd like to fix this myself and submit a PR.