hanzo-mcp 0.7.7__py3-none-any.whl → 0.8.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.
- hanzo_mcp/__init__.py +6 -0
- hanzo_mcp/__main__.py +1 -1
- hanzo_mcp/analytics/__init__.py +2 -2
- hanzo_mcp/analytics/posthog_analytics.py +76 -82
- hanzo_mcp/cli.py +31 -36
- hanzo_mcp/cli_enhanced.py +94 -72
- hanzo_mcp/cli_plugin.py +27 -17
- hanzo_mcp/config/__init__.py +2 -2
- hanzo_mcp/config/settings.py +112 -88
- hanzo_mcp/config/tool_config.py +32 -34
- hanzo_mcp/dev_server.py +66 -67
- hanzo_mcp/prompts/__init__.py +94 -12
- hanzo_mcp/prompts/enhanced_prompts.py +809 -0
- hanzo_mcp/prompts/example_custom_prompt.py +6 -5
- hanzo_mcp/prompts/project_todo_reminder.py +0 -1
- hanzo_mcp/prompts/tool_explorer.py +10 -7
- hanzo_mcp/server.py +17 -21
- hanzo_mcp/server_enhanced.py +15 -22
- hanzo_mcp/tools/__init__.py +56 -28
- hanzo_mcp/tools/agent/__init__.py +16 -19
- hanzo_mcp/tools/agent/agent.py +82 -65
- hanzo_mcp/tools/agent/agent_tool.py +152 -122
- hanzo_mcp/tools/agent/agent_tool_v1_deprecated.py +66 -62
- hanzo_mcp/tools/agent/clarification_protocol.py +55 -50
- hanzo_mcp/tools/agent/clarification_tool.py +11 -10
- hanzo_mcp/tools/agent/claude_cli_tool.py +21 -20
- hanzo_mcp/tools/agent/claude_desktop_auth.py +130 -144
- hanzo_mcp/tools/agent/cli_agent_base.py +59 -53
- hanzo_mcp/tools/agent/code_auth.py +102 -107
- hanzo_mcp/tools/agent/code_auth_tool.py +28 -27
- hanzo_mcp/tools/agent/codex_cli_tool.py +20 -19
- hanzo_mcp/tools/agent/critic_tool.py +86 -73
- hanzo_mcp/tools/agent/gemini_cli_tool.py +21 -20
- hanzo_mcp/tools/agent/grok_cli_tool.py +21 -20
- hanzo_mcp/tools/agent/iching_tool.py +404 -139
- hanzo_mcp/tools/agent/network_tool.py +89 -73
- hanzo_mcp/tools/agent/prompt.py +2 -1
- hanzo_mcp/tools/agent/review_tool.py +101 -98
- hanzo_mcp/tools/agent/swarm_alias.py +87 -0
- hanzo_mcp/tools/agent/swarm_tool.py +246 -161
- hanzo_mcp/tools/agent/swarm_tool_v1_deprecated.py +134 -92
- hanzo_mcp/tools/agent/tool_adapter.py +21 -11
- hanzo_mcp/tools/common/__init__.py +1 -1
- hanzo_mcp/tools/common/base.py +3 -5
- hanzo_mcp/tools/common/batch_tool.py +46 -39
- hanzo_mcp/tools/common/config_tool.py +120 -84
- hanzo_mcp/tools/common/context.py +1 -5
- hanzo_mcp/tools/common/context_fix.py +5 -3
- hanzo_mcp/tools/common/critic_tool.py +4 -8
- hanzo_mcp/tools/common/decorators.py +58 -56
- hanzo_mcp/tools/common/enhanced_base.py +29 -32
- hanzo_mcp/tools/common/fastmcp_pagination.py +91 -94
- hanzo_mcp/tools/common/forgiving_edit.py +91 -87
- hanzo_mcp/tools/common/mode.py +15 -17
- hanzo_mcp/tools/common/mode_loader.py +27 -24
- hanzo_mcp/tools/common/paginated_base.py +61 -53
- hanzo_mcp/tools/common/paginated_response.py +72 -79
- hanzo_mcp/tools/common/pagination.py +50 -53
- hanzo_mcp/tools/common/permissions.py +4 -4
- hanzo_mcp/tools/common/personality.py +186 -138
- hanzo_mcp/tools/common/plugin_loader.py +54 -54
- hanzo_mcp/tools/common/stats.py +65 -47
- hanzo_mcp/tools/common/test_helpers.py +31 -0
- hanzo_mcp/tools/common/thinking_tool.py +4 -8
- hanzo_mcp/tools/common/tool_disable.py +17 -12
- hanzo_mcp/tools/common/tool_enable.py +13 -14
- hanzo_mcp/tools/common/tool_list.py +36 -28
- hanzo_mcp/tools/common/truncate.py +23 -23
- hanzo_mcp/tools/config/__init__.py +4 -4
- hanzo_mcp/tools/config/config_tool.py +42 -29
- hanzo_mcp/tools/config/index_config.py +37 -34
- hanzo_mcp/tools/config/mode_tool.py +175 -55
- hanzo_mcp/tools/database/__init__.py +15 -12
- hanzo_mcp/tools/database/database_manager.py +77 -75
- hanzo_mcp/tools/database/graph.py +137 -91
- hanzo_mcp/tools/database/graph_add.py +30 -18
- hanzo_mcp/tools/database/graph_query.py +178 -102
- hanzo_mcp/tools/database/graph_remove.py +33 -28
- hanzo_mcp/tools/database/graph_search.py +97 -75
- hanzo_mcp/tools/database/graph_stats.py +91 -59
- hanzo_mcp/tools/database/sql.py +107 -79
- hanzo_mcp/tools/database/sql_query.py +30 -24
- hanzo_mcp/tools/database/sql_search.py +29 -25
- hanzo_mcp/tools/database/sql_stats.py +47 -35
- hanzo_mcp/tools/editor/neovim_command.py +25 -28
- hanzo_mcp/tools/editor/neovim_edit.py +21 -23
- hanzo_mcp/tools/editor/neovim_session.py +60 -54
- hanzo_mcp/tools/filesystem/__init__.py +31 -30
- hanzo_mcp/tools/filesystem/ast_multi_edit.py +329 -249
- hanzo_mcp/tools/filesystem/ast_tool.py +4 -4
- hanzo_mcp/tools/filesystem/base.py +1 -1
- hanzo_mcp/tools/filesystem/batch_search.py +316 -224
- hanzo_mcp/tools/filesystem/content_replace.py +4 -4
- hanzo_mcp/tools/filesystem/diff.py +71 -59
- hanzo_mcp/tools/filesystem/directory_tree.py +7 -7
- hanzo_mcp/tools/filesystem/directory_tree_paginated.py +49 -37
- hanzo_mcp/tools/filesystem/edit.py +4 -4
- hanzo_mcp/tools/filesystem/find.py +173 -80
- hanzo_mcp/tools/filesystem/find_files.py +73 -52
- hanzo_mcp/tools/filesystem/git_search.py +157 -104
- hanzo_mcp/tools/filesystem/grep.py +8 -8
- hanzo_mcp/tools/filesystem/multi_edit.py +4 -8
- hanzo_mcp/tools/filesystem/read.py +12 -10
- hanzo_mcp/tools/filesystem/rules_tool.py +59 -43
- hanzo_mcp/tools/filesystem/search_tool.py +263 -207
- hanzo_mcp/tools/filesystem/symbols_tool.py +94 -54
- hanzo_mcp/tools/filesystem/tree.py +35 -33
- hanzo_mcp/tools/filesystem/unix_aliases.py +13 -18
- hanzo_mcp/tools/filesystem/watch.py +37 -36
- hanzo_mcp/tools/filesystem/write.py +4 -8
- hanzo_mcp/tools/jupyter/__init__.py +4 -4
- hanzo_mcp/tools/jupyter/base.py +4 -5
- hanzo_mcp/tools/jupyter/jupyter.py +67 -47
- hanzo_mcp/tools/jupyter/notebook_edit.py +4 -4
- hanzo_mcp/tools/jupyter/notebook_read.py +4 -7
- hanzo_mcp/tools/llm/__init__.py +5 -7
- hanzo_mcp/tools/llm/consensus_tool.py +72 -52
- hanzo_mcp/tools/llm/llm_manage.py +101 -60
- hanzo_mcp/tools/llm/llm_tool.py +226 -166
- hanzo_mcp/tools/llm/provider_tools.py +25 -26
- hanzo_mcp/tools/lsp/__init__.py +1 -1
- hanzo_mcp/tools/lsp/lsp_tool.py +228 -143
- hanzo_mcp/tools/mcp/__init__.py +2 -3
- hanzo_mcp/tools/mcp/mcp_add.py +27 -25
- hanzo_mcp/tools/mcp/mcp_remove.py +7 -8
- hanzo_mcp/tools/mcp/mcp_stats.py +23 -22
- hanzo_mcp/tools/mcp/mcp_tool.py +129 -98
- hanzo_mcp/tools/memory/__init__.py +39 -21
- hanzo_mcp/tools/memory/knowledge_tools.py +124 -99
- hanzo_mcp/tools/memory/memory_tools.py +90 -108
- hanzo_mcp/tools/search/__init__.py +7 -2
- hanzo_mcp/tools/search/find_tool.py +297 -212
- hanzo_mcp/tools/search/unified_search.py +366 -314
- hanzo_mcp/tools/shell/__init__.py +8 -7
- hanzo_mcp/tools/shell/auto_background.py +56 -49
- hanzo_mcp/tools/shell/base.py +1 -1
- hanzo_mcp/tools/shell/base_process.py +75 -75
- hanzo_mcp/tools/shell/bash_session.py +2 -2
- hanzo_mcp/tools/shell/bash_session_executor.py +4 -4
- hanzo_mcp/tools/shell/bash_tool.py +24 -31
- hanzo_mcp/tools/shell/command_executor.py +12 -12
- hanzo_mcp/tools/shell/logs.py +43 -33
- hanzo_mcp/tools/shell/npx.py +13 -13
- hanzo_mcp/tools/shell/npx_background.py +24 -21
- hanzo_mcp/tools/shell/npx_tool.py +18 -22
- hanzo_mcp/tools/shell/open.py +19 -21
- hanzo_mcp/tools/shell/pkill.py +31 -26
- hanzo_mcp/tools/shell/process_tool.py +32 -32
- hanzo_mcp/tools/shell/processes.py +57 -58
- hanzo_mcp/tools/shell/run_background.py +24 -25
- hanzo_mcp/tools/shell/run_command.py +5 -5
- hanzo_mcp/tools/shell/run_command_windows.py +5 -5
- hanzo_mcp/tools/shell/session_storage.py +3 -3
- hanzo_mcp/tools/shell/streaming_command.py +141 -126
- hanzo_mcp/tools/shell/uvx.py +24 -25
- hanzo_mcp/tools/shell/uvx_background.py +35 -33
- hanzo_mcp/tools/shell/uvx_tool.py +18 -22
- hanzo_mcp/tools/todo/__init__.py +6 -2
- hanzo_mcp/tools/todo/todo.py +50 -37
- hanzo_mcp/tools/todo/todo_read.py +5 -8
- hanzo_mcp/tools/todo/todo_write.py +5 -7
- hanzo_mcp/tools/vector/__init__.py +40 -28
- hanzo_mcp/tools/vector/ast_analyzer.py +176 -143
- hanzo_mcp/tools/vector/git_ingester.py +170 -179
- hanzo_mcp/tools/vector/index_tool.py +96 -44
- hanzo_mcp/tools/vector/infinity_store.py +283 -228
- hanzo_mcp/tools/vector/mock_infinity.py +39 -40
- hanzo_mcp/tools/vector/project_manager.py +88 -78
- hanzo_mcp/tools/vector/vector.py +59 -42
- hanzo_mcp/tools/vector/vector_index.py +30 -27
- hanzo_mcp/tools/vector/vector_search.py +64 -45
- hanzo_mcp/types.py +6 -4
- {hanzo_mcp-0.7.7.dist-info → hanzo_mcp-0.8.0.dist-info}/METADATA +1 -1
- hanzo_mcp-0.8.0.dist-info/RECORD +185 -0
- hanzo_mcp-0.7.7.dist-info/RECORD +0 -182
- {hanzo_mcp-0.7.7.dist-info → hanzo_mcp-0.8.0.dist-info}/WHEEL +0 -0
- {hanzo_mcp-0.7.7.dist-info → hanzo_mcp-0.8.0.dist-info}/entry_points.txt +0 -0
- {hanzo_mcp-0.7.7.dist-info → hanzo_mcp-0.8.0.dist-info}/top_level.txt +0 -0
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
"""Rules tool implementation.
|
|
2
2
|
|
|
3
|
-
This module provides the RulesTool for reading local preferences from .cursor rules
|
|
3
|
+
This module provides the RulesTool for reading local preferences from .cursor rules
|
|
4
4
|
or .claude code configuration files.
|
|
5
5
|
"""
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
import os
|
|
7
|
+
from typing import Unpack, Annotated, TypedDict, final, override
|
|
9
8
|
from pathlib import Path
|
|
10
|
-
from typing import Annotated, TypedDict, Unpack, final, override, Optional
|
|
11
9
|
|
|
12
|
-
from mcp.server.fastmcp import Context as MCPContext
|
|
13
|
-
from mcp.server import FastMCP
|
|
14
10
|
from pydantic import Field
|
|
11
|
+
from mcp.server import FastMCP
|
|
12
|
+
from mcp.server.fastmcp import Context as MCPContext
|
|
15
13
|
|
|
16
14
|
from hanzo_mcp.tools.filesystem.base import FilesystemBaseTool
|
|
17
15
|
|
|
18
|
-
|
|
19
16
|
SearchPath = Annotated[
|
|
20
17
|
str,
|
|
21
18
|
Field(
|
|
@@ -115,7 +112,7 @@ understand project-specific requirements and preferences."""
|
|
|
115
112
|
|
|
116
113
|
# Convert to Path object
|
|
117
114
|
start_path = Path(search_path).resolve()
|
|
118
|
-
|
|
115
|
+
|
|
119
116
|
# Configuration files to search for
|
|
120
117
|
config_files = [
|
|
121
118
|
".cursorrules",
|
|
@@ -125,15 +122,15 @@ understand project-specific requirements and preferences."""
|
|
|
125
122
|
".claude/rules.md",
|
|
126
123
|
".claude/config.md",
|
|
127
124
|
]
|
|
128
|
-
|
|
125
|
+
|
|
129
126
|
found_configs = []
|
|
130
|
-
|
|
127
|
+
|
|
131
128
|
# Search in current directory and parent directories
|
|
132
129
|
current_path = start_path
|
|
133
130
|
while True:
|
|
134
131
|
for config_file in config_files:
|
|
135
132
|
config_path = current_path / config_file
|
|
136
|
-
|
|
133
|
+
|
|
137
134
|
# Check if file exists and we have permission
|
|
138
135
|
if config_path.exists() and config_path.is_file():
|
|
139
136
|
try:
|
|
@@ -141,62 +138,81 @@ understand project-specific requirements and preferences."""
|
|
|
141
138
|
if self.is_path_allowed(str(config_path)):
|
|
142
139
|
with open(config_path, "r", encoding="utf-8") as f:
|
|
143
140
|
content = f.read()
|
|
144
|
-
|
|
145
|
-
found_configs.append(
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
141
|
+
|
|
142
|
+
found_configs.append(
|
|
143
|
+
{
|
|
144
|
+
"path": str(config_path),
|
|
145
|
+
"relative_path": str(
|
|
146
|
+
config_path.relative_to(start_path)
|
|
147
|
+
),
|
|
148
|
+
"content": content,
|
|
149
|
+
"size": len(content),
|
|
150
|
+
}
|
|
151
|
+
)
|
|
152
|
+
|
|
152
153
|
await tool_ctx.info(f"Found configuration: {config_path}")
|
|
153
154
|
except Exception as e:
|
|
154
|
-
await tool_ctx.warning(
|
|
155
|
-
|
|
155
|
+
await tool_ctx.warning(
|
|
156
|
+
f"Could not read {config_path}: {str(e)}"
|
|
157
|
+
)
|
|
158
|
+
|
|
156
159
|
# Check if we've reached the root or a git repository root
|
|
157
160
|
if current_path.parent == current_path:
|
|
158
161
|
break
|
|
159
|
-
|
|
162
|
+
|
|
160
163
|
# Check if this is a git repository root
|
|
161
164
|
if (current_path / ".git").exists():
|
|
162
165
|
# Search one more time in the git root before stopping
|
|
163
166
|
if current_path != start_path:
|
|
164
167
|
for config_file in config_files:
|
|
165
168
|
config_path = current_path / config_file
|
|
166
|
-
if
|
|
169
|
+
if (
|
|
170
|
+
config_path.exists()
|
|
171
|
+
and config_path.is_file()
|
|
172
|
+
and str(config_path)
|
|
173
|
+
not in [c["path"] for c in found_configs]
|
|
174
|
+
):
|
|
167
175
|
try:
|
|
168
176
|
if self.is_path_allowed(str(config_path)):
|
|
169
177
|
with open(config_path, "r", encoding="utf-8") as f:
|
|
170
178
|
content = f.read()
|
|
171
|
-
|
|
172
|
-
found_configs.append(
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
179
|
+
|
|
180
|
+
found_configs.append(
|
|
181
|
+
{
|
|
182
|
+
"path": str(config_path),
|
|
183
|
+
"relative_path": str(
|
|
184
|
+
config_path.relative_to(start_path)
|
|
185
|
+
),
|
|
186
|
+
"content": content,
|
|
187
|
+
"size": len(content),
|
|
188
|
+
}
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
await tool_ctx.info(
|
|
192
|
+
f"Found configuration: {config_path}"
|
|
193
|
+
)
|
|
180
194
|
except Exception as e:
|
|
181
|
-
await tool_ctx.warning(
|
|
195
|
+
await tool_ctx.warning(
|
|
196
|
+
f"Could not read {config_path}: {str(e)}"
|
|
197
|
+
)
|
|
182
198
|
break
|
|
183
|
-
|
|
199
|
+
|
|
184
200
|
# Move to parent directory
|
|
185
201
|
parent = current_path.parent
|
|
186
|
-
|
|
202
|
+
|
|
187
203
|
# Check if parent is still within allowed paths
|
|
188
204
|
if not self.is_path_allowed(str(parent)):
|
|
189
205
|
await tool_ctx.info(f"Stopped at directory boundary: {parent}")
|
|
190
206
|
break
|
|
191
|
-
|
|
207
|
+
|
|
192
208
|
current_path = parent
|
|
193
|
-
|
|
209
|
+
|
|
194
210
|
# Format results
|
|
195
211
|
if not found_configs:
|
|
196
212
|
return f"""No configuration files found.
|
|
197
213
|
|
|
198
214
|
Searched for:
|
|
199
|
-
{chr(10).join(
|
|
215
|
+
{chr(10).join("- " + cf for cf in config_files)}
|
|
200
216
|
|
|
201
217
|
Starting from: {start_path}
|
|
202
218
|
|
|
@@ -205,17 +221,17 @@ To create project rules, create one of these files with your preferences:
|
|
|
205
221
|
- .cursor/rules: Alternative Cursor location
|
|
206
222
|
- .claude/code.md: For Claude-specific coding preferences
|
|
207
223
|
- .claude/rules.md: For general Claude interaction rules"""
|
|
208
|
-
|
|
224
|
+
|
|
209
225
|
# Build output
|
|
210
226
|
output = [f"=== Found {len(found_configs)} Configuration File(s) ===\n"]
|
|
211
|
-
|
|
227
|
+
|
|
212
228
|
for i, config in enumerate(found_configs, 1):
|
|
213
229
|
output.append(f"--- [{i}] {config['path']} ({config['size']} bytes) ---")
|
|
214
|
-
output.append(config[
|
|
230
|
+
output.append(config["content"])
|
|
215
231
|
output.append("") # Empty line between configs
|
|
216
|
-
|
|
232
|
+
|
|
217
233
|
output.append(f"\nSearched from: {start_path}")
|
|
218
|
-
|
|
234
|
+
|
|
219
235
|
return "\n".join(output)
|
|
220
236
|
|
|
221
237
|
@override
|