Skip to content

Commit 44d6a73

Browse files
author
LittleCoinCoin
committed
fix(cli): resolve argparse naming conflict
The MCP configure command had a critical argparse naming conflict where the --command flag (for server command) was overwriting the top-level 'command' dest (which should be 'mcp'). This caused the CLI routing logic to fail because args.command would be 'python' instead of 'mcp'. Changes: - Added dest='server_command' to --command argument in configure parser - Updated handler call to use args.server_command instead of args.command - Fixed test_configure_argument_parsing_basic to handle SystemExit properly - Fixed test_configure_argument_parsing_with_options CLI arguments This resolves the issue where 'hatch mcp configure' commands would display help instead of executing the configuration.
1 parent 1774610 commit 44d6a73

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

hatch/cli_hatch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,7 @@ def main():
11091109

11101110
# Create mutually exclusive group for server type
11111111
server_type_group = mcp_configure_parser.add_mutually_exclusive_group(required=True)
1112-
server_type_group.add_argument("--command", help="Command to execute the MCP server (for local servers)")
1112+
server_type_group.add_argument("--command", dest="server_command", help="Command to execute the MCP server (for local servers)")
11131113
server_type_group.add_argument("--url", help="Server URL for remote MCP servers")
11141114

11151115
mcp_configure_parser.add_argument("--args", nargs="*", help="Arguments for the MCP server command (only with --command)")
@@ -1785,7 +1785,7 @@ def main():
17851785

17861786
elif args.mcp_command == "configure":
17871787
return handle_mcp_configure(
1788-
args.host, args.server_name, args.command, args.args,
1788+
args.host, args.server_name, args.server_command, args.args,
17891789
getattr(args, 'env_var', None), args.url, args.headers, args.no_backup,
17901790
args.dry_run, args.auto_approve
17911791
)

0 commit comments

Comments
 (0)