hanzo-mcp 0.8.8__py3-none-any.whl → 0.9.0__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 (167) hide show
  1. hanzo_mcp/__init__.py +1 -3
  2. hanzo_mcp/analytics/posthog_analytics.py +4 -17
  3. hanzo_mcp/bridge.py +9 -25
  4. hanzo_mcp/cli.py +8 -17
  5. hanzo_mcp/cli_enhanced.py +5 -14
  6. hanzo_mcp/cli_plugin.py +3 -9
  7. hanzo_mcp/config/settings.py +6 -20
  8. hanzo_mcp/config/tool_config.py +2 -4
  9. hanzo_mcp/core/base_agent.py +88 -88
  10. hanzo_mcp/core/model_registry.py +238 -210
  11. hanzo_mcp/dev_server.py +5 -15
  12. hanzo_mcp/prompts/__init__.py +2 -6
  13. hanzo_mcp/prompts/project_todo_reminder.py +3 -9
  14. hanzo_mcp/prompts/tool_explorer.py +1 -3
  15. hanzo_mcp/prompts/utils.py +7 -21
  16. hanzo_mcp/server.py +6 -7
  17. hanzo_mcp/tools/__init__.py +29 -32
  18. hanzo_mcp/tools/agent/__init__.py +2 -1
  19. hanzo_mcp/tools/agent/agent.py +10 -30
  20. hanzo_mcp/tools/agent/agent_tool.py +23 -17
  21. hanzo_mcp/tools/agent/claude_desktop_auth.py +3 -9
  22. hanzo_mcp/tools/agent/cli_agent_base.py +7 -24
  23. hanzo_mcp/tools/agent/cli_tools.py +76 -75
  24. hanzo_mcp/tools/agent/code_auth.py +1 -3
  25. hanzo_mcp/tools/agent/code_auth_tool.py +2 -6
  26. hanzo_mcp/tools/agent/critic_tool.py +8 -24
  27. hanzo_mcp/tools/agent/iching_tool.py +12 -36
  28. hanzo_mcp/tools/agent/network_tool.py +7 -18
  29. hanzo_mcp/tools/agent/prompt.py +1 -5
  30. hanzo_mcp/tools/agent/review_tool.py +10 -25
  31. hanzo_mcp/tools/agent/swarm_alias.py +1 -3
  32. hanzo_mcp/tools/agent/unified_cli_tools.py +38 -38
  33. hanzo_mcp/tools/common/batch_tool.py +15 -45
  34. hanzo_mcp/tools/common/config_tool.py +9 -28
  35. hanzo_mcp/tools/common/context.py +1 -3
  36. hanzo_mcp/tools/common/critic_tool.py +1 -3
  37. hanzo_mcp/tools/common/decorators.py +2 -6
  38. hanzo_mcp/tools/common/enhanced_base.py +2 -6
  39. hanzo_mcp/tools/common/fastmcp_pagination.py +4 -12
  40. hanzo_mcp/tools/common/forgiving_edit.py +9 -28
  41. hanzo_mcp/tools/common/mode.py +1 -5
  42. hanzo_mcp/tools/common/paginated_base.py +3 -11
  43. hanzo_mcp/tools/common/paginated_response.py +10 -30
  44. hanzo_mcp/tools/common/pagination.py +3 -9
  45. hanzo_mcp/tools/common/path_utils.py +34 -0
  46. hanzo_mcp/tools/common/permissions.py +14 -13
  47. hanzo_mcp/tools/common/personality.py +983 -701
  48. hanzo_mcp/tools/common/plugin_loader.py +3 -15
  49. hanzo_mcp/tools/common/stats.py +7 -19
  50. hanzo_mcp/tools/common/thinking_tool.py +1 -3
  51. hanzo_mcp/tools/common/tool_disable.py +2 -6
  52. hanzo_mcp/tools/common/tool_list.py +2 -6
  53. hanzo_mcp/tools/common/validation.py +1 -3
  54. hanzo_mcp/tools/compiler/__init__.py +8 -0
  55. hanzo_mcp/tools/compiler/sandboxed_compiler.py +681 -0
  56. hanzo_mcp/tools/config/config_tool.py +7 -13
  57. hanzo_mcp/tools/config/index_config.py +1 -3
  58. hanzo_mcp/tools/config/mode_tool.py +5 -15
  59. hanzo_mcp/tools/database/database_manager.py +3 -9
  60. hanzo_mcp/tools/database/graph.py +1 -3
  61. hanzo_mcp/tools/database/graph_add.py +3 -9
  62. hanzo_mcp/tools/database/graph_query.py +11 -34
  63. hanzo_mcp/tools/database/graph_remove.py +3 -9
  64. hanzo_mcp/tools/database/graph_search.py +6 -20
  65. hanzo_mcp/tools/database/graph_stats.py +11 -33
  66. hanzo_mcp/tools/database/sql.py +4 -12
  67. hanzo_mcp/tools/database/sql_query.py +6 -10
  68. hanzo_mcp/tools/database/sql_search.py +2 -6
  69. hanzo_mcp/tools/database/sql_stats.py +5 -15
  70. hanzo_mcp/tools/editor/neovim_command.py +1 -3
  71. hanzo_mcp/tools/editor/neovim_session.py +7 -13
  72. hanzo_mcp/tools/environment/__init__.py +8 -0
  73. hanzo_mcp/tools/environment/environment_detector.py +594 -0
  74. hanzo_mcp/tools/filesystem/__init__.py +28 -26
  75. hanzo_mcp/tools/filesystem/ast_multi_edit.py +14 -43
  76. hanzo_mcp/tools/filesystem/ast_tool.py +3 -0
  77. hanzo_mcp/tools/filesystem/base.py +20 -12
  78. hanzo_mcp/tools/filesystem/content_replace.py +7 -12
  79. hanzo_mcp/tools/filesystem/diff.py +2 -10
  80. hanzo_mcp/tools/filesystem/directory_tree.py +285 -51
  81. hanzo_mcp/tools/filesystem/edit.py +10 -18
  82. hanzo_mcp/tools/filesystem/find.py +312 -179
  83. hanzo_mcp/tools/filesystem/git_search.py +12 -24
  84. hanzo_mcp/tools/filesystem/multi_edit.py +10 -18
  85. hanzo_mcp/tools/filesystem/read.py +14 -30
  86. hanzo_mcp/tools/filesystem/rules_tool.py +9 -17
  87. hanzo_mcp/tools/filesystem/search.py +1160 -0
  88. hanzo_mcp/tools/filesystem/watch.py +2 -4
  89. hanzo_mcp/tools/filesystem/write.py +7 -10
  90. hanzo_mcp/tools/framework/__init__.py +8 -0
  91. hanzo_mcp/tools/framework/framework_modes.py +714 -0
  92. hanzo_mcp/tools/jupyter/base.py +6 -20
  93. hanzo_mcp/tools/jupyter/jupyter.py +4 -12
  94. hanzo_mcp/tools/llm/consensus_tool.py +8 -24
  95. hanzo_mcp/tools/llm/llm_manage.py +2 -6
  96. hanzo_mcp/tools/llm/llm_tool.py +17 -58
  97. hanzo_mcp/tools/llm/llm_unified.py +18 -59
  98. hanzo_mcp/tools/llm/provider_tools.py +1 -3
  99. hanzo_mcp/tools/lsp/lsp_tool.py +621 -481
  100. hanzo_mcp/tools/mcp/mcp_add.py +3 -5
  101. hanzo_mcp/tools/mcp/mcp_remove.py +1 -1
  102. hanzo_mcp/tools/mcp/mcp_stats.py +1 -3
  103. hanzo_mcp/tools/mcp/mcp_tool.py +9 -23
  104. hanzo_mcp/tools/memory/__init__.py +33 -40
  105. hanzo_mcp/tools/memory/conversation_memory.py +636 -0
  106. hanzo_mcp/tools/memory/knowledge_tools.py +7 -25
  107. hanzo_mcp/tools/memory/memory_tools.py +7 -19
  108. hanzo_mcp/tools/search/find_tool.py +12 -34
  109. hanzo_mcp/tools/search/unified_search.py +27 -81
  110. hanzo_mcp/tools/shell/__init__.py +16 -4
  111. hanzo_mcp/tools/shell/auto_background.py +2 -6
  112. hanzo_mcp/tools/shell/base.py +1 -5
  113. hanzo_mcp/tools/shell/base_process.py +5 -7
  114. hanzo_mcp/tools/shell/bash_session.py +7 -24
  115. hanzo_mcp/tools/shell/bash_session_executor.py +5 -15
  116. hanzo_mcp/tools/shell/bash_tool.py +3 -7
  117. hanzo_mcp/tools/shell/command_executor.py +26 -79
  118. hanzo_mcp/tools/shell/logs.py +4 -16
  119. hanzo_mcp/tools/shell/npx.py +2 -8
  120. hanzo_mcp/tools/shell/npx_tool.py +1 -3
  121. hanzo_mcp/tools/shell/pkill.py +4 -12
  122. hanzo_mcp/tools/shell/process_tool.py +2 -8
  123. hanzo_mcp/tools/shell/processes.py +5 -17
  124. hanzo_mcp/tools/shell/run_background.py +1 -3
  125. hanzo_mcp/tools/shell/run_command.py +1 -3
  126. hanzo_mcp/tools/shell/run_command_windows.py +1 -3
  127. hanzo_mcp/tools/shell/run_tool.py +56 -0
  128. hanzo_mcp/tools/shell/session_manager.py +2 -6
  129. hanzo_mcp/tools/shell/session_storage.py +2 -6
  130. hanzo_mcp/tools/shell/streaming_command.py +7 -23
  131. hanzo_mcp/tools/shell/uvx.py +4 -14
  132. hanzo_mcp/tools/shell/uvx_background.py +2 -6
  133. hanzo_mcp/tools/shell/uvx_tool.py +1 -3
  134. hanzo_mcp/tools/shell/zsh_tool.py +12 -20
  135. hanzo_mcp/tools/todo/todo.py +1 -3
  136. hanzo_mcp/tools/vector/__init__.py +97 -50
  137. hanzo_mcp/tools/vector/ast_analyzer.py +6 -20
  138. hanzo_mcp/tools/vector/git_ingester.py +10 -30
  139. hanzo_mcp/tools/vector/index_tool.py +3 -9
  140. hanzo_mcp/tools/vector/infinity_store.py +11 -30
  141. hanzo_mcp/tools/vector/mock_infinity.py +159 -0
  142. hanzo_mcp/tools/vector/node_tool.py +538 -0
  143. hanzo_mcp/tools/vector/project_manager.py +4 -12
  144. hanzo_mcp/tools/vector/unified_vector.py +384 -0
  145. hanzo_mcp/tools/vector/vector.py +2 -6
  146. hanzo_mcp/tools/vector/vector_index.py +8 -8
  147. hanzo_mcp/tools/vector/vector_search.py +7 -21
  148. {hanzo_mcp-0.8.8.dist-info → hanzo_mcp-0.9.0.dist-info}/METADATA +2 -2
  149. hanzo_mcp-0.9.0.dist-info/RECORD +191 -0
  150. hanzo_mcp/tools/agent/agent_tool_v1_deprecated.py +0 -645
  151. hanzo_mcp/tools/agent/swarm_tool.py +0 -723
  152. hanzo_mcp/tools/agent/swarm_tool_v1_deprecated.py +0 -577
  153. hanzo_mcp/tools/filesystem/batch_search.py +0 -900
  154. hanzo_mcp/tools/filesystem/directory_tree_paginated.py +0 -350
  155. hanzo_mcp/tools/filesystem/find_files.py +0 -369
  156. hanzo_mcp/tools/filesystem/grep.py +0 -467
  157. hanzo_mcp/tools/filesystem/search_tool.py +0 -767
  158. hanzo_mcp/tools/filesystem/symbols_tool.py +0 -515
  159. hanzo_mcp/tools/filesystem/tree.py +0 -270
  160. hanzo_mcp/tools/jupyter/notebook_edit.py +0 -317
  161. hanzo_mcp/tools/jupyter/notebook_read.py +0 -147
  162. hanzo_mcp/tools/todo/todo_read.py +0 -143
  163. hanzo_mcp/tools/todo/todo_write.py +0 -374
  164. hanzo_mcp-0.8.8.dist-info/RECORD +0 -192
  165. {hanzo_mcp-0.8.8.dist-info → hanzo_mcp-0.9.0.dist-info}/WHEEL +0 -0
  166. {hanzo_mcp-0.8.8.dist-info → hanzo_mcp-0.9.0.dist-info}/entry_points.txt +0 -0
  167. {hanzo_mcp-0.8.8.dist-info → hanzo_mcp-0.9.0.dist-info}/top_level.txt +0 -0
@@ -189,9 +189,7 @@ Use 'mcp_stats' to see all added servers and their status.
189
189
 
190
190
  full_command = shlex.split(command)
191
191
 
192
- await tool_ctx.info(
193
- f"Adding MCP server '{name}' with command: {' '.join(full_command)}"
194
- )
192
+ await tool_ctx.info(f"Adding MCP server '{name}' with command: {' '.join(full_command)}")
195
193
 
196
194
  # Create server configuration
197
195
  server_config = {
@@ -221,8 +219,8 @@ Use 'mcp_stats' to see all added servers and their status.
221
219
  if not shutil.which("uvx"):
222
220
  return "Error: uvx not found. Install uv first."
223
221
 
224
- # MCP server connection handled by runtime
225
- # Store configuration for runtime to use
222
+ # TODO: Actually start and connect to the MCP server
223
+ # For now, we just store the configuration
226
224
  server_config["status"] = "ready"
227
225
 
228
226
  except Exception as e:
@@ -103,7 +103,7 @@ Use 'mcp_stats' to see all servers before removing.
103
103
  if not force:
104
104
  return f"Error: Server '{name}' is currently running. Use --force to remove anyway."
105
105
  else:
106
- # Server process stopping handled by MCP runtime
106
+ # TODO: Stop the server process
107
107
  await tool_ctx.info(f"Stopping running server '{name}'")
108
108
 
109
109
  # Remove from registry
@@ -68,9 +68,7 @@ Example:
68
68
  servers = McpAddTool.get_servers()
69
69
 
70
70
  if not servers:
71
- return (
72
- "No MCP servers have been added yet.\n\nUse 'mcp_add' to add servers."
73
- )
71
+ return "No MCP servers have been added yet.\n\nUse 'mcp_add' to add servers."
74
72
 
75
73
  output = []
76
74
  output.append("=== MCP Server Statistics ===")
@@ -173,9 +173,7 @@ class MCPTool(BaseTool):
173
173
  def _auto_start_servers(self):
174
174
  """Auto-start servers configured for auto-start."""
175
175
  for name, server_config in self.config.get("servers", {}).items():
176
- if server_config.get("enabled", False) and server_config.get(
177
- "auto_start", False
178
- ):
176
+ if server_config.get("enabled", False) and server_config.get("auto_start", False):
179
177
  self._start_server(name, server_config)
180
178
 
181
179
  def _start_server(self, name: str, config: Dict[str, Any]) -> bool:
@@ -202,9 +200,7 @@ class MCPTool(BaseTool):
202
200
  cmd = [config["command"]] + config.get("args", [])
203
201
 
204
202
  # Create log directory
205
- log_dir = Path(
206
- self.config.get("log_dir", str(Path.home() / ".hanzo" / "mcp" / "logs"))
207
- )
203
+ log_dir = Path(self.config.get("log_dir", str(Path.home() / ".hanzo" / "mcp" / "logs")))
208
204
  log_dir.mkdir(parents=True, exist_ok=True)
209
205
 
210
206
  # Start process
@@ -307,11 +303,11 @@ Status: {enabled} enabled, {running} running"""
307
303
  elif action == "restart":
308
304
  return self._handle_restart(params.get("name"))
309
305
  elif action == "config":
310
- return self._handle_config(
311
- params.get("config_key"), params.get("config_value")
312
- )
306
+ return self._handle_config(params.get("config_key"), params.get("config_value"))
313
307
  else:
314
- return f"Error: Unknown action '{action}'. Valid actions: list, add, remove, enable, disable, restart, config"
308
+ return (
309
+ f"Error: Unknown action '{action}'. Valid actions: list, add, remove, enable, disable, restart, config"
310
+ )
315
311
 
316
312
  def _handle_list(self) -> str:
317
313
  """List all MCP servers."""
@@ -355,9 +351,7 @@ Status: {enabled} enabled, {running} running"""
355
351
  output.append(f"{name}: {status}")
356
352
  if config.get("description"):
357
353
  output.append(f" Description: {config['description']}")
358
- output.append(
359
- f" Command: {config['command']} {' '.join(config.get('args', []))}"
360
- )
354
+ output.append(f" Command: {config['command']} {' '.join(config.get('args', []))}")
361
355
 
362
356
  if config.get("env"):
363
357
  env_str = ", ".join([f"{k}={v}" for k, v in config["env"].items()])
@@ -498,11 +492,7 @@ Status: {enabled} enabled, {running} running"""
498
492
  else:
499
493
  return f"Configuration key '{key}' not found"
500
494
 
501
- return (
502
- json.dumps(current, indent=2)
503
- if isinstance(current, (dict, list))
504
- else str(current)
505
- )
495
+ return json.dumps(current, indent=2) if isinstance(current, (dict, list)) else str(current)
506
496
  else:
507
497
  # Set value
508
498
  # Navigate to parent
@@ -513,11 +503,7 @@ Status: {enabled} enabled, {running} running"""
513
503
  current = current[k]
514
504
 
515
505
  # Parse value if it looks like JSON
516
- if (
517
- isinstance(value, str)
518
- and value.startswith("{")
519
- or value.startswith("[")
520
- ):
506
+ if isinstance(value, str) and value.startswith("{") or value.startswith("["):
521
507
  try:
522
508
  value = json.loads(value)
523
509
  except Exception:
@@ -4,19 +4,26 @@ from mcp.server import FastMCP
4
4
 
5
5
  from hanzo_mcp.tools.common.base import BaseTool, ToolRegistry
6
6
  from hanzo_mcp.tools.common.permissions import PermissionManager
7
- from hanzo_mcp.tools.memory.memory_tools import (
8
- CreateMemoriesTool,
9
- DeleteMemoriesTool,
10
- ManageMemoriesTool,
11
- RecallMemoriesTool,
12
- UpdateMemoriesTool,
13
- )
14
- from hanzo_mcp.tools.memory.knowledge_tools import (
15
- StoreFactsTool,
16
- RecallFactsTool,
17
- SummarizeToMemoryTool,
18
- ManageKnowledgeBasesTool,
19
- )
7
+
8
+ # Import memory tools if available
9
+ try:
10
+ from hanzo_mcp.tools.memory.memory_tools import (
11
+ CreateMemoriesTool,
12
+ DeleteMemoriesTool,
13
+ ManageMemoriesTool,
14
+ RecallMemoriesTool,
15
+ UpdateMemoriesTool,
16
+ )
17
+ from hanzo_mcp.tools.memory.knowledge_tools import (
18
+ StoreFactsTool,
19
+ RecallFactsTool,
20
+ SummarizeToMemoryTool,
21
+ ManageKnowledgeBasesTool,
22
+ )
23
+
24
+ MEMORY_TOOLS_AVAILABLE = True
25
+ except ImportError:
26
+ MEMORY_TOOLS_AVAILABLE = False
20
27
 
21
28
 
22
29
  def register_memory_tools(
@@ -38,36 +45,22 @@ def register_memory_tools(
38
45
  Returns:
39
46
  List of registered tools
40
47
  """
48
+ if not MEMORY_TOOLS_AVAILABLE:
49
+ print("Warning: Memory tools not available (hanzo-memory package not found)")
50
+ return []
51
+
41
52
  # Create memory tools
42
- recall_tool = RecallMemoriesTool(
43
- user_id=user_id, project_id=project_id, **memory_config
44
- )
45
- create_tool = CreateMemoriesTool(
46
- user_id=user_id, project_id=project_id, **memory_config
47
- )
48
- update_tool = UpdateMemoriesTool(
49
- user_id=user_id, project_id=project_id, **memory_config
50
- )
51
- delete_tool = DeleteMemoriesTool(
52
- user_id=user_id, project_id=project_id, **memory_config
53
- )
54
- manage_tool = ManageMemoriesTool(
55
- user_id=user_id, project_id=project_id, **memory_config
56
- )
53
+ recall_tool = RecallMemoriesTool(user_id=user_id, project_id=project_id, **memory_config)
54
+ create_tool = CreateMemoriesTool(user_id=user_id, project_id=project_id, **memory_config)
55
+ update_tool = UpdateMemoriesTool(user_id=user_id, project_id=project_id, **memory_config)
56
+ delete_tool = DeleteMemoriesTool(user_id=user_id, project_id=project_id, **memory_config)
57
+ manage_tool = ManageMemoriesTool(user_id=user_id, project_id=project_id, **memory_config)
57
58
 
58
59
  # Create knowledge tools
59
- recall_facts_tool = RecallFactsTool(
60
- user_id=user_id, project_id=project_id, **memory_config
61
- )
62
- store_facts_tool = StoreFactsTool(
63
- user_id=user_id, project_id=project_id, **memory_config
64
- )
65
- summarize_tool = SummarizeToMemoryTool(
66
- user_id=user_id, project_id=project_id, **memory_config
67
- )
68
- manage_kb_tool = ManageKnowledgeBasesTool(
69
- user_id=user_id, project_id=project_id, **memory_config
70
- )
60
+ recall_facts_tool = RecallFactsTool(user_id=user_id, project_id=project_id, **memory_config)
61
+ store_facts_tool = StoreFactsTool(user_id=user_id, project_id=project_id, **memory_config)
62
+ summarize_tool = SummarizeToMemoryTool(user_id=user_id, project_id=project_id, **memory_config)
63
+ manage_kb_tool = ManageKnowledgeBasesTool(user_id=user_id, project_id=project_id, **memory_config)
71
64
 
72
65
  # Register tools
73
66
  ToolRegistry.register_tool(mcp_server, recall_tool)