hanzo-mcp 0.5.0__tar.gz → 0.5.2__tar.gz
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-0.5.0 → hanzo_mcp-0.5.2}/PKG-INFO +68 -20
- hanzo_mcp-0.5.2/README.md +231 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/__init__.py +1 -1
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/config/settings.py +61 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/__init__.py +158 -12
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/common/base.py +7 -2
- hanzo_mcp-0.5.2/hanzo_mcp/tools/common/config_tool.py +396 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/common/stats.py +261 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/common/tool_disable.py +144 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/common/tool_enable.py +182 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/common/tool_list.py +263 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/database/__init__.py +71 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/database/database_manager.py +246 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/database/graph_add.py +257 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/database/graph_query.py +536 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/database/graph_remove.py +267 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/database/graph_search.py +348 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/database/graph_stats.py +345 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/database/sql_query.py +229 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/database/sql_search.py +296 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/database/sql_stats.py +254 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/editor/__init__.py +11 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/editor/neovim_command.py +272 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/editor/neovim_edit.py +290 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/editor/neovim_session.py +356 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/filesystem/__init__.py +20 -1
- hanzo_mcp-0.5.2/hanzo_mcp/tools/filesystem/batch_search.py +812 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/filesystem/find_files.py +348 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/filesystem/git_search.py +505 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/llm/__init__.py +27 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/llm/consensus_tool.py +351 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/llm/llm_manage.py +413 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/llm/llm_tool.py +346 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/llm/provider_tools.py +412 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/mcp/__init__.py +11 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/mcp/mcp_add.py +263 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/mcp/mcp_remove.py +127 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/mcp/mcp_stats.py +165 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/shell/__init__.py +27 -7
- hanzo_mcp-0.5.2/hanzo_mcp/tools/shell/logs.py +265 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/shell/npx.py +194 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/shell/npx_background.py +254 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/shell/pkill.py +262 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/shell/processes.py +279 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/shell/run_background.py +326 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/shell/uvx.py +187 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/shell/uvx_background.py +249 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/vector/__init__.py +21 -12
- hanzo_mcp-0.5.2/hanzo_mcp/tools/vector/ast_analyzer.py +459 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/vector/git_ingester.py +485 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/vector/index_tool.py +358 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/vector/infinity_store.py +829 -0
- hanzo_mcp-0.5.2/hanzo_mcp/tools/vector/mock_infinity.py +162 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/vector/vector_index.py +7 -6
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/vector/vector_search.py +22 -7
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp.egg-info/PKG-INFO +68 -20
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp.egg-info/SOURCES.txt +49 -1
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/pyproject.toml +1 -1
- hanzo_mcp-0.5.2/tests/test_git_ingestion.py +346 -0
- hanzo_mcp-0.5.2/tests/test_new_tools.py +439 -0
- hanzo_mcp-0.5.2/tests/test_search_quality.py +607 -0
- hanzo_mcp-0.5.2/tests/test_unified_search.py +628 -0
- hanzo_mcp-0.5.2/tests/test_vector_store.py +351 -0
- hanzo_mcp-0.5.0/README.md +0 -183
- hanzo_mcp-0.5.0/hanzo_mcp/tools/vector/infinity_store.py +0 -365
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/LICENSE +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/cli.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/cli_enhanced.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/config/__init__.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/config/tool_config.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/prompts/__init__.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/prompts/compact_conversation.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/prompts/create_release.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/prompts/project_system.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/prompts/project_todo_reminder.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/prompts/utils.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/server.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/agent/__init__.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/agent/agent_tool.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/agent/prompt.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/agent/tool_adapter.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/common/__init__.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/common/batch_tool.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/common/context.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/common/permissions.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/common/thinking_tool.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/common/validation.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/filesystem/base.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/filesystem/content_replace.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/filesystem/directory_tree.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/filesystem/edit.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/filesystem/grep.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/filesystem/grep_ast_tool.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/filesystem/multi_edit.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/filesystem/read.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/filesystem/write.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/jupyter/__init__.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/jupyter/base.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/jupyter/notebook_edit.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/jupyter/notebook_read.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/shell/base.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/shell/bash_session.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/shell/bash_session_executor.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/shell/command_executor.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/shell/run_command.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/shell/run_command_windows.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/shell/session_manager.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/shell/session_storage.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/todo/__init__.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/todo/base.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/todo/todo_read.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/todo/todo_write.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp/tools/vector/project_manager.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp.egg-info/dependency_links.txt +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp.egg-info/entry_points.txt +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp.egg-info/requires.txt +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/hanzo_mcp.egg-info/top_level.txt +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/setup.cfg +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/setup.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/tests/test_async_support.py +0 -0
- {hanzo_mcp-0.5.0 → hanzo_mcp-0.5.2}/tests/test_cli.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hanzo-mcp
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2
|
|
4
4
|
Summary: MCP implementation of Hanzo capabilities
|
|
5
5
|
Author-email: Hanzo Industries Inc <dev@hanzo.ai>
|
|
6
6
|
License: MIT
|
|
@@ -45,6 +45,10 @@ Dynamic: license-file
|
|
|
45
45
|
|
|
46
46
|
# Hanzo MCP
|
|
47
47
|
|
|
48
|
+
[](https://hanzo.app/launch?repo=https://github.com/hanzoai/mcp)
|
|
49
|
+
[](https://hanzo.app/dev?repo=https://github.com/hanzoai/mcp&action=feature)
|
|
50
|
+
[](https://hanzo.app/dev?repo=https://github.com/hanzoai/mcp&action=bugfix)
|
|
51
|
+
|
|
48
52
|
An implementation of Hanzo capabilities using the Model Context Protocol (MCP).
|
|
49
53
|
|
|
50
54
|
## Overview
|
|
@@ -67,26 +71,59 @@ This project provides an MCP server that implements Hanzo-like functionality, al
|
|
|
67
71
|
|
|
68
72
|
## Tools Implemented
|
|
69
73
|
|
|
70
|
-
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
| `
|
|
76
|
-
| `
|
|
77
|
-
| `
|
|
78
|
-
| `content_replace`
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
74
|
+
### Core File Operations
|
|
75
|
+
| Tool | Description |
|
|
76
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
77
|
+
| `read` | Read one or multiple files with encoding detection and line range support |
|
|
78
|
+
| `write` | Create or overwrite files with content |
|
|
79
|
+
| `edit` | Make precise line-based edits to existing files |
|
|
80
|
+
| `multi_edit` | Make multiple edits to a single file in one atomic operation |
|
|
81
|
+
| `directory_tree` | Get a recursive tree view of directories with customizable depth and filters |
|
|
82
|
+
| `content_replace` | Replace patterns in file contents using regex |
|
|
83
|
+
|
|
84
|
+
### Search & Analysis
|
|
85
|
+
| Tool | Description |
|
|
86
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
87
|
+
| `grep` | Fast pattern search across files using ripgrep |
|
|
88
|
+
| `grep_ast` | AST-aware code search that understands code structure |
|
|
89
|
+
| `unified_search` | Intelligent multi-modal search combining text, vector, AST, and symbol search |
|
|
90
|
+
| `vector_search` | Semantic search across indexed documents and code |
|
|
91
|
+
| `vector_index` | Index documents and code in project-aware vector databases |
|
|
92
|
+
|
|
93
|
+
### Shell & Commands
|
|
94
|
+
| Tool | Description |
|
|
95
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
96
|
+
| `run_command` | Execute shell commands with timeout, environment control, and session support |
|
|
97
|
+
|
|
98
|
+
### Jupyter Support
|
|
99
|
+
| Tool | Description |
|
|
100
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
101
|
+
| `notebook_read` | Read Jupyter notebook cells with outputs and metadata |
|
|
102
|
+
| `notebook_edit` | Edit, insert, or delete cells in Jupyter notebooks |
|
|
103
|
+
|
|
104
|
+
### Task Management
|
|
105
|
+
| Tool | Description |
|
|
106
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
107
|
+
| `todo_read` | Read the current task list for tracking progress |
|
|
108
|
+
| `todo_write` | Create and manage structured task lists with status and priority |
|
|
109
|
+
|
|
110
|
+
### Advanced Tools
|
|
111
|
+
| Tool | Description |
|
|
112
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
113
|
+
| `think` | Structured space for complex reasoning and analysis without making changes |
|
|
114
|
+
| `dispatch_agent` | Launch specialized sub-agents for concurrent task execution |
|
|
115
|
+
| `batch` | Execute multiple tool calls in a single operation for performance |
|
|
116
|
+
|
|
117
|
+
For detailed documentation on all tools, see [TOOLS_DOCUMENTATION.md](./TOOLS_DOCUMENTATION.md).
|
|
87
118
|
|
|
88
119
|
## Getting Started
|
|
89
120
|
|
|
121
|
+
### 🚀 Try it Instantly in Hanzo.App
|
|
122
|
+
|
|
123
|
+
**No setup required!** Launch this project instantly in your browser:
|
|
124
|
+
|
|
125
|
+
[](https://hanzo.app/launch?repo=https://github.com/hanzoai/mcp)
|
|
126
|
+
|
|
90
127
|
### Quick Install
|
|
91
128
|
|
|
92
129
|
```bash
|
|
@@ -120,7 +157,7 @@ cd mcp
|
|
|
120
157
|
make install-desktop
|
|
121
158
|
|
|
122
159
|
# With custom paths and server name
|
|
123
|
-
make install-desktop ALLOWED_PATHS="/path/to/projects,/another/path" SERVER_NAME="hanzo
|
|
160
|
+
make install-desktop ALLOWED_PATHS="/path/to/projects,/another/path" SERVER_NAME="hanzo"
|
|
124
161
|
|
|
125
162
|
# Disable write tools (useful if you prefer using your IDE for edits)
|
|
126
163
|
make install-desktop DISABLE_WRITE=1
|
|
@@ -215,7 +252,11 @@ make publish-test
|
|
|
215
252
|
|
|
216
253
|
### Contributing
|
|
217
254
|
|
|
218
|
-
|
|
255
|
+
**New contributors welcome!** 🎉 We've made it easy to contribute:
|
|
256
|
+
|
|
257
|
+
[](https://hanzo.app/dev?repo=https://github.com/hanzoai/mcp&action=contribute)
|
|
258
|
+
|
|
259
|
+
**Traditional approach:**
|
|
219
260
|
|
|
220
261
|
1. Fork the repository
|
|
221
262
|
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
@@ -223,6 +264,13 @@ To contribute to this project:
|
|
|
223
264
|
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
224
265
|
5. Open a Pull Request
|
|
225
266
|
|
|
267
|
+
**Or use Hanzo Dev for AI-assisted contributions:**
|
|
268
|
+
- [Launch in Hanzo.App](https://hanzo.app/launch?repo=https://github.com/hanzoai/mcp) for instant setup
|
|
269
|
+
- [Add new features](https://hanzo.app/dev?repo=https://github.com/hanzoai/mcp&action=feature) with AI assistance
|
|
270
|
+
- [Fix bugs automatically](https://hanzo.app/dev?repo=https://github.com/hanzoai/mcp&action=bugfix)
|
|
271
|
+
|
|
272
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines.
|
|
273
|
+
|
|
226
274
|
## License
|
|
227
275
|
|
|
228
276
|
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Hanzo MCP
|
|
2
|
+
|
|
3
|
+
[](https://hanzo.app/launch?repo=https://github.com/hanzoai/mcp)
|
|
4
|
+
[](https://hanzo.app/dev?repo=https://github.com/hanzoai/mcp&action=feature)
|
|
5
|
+
[](https://hanzo.app/dev?repo=https://github.com/hanzoai/mcp&action=bugfix)
|
|
6
|
+
|
|
7
|
+
An implementation of Hanzo capabilities using the Model Context Protocol (MCP).
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This project provides an MCP server that implements Hanzo-like functionality, allowing Claude to directly execute instructions for modifying and improving project files. By leveraging the Model Context Protocol, this implementation enables seamless integration with various MCP clients including Claude Desktop.
|
|
12
|
+
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **Code Understanding**: Analyze and understand codebases through file access and pattern searching
|
|
18
|
+
- **Code Modification**: Make targeted edits to files with proper permission handling
|
|
19
|
+
- **Enhanced Command Execution**: Run commands and scripts in various languages with improved error handling and shell support
|
|
20
|
+
- **File Operations**: Manage files with proper security controls through shell commands
|
|
21
|
+
- **Code Discovery**: Find relevant files and code patterns across your project
|
|
22
|
+
- **Project Analysis**: Understand project structure, dependencies, and frameworks
|
|
23
|
+
- **Agent Delegation**: Delegate complex tasks to specialized sub-agents that can work concurrently
|
|
24
|
+
- **Multiple LLM Provider Support**: Configure any LiteLLM-compatible model for agent operations
|
|
25
|
+
- **Jupyter Notebook Support**: Read and edit Jupyter notebooks with full cell and output handling
|
|
26
|
+
|
|
27
|
+
## Tools Implemented
|
|
28
|
+
|
|
29
|
+
### Core File Operations
|
|
30
|
+
| Tool | Description |
|
|
31
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
32
|
+
| `read` | Read one or multiple files with encoding detection and line range support |
|
|
33
|
+
| `write` | Create or overwrite files with content |
|
|
34
|
+
| `edit` | Make precise line-based edits to existing files |
|
|
35
|
+
| `multi_edit` | Make multiple edits to a single file in one atomic operation |
|
|
36
|
+
| `directory_tree` | Get a recursive tree view of directories with customizable depth and filters |
|
|
37
|
+
| `content_replace` | Replace patterns in file contents using regex |
|
|
38
|
+
|
|
39
|
+
### Search & Analysis
|
|
40
|
+
| Tool | Description |
|
|
41
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
42
|
+
| `grep` | Fast pattern search across files using ripgrep |
|
|
43
|
+
| `grep_ast` | AST-aware code search that understands code structure |
|
|
44
|
+
| `unified_search` | Intelligent multi-modal search combining text, vector, AST, and symbol search |
|
|
45
|
+
| `vector_search` | Semantic search across indexed documents and code |
|
|
46
|
+
| `vector_index` | Index documents and code in project-aware vector databases |
|
|
47
|
+
|
|
48
|
+
### Shell & Commands
|
|
49
|
+
| Tool | Description |
|
|
50
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
51
|
+
| `run_command` | Execute shell commands with timeout, environment control, and session support |
|
|
52
|
+
|
|
53
|
+
### Jupyter Support
|
|
54
|
+
| Tool | Description |
|
|
55
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
56
|
+
| `notebook_read` | Read Jupyter notebook cells with outputs and metadata |
|
|
57
|
+
| `notebook_edit` | Edit, insert, or delete cells in Jupyter notebooks |
|
|
58
|
+
|
|
59
|
+
### Task Management
|
|
60
|
+
| Tool | Description |
|
|
61
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
62
|
+
| `todo_read` | Read the current task list for tracking progress |
|
|
63
|
+
| `todo_write` | Create and manage structured task lists with status and priority |
|
|
64
|
+
|
|
65
|
+
### Advanced Tools
|
|
66
|
+
| Tool | Description |
|
|
67
|
+
| ----------------- | ----------------------------------------------------------------------------------- |
|
|
68
|
+
| `think` | Structured space for complex reasoning and analysis without making changes |
|
|
69
|
+
| `dispatch_agent` | Launch specialized sub-agents for concurrent task execution |
|
|
70
|
+
| `batch` | Execute multiple tool calls in a single operation for performance |
|
|
71
|
+
|
|
72
|
+
For detailed documentation on all tools, see [TOOLS_DOCUMENTATION.md](./TOOLS_DOCUMENTATION.md).
|
|
73
|
+
|
|
74
|
+
## Getting Started
|
|
75
|
+
|
|
76
|
+
### 🚀 Try it Instantly in Hanzo.App
|
|
77
|
+
|
|
78
|
+
**No setup required!** Launch this project instantly in your browser:
|
|
79
|
+
|
|
80
|
+
[](https://hanzo.app/launch?repo=https://github.com/hanzoai/mcp)
|
|
81
|
+
|
|
82
|
+
### Quick Install
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Install using uv
|
|
86
|
+
uv pip install hanzo-mcp
|
|
87
|
+
|
|
88
|
+
# Or using pip
|
|
89
|
+
pip install hanzo-mcp
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Claude Desktop Integration
|
|
93
|
+
|
|
94
|
+
To install and configure hanzo-mcp for use with Claude Desktop:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Install the package globally
|
|
98
|
+
uv pip install hanzo-mcp
|
|
99
|
+
|
|
100
|
+
# Install configuration to Claude Desktop with default settings
|
|
101
|
+
hanzo-mcp --install
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
For development, if you want to install your local version to Claude Desktop:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Clone and navigate to the repository
|
|
108
|
+
git clone https://github.com/hanzoai/mcp.git
|
|
109
|
+
cd mcp
|
|
110
|
+
|
|
111
|
+
# Install and configure for Claude Desktop
|
|
112
|
+
make install-desktop
|
|
113
|
+
|
|
114
|
+
# With custom paths and server name
|
|
115
|
+
make install-desktop ALLOWED_PATHS="/path/to/projects,/another/path" SERVER_NAME="hanzo"
|
|
116
|
+
|
|
117
|
+
# Disable write tools (useful if you prefer using your IDE for edits)
|
|
118
|
+
make install-desktop DISABLE_WRITE=1
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
After installation, restart Claude Desktop. You'll see "hanzo" (or your custom server name) available in the MCP server dropdown.
|
|
122
|
+
|
|
123
|
+
For detailed installation and configuration instructions, please refer to the [documentation](./docs/).
|
|
124
|
+
|
|
125
|
+
Of course, you can also read [USEFUL_PROMPTS](./docs/USEFUL_PROMPTS.md) for some inspiration on how to use hanzo-mcp.
|
|
126
|
+
|
|
127
|
+
## Security
|
|
128
|
+
|
|
129
|
+
This implementation follows best practices for securing access to your filesystem:
|
|
130
|
+
|
|
131
|
+
- Permission prompts for file modifications and command execution
|
|
132
|
+
- Restricted access to specified directories only
|
|
133
|
+
- Input validation and sanitization
|
|
134
|
+
- Proper error handling and reporting
|
|
135
|
+
|
|
136
|
+
## Documentation
|
|
137
|
+
|
|
138
|
+
Comprehensive documentation is available in the [docs](./docs/) directory. You can build and view the documentation locally:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Build the documentation
|
|
142
|
+
make docs
|
|
143
|
+
|
|
144
|
+
# Start a local server to view the documentation
|
|
145
|
+
make docs-serve
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Then open http://localhost:8000/ in your browser to view the documentation.
|
|
149
|
+
|
|
150
|
+
## Development
|
|
151
|
+
|
|
152
|
+
### Setup Development Environment
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Clone the repository
|
|
156
|
+
git clone https://github.com/hanzoai/mcp.git
|
|
157
|
+
cd mcp
|
|
158
|
+
|
|
159
|
+
# Install Python 3.13 using uv
|
|
160
|
+
make install-python
|
|
161
|
+
|
|
162
|
+
# Setup virtual environment and install dependencies
|
|
163
|
+
make setup
|
|
164
|
+
|
|
165
|
+
# Or install with development dependencies
|
|
166
|
+
make install-dev
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Testing
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Run tests
|
|
173
|
+
make test
|
|
174
|
+
|
|
175
|
+
# Run tests with coverage
|
|
176
|
+
make test-cov
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Building and Publishing
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# Build package
|
|
183
|
+
make build
|
|
184
|
+
|
|
185
|
+
# Version bumping
|
|
186
|
+
make bump-patch # Increment patch version (0.1.x → 0.1.x+1)
|
|
187
|
+
make bump-minor # Increment minor version (0.x.0 → 0.x+1.0)
|
|
188
|
+
make bump-major # Increment major version (x.0.0 → x+1.0.0)
|
|
189
|
+
|
|
190
|
+
# Manual version bumping (alternative to make commands)
|
|
191
|
+
python -m scripts.bump_version patch # Increment patch version
|
|
192
|
+
python -m scripts.bump_version minor # Increment minor version
|
|
193
|
+
python -m scripts.bump_version major # Increment major version
|
|
194
|
+
|
|
195
|
+
# Publishing (creates git tag and pushes it to GitHub)
|
|
196
|
+
make publish # Publish using configured credentials in .pypirc
|
|
197
|
+
PYPI_TOKEN=your_token make publish # Publish with token from environment variable
|
|
198
|
+
|
|
199
|
+
# Publishing (creates git tag, pushes to GitHub, and publishes to PyPI)
|
|
200
|
+
make patch # Bump patch version, build, publish, create git tag, and push
|
|
201
|
+
make minor # Bump minor version, build, publish, create git tag, and push
|
|
202
|
+
make major # Bump major version, build, publish, create git tag, and push
|
|
203
|
+
|
|
204
|
+
# Publish to Test PyPI
|
|
205
|
+
make publish-test
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Contributing
|
|
209
|
+
|
|
210
|
+
**New contributors welcome!** 🎉 We've made it easy to contribute:
|
|
211
|
+
|
|
212
|
+
[](https://hanzo.app/dev?repo=https://github.com/hanzoai/mcp&action=contribute)
|
|
213
|
+
|
|
214
|
+
**Traditional approach:**
|
|
215
|
+
|
|
216
|
+
1. Fork the repository
|
|
217
|
+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
218
|
+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
219
|
+
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
220
|
+
5. Open a Pull Request
|
|
221
|
+
|
|
222
|
+
**Or use Hanzo Dev for AI-assisted contributions:**
|
|
223
|
+
- [Launch in Hanzo.App](https://hanzo.app/launch?repo=https://github.com/hanzoai/mcp) for instant setup
|
|
224
|
+
- [Add new features](https://hanzo.app/dev?repo=https://github.com/hanzoai/mcp&action=feature) with AI assistance
|
|
225
|
+
- [Fix bugs automatically](https://hanzo.app/dev?repo=https://github.com/hanzoai/mcp&action=bugfix)
|
|
226
|
+
|
|
227
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for detailed guidelines.
|
|
228
|
+
|
|
229
|
+
## License
|
|
230
|
+
|
|
231
|
+
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
@@ -280,6 +280,67 @@ def get_project_config_path(project_dir: Optional[str] = None) -> Optional[Path]
|
|
|
280
280
|
return None
|
|
281
281
|
|
|
282
282
|
|
|
283
|
+
def ensure_project_hanzo_dir(project_dir: str) -> Path:
|
|
284
|
+
"""Ensure .hanzo directory exists in project and return its path."""
|
|
285
|
+
project_path = Path(project_dir)
|
|
286
|
+
hanzo_dir = project_path / ".hanzo"
|
|
287
|
+
hanzo_dir.mkdir(exist_ok=True)
|
|
288
|
+
|
|
289
|
+
# Create default structure
|
|
290
|
+
(hanzo_dir / "db").mkdir(exist_ok=True) # Vector database
|
|
291
|
+
|
|
292
|
+
# Create default project config if it doesn't exist
|
|
293
|
+
config_path = hanzo_dir / "mcp-settings.json"
|
|
294
|
+
if not config_path.exists():
|
|
295
|
+
default_project_config = {
|
|
296
|
+
"name": project_path.name,
|
|
297
|
+
"root_path": str(project_path),
|
|
298
|
+
"rules": [
|
|
299
|
+
"Follow project-specific coding standards",
|
|
300
|
+
"Test all changes before committing",
|
|
301
|
+
"Update documentation for new features"
|
|
302
|
+
],
|
|
303
|
+
"workflows": {
|
|
304
|
+
"development": {
|
|
305
|
+
"steps": ["edit", "test", "commit"],
|
|
306
|
+
"tools": ["read", "write", "edit", "run_command"]
|
|
307
|
+
},
|
|
308
|
+
"documentation": {
|
|
309
|
+
"steps": ["read", "analyze", "write"],
|
|
310
|
+
"tools": ["read", "write", "vector_search"]
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
"tasks": [],
|
|
314
|
+
"enabled_tools": {},
|
|
315
|
+
"disabled_tools": [],
|
|
316
|
+
"mcp_servers": []
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
with open(config_path, 'w') as f:
|
|
320
|
+
json.dump(default_project_config, f, indent=2)
|
|
321
|
+
|
|
322
|
+
return hanzo_dir
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def detect_project_from_path(file_path: str) -> Optional[Dict[str, str]]:
|
|
326
|
+
"""Detect project information from a file path by looking for LLM.md."""
|
|
327
|
+
path = Path(file_path).resolve()
|
|
328
|
+
current_path = path.parent if path.is_file() else path
|
|
329
|
+
|
|
330
|
+
while current_path != current_path.parent: # Stop at filesystem root
|
|
331
|
+
llm_md_path = current_path / "LLM.md"
|
|
332
|
+
if llm_md_path.exists():
|
|
333
|
+
return {
|
|
334
|
+
"name": current_path.name,
|
|
335
|
+
"root_path": str(current_path),
|
|
336
|
+
"llm_md_path": str(llm_md_path),
|
|
337
|
+
"hanzo_dir": str(ensure_project_hanzo_dir(str(current_path)))
|
|
338
|
+
}
|
|
339
|
+
current_path = current_path.parent
|
|
340
|
+
|
|
341
|
+
return None
|
|
342
|
+
|
|
343
|
+
|
|
283
344
|
def load_settings(
|
|
284
345
|
project_dir: Optional[str] = None,
|
|
285
346
|
config_overrides: Optional[Dict[str, Any]] = None
|
|
@@ -14,13 +14,22 @@ from fastmcp import FastMCP
|
|
|
14
14
|
from hanzo_mcp.tools.agent import register_agent_tools
|
|
15
15
|
from hanzo_mcp.tools.common import register_batch_tool, register_thinking_tool
|
|
16
16
|
from hanzo_mcp.tools.common.base import BaseTool
|
|
17
|
-
|
|
18
17
|
from hanzo_mcp.tools.common.permissions import PermissionManager
|
|
18
|
+
from hanzo_mcp.tools.common.tool_enable import ToolEnableTool
|
|
19
|
+
from hanzo_mcp.tools.common.tool_disable import ToolDisableTool
|
|
20
|
+
from hanzo_mcp.tools.common.tool_list import ToolListTool
|
|
21
|
+
from hanzo_mcp.tools.common.stats import StatsTool
|
|
19
22
|
from hanzo_mcp.tools.filesystem import register_filesystem_tools
|
|
20
23
|
from hanzo_mcp.tools.jupyter import register_jupyter_tools
|
|
21
24
|
from hanzo_mcp.tools.shell import register_shell_tools
|
|
22
25
|
from hanzo_mcp.tools.todo import register_todo_tools
|
|
23
26
|
from hanzo_mcp.tools.vector import register_vector_tools
|
|
27
|
+
from hanzo_mcp.tools.database import register_database_tools, DatabaseManager
|
|
28
|
+
from hanzo_mcp.tools.mcp.mcp_add import McpAddTool
|
|
29
|
+
from hanzo_mcp.tools.mcp.mcp_remove import McpRemoveTool
|
|
30
|
+
from hanzo_mcp.tools.mcp.mcp_stats import McpStatsTool
|
|
31
|
+
from hanzo_mcp.tools.editor import NeovimEditTool, NeovimCommandTool, NeovimSessionTool
|
|
32
|
+
from hanzo_mcp.tools.llm import LLMTool, ConsensusTool, LLMManageTool, create_provider_tools
|
|
24
33
|
|
|
25
34
|
|
|
26
35
|
def register_all_tools(
|
|
@@ -76,13 +85,38 @@ def register_all_tools(
|
|
|
76
85
|
"directory_tree": is_tool_enabled("directory_tree", True),
|
|
77
86
|
"grep": is_tool_enabled("grep", not disable_search_tools),
|
|
78
87
|
"grep_ast": is_tool_enabled("grep_ast", not disable_search_tools),
|
|
88
|
+
"git_search": is_tool_enabled("git_search", not disable_search_tools),
|
|
79
89
|
"content_replace": is_tool_enabled("content_replace", not disable_write_tools),
|
|
90
|
+
"batch_search": is_tool_enabled("batch_search", not disable_search_tools),
|
|
91
|
+
"find_files": is_tool_enabled("find_files", True),
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
# Vector tools setup (needed for unified search)
|
|
95
|
+
project_manager = None
|
|
96
|
+
vector_enabled = {
|
|
97
|
+
"vector_index": is_tool_enabled("vector_index", False),
|
|
98
|
+
"vector_search": is_tool_enabled("vector_search", False),
|
|
80
99
|
}
|
|
81
100
|
|
|
101
|
+
# Create project manager if vector tools or batch_search are enabled
|
|
102
|
+
if any(vector_enabled.values()) or filesystem_enabled.get("batch_search", False):
|
|
103
|
+
if vector_config:
|
|
104
|
+
from hanzo_mcp.tools.vector.project_manager import ProjectVectorManager
|
|
105
|
+
search_paths = [str(path) for path in permission_manager.allowed_paths]
|
|
106
|
+
project_manager = ProjectVectorManager(
|
|
107
|
+
global_db_path=vector_config.get("data_path"),
|
|
108
|
+
embedding_model=vector_config.get("embedding_model", "text-embedding-3-small"),
|
|
109
|
+
dimension=vector_config.get("dimension", 1536),
|
|
110
|
+
)
|
|
111
|
+
# Auto-detect projects from search paths
|
|
112
|
+
detected_projects = project_manager.detect_projects(search_paths)
|
|
113
|
+
print(f"Detected {len(detected_projects)} projects with LLM.md files")
|
|
114
|
+
|
|
82
115
|
filesystem_tools = register_filesystem_tools(
|
|
83
116
|
mcp_server,
|
|
84
117
|
permission_manager,
|
|
85
118
|
enabled_tools=filesystem_enabled,
|
|
119
|
+
project_manager=project_manager,
|
|
86
120
|
)
|
|
87
121
|
for tool in filesystem_tools:
|
|
88
122
|
all_tools[tool.name] = tool
|
|
@@ -137,22 +171,14 @@ def register_all_tools(
|
|
|
137
171
|
for tool in thinking_tool:
|
|
138
172
|
all_tools[tool.name] = tool
|
|
139
173
|
|
|
140
|
-
# Register vector tools if enabled
|
|
141
|
-
vector_enabled
|
|
142
|
-
"vector_index": is_tool_enabled("vector_index", False),
|
|
143
|
-
"vector_search": is_tool_enabled("vector_search", False),
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if any(vector_enabled.values()) and vector_config:
|
|
147
|
-
# Get allowed paths for project detection
|
|
148
|
-
search_paths = [str(path) for path in permission_manager.allowed_paths]
|
|
149
|
-
|
|
174
|
+
# Register vector tools if enabled (reuse project_manager if available)
|
|
175
|
+
if any(vector_enabled.values()) and project_manager:
|
|
150
176
|
vector_tools = register_vector_tools(
|
|
151
177
|
mcp_server,
|
|
152
178
|
permission_manager,
|
|
153
179
|
vector_config=vector_config,
|
|
154
180
|
enabled_tools=vector_enabled,
|
|
155
|
-
|
|
181
|
+
project_manager=project_manager,
|
|
156
182
|
)
|
|
157
183
|
for tool in vector_tools:
|
|
158
184
|
all_tools[tool.name] = tool
|
|
@@ -160,3 +186,123 @@ def register_all_tools(
|
|
|
160
186
|
# Register batch tool if enabled (batch tool is typically always enabled)
|
|
161
187
|
if is_tool_enabled("batch", True):
|
|
162
188
|
register_batch_tool(mcp_server, all_tools)
|
|
189
|
+
|
|
190
|
+
# Register database tools if enabled
|
|
191
|
+
db_manager = None
|
|
192
|
+
database_enabled = {
|
|
193
|
+
"sql_query": is_tool_enabled("sql_query", True),
|
|
194
|
+
"sql_search": is_tool_enabled("sql_search", True),
|
|
195
|
+
"sql_stats": is_tool_enabled("sql_stats", True),
|
|
196
|
+
"graph_add": is_tool_enabled("graph_add", True),
|
|
197
|
+
"graph_remove": is_tool_enabled("graph_remove", True),
|
|
198
|
+
"graph_query": is_tool_enabled("graph_query", True),
|
|
199
|
+
"graph_search": is_tool_enabled("graph_search", True),
|
|
200
|
+
"graph_stats": is_tool_enabled("graph_stats", True),
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
if any(database_enabled.values()):
|
|
204
|
+
db_manager = DatabaseManager(permission_manager)
|
|
205
|
+
database_tools = register_database_tools(
|
|
206
|
+
mcp_server,
|
|
207
|
+
permission_manager,
|
|
208
|
+
db_manager=db_manager,
|
|
209
|
+
)
|
|
210
|
+
# Filter based on enabled state
|
|
211
|
+
for tool in database_tools:
|
|
212
|
+
if database_enabled.get(tool.name, True):
|
|
213
|
+
all_tools[tool.name] = tool
|
|
214
|
+
|
|
215
|
+
# Register MCP management tools if enabled
|
|
216
|
+
mcp_enabled = {
|
|
217
|
+
"mcp_add": is_tool_enabled("mcp_add", True),
|
|
218
|
+
"mcp_remove": is_tool_enabled("mcp_remove", True),
|
|
219
|
+
"mcp_stats": is_tool_enabled("mcp_stats", True),
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if mcp_enabled.get("mcp_add", True):
|
|
223
|
+
tool = McpAddTool()
|
|
224
|
+
tool.register(mcp_server)
|
|
225
|
+
all_tools[tool.name] = tool
|
|
226
|
+
|
|
227
|
+
if mcp_enabled.get("mcp_remove", True):
|
|
228
|
+
tool = McpRemoveTool()
|
|
229
|
+
tool.register(mcp_server)
|
|
230
|
+
all_tools[tool.name] = tool
|
|
231
|
+
|
|
232
|
+
if mcp_enabled.get("mcp_stats", True):
|
|
233
|
+
tool = McpStatsTool()
|
|
234
|
+
tool.register(mcp_server)
|
|
235
|
+
all_tools[tool.name] = tool
|
|
236
|
+
|
|
237
|
+
# Register system tools (always enabled)
|
|
238
|
+
# Tool enable/disable tools
|
|
239
|
+
tool_enable = ToolEnableTool()
|
|
240
|
+
tool_enable.register(mcp_server)
|
|
241
|
+
all_tools[tool_enable.name] = tool_enable
|
|
242
|
+
|
|
243
|
+
tool_disable = ToolDisableTool()
|
|
244
|
+
tool_disable.register(mcp_server)
|
|
245
|
+
all_tools[tool_disable.name] = tool_disable
|
|
246
|
+
|
|
247
|
+
tool_list = ToolListTool()
|
|
248
|
+
tool_list.register(mcp_server)
|
|
249
|
+
all_tools[tool_list.name] = tool_list
|
|
250
|
+
|
|
251
|
+
# Stats tool
|
|
252
|
+
stats_tool = StatsTool(db_manager=db_manager)
|
|
253
|
+
stats_tool.register(mcp_server)
|
|
254
|
+
all_tools[stats_tool.name] = stats_tool
|
|
255
|
+
|
|
256
|
+
# Register editor tools if enabled
|
|
257
|
+
editor_enabled = {
|
|
258
|
+
"neovim_edit": is_tool_enabled("neovim_edit", True),
|
|
259
|
+
"neovim_command": is_tool_enabled("neovim_command", True),
|
|
260
|
+
"neovim_session": is_tool_enabled("neovim_session", True),
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
if editor_enabled.get("neovim_edit", True):
|
|
264
|
+
tool = NeovimEditTool(permission_manager)
|
|
265
|
+
tool.register(mcp_server)
|
|
266
|
+
all_tools[tool.name] = tool
|
|
267
|
+
|
|
268
|
+
if editor_enabled.get("neovim_command", True):
|
|
269
|
+
tool = NeovimCommandTool(permission_manager)
|
|
270
|
+
tool.register(mcp_server)
|
|
271
|
+
all_tools[tool.name] = tool
|
|
272
|
+
|
|
273
|
+
if editor_enabled.get("neovim_session", True):
|
|
274
|
+
tool = NeovimSessionTool()
|
|
275
|
+
tool.register(mcp_server)
|
|
276
|
+
all_tools[tool.name] = tool
|
|
277
|
+
|
|
278
|
+
# Register LLM tools if enabled
|
|
279
|
+
llm_enabled = {
|
|
280
|
+
"llm": is_tool_enabled("llm", True),
|
|
281
|
+
"consensus": is_tool_enabled("consensus", True),
|
|
282
|
+
"llm_manage": is_tool_enabled("llm_manage", True),
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if llm_enabled.get("llm", True):
|
|
286
|
+
tool = LLMTool()
|
|
287
|
+
if tool.available_providers: # Only register if API keys found
|
|
288
|
+
tool.register(mcp_server)
|
|
289
|
+
all_tools[tool.name] = tool
|
|
290
|
+
|
|
291
|
+
if llm_enabled.get("consensus", True):
|
|
292
|
+
tool = ConsensusTool()
|
|
293
|
+
if tool.llm_tool.available_providers: # Only register if API keys found
|
|
294
|
+
tool.register(mcp_server)
|
|
295
|
+
all_tools[tool.name] = tool
|
|
296
|
+
|
|
297
|
+
if llm_enabled.get("llm_manage", True):
|
|
298
|
+
tool = LLMManageTool()
|
|
299
|
+
tool.register(mcp_server)
|
|
300
|
+
all_tools[tool.name] = tool
|
|
301
|
+
|
|
302
|
+
# Register provider-specific LLM tools
|
|
303
|
+
# These are only registered if their API keys are available
|
|
304
|
+
provider_tools = create_provider_tools()
|
|
305
|
+
for tool in provider_tools:
|
|
306
|
+
if is_tool_enabled(tool.name, True):
|
|
307
|
+
tool.register(mcp_server)
|
|
308
|
+
all_tools[tool.name] = tool
|
|
@@ -170,8 +170,13 @@ class ToolRegistry:
|
|
|
170
170
|
mcp_server: The FastMCP server instance
|
|
171
171
|
tool: The tool to register
|
|
172
172
|
"""
|
|
173
|
-
#
|
|
174
|
-
|
|
173
|
+
# Check if tool is enabled before registering
|
|
174
|
+
# Import here to avoid circular imports
|
|
175
|
+
from hanzo_mcp.tools.common.tool_enable import ToolEnableTool
|
|
176
|
+
|
|
177
|
+
if ToolEnableTool.is_tool_enabled(tool.name):
|
|
178
|
+
# Use the tool's register method which handles all the details
|
|
179
|
+
tool.register(mcp_server)
|
|
175
180
|
|
|
176
181
|
@staticmethod
|
|
177
182
|
def register_tools(mcp_server: FastMCP, tools: list[BaseTool]) -> None:
|