hanzo-mcp 0.8.11__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 (166) hide show
  1. hanzo_mcp/__init__.py +1 -3
  2. hanzo_mcp/analytics/posthog_analytics.py +3 -9
  3. hanzo_mcp/bridge.py +9 -25
  4. hanzo_mcp/cli.py +6 -15
  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 +1 -3
  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 +2 -6
  17. hanzo_mcp/tools/__init__.py +26 -27
  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 +22 -15
  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 +75 -74
  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 +6 -18
  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 +1 -3
  101. hanzo_mcp/tools/mcp/mcp_stats.py +1 -3
  102. hanzo_mcp/tools/mcp/mcp_tool.py +9 -23
  103. hanzo_mcp/tools/memory/__init__.py +10 -27
  104. hanzo_mcp/tools/memory/conversation_memory.py +636 -0
  105. hanzo_mcp/tools/memory/knowledge_tools.py +7 -25
  106. hanzo_mcp/tools/memory/memory_tools.py +6 -18
  107. hanzo_mcp/tools/search/find_tool.py +12 -34
  108. hanzo_mcp/tools/search/unified_search.py +24 -78
  109. hanzo_mcp/tools/shell/__init__.py +16 -4
  110. hanzo_mcp/tools/shell/auto_background.py +2 -6
  111. hanzo_mcp/tools/shell/base.py +1 -5
  112. hanzo_mcp/tools/shell/base_process.py +5 -7
  113. hanzo_mcp/tools/shell/bash_session.py +7 -24
  114. hanzo_mcp/tools/shell/bash_session_executor.py +5 -15
  115. hanzo_mcp/tools/shell/bash_tool.py +3 -7
  116. hanzo_mcp/tools/shell/command_executor.py +26 -79
  117. hanzo_mcp/tools/shell/logs.py +4 -16
  118. hanzo_mcp/tools/shell/npx.py +2 -8
  119. hanzo_mcp/tools/shell/npx_tool.py +1 -3
  120. hanzo_mcp/tools/shell/pkill.py +4 -12
  121. hanzo_mcp/tools/shell/process_tool.py +2 -8
  122. hanzo_mcp/tools/shell/processes.py +5 -17
  123. hanzo_mcp/tools/shell/run_background.py +1 -3
  124. hanzo_mcp/tools/shell/run_command.py +1 -3
  125. hanzo_mcp/tools/shell/run_command_windows.py +1 -3
  126. hanzo_mcp/tools/shell/run_tool.py +56 -0
  127. hanzo_mcp/tools/shell/session_manager.py +2 -6
  128. hanzo_mcp/tools/shell/session_storage.py +2 -6
  129. hanzo_mcp/tools/shell/streaming_command.py +7 -23
  130. hanzo_mcp/tools/shell/uvx.py +4 -14
  131. hanzo_mcp/tools/shell/uvx_background.py +2 -6
  132. hanzo_mcp/tools/shell/uvx_tool.py +1 -3
  133. hanzo_mcp/tools/shell/zsh_tool.py +12 -20
  134. hanzo_mcp/tools/todo/todo.py +1 -3
  135. hanzo_mcp/tools/vector/__init__.py +97 -50
  136. hanzo_mcp/tools/vector/ast_analyzer.py +6 -20
  137. hanzo_mcp/tools/vector/git_ingester.py +10 -30
  138. hanzo_mcp/tools/vector/index_tool.py +3 -9
  139. hanzo_mcp/tools/vector/infinity_store.py +7 -27
  140. hanzo_mcp/tools/vector/mock_infinity.py +1 -3
  141. hanzo_mcp/tools/vector/node_tool.py +538 -0
  142. hanzo_mcp/tools/vector/project_manager.py +4 -12
  143. hanzo_mcp/tools/vector/unified_vector.py +384 -0
  144. hanzo_mcp/tools/vector/vector.py +2 -6
  145. hanzo_mcp/tools/vector/vector_index.py +8 -8
  146. hanzo_mcp/tools/vector/vector_search.py +7 -21
  147. {hanzo_mcp-0.8.11.dist-info → hanzo_mcp-0.9.0.dist-info}/METADATA +2 -2
  148. hanzo_mcp-0.9.0.dist-info/RECORD +191 -0
  149. hanzo_mcp/tools/agent/agent_tool_v1_deprecated.py +0 -645
  150. hanzo_mcp/tools/agent/swarm_tool.py +0 -718
  151. hanzo_mcp/tools/agent/swarm_tool_v1_deprecated.py +0 -577
  152. hanzo_mcp/tools/filesystem/batch_search.py +0 -900
  153. hanzo_mcp/tools/filesystem/directory_tree_paginated.py +0 -350
  154. hanzo_mcp/tools/filesystem/find_files.py +0 -369
  155. hanzo_mcp/tools/filesystem/grep.py +0 -467
  156. hanzo_mcp/tools/filesystem/search_tool.py +0 -767
  157. hanzo_mcp/tools/filesystem/symbols_tool.py +0 -515
  158. hanzo_mcp/tools/filesystem/tree.py +0 -270
  159. hanzo_mcp/tools/jupyter/notebook_edit.py +0 -317
  160. hanzo_mcp/tools/jupyter/notebook_read.py +0 -147
  161. hanzo_mcp/tools/todo/todo_read.py +0 -143
  162. hanzo_mcp/tools/todo/todo_write.py +0 -374
  163. hanzo_mcp-0.8.11.dist-info/RECORD +0 -193
  164. {hanzo_mcp-0.8.11.dist-info → hanzo_mcp-0.9.0.dist-info}/WHEEL +0 -0
  165. {hanzo_mcp-0.8.11.dist-info → hanzo_mcp-0.9.0.dist-info}/entry_points.txt +0 -0
  166. {hanzo_mcp-0.8.11.dist-info → hanzo_mcp-0.9.0.dist-info}/top_level.txt +0 -0
@@ -88,12 +88,7 @@ class PluginLoader:
88
88
 
89
89
  # Find tool classes
90
90
  for _name, obj in inspect.getmembers(module):
91
- if (
92
- inspect.isclass(obj)
93
- and issubclass(obj, BaseTool)
94
- and obj != BaseTool
95
- and hasattr(obj, "name")
96
- ):
91
+ if inspect.isclass(obj) and issubclass(obj, BaseTool) and obj != BaseTool and hasattr(obj, "name"):
97
92
  # Load metadata if available
98
93
  metadata = None
99
94
  metadata_file = file_path.with_suffix(".json")
@@ -134,15 +129,8 @@ class PluginLoader:
134
129
  else:
135
130
  # Search for tool classes
136
131
  for _name, obj in inspect.getmembers(module):
137
- if (
138
- inspect.isclass(obj)
139
- and issubclass(obj, BaseTool)
140
- and obj != BaseTool
141
- and hasattr(obj, "name")
142
- ):
143
- plugin = ToolPlugin(
144
- name=obj.name, tool_class=obj, source_path=package_dir
145
- )
132
+ if inspect.isclass(obj) and issubclass(obj, BaseTool) and obj != BaseTool and hasattr(obj, "name"):
133
+ plugin = ToolPlugin(name=obj.name, tool_class=obj, source_path=package_dir)
146
134
  self.plugins[obj.name] = plugin
147
135
  finally:
148
136
  # Remove from path
@@ -97,9 +97,7 @@ Example:
97
97
  memory_used_gb = memory.used / (1024**3)
98
98
  memory_total_gb = memory.total / (1024**3)
99
99
  memory_percent = memory.percent
100
- output.append(
101
- f"Memory: {memory_used_gb:.1f}/{memory_total_gb:.1f} GB ({memory_percent}%)"
102
- )
100
+ output.append(f"Memory: {memory_used_gb:.1f}/{memory_total_gb:.1f} GB ({memory_percent}%)")
103
101
  if memory_percent > 90:
104
102
  warnings.append(f"⚠️ HIGH MEMORY USAGE: {memory_percent}%")
105
103
 
@@ -109,14 +107,10 @@ Example:
109
107
  disk_total_gb = disk.total / (1024**3)
110
108
  disk_percent = disk.percent
111
109
  disk_free_gb = disk.free / (1024**3)
112
- output.append(
113
- f"Disk: {disk_used_gb:.1f}/{disk_total_gb:.1f} GB ({disk_percent}%)"
114
- )
110
+ output.append(f"Disk: {disk_used_gb:.1f}/{disk_total_gb:.1f} GB ({disk_percent}%)")
115
111
  output.append(f"Free Space: {disk_free_gb:.1f} GB")
116
112
  if disk_percent > 90:
117
- warnings.append(
118
- f"⚠️ LOW DISK SPACE: Only {disk_free_gb:.1f} GB free ({100 - disk_percent:.1f}% remaining)"
119
- )
113
+ warnings.append(f"⚠️ LOW DISK SPACE: Only {disk_free_gb:.1f} GB free ({100 - disk_percent:.1f}% remaining)")
120
114
 
121
115
  output.append("")
122
116
 
@@ -173,9 +167,7 @@ Example:
173
167
  size = db_file.stat().st_size
174
168
  total_db_size += size
175
169
 
176
- output.append(
177
- f"Total Database Size: {total_db_size / (1024**2):.1f} MB"
178
- )
170
+ output.append(f"Total Database Size: {total_db_size / (1024**2):.1f} MB")
179
171
  output.append(f"Active Projects: {len(self.db_manager.projects)}")
180
172
 
181
173
  # List largest databases
@@ -201,9 +193,7 @@ Example:
201
193
  output.append("=== MCP Servers ===")
202
194
  mcp_servers = McpAddTool.get_servers()
203
195
  if mcp_servers:
204
- running_mcp = sum(
205
- 1 for s in mcp_servers.values() if s.get("status") == "running"
206
- )
196
+ running_mcp = sum(1 for s in mcp_servers.values() if s.get("status") == "running")
207
197
  total_mcp_tools = sum(len(s.get("tools", [])) for s in mcp_servers.values())
208
198
 
209
199
  output.append(f"Total Servers: {len(mcp_servers)}")
@@ -225,9 +215,7 @@ Example:
225
215
  output.append(f"Log Files: {log_count} ({log_size / (1024**2):.1f} MB)")
226
216
 
227
217
  if log_size > 100 * 1024**2: # > 100MB
228
- warnings.append(
229
- f"⚠️ Large log directory: {log_size / (1024**2):.1f} MB"
230
- )
218
+ warnings.append(f"⚠️ Large log directory: {log_size / (1024**2):.1f} MB")
231
219
 
232
220
  # Config directory
233
221
  config_dir = Path.home() / ".hanzo" / "mcp"
@@ -115,9 +115,7 @@ Feature Implementation Planning
115
115
 
116
116
  # Validate required thought parameter
117
117
  if not thought:
118
- await tool_ctx.error(
119
- "Parameter 'thought' is required but was None or empty"
120
- )
118
+ await tool_ctx.error("Parameter 'thought' is required but was None or empty")
121
119
  return "Error: Parameter 'thought' is required but was None or empty"
122
120
 
123
121
  if thought.strip() == "":
@@ -125,9 +125,7 @@ Use 'tool_enable' to re-enable disabled tools.
125
125
  ]
126
126
 
127
127
  if not persist:
128
- output.append(
129
- "\nNote: This change is temporary and will be lost on restart."
130
- )
128
+ output.append("\nNote: This change is temporary and will be lost on restart.")
131
129
 
132
130
  # Warn about commonly used tools
133
131
  common_tools = {"grep", "read", "write", "bash", "edit"}
@@ -137,9 +135,7 @@ Use 'tool_enable' to re-enable disabled tools.
137
135
  )
138
136
 
139
137
  # Count disabled tools
140
- disabled_count = sum(
141
- 1 for enabled in ToolEnableTool._tool_states.values() if not enabled
142
- )
138
+ disabled_count = sum(1 for enabled in ToolEnableTool._tool_states.values() if not enabled)
143
139
  output.append(f"\nTotal disabled tools: {disabled_count}")
144
140
 
145
141
  return "\n".join(output)
@@ -205,9 +205,7 @@ Use 'tool_enable' and 'tool_disable' to change tool status.
205
205
 
206
206
  # Iterate through categories
207
207
  categories = (
208
- [category_filter]
209
- if category_filter and category_filter in self.TOOL_INFO
210
- else self.TOOL_INFO.keys()
208
+ [category_filter] if category_filter and category_filter in self.TOOL_INFO else self.TOOL_INFO.keys()
211
209
  )
212
210
 
213
211
  for category in categories:
@@ -242,9 +240,7 @@ Use 'tool_enable' and 'tool_disable' to change tool status.
242
240
  max_name_len = max(len(name) for name, _, _ in category_shown)
243
241
 
244
242
  for tool_name, description, status in category_shown:
245
- output.append(
246
- f"{status} {tool_name.ljust(max_name_len)} - {description}"
247
- )
243
+ output.append(f"{status} {tool_name.ljust(max_name_len)} - {description}")
248
244
 
249
245
  output.append("")
250
246
 
@@ -32,9 +32,7 @@ class ValidationResult:
32
32
  return not self.is_valid
33
33
 
34
34
 
35
- def validate_path_parameter(
36
- path: str | None, parameter_name: str = "path"
37
- ) -> ValidationResult:
35
+ def validate_path_parameter(path: str | None, parameter_name: str = "path") -> ValidationResult:
38
36
  """Validate a path parameter.
39
37
 
40
38
  Args:
@@ -0,0 +1,8 @@
1
+ """Sandboxed compilation and execution tools."""
2
+
3
+ from .sandboxed_compiler import SandboxedCompiler, create_sandboxed_compiler
4
+
5
+ __all__ = [
6
+ "SandboxedCompiler",
7
+ "create_sandboxed_compiler",
8
+ ]