fix(hanzo-mcp): add serve subcommand support for Claude Code

- Add 'serve' subcommand handling (Claude Code calls: hanzo-mcp serve --enable-agent)
- Add --enable-agent as alias for --enable-agent-tool
- Bump fastmcp dependency to >=2.14.4
- Version 0.11.6
This commit is contained in:
2026-01-22 15:35:57 -08:00
parent 03b3969ddf
commit ca4dcfe38d
2 changed files with 21 additions and 3 deletions
+18
View File
@@ -42,9 +42,18 @@ def _parse_timeout_arg(timeout_str: str) -> float:
def main() -> None:
"""Run the CLI for the Hanzo AI server."""
# Handle 'serve' subcommand for Claude Code compatibility
# Claude Code calls: hanzo-mcp serve --enable-agent
# We support both: hanzo-mcp [serve] [options]
if len(sys.argv) > 1 and sys.argv[1] == "serve":
# Remove 'serve' from argv so argparse treats it as direct invocation
sys.argv = [sys.argv[0]] + sys.argv[2:]
# Pre-parse arguments to check transport type early, BEFORE importing server
early_parser = argparse.ArgumentParser(add_help=False)
early_parser.add_argument("--transport", choices=["stdio", "sse"], default="stdio")
# Support --enable-agent as alias for --enable-agent-tool (Claude Code compatibility)
early_parser.add_argument("--enable-agent", dest="enable_agent", action="store_true")
early_args, _ = early_parser.parse_known_args()
# Configure logging VERY early based on transport
@@ -195,6 +204,15 @@ def main() -> None:
help="Enable the agent tool (disabled by default)",
)
# Alias for Claude Code compatibility (uses --enable-agent)
_ = parser.add_argument(
"--enable-agent",
dest="enable_agent_tool",
action="store_true",
default=False,
help=argparse.SUPPRESS, # Hidden alias for --enable-agent-tool
)
_ = parser.add_argument(
"--command-timeout",
dest="command_timeout",
+3 -3
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "hanzo-mcp"
version = "0.11.4"
version = "0.11.6"
description = "The Zen of Hanzo MCP: One server to rule them all. The ultimate MCP that orchestrates all others."
readme = "README.md"
requires-python = ">=3.12"
@@ -19,7 +19,7 @@ keywords = ["mcp", "claude", "hanzo", "code", "agent"]
dependencies = [
# Core MCP dependencies
"mcp>=1.25.0",
"fastmcp>=2.14.1",
"fastmcp>=2.14.4",
"pydantic>=2.12.5",
"pydantic-settings>=2.12.0",
"typing-extensions>=4.13.0",
@@ -29,7 +29,7 @@ dependencies = [
"hanzo-tools>=0.3.0",
"hanzo-tools-fs>=0.1.0",
"hanzo-tools-shell>=0.6.1",
"hanzo-tools-browser>=0.1.0",
"hanzo-tools-browser>=0.2.1", # Extension-first routing
"hanzo-tools-memory>=0.1.0",
"hanzo-tools-todo>=0.1.0",
"hanzo-tools-reasoning>=0.1.0",