hanzo-mcp 0.8.2__py3-none-any.whl → 0.8.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of hanzo-mcp might be problematic. Click here for more details.
- hanzo_mcp/__init__.py +15 -2
- hanzo_mcp/bridge.py +133 -127
- hanzo_mcp/cli.py +45 -21
- hanzo_mcp/compute_nodes.py +68 -55
- hanzo_mcp/config/settings.py +11 -0
- hanzo_mcp/core/base_agent.py +520 -0
- hanzo_mcp/core/model_registry.py +436 -0
- hanzo_mcp/dev_server.py +3 -2
- hanzo_mcp/server.py +4 -1
- hanzo_mcp/tools/__init__.py +61 -46
- hanzo_mcp/tools/agent/__init__.py +63 -52
- hanzo_mcp/tools/agent/agent_tool.py +12 -1
- hanzo_mcp/tools/agent/cli_tools.py +543 -0
- hanzo_mcp/tools/agent/network_tool.py +11 -55
- hanzo_mcp/tools/agent/unified_cli_tools.py +259 -0
- hanzo_mcp/tools/common/batch_tool.py +2 -0
- hanzo_mcp/tools/common/context.py +3 -1
- hanzo_mcp/tools/config/config_tool.py +121 -9
- hanzo_mcp/tools/filesystem/__init__.py +18 -0
- hanzo_mcp/tools/llm/__init__.py +44 -16
- hanzo_mcp/tools/llm/llm_tool.py +13 -0
- hanzo_mcp/tools/llm/llm_unified.py +911 -0
- hanzo_mcp/tools/shell/__init__.py +7 -1
- hanzo_mcp/tools/shell/auto_background.py +24 -0
- hanzo_mcp/tools/shell/bash_tool.py +14 -28
- hanzo_mcp/tools/shell/zsh_tool.py +266 -0
- hanzo_mcp-0.8.4.dist-info/METADATA +411 -0
- {hanzo_mcp-0.8.2.dist-info → hanzo_mcp-0.8.4.dist-info}/RECORD +31 -25
- hanzo_mcp-0.8.2.dist-info/METADATA +0 -526
- {hanzo_mcp-0.8.2.dist-info → hanzo_mcp-0.8.4.dist-info}/WHEEL +0 -0
- {hanzo_mcp-0.8.2.dist-info → hanzo_mcp-0.8.4.dist-info}/entry_points.txt +0 -0
- {hanzo_mcp-0.8.2.dist-info → hanzo_mcp-0.8.4.dist-info}/top_level.txt +0 -0
|
@@ -8,16 +8,26 @@ from mcp.server import FastMCP
|
|
|
8
8
|
|
|
9
9
|
from hanzo_mcp.tools.common.base import BaseTool, ToolRegistry
|
|
10
10
|
|
|
11
|
+
# Import unified CLI tools (single source of truth)
|
|
12
|
+
from hanzo_mcp.tools.agent.cli_tools import (
|
|
13
|
+
GrokCLITool,
|
|
14
|
+
AiderCLITool,
|
|
15
|
+
ClineCLITool,
|
|
16
|
+
CodexCLITool,
|
|
17
|
+
ClaudeCLITool,
|
|
18
|
+
GeminiCLITool,
|
|
19
|
+
HanzoDevCLITool,
|
|
20
|
+
OpenHandsCLITool,
|
|
21
|
+
ClaudeCodeCLITool, # cc alias
|
|
22
|
+
OpenHandsShortCLITool, # oh alias
|
|
23
|
+
register_cli_tools,
|
|
24
|
+
)
|
|
25
|
+
|
|
11
26
|
# Import the main implementations (using hanzo-agents SDK)
|
|
12
27
|
from hanzo_mcp.tools.agent.agent_tool import AgentTool
|
|
13
|
-
from hanzo_mcp.tools.agent.swarm_tool import SwarmTool
|
|
14
28
|
from hanzo_mcp.tools.agent.network_tool import NetworkTool
|
|
15
29
|
from hanzo_mcp.tools.common.permissions import PermissionManager
|
|
16
|
-
from hanzo_mcp.tools.agent.grok_cli_tool import GrokCLITool
|
|
17
30
|
from hanzo_mcp.tools.agent.code_auth_tool import CodeAuthTool
|
|
18
|
-
from hanzo_mcp.tools.agent.codex_cli_tool import CodexCLITool
|
|
19
|
-
from hanzo_mcp.tools.agent.claude_cli_tool import ClaudeCLITool
|
|
20
|
-
from hanzo_mcp.tools.agent.gemini_cli_tool import GeminiCLITool
|
|
21
31
|
|
|
22
32
|
|
|
23
33
|
def register_agent_tools(
|
|
@@ -57,37 +67,48 @@ def register_agent_tools(
|
|
|
57
67
|
max_tool_uses=agent_max_tool_uses,
|
|
58
68
|
)
|
|
59
69
|
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
70
|
+
# Register a swarm alias that forwards to AgentTool with default concurrency
|
|
71
|
+
class SwarmAliasTool(BaseTool):
|
|
72
|
+
name = "swarm"
|
|
73
|
+
description = (
|
|
74
|
+
"Alias for agent with concurrency. swarm == agent:5 by default.\n"
|
|
75
|
+
"Use 'swarm' for parallel multi-agent runs; 'swarm:N' for N agents."
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
def __init__(self, agent_tool: AgentTool):
|
|
79
|
+
self._agent = agent_tool
|
|
80
|
+
|
|
81
|
+
async def call(self, ctx, **params): # type: ignore[override]
|
|
82
|
+
# Default to 5 agents unless explicitly provided
|
|
83
|
+
params = dict(params)
|
|
84
|
+
params.setdefault("concurrency", 5)
|
|
85
|
+
return await self._agent.call(ctx, **params)
|
|
86
|
+
|
|
87
|
+
def register(self, mcp_server: FastMCP): # type: ignore[override]
|
|
88
|
+
tool_self = self
|
|
89
|
+
|
|
90
|
+
@mcp_server.tool(name=self.name, description=self.description)
|
|
91
|
+
async def swarm(
|
|
92
|
+
ctx,
|
|
93
|
+
prompts: str | list[str], # forwarded
|
|
94
|
+
concurrency: int | None = None,
|
|
95
|
+
model: str | None = None,
|
|
96
|
+
use_memory: bool | None = None,
|
|
97
|
+
memory_backend: str | None = None,
|
|
98
|
+
) -> str:
|
|
99
|
+
p = {
|
|
100
|
+
"prompts": prompts,
|
|
101
|
+
}
|
|
102
|
+
if concurrency is not None:
|
|
103
|
+
p["concurrency"] = concurrency
|
|
104
|
+
if model is not None:
|
|
105
|
+
p["model"] = model
|
|
106
|
+
if use_memory is not None:
|
|
107
|
+
p["use_memory"] = use_memory
|
|
108
|
+
if memory_backend is not None:
|
|
109
|
+
p["memory_backend"] = memory_backend
|
|
110
|
+
return await tool_self.call(ctx, **p)
|
|
111
|
+
return tool_self
|
|
91
112
|
|
|
92
113
|
# Create auth management tool
|
|
93
114
|
code_auth_tool = CodeAuthTool()
|
|
@@ -98,24 +119,14 @@ def register_agent_tools(
|
|
|
98
119
|
default_mode="hybrid", # Prefer local, fallback to cloud
|
|
99
120
|
)
|
|
100
121
|
|
|
101
|
-
# Register tools
|
|
122
|
+
# Register core agent tools
|
|
102
123
|
ToolRegistry.register_tool(mcp_server, agent_tool)
|
|
103
|
-
ToolRegistry.register_tool(mcp_server,
|
|
124
|
+
ToolRegistry.register_tool(mcp_server, SwarmAliasTool(agent_tool))
|
|
104
125
|
ToolRegistry.register_tool(mcp_server, network_tool)
|
|
105
|
-
ToolRegistry.register_tool(mcp_server, claude_cli_tool)
|
|
106
|
-
ToolRegistry.register_tool(mcp_server, codex_cli_tool)
|
|
107
|
-
ToolRegistry.register_tool(mcp_server, gemini_cli_tool)
|
|
108
|
-
ToolRegistry.register_tool(mcp_server, grok_cli_tool)
|
|
109
126
|
ToolRegistry.register_tool(mcp_server, code_auth_tool)
|
|
110
127
|
|
|
128
|
+
# Register all CLI tools (includes claude, codex, gemini, grok, etc.)
|
|
129
|
+
cli_tools = register_cli_tools(mcp_server, permission_manager)
|
|
130
|
+
|
|
111
131
|
# Return list of registered tools
|
|
112
|
-
return [
|
|
113
|
-
agent_tool,
|
|
114
|
-
swarm_tool,
|
|
115
|
-
network_tool,
|
|
116
|
-
claude_cli_tool,
|
|
117
|
-
codex_cli_tool,
|
|
118
|
-
gemini_cli_tool,
|
|
119
|
-
grok_cli_tool,
|
|
120
|
-
code_auth_tool,
|
|
121
|
-
]
|
|
132
|
+
return [agent_tool, network_tool, code_auth_tool] + cli_tools
|
|
@@ -109,6 +109,7 @@ class AgentToolParams(TypedDict, total=False):
|
|
|
109
109
|
model: Optional[str]
|
|
110
110
|
use_memory: Optional[bool]
|
|
111
111
|
memory_backend: Optional[str]
|
|
112
|
+
concurrency: Optional[int]
|
|
112
113
|
|
|
113
114
|
|
|
114
115
|
class MCPAgentState(State):
|
|
@@ -387,7 +388,17 @@ Usage notes:
|
|
|
387
388
|
await tool_ctx.error("hanzo-agents SDK is required but not available")
|
|
388
389
|
return "Error: hanzo-agents SDK is required for agent tool functionality. Please install it with: pip install hanzo-agents"
|
|
389
390
|
|
|
390
|
-
#
|
|
391
|
+
# Determine concurrency (parallel agents)
|
|
392
|
+
concurrency = params.get("concurrency")
|
|
393
|
+
if concurrency is not None and isinstance(concurrency, int) and concurrency > 0:
|
|
394
|
+
# Expand prompt list to match concurrency
|
|
395
|
+
if len(prompt_list) == 1:
|
|
396
|
+
prompt_list = prompt_list * concurrency
|
|
397
|
+
elif len(prompt_list) < concurrency:
|
|
398
|
+
# Repeat prompts to reach concurrency
|
|
399
|
+
times = (concurrency + len(prompt_list) - 1) // len(prompt_list)
|
|
400
|
+
prompt_list = (prompt_list * times)[:concurrency]
|
|
401
|
+
|
|
391
402
|
await tool_ctx.info(
|
|
392
403
|
f"Launching {len(prompt_list)} agent(s) using hanzo-agents SDK"
|
|
393
404
|
)
|