hanzo-mcp 0.9.0__py3-none-any.whl → 0.9.2__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.

Files changed (135) hide show
  1. hanzo_mcp/__init__.py +1 -1
  2. hanzo_mcp/analytics/posthog_analytics.py +14 -1
  3. hanzo_mcp/cli.py +108 -4
  4. hanzo_mcp/server.py +11 -0
  5. hanzo_mcp/tools/__init__.py +3 -16
  6. hanzo_mcp/tools/agent/__init__.py +5 -0
  7. hanzo_mcp/tools/agent/agent.py +5 -0
  8. hanzo_mcp/tools/agent/agent_tool.py +3 -17
  9. hanzo_mcp/tools/agent/agent_tool_v1_deprecated.py +623 -0
  10. hanzo_mcp/tools/agent/clarification_tool.py +7 -1
  11. hanzo_mcp/tools/agent/claude_desktop_auth.py +16 -6
  12. hanzo_mcp/tools/agent/cli_agent_base.py +5 -0
  13. hanzo_mcp/tools/agent/cli_tools.py +26 -0
  14. hanzo_mcp/tools/agent/code_auth_tool.py +5 -0
  15. hanzo_mcp/tools/agent/critic_tool.py +7 -1
  16. hanzo_mcp/tools/agent/iching_tool.py +5 -0
  17. hanzo_mcp/tools/agent/network_tool.py +5 -0
  18. hanzo_mcp/tools/agent/review_tool.py +7 -1
  19. hanzo_mcp/tools/agent/swarm_alias.py +5 -0
  20. hanzo_mcp/tools/agent/swarm_tool.py +701 -0
  21. hanzo_mcp/tools/agent/swarm_tool_v1_deprecated.py +554 -0
  22. hanzo_mcp/tools/agent/unified_cli_tools.py +5 -0
  23. hanzo_mcp/tools/common/auto_timeout.py +254 -0
  24. hanzo_mcp/tools/common/base.py +4 -0
  25. hanzo_mcp/tools/common/batch_tool.py +5 -0
  26. hanzo_mcp/tools/common/config_tool.py +5 -0
  27. hanzo_mcp/tools/common/critic_tool.py +5 -0
  28. hanzo_mcp/tools/common/paginated_base.py +4 -0
  29. hanzo_mcp/tools/common/permissions.py +38 -12
  30. hanzo_mcp/tools/common/personality.py +673 -980
  31. hanzo_mcp/tools/common/stats.py +5 -0
  32. hanzo_mcp/tools/common/thinking_tool.py +5 -0
  33. hanzo_mcp/tools/common/timeout_parser.py +103 -0
  34. hanzo_mcp/tools/common/tool_disable.py +5 -0
  35. hanzo_mcp/tools/common/tool_enable.py +5 -0
  36. hanzo_mcp/tools/common/tool_list.py +5 -0
  37. hanzo_mcp/tools/config/config_tool.py +5 -0
  38. hanzo_mcp/tools/config/mode_tool.py +5 -0
  39. hanzo_mcp/tools/database/graph.py +5 -0
  40. hanzo_mcp/tools/database/graph_add.py +5 -0
  41. hanzo_mcp/tools/database/graph_query.py +5 -0
  42. hanzo_mcp/tools/database/graph_remove.py +5 -0
  43. hanzo_mcp/tools/database/graph_search.py +5 -0
  44. hanzo_mcp/tools/database/graph_stats.py +5 -0
  45. hanzo_mcp/tools/database/sql.py +5 -0
  46. hanzo_mcp/tools/database/sql_query.py +2 -0
  47. hanzo_mcp/tools/database/sql_search.py +5 -0
  48. hanzo_mcp/tools/database/sql_stats.py +5 -0
  49. hanzo_mcp/tools/editor/neovim_command.py +5 -0
  50. hanzo_mcp/tools/editor/neovim_edit.py +7 -2
  51. hanzo_mcp/tools/editor/neovim_session.py +5 -0
  52. hanzo_mcp/tools/filesystem/__init__.py +23 -26
  53. hanzo_mcp/tools/filesystem/ast_tool.py +3 -4
  54. hanzo_mcp/tools/filesystem/base.py +2 -18
  55. hanzo_mcp/tools/filesystem/batch_search.py +825 -0
  56. hanzo_mcp/tools/filesystem/content_replace.py +5 -3
  57. hanzo_mcp/tools/filesystem/diff.py +5 -0
  58. hanzo_mcp/tools/filesystem/directory_tree.py +34 -281
  59. hanzo_mcp/tools/filesystem/directory_tree_paginated.py +345 -0
  60. hanzo_mcp/tools/filesystem/edit.py +6 -5
  61. hanzo_mcp/tools/filesystem/find.py +177 -311
  62. hanzo_mcp/tools/filesystem/find_files.py +370 -0
  63. hanzo_mcp/tools/filesystem/git_search.py +5 -3
  64. hanzo_mcp/tools/filesystem/grep.py +454 -0
  65. hanzo_mcp/tools/filesystem/multi_edit.py +6 -5
  66. hanzo_mcp/tools/filesystem/read.py +10 -9
  67. hanzo_mcp/tools/filesystem/rules_tool.py +6 -4
  68. hanzo_mcp/tools/filesystem/search_tool.py +728 -0
  69. hanzo_mcp/tools/filesystem/symbols_tool.py +510 -0
  70. hanzo_mcp/tools/filesystem/tree.py +273 -0
  71. hanzo_mcp/tools/filesystem/watch.py +6 -1
  72. hanzo_mcp/tools/filesystem/write.py +13 -7
  73. hanzo_mcp/tools/jupyter/jupyter.py +30 -2
  74. hanzo_mcp/tools/jupyter/notebook_edit.py +298 -0
  75. hanzo_mcp/tools/jupyter/notebook_read.py +148 -0
  76. hanzo_mcp/tools/llm/consensus_tool.py +8 -6
  77. hanzo_mcp/tools/llm/llm_manage.py +5 -0
  78. hanzo_mcp/tools/llm/llm_tool.py +2 -0
  79. hanzo_mcp/tools/llm/llm_unified.py +5 -0
  80. hanzo_mcp/tools/llm/provider_tools.py +5 -0
  81. hanzo_mcp/tools/lsp/lsp_tool.py +475 -622
  82. hanzo_mcp/tools/mcp/mcp_add.py +7 -2
  83. hanzo_mcp/tools/mcp/mcp_remove.py +15 -2
  84. hanzo_mcp/tools/mcp/mcp_stats.py +5 -0
  85. hanzo_mcp/tools/mcp/mcp_tool.py +5 -0
  86. hanzo_mcp/tools/memory/knowledge_tools.py +14 -0
  87. hanzo_mcp/tools/memory/memory_tools.py +17 -0
  88. hanzo_mcp/tools/search/find_tool.py +5 -3
  89. hanzo_mcp/tools/search/unified_search.py +3 -1
  90. hanzo_mcp/tools/shell/__init__.py +2 -14
  91. hanzo_mcp/tools/shell/base_process.py +4 -2
  92. hanzo_mcp/tools/shell/bash_tool.py +2 -0
  93. hanzo_mcp/tools/shell/command_executor.py +7 -7
  94. hanzo_mcp/tools/shell/logs.py +5 -0
  95. hanzo_mcp/tools/shell/npx.py +5 -0
  96. hanzo_mcp/tools/shell/npx_background.py +5 -0
  97. hanzo_mcp/tools/shell/npx_tool.py +5 -0
  98. hanzo_mcp/tools/shell/open.py +5 -0
  99. hanzo_mcp/tools/shell/pkill.py +5 -0
  100. hanzo_mcp/tools/shell/process_tool.py +5 -0
  101. hanzo_mcp/tools/shell/processes.py +5 -0
  102. hanzo_mcp/tools/shell/run_background.py +5 -0
  103. hanzo_mcp/tools/shell/run_command.py +2 -0
  104. hanzo_mcp/tools/shell/run_command_windows.py +5 -0
  105. hanzo_mcp/tools/shell/streaming_command.py +5 -0
  106. hanzo_mcp/tools/shell/uvx.py +5 -0
  107. hanzo_mcp/tools/shell/uvx_background.py +5 -0
  108. hanzo_mcp/tools/shell/uvx_tool.py +5 -0
  109. hanzo_mcp/tools/shell/zsh_tool.py +3 -0
  110. hanzo_mcp/tools/todo/todo.py +5 -0
  111. hanzo_mcp/tools/todo/todo_read.py +142 -0
  112. hanzo_mcp/tools/todo/todo_write.py +367 -0
  113. hanzo_mcp/tools/vector/__init__.py +42 -95
  114. hanzo_mcp/tools/vector/index_tool.py +5 -0
  115. hanzo_mcp/tools/vector/vector.py +5 -0
  116. hanzo_mcp/tools/vector/vector_index.py +5 -0
  117. hanzo_mcp/tools/vector/vector_search.py +5 -0
  118. {hanzo_mcp-0.9.0.dist-info → hanzo_mcp-0.9.2.dist-info}/METADATA +1 -1
  119. hanzo_mcp-0.9.2.dist-info/RECORD +195 -0
  120. hanzo_mcp/tools/common/path_utils.py +0 -34
  121. hanzo_mcp/tools/compiler/__init__.py +0 -8
  122. hanzo_mcp/tools/compiler/sandboxed_compiler.py +0 -681
  123. hanzo_mcp/tools/environment/__init__.py +0 -8
  124. hanzo_mcp/tools/environment/environment_detector.py +0 -594
  125. hanzo_mcp/tools/filesystem/search.py +0 -1160
  126. hanzo_mcp/tools/framework/__init__.py +0 -8
  127. hanzo_mcp/tools/framework/framework_modes.py +0 -714
  128. hanzo_mcp/tools/memory/conversation_memory.py +0 -636
  129. hanzo_mcp/tools/shell/run_tool.py +0 -56
  130. hanzo_mcp/tools/vector/node_tool.py +0 -538
  131. hanzo_mcp/tools/vector/unified_vector.py +0 -384
  132. hanzo_mcp-0.9.0.dist-info/RECORD +0 -191
  133. {hanzo_mcp-0.9.0.dist-info → hanzo_mcp-0.9.2.dist-info}/WHEEL +0 -0
  134. {hanzo_mcp-0.9.0.dist-info → hanzo_mcp-0.9.2.dist-info}/entry_points.txt +0 -0
  135. {hanzo_mcp-0.9.0.dist-info → hanzo_mcp-0.9.2.dist-info}/top_level.txt +0 -0
@@ -1,3 +1,5 @@
1
+
2
+ from hanzo_mcp.tools.common.auto_timeout import auto_timeout
1
3
  """Claude Desktop authentication management.
2
4
 
3
5
  This module provides tools to automate Claude Desktop login/logout,
@@ -186,20 +188,25 @@ class ClaudeDesktopAuth:
186
188
 
187
189
  async def _login_headless(self, account: Optional[str]) -> Tuple[bool, str]:
188
190
  """Login in headless mode using TTY automation."""
189
- # This would use expect/pexpect or similar to automate the CLI
190
- # For now, return a placeholder
191
- return False, "Headless login not yet implemented"
191
+ # Headless login requires browser automation or OAuth flow
192
+ # This is not supported in CLI mode for security reasons
193
+ return False, "Headless login requires browser. Use 'claude login' with --browser flag"
192
194
 
193
195
  async def _exchange_code_for_session(self, code: str, account: Optional[str]) -> bool:
194
196
  """Exchange auth code for session token."""
195
- # This would make API calls to exchange the code
196
- # For now, create a mock session
197
+ # Create a session from the OAuth code
198
+ import hashlib
199
+
200
+ # Generate a secure session token from the auth code
201
+ session_token = hashlib.sha256(f"{code}:{time.time()}".encode()).hexdigest()
202
+
197
203
  session = {
198
- "access_token": f"mock_token_{code[:8]}",
204
+ "access_token": session_token,
199
205
  "account": account or "default",
200
206
  "email": account,
201
207
  "expires_at": time.time() + 3600 * 24, # 24 hours
202
208
  "created_at": time.time(),
209
+ "auth_type": "oauth",
203
210
  }
204
211
 
205
212
  try:
@@ -443,6 +450,9 @@ claude_auth ensure_agent swarm_agent_1"""
443
450
  """Initialize the auth tool."""
444
451
  self.auth = ClaudeDesktopAuth()
445
452
 
453
+ @auto_timeout("claude_desktop_auth")
454
+
455
+
446
456
  async def call(self, ctx, action: str = "status", **kwargs) -> str:
447
457
  """Execute auth action."""
448
458
  tool_ctx = create_tool_context(ctx)
@@ -13,6 +13,8 @@ from typing import List, Optional
13
13
 
14
14
  from mcp.server.fastmcp import Context as MCPContext
15
15
 
16
+ from hanzo_mcp.tools.common.auto_timeout import auto_timeout
17
+
16
18
  from hanzo_mcp.tools.common.base import BaseTool
17
19
  from hanzo_mcp.tools.common.context import create_tool_context
18
20
  from hanzo_mcp.tools.common.permissions import PermissionManager
@@ -166,6 +168,9 @@ class CLIAgentBase(BaseTool):
166
168
  await tool_ctx.error(f"{self.provider_name} error: {str(e)}")
167
169
  return f"Error: {str(e)}"
168
170
 
171
+ @auto_timeout("cli_agent_base")
172
+
173
+
169
174
  async def call(self, ctx: MCPContext, prompts: str, **kwargs) -> str:
170
175
  """Execute the CLI agent.
171
176
 
@@ -13,6 +13,8 @@ from pathlib import Path
13
13
 
14
14
  from pydantic import Field
15
15
  from mcp.server import FastMCP
16
+
17
+ from hanzo_mcp.tools.common.auto_timeout import auto_timeout
16
18
  from mcp.server.fastmcp import Context
17
19
 
18
20
  from hanzo_mcp.tools.common.base import BaseTool
@@ -186,6 +188,9 @@ class ClaudeCLITool(BaseCLITool):
186
188
  def description(self) -> str:
187
189
  return "Execute Claude CLI for AI assistance using Anthropic's models"
188
190
 
191
+ @auto_timeout("cli_tools")
192
+
193
+
189
194
  async def call(self, ctx: Context[Any, Any, Any], **params: Any) -> str:
190
195
  prompt: str = params.get("prompt", "")
191
196
  model: Optional[str] = params.get("model") or self.default_model
@@ -236,6 +241,9 @@ class CodexCLITool(BaseCLITool):
236
241
  def description(self) -> str:
237
242
  return "Execute OpenAI Codex/GPT-4 CLI for code generation and AI assistance"
238
243
 
244
+ @auto_timeout("cli_tools")
245
+
246
+
239
247
  async def call(self, ctx: Context[Any, Any, Any], **params: Any) -> str:
240
248
  prompt: str = params.get("prompt", "")
241
249
  model: Optional[str] = params.get("model") or self.default_model
@@ -274,6 +282,9 @@ class GeminiCLITool(BaseCLITool):
274
282
  def description(self) -> str:
275
283
  return "Execute Google Gemini CLI for multimodal AI assistance"
276
284
 
285
+ @auto_timeout("cli_tools")
286
+
287
+
277
288
  async def call(self, ctx: Context[Any, Any, Any], **params: Any) -> str:
278
289
  prompt: str = params.get("prompt", "")
279
290
  model: Optional[str] = params.get("model") or self.default_model
@@ -312,6 +323,9 @@ class GrokCLITool(BaseCLITool):
312
323
  def description(self) -> str:
313
324
  return "Execute xAI Grok CLI for real-time AI assistance"
314
325
 
326
+ @auto_timeout("cli_tools")
327
+
328
+
315
329
  async def call(self, ctx: Context[Any, Any, Any], **params: Any) -> str:
316
330
  prompt: str = params.get("prompt", "")
317
331
  model: Optional[str] = params.get("model") or self.default_model
@@ -350,6 +364,9 @@ class OpenHandsCLITool(BaseCLITool):
350
364
  def description(self) -> str:
351
365
  return "Execute OpenHands (OpenDevin) for autonomous coding assistance"
352
366
 
367
+ @auto_timeout("cli_tools")
368
+
369
+
353
370
  async def call(self, ctx: Context[Any, Any, Any], **params: Any) -> str:
354
371
  prompt = params.get("prompt", "")
355
372
  model = params.get("model") or self.default_model
@@ -400,6 +417,9 @@ class HanzoDevCLITool(BaseCLITool):
400
417
  def description(self) -> str:
401
418
  return "Execute Hanzo Dev for AI-powered code editing and development"
402
419
 
420
+ @auto_timeout("cli_tools")
421
+
422
+
403
423
  async def call(self, ctx: Context[Any, Any, Any], **params: Any) -> str:
404
424
  prompt = params.get("prompt", "")
405
425
  model = params.get("model") or self.default_model
@@ -438,6 +458,9 @@ class ClineCLITool(BaseCLITool):
438
458
  def description(self) -> str:
439
459
  return "Execute Cline for autonomous coding with Claude"
440
460
 
461
+ @auto_timeout("cli_tools")
462
+
463
+
441
464
  async def call(self, ctx: Context[Any, Any, Any], **params: Any) -> str:
442
465
  prompt = params.get("prompt", "")
443
466
  working_dir: str = params.get("working_dir") or os.getcwd()
@@ -473,6 +496,9 @@ class AiderCLITool(BaseCLITool):
473
496
  def description(self) -> str:
474
497
  return "Execute Aider for AI pair programming"
475
498
 
499
+ @auto_timeout("cli_tools")
500
+
501
+
476
502
  async def call(self, ctx: Context[Any, Any, Any], **params: Any) -> str:
477
503
  prompt = params.get("prompt", "")
478
504
  model = params.get("model") or self.default_model
@@ -6,6 +6,8 @@ This tool manages API keys and accounts for Claude Code and other AI coding tool
6
6
  from typing import Unpack, Optional, TypedDict, final, override
7
7
 
8
8
  from mcp.server import FastMCP
9
+
10
+ from hanzo_mcp.tools.common.auto_timeout import auto_timeout
9
11
  from mcp.server.fastmcp import Context as MCPContext
10
12
 
11
13
  from hanzo_mcp.tools.common.base import BaseTool
@@ -67,6 +69,9 @@ Providers: claude, openai, azure, deepseek, google, groq"""
67
69
  self.auth_manager = CodeAuthManager()
68
70
 
69
71
  @override
72
+ @auto_timeout("code_auth")
73
+
74
+
70
75
  async def call(
71
76
  self,
72
77
  ctx: MCPContext,
@@ -6,6 +6,7 @@ from typing import List, Optional, override
6
6
  from mcp.server import FastMCP
7
7
  from mcp.server.fastmcp import Context as MCPContext
8
8
 
9
+ from hanzo_mcp.tools.common.auto_timeout import auto_timeout
9
10
  from hanzo_mcp.tools.common.base import BaseTool
10
11
 
11
12
 
@@ -57,6 +58,7 @@ critic(
57
58
  specific_concerns="Are the imports in the correct format and location?"
58
59
  )"""
59
60
 
61
+ @auto_timeout("critic")
60
62
  async def call(
61
63
  self,
62
64
  ctx: MCPContext,
@@ -66,7 +68,11 @@ critic(
66
68
  file_paths: Optional[List[str]] = None,
67
69
  specific_concerns: Optional[str] = None,
68
70
  ) -> str:
69
- """This is a placeholder - actual implementation happens in AgentTool."""
71
+ """Delegate to AgentTool for actual implementation.
72
+
73
+ This method provides the interface, but the actual critic logic
74
+ is handled by the AgentTool's execution framework.
75
+ """
70
76
  # This tool is handled specially in the agent execution
71
77
  return f"Critic review requested for: {work_description}"
72
78
 
@@ -5,6 +5,8 @@ from enum import Enum
5
5
  from typing import List, override
6
6
 
7
7
  from mcp.server import FastMCP
8
+
9
+ from hanzo_mcp.tools.common.auto_timeout import auto_timeout
8
10
  from mcp.server.fastmcp import Context as MCPContext
9
11
 
10
12
  from hanzo_mcp.tools.common.base import BaseTool
@@ -599,6 +601,9 @@ Use this when you need:
599
601
  super().__init__()
600
602
  self.oracle = IChing()
601
603
 
604
+ @auto_timeout("iching")
605
+
606
+
602
607
  async def call(self, ctx: MCPContext, challenge: str) -> str:
603
608
  """Cast I Ching and provide guidance."""
604
609
  # Cast hexagram
@@ -18,6 +18,8 @@ from typing import (
18
18
 
19
19
  from pydantic import Field
20
20
  from mcp.server import FastMCP
21
+
22
+ from hanzo_mcp.tools.common.auto_timeout import auto_timeout
21
23
  from mcp.server.fastmcp import Context as MCPContext
22
24
 
23
25
  from hanzo_mcp.tools.common.base import BaseTool
@@ -104,6 +106,9 @@ class NetworkTool(BaseTool):
104
106
  return self._cluster
105
107
 
106
108
  @override
109
+ @auto_timeout("network")
110
+
111
+
107
112
  async def call(self, ctx: MCPContext, **params: Unpack[NetworkToolParams]) -> str:
108
113
  """Execute a task on the agent network.
109
114
 
@@ -6,6 +6,7 @@ from typing import List, Optional, override
6
6
  from mcp.server import FastMCP
7
7
  from mcp.server.fastmcp import Context as MCPContext
8
8
 
9
+ from hanzo_mcp.tools.common.auto_timeout import auto_timeout
9
10
  from hanzo_mcp.tools.common.base import BaseTool
10
11
 
11
12
 
@@ -57,6 +58,7 @@ review(
57
58
  context="This will be used to automatically fix missing imports in Go files"
58
59
  )"""
59
60
 
61
+ @auto_timeout("review")
60
62
  async def call(
61
63
  self,
62
64
  ctx: MCPContext,
@@ -66,7 +68,11 @@ review(
66
68
  file_paths: Optional[List[str]] = None,
67
69
  context: Optional[str] = None,
68
70
  ) -> str:
69
- """This is a placeholder - actual implementation happens in AgentTool."""
71
+ """Delegate to AgentTool for actual implementation.
72
+
73
+ This method provides the interface, but the actual review logic
74
+ is handled by the AgentTool's execution framework.
75
+ """
70
76
  # This tool is handled specially in the agent execution
71
77
  return f"Review requested for: {work_description}"
72
78
 
@@ -1,3 +1,5 @@
1
+
2
+ from hanzo_mcp.tools.common.auto_timeout import auto_timeout
1
3
  """Swarm tool as an alias to Network tool for backward compatibility.
2
4
 
3
5
  This module makes swarm an alias to the network tool, as network is the
@@ -63,6 +65,9 @@ For new code, prefer using 'network' directly."""
63
65
  # Just pass through to NetworkTool
64
66
  super().__init__(permission_manager=permission_manager, default_mode=default_mode, **kwargs)
65
67
 
68
+ @auto_timeout("swarm_alias")
69
+
70
+
66
71
  async def call(self, **kwargs) -> str:
67
72
  """Execute swarm via network tool.
68
73