hanzo-mcp 0.1.25__py3-none-any.whl → 0.1.32__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 +2 -2
- hanzo_mcp/cli.py +80 -9
- hanzo_mcp/server.py +41 -10
- hanzo_mcp/tools/__init__.py +54 -32
- hanzo_mcp/tools/agent/__init__.py +59 -0
- hanzo_mcp/tools/agent/agent_tool.py +474 -0
- hanzo_mcp/tools/agent/prompt.py +137 -0
- hanzo_mcp/tools/agent/tool_adapter.py +75 -0
- hanzo_mcp/tools/common/__init__.py +29 -0
- hanzo_mcp/tools/common/base.py +216 -0
- hanzo_mcp/tools/common/context.py +7 -3
- hanzo_mcp/tools/common/permissions.py +63 -119
- hanzo_mcp/tools/common/session.py +91 -0
- hanzo_mcp/tools/common/thinking_tool.py +123 -0
- hanzo_mcp/tools/common/version_tool.py +62 -0
- hanzo_mcp/tools/filesystem/__init__.py +85 -5
- hanzo_mcp/tools/filesystem/base.py +113 -0
- hanzo_mcp/tools/filesystem/content_replace.py +287 -0
- hanzo_mcp/tools/filesystem/directory_tree.py +286 -0
- hanzo_mcp/tools/filesystem/edit_file.py +287 -0
- hanzo_mcp/tools/filesystem/get_file_info.py +170 -0
- hanzo_mcp/tools/filesystem/read_files.py +198 -0
- hanzo_mcp/tools/filesystem/search_content.py +275 -0
- hanzo_mcp/tools/filesystem/write_file.py +162 -0
- hanzo_mcp/tools/jupyter/__init__.py +67 -4
- hanzo_mcp/tools/jupyter/base.py +284 -0
- hanzo_mcp/tools/jupyter/edit_notebook.py +295 -0
- hanzo_mcp/tools/jupyter/notebook_operations.py +72 -112
- hanzo_mcp/tools/jupyter/read_notebook.py +165 -0
- hanzo_mcp/tools/project/__init__.py +64 -1
- hanzo_mcp/tools/project/analysis.py +9 -6
- hanzo_mcp/tools/project/base.py +66 -0
- hanzo_mcp/tools/project/project_analyze.py +173 -0
- hanzo_mcp/tools/shell/__init__.py +58 -1
- hanzo_mcp/tools/shell/base.py +148 -0
- hanzo_mcp/tools/shell/command_executor.py +203 -322
- hanzo_mcp/tools/shell/run_command.py +204 -0
- hanzo_mcp/tools/shell/run_script.py +215 -0
- hanzo_mcp/tools/shell/script_tool.py +244 -0
- {hanzo_mcp-0.1.25.dist-info → hanzo_mcp-0.1.32.dist-info}/METADATA +83 -77
- hanzo_mcp-0.1.32.dist-info/RECORD +46 -0
- {hanzo_mcp-0.1.25.dist-info → hanzo_mcp-0.1.32.dist-info}/licenses/LICENSE +2 -2
- hanzo_mcp/tools/common/thinking.py +0 -65
- hanzo_mcp/tools/filesystem/file_operations.py +0 -1050
- hanzo_mcp-0.1.25.dist-info/RECORD +0 -24
- hanzo_mcp-0.1.25.dist-info/zip-safe +0 -1
- {hanzo_mcp-0.1.25.dist-info → hanzo_mcp-0.1.32.dist-info}/WHEEL +0 -0
- {hanzo_mcp-0.1.25.dist-info → hanzo_mcp-0.1.32.dist-info}/entry_points.txt +0 -0
- {hanzo_mcp-0.1.25.dist-info → hanzo_mcp-0.1.32.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hanzo-mcp
|
|
3
|
-
Version: 0.1.
|
|
4
|
-
Summary: MCP
|
|
5
|
-
Author-email: Hanzo <dev@hanzo.ai>
|
|
3
|
+
Version: 0.1.32
|
|
4
|
+
Summary: MCP implementation of Hanzo capabilities
|
|
5
|
+
Author-email: Hanzo Industries Inc <dev@hanzo.ai>
|
|
6
6
|
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/hanzoai/mcp
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/hanzoai/mcp/issues
|
|
9
|
+
Project-URL: Documentation, https://github.com/hanzoai/mcp/blob/main/README.md
|
|
10
|
+
Keywords: mcp,claude,hanzo,code,agent
|
|
7
11
|
Classifier: Programming Language :: Python :: 3
|
|
8
12
|
Classifier: License :: OSI Approved :: MIT License
|
|
9
13
|
Classifier: Operating System :: OS Independent
|
|
@@ -13,8 +17,9 @@ License-File: LICENSE
|
|
|
13
17
|
Requires-Dist: mcp>=1.3.0
|
|
14
18
|
Requires-Dist: httpx>=0.27.0
|
|
15
19
|
Requires-Dist: uvicorn>=0.23.1
|
|
16
|
-
Requires-Dist:
|
|
17
|
-
Requires-Dist:
|
|
20
|
+
Requires-Dist: openai>=1.50.0
|
|
21
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
22
|
+
Requires-Dist: litellm>=1.40.14
|
|
18
23
|
Provides-Extra: dev
|
|
19
24
|
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
20
25
|
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
|
|
@@ -29,15 +34,18 @@ Requires-Dist: twisted; extra == "test"
|
|
|
29
34
|
Provides-Extra: performance
|
|
30
35
|
Requires-Dist: ujson>=5.7.0; extra == "performance"
|
|
31
36
|
Requires-Dist: orjson>=3.9.0; extra == "performance"
|
|
37
|
+
Provides-Extra: publish
|
|
38
|
+
Requires-Dist: twine>=4.0.2; extra == "publish"
|
|
39
|
+
Requires-Dist: build>=1.0.3; extra == "publish"
|
|
32
40
|
Dynamic: license-file
|
|
33
41
|
|
|
34
42
|
# Hanzo MCP
|
|
35
43
|
|
|
36
|
-
|
|
44
|
+
An implementation of Hanzo capabilities using the Model Context Protocol (MCP).
|
|
37
45
|
|
|
38
46
|
## Overview
|
|
39
47
|
|
|
40
|
-
This project provides an MCP server that
|
|
48
|
+
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.
|
|
41
49
|
|
|
42
50
|

|
|
43
51
|
|
|
@@ -49,6 +57,8 @@ This project provides an MCP server that enables access to Hanzo APIs and Platfo
|
|
|
49
57
|
- **File Operations**: Manage files with proper security controls through shell commands
|
|
50
58
|
- **Code Discovery**: Find relevant files and code patterns across your project
|
|
51
59
|
- **Project Analysis**: Understand project structure, dependencies, and frameworks
|
|
60
|
+
- **Agent Delegation**: Delegate complex tasks to specialized sub-agents that can work concurrently
|
|
61
|
+
- **Multiple LLM Provider Support**: Configure any LiteLLM-compatible model for agent operations
|
|
52
62
|
- **Jupyter Notebook Support**: Read and edit Jupyter notebooks with full cell and output handling
|
|
53
63
|
|
|
54
64
|
## Tools Implemented
|
|
@@ -65,84 +75,27 @@ This project provides an MCP server that enables access to Hanzo APIs and Platfo
|
|
|
65
75
|
| `run_command` | Execute shell commands (also used for directory creation, file moving, and directory listing) |
|
|
66
76
|
| `run_script` | Execute scripts with specified interpreters |
|
|
67
77
|
| `script_tool` | Execute scripts in specific programming languages |
|
|
68
|
-
| `project_analyze_tool` | Analyze project structure and dependencies
|
|
69
|
-
| `read_notebook` | Extract and read source code from all cells in a Jupyter notebook with outputs
|
|
70
|
-
| `edit_notebook` | Edit, insert, or delete cells in a Jupyter notebook
|
|
78
|
+
| `project_analyze_tool` | Analyze project structure and dependencies |
|
|
79
|
+
| `read_notebook` | Extract and read source code from all cells in a Jupyter notebook with outputs |
|
|
80
|
+
| `edit_notebook` | Edit, insert, or delete cells in a Jupyter notebook |
|
|
71
81
|
| `think` | Structured space for complex reasoning and analysis without making changes |
|
|
82
|
+
| `dispatch_agent` | Launch one or more agents that can perform tasks using read-only tools concurrently |
|
|
72
83
|
|
|
73
84
|
## Getting Started
|
|
74
85
|
|
|
75
|
-
###
|
|
76
|
-
|
|
77
|
-
#### Configuring Claude Desktop
|
|
78
|
-
|
|
79
|
-
You can run it with `uvx run hanzo-mcp` without installation. Configure Claude Desktop to use this server by adding the following to your Claude Desktop configuration file:
|
|
80
|
-
|
|
81
|
-
```json
|
|
82
|
-
{
|
|
83
|
-
"mcpServers": {
|
|
84
|
-
"hanzo": {
|
|
85
|
-
"command": "uvx",
|
|
86
|
-
"args": [
|
|
87
|
-
"--from",
|
|
88
|
-
"hanzo-mcp",
|
|
89
|
-
"hanzo-mcp",
|
|
90
|
-
"--allow-path",
|
|
91
|
-
"/path/to/your/project"
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
Make sure to replace `/path/to/your/project` with the actual path to the project you want Claude to access.
|
|
99
|
-
|
|
100
|
-
#### Advanced Configuration Options
|
|
101
|
-
|
|
102
|
-
You can customize the server using other options:
|
|
103
|
-
|
|
104
|
-
```json
|
|
105
|
-
{
|
|
106
|
-
"mcpServers": {
|
|
107
|
-
"hanzo": {
|
|
108
|
-
"command": "uvx",
|
|
109
|
-
"args": [
|
|
110
|
-
"--from",
|
|
111
|
-
"hanzo-mcp",
|
|
112
|
-
"hanzo-mcp",
|
|
113
|
-
"--allow-path",
|
|
114
|
-
"/path/to/project",
|
|
115
|
-
"--name",
|
|
116
|
-
"custom-hanzo",
|
|
117
|
-
"--transport",
|
|
118
|
-
"stdio"
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Configuring Claude Desktop System Prompt
|
|
86
|
+
### Quick Install
|
|
126
87
|
|
|
127
|
-
|
|
88
|
+
```bash
|
|
89
|
+
# Install using uv
|
|
90
|
+
uv pip install hanzo-mcp
|
|
128
91
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
2. Open your Claude Desktop client
|
|
133
|
-
3. Create a new project or open an existing one
|
|
134
|
-
4. Navigate to the "Project instructions" section in the Claude Desktop sidebar
|
|
135
|
-
5. Copy the contents of `doc/system_prompt` and paste it into the "Project instructions" section
|
|
136
|
-
6. Replace `{project_path}` with the actual absolute path to your project
|
|
137
|
-
|
|
138
|
-
The system prompt provides Claude with:
|
|
92
|
+
# Or using pip
|
|
93
|
+
pip install hanzo-mcp
|
|
94
|
+
```
|
|
139
95
|
|
|
140
|
-
|
|
141
|
-
- Best practices for project exploration and analysis
|
|
142
|
-
- Guidelines for development, refactoring, and quality assurance
|
|
143
|
-
- Special formatting instructions for mathematical content
|
|
96
|
+
For detailed installation and configuration instructions, please refer to [INSTALL.md](./doc/INSTALL.md).
|
|
144
97
|
|
|
145
|
-
|
|
98
|
+
Of course, you can also read [USEFUL_PROMPTS](./doc/USEFUL_PROMPTS.md) for some inspiration on how to use hanzo-mcp.
|
|
146
99
|
|
|
147
100
|
## Security
|
|
148
101
|
|
|
@@ -155,6 +108,59 @@ This implementation follows best practices for securing access to your filesyste
|
|
|
155
108
|
|
|
156
109
|
## Development
|
|
157
110
|
|
|
111
|
+
### Setup Development Environment
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Clone the repository
|
|
115
|
+
git clone https://github.com/hanzoai/mcp.git
|
|
116
|
+
cd mcp
|
|
117
|
+
|
|
118
|
+
# Install Python 3.13 using uv
|
|
119
|
+
make install-python
|
|
120
|
+
|
|
121
|
+
# Setup virtual environment and install dependencies
|
|
122
|
+
make setup
|
|
123
|
+
|
|
124
|
+
# Or install with development dependencies
|
|
125
|
+
make install-dev
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Testing
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Run tests
|
|
132
|
+
make test
|
|
133
|
+
|
|
134
|
+
# Run tests with coverage
|
|
135
|
+
make test-cov
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Building and Publishing
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Build package
|
|
142
|
+
make build
|
|
143
|
+
|
|
144
|
+
# Version bumping
|
|
145
|
+
make bump-patch # Increment patch version (0.1.x → 0.1.x+1)
|
|
146
|
+
make bump-minor # Increment minor version (0.x.0 → 0.x+1.0)
|
|
147
|
+
make bump-major # Increment major version (x.0.0 → x+1.0.0)
|
|
148
|
+
|
|
149
|
+
# Publishing (creates git tag and pushes it to GitHub)
|
|
150
|
+
make publish # Publish using configured credentials in .pypirc
|
|
151
|
+
PYPI_TOKEN=your_token make publish # Publish with token from environment variable
|
|
152
|
+
|
|
153
|
+
# Version bump and publish in one step (with automatic git tagging)
|
|
154
|
+
make publish-patch # Bump patch version, publish, and create git tag
|
|
155
|
+
make publish-minor # Bump minor version, publish, and create git tag
|
|
156
|
+
make publish-major # Bump major version, publish, and create git tag
|
|
157
|
+
|
|
158
|
+
# Publish to Test PyPI
|
|
159
|
+
make publish-test
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Contributing
|
|
163
|
+
|
|
158
164
|
To contribute to this project:
|
|
159
165
|
|
|
160
166
|
1. Fork the repository
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
hanzo_mcp/__init__.py,sha256=Y5rIvHCEKCc1GKgt4XqjpEjZa91JOu3fSPnJZSBZJ70,89
|
|
2
|
+
hanzo_mcp/cli.py,sha256=G0Klg7RMK9XLehLT9ysWbpii0XRrECglUaxwvCekl7g,7201
|
|
3
|
+
hanzo_mcp/server.py,sha256=j2UagHTxwCbZrnhODbMUI0wdZ-7yLFxB9-ZbignZFzg,5671
|
|
4
|
+
hanzo_mcp/tools/__init__.py,sha256=3IHzhmSiAbxg2yvqVJn4SH6YP_DSnxYaNk9ccBtk7H0,3339
|
|
5
|
+
hanzo_mcp/tools/agent/__init__.py,sha256=0eyQqqdAy7WCZEqUfV6xh66bDpQI9neB6iDjWf0_pJI,2189
|
|
6
|
+
hanzo_mcp/tools/agent/agent_tool.py,sha256=qXu62ZRGM0o9mxOiRVFy-ABIZtEJ8z03DqAXshKAieI,19180
|
|
7
|
+
hanzo_mcp/tools/agent/prompt.py,sha256=jmYRI4Sm2D3LwEdC2qWakpqupgfGg8CT6grmx4NEDaA,4431
|
|
8
|
+
hanzo_mcp/tools/agent/tool_adapter.py,sha256=g9NKfIET0WOsm0r28xEXsibsprpI1C6ripcM6QwU-rI,2172
|
|
9
|
+
hanzo_mcp/tools/common/__init__.py,sha256=VS_eJP0oJGEgO78stwQWyer1heVfhhHihtt5sctjei8,809
|
|
10
|
+
hanzo_mcp/tools/common/base.py,sha256=O7Lgft0XiC9Iyi3fYsmoWWrvKDK2Aa-FJLxPgnNJRJY,7341
|
|
11
|
+
hanzo_mcp/tools/common/context.py,sha256=ReIfcm37j5qnLQ8G_-d88ad5uC1OKkjQZKG9HdJPybI,13145
|
|
12
|
+
hanzo_mcp/tools/common/permissions.py,sha256=4YCfA2PJUOl-z_47n5uaRXO8gAZ_shMaPhpi1dilgRE,7594
|
|
13
|
+
hanzo_mcp/tools/common/session.py,sha256=csX5ZhgBjO2bdXXXPpsUPzOCc7Tib-apYe01AP8sh8k,2774
|
|
14
|
+
hanzo_mcp/tools/common/thinking_tool.py,sha256=I-O6ipM-PUofkNoMMzv37Y_2Yfx9mh7F1upTTsfRN4M,4046
|
|
15
|
+
hanzo_mcp/tools/common/validation.py,sha256=gB3uM_cbPZsH4Ez0hnTgIcdP-AUlHZU02aRmZEpk_6I,3648
|
|
16
|
+
hanzo_mcp/tools/common/version_tool.py,sha256=q6JVEyz-uWVJtCU_WY3TxE6aSLwlkIm0__mv4ZK43eY,1979
|
|
17
|
+
hanzo_mcp/tools/filesystem/__init__.py,sha256=-wNhb0IjJgz05n_fRP0wDXfKgJ6fgBp4wrGo62Hpyvc,3265
|
|
18
|
+
hanzo_mcp/tools/filesystem/base.py,sha256=HAzuMCrS0dKOBZNoLr7y74tdbYyKpi0FGhStuRgkFTU,3917
|
|
19
|
+
hanzo_mcp/tools/filesystem/content_replace.py,sha256=ZwzxyOTASUmzP-jtEnsSR-MKtNFC4R3kQunpV3KOCyg,11049
|
|
20
|
+
hanzo_mcp/tools/filesystem/directory_tree.py,sha256=cx-zpOeKP8DDuMt1ls3QhRk9h3RVmMhpPwpqn4wTfP4,11271
|
|
21
|
+
hanzo_mcp/tools/filesystem/edit_file.py,sha256=03ku1_8X_uAUPfqGlR6fv55VEz-0Pifp9DJtkcOTFHY,10980
|
|
22
|
+
hanzo_mcp/tools/filesystem/get_file_info.py,sha256=WR7uMqFcpKboS3FX3jF-MD-0-ROJJcppX7M_GtR0yLs,5392
|
|
23
|
+
hanzo_mcp/tools/filesystem/read_files.py,sha256=0JYJ2kM8FIoksbnnO8V0uY3D2R1uWvR7zb7_oXV0sMM,6968
|
|
24
|
+
hanzo_mcp/tools/filesystem/search_content.py,sha256=2zXke1YHYxg6GKQ_XHb0sXeaSkHI7Jx3P-YAqrpOTNM,10766
|
|
25
|
+
hanzo_mcp/tools/filesystem/write_file.py,sha256=7ZNR1ygECBjT7m62QNkeIEt0OGxNZL2zijX-bASWj0Y,5303
|
|
26
|
+
hanzo_mcp/tools/jupyter/__init__.py,sha256=xFYW8Idb4x1jLWbexN5sqFKSCd1aL820uENzJ7mb6rs,2282
|
|
27
|
+
hanzo_mcp/tools/jupyter/base.py,sha256=xtssHrkHx_u_nE12dqtZGcvuJe8kfsbSkMmq-6KQobQ,10412
|
|
28
|
+
hanzo_mcp/tools/jupyter/edit_notebook.py,sha256=_ZNlsCYaO9_SbZouvrLYElvssL6nlElCc2JxNCeMdQo,11986
|
|
29
|
+
hanzo_mcp/tools/jupyter/notebook_operations.py,sha256=PkZXk_PYPkBGxg2RWzqh-rN6VDHjFybImhdUm3xLLoY,23120
|
|
30
|
+
hanzo_mcp/tools/jupyter/read_notebook.py,sha256=54-i9MIaUiZGJndUPp2_-edTo3_j9WSgxXXoTmRCnlI,5656
|
|
31
|
+
hanzo_mcp/tools/project/__init__.py,sha256=kMaSPyYT03qXqFL83nKdSz19-IzlrsVZTJk6YMgJOhw,2208
|
|
32
|
+
hanzo_mcp/tools/project/analysis.py,sha256=9LFX_diDv6yYcqnY7tJQog4Sp3ZPrtm7EopnYJ3SPZo,30554
|
|
33
|
+
hanzo_mcp/tools/project/base.py,sha256=CniLAsjum5vC3cgvF9AqU-_ZY_0Nf9uaF2L_xV2obxE,1948
|
|
34
|
+
hanzo_mcp/tools/project/project_analyze.py,sha256=6GLE_JcSiCy6kKdee0sMI5T2229A-Vpp98s2j_JD6yI,5711
|
|
35
|
+
hanzo_mcp/tools/shell/__init__.py,sha256=lKgh0WXds4tZJ1tIL9MJbyMSzP6A9uZQALjGGBvyYc4,1679
|
|
36
|
+
hanzo_mcp/tools/shell/base.py,sha256=OxKNWMp-fB-vozzWOE_hHvr5M_pFKSMIYfOX0dEOWzA,4836
|
|
37
|
+
hanzo_mcp/tools/shell/command_executor.py,sha256=5GcJvg54uty9fl_tkGdWTBcHyjxuynQZ_Tv6qOyKgdk,32616
|
|
38
|
+
hanzo_mcp/tools/shell/run_command.py,sha256=r7HBw0lqabgkGnVsDXmLnrTo0SU9g8gLvzpa-9n-cmM,6891
|
|
39
|
+
hanzo_mcp/tools/shell/run_script.py,sha256=CLYnDc0Ze8plkXU6d98RgE4UrBg-fwaMVdcn9Fc6Ixw,7432
|
|
40
|
+
hanzo_mcp/tools/shell/script_tool.py,sha256=s63tawIZBvwgm_kU9P7A3D4v2ulVw7j4l_rpsa_zGuc,8680
|
|
41
|
+
hanzo_mcp-0.1.32.dist-info/licenses/LICENSE,sha256=mf1qZGFsPGskoPgytp9B-RsahfKvXsBpmaAbTLGTt8Y,1063
|
|
42
|
+
hanzo_mcp-0.1.32.dist-info/METADATA,sha256=FvKaHStWB3J_-pMcwBGM0c21MxyQfvgMd4Ek3lQHjMg,7277
|
|
43
|
+
hanzo_mcp-0.1.32.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
44
|
+
hanzo_mcp-0.1.32.dist-info/entry_points.txt,sha256=aRKOKXtuQr-idSr-yH4efnRl2v8te94AcgN3ysqqSYs,49
|
|
45
|
+
hanzo_mcp-0.1.32.dist-info/top_level.txt,sha256=eGFANatA0MHWiVlpS56fTYRIShtibrSom1uXI6XU0GU,10
|
|
46
|
+
hanzo_mcp-0.1.32.dist-info/RECORD,,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2025
|
|
3
|
+
Copyright (c) 2025 hanzoai
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
18
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
"""Thinking tool for Hanzo MCP.
|
|
2
|
-
|
|
3
|
-
This module provides a tool for Claude to engage in structured thinking
|
|
4
|
-
when performing complex multi-step operations or reasoning through policies.
|
|
5
|
-
Following the pattern described in Anthropic's "Claude Think Tool" article.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
from typing import final
|
|
9
|
-
|
|
10
|
-
from mcp.server.fastmcp import Context as MCPContext
|
|
11
|
-
from mcp.server.fastmcp import FastMCP
|
|
12
|
-
|
|
13
|
-
from hanzo_mcp.tools.common.context import create_tool_context
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
@final
|
|
17
|
-
class ThinkingTool:
|
|
18
|
-
"""Think tool for Hanzo MCP.
|
|
19
|
-
|
|
20
|
-
This class provides a "think" tool that enables Claude to engage in more structured
|
|
21
|
-
thinking when processing complex information or making multi-step decisions.
|
|
22
|
-
"""
|
|
23
|
-
|
|
24
|
-
def __init__(self) -> None:
|
|
25
|
-
"""Initialize the thinking tool."""
|
|
26
|
-
pass
|
|
27
|
-
|
|
28
|
-
def register_tools(self, mcp_server: FastMCP) -> None:
|
|
29
|
-
"""Register thinking tools with the MCP server.
|
|
30
|
-
|
|
31
|
-
Args:
|
|
32
|
-
mcp_server: The FastMCP server instance
|
|
33
|
-
"""
|
|
34
|
-
|
|
35
|
-
@mcp_server.tool()
|
|
36
|
-
async def think(thought: str, ctx: MCPContext) -> str:
|
|
37
|
-
"""Use the tool to think about something.
|
|
38
|
-
|
|
39
|
-
It will not obtain new information or make any changes to the repository, but just log the thought. Use it when complex reasoning or brainstorming is needed. For example, if you explore the repo and discover the source of a bug, call this tool to brainstorm several unique ways of fixing the bug, and assess which change(s) are likely to be simplest and most effective. Alternatively, if you receive some test results, call this tool to brainstorm ways to fix the failing tests.
|
|
40
|
-
|
|
41
|
-
Args:
|
|
42
|
-
thought: Your thoughts or analysis
|
|
43
|
-
|
|
44
|
-
Returns:
|
|
45
|
-
Confirmation that the thinking process has been recorded
|
|
46
|
-
"""
|
|
47
|
-
tool_ctx = create_tool_context(ctx)
|
|
48
|
-
tool_ctx.set_tool_info("think")
|
|
49
|
-
|
|
50
|
-
# Validate required thought parameter
|
|
51
|
-
if not thought:
|
|
52
|
-
await tool_ctx.error(
|
|
53
|
-
"Parameter 'thought' is required but was None or empty"
|
|
54
|
-
)
|
|
55
|
-
return "Error: Parameter 'thought' is required but was None or empty"
|
|
56
|
-
|
|
57
|
-
if thought.strip() == "":
|
|
58
|
-
await tool_ctx.error("Parameter 'thought' cannot be empty")
|
|
59
|
-
return "Error: Parameter 'thought' cannot be empty"
|
|
60
|
-
|
|
61
|
-
# Log the thought but don't take action
|
|
62
|
-
await tool_ctx.info("Thinking process recorded")
|
|
63
|
-
|
|
64
|
-
# Return confirmation
|
|
65
|
-
return "I've recorded your thinking process. You can continue with your next action based on this analysis."
|