hanzo-mcp 0.1.21__tar.gz → 0.1.30__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.

Files changed (63) hide show
  1. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/LICENSE +2 -2
  2. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/PKG-INFO +72 -77
  3. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/README.md +59 -72
  4. hanzo_mcp-0.1.30/hanzo_mcp/__init__.py +3 -0
  5. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp/cli.py +81 -10
  6. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp/server.py +42 -11
  7. hanzo_mcp-0.1.30/hanzo_mcp/tools/__init__.py +81 -0
  8. hanzo_mcp-0.1.30/hanzo_mcp/tools/agent/__init__.py +59 -0
  9. hanzo_mcp-0.1.30/hanzo_mcp/tools/agent/agent_tool.py +474 -0
  10. hanzo_mcp-0.1.30/hanzo_mcp/tools/agent/prompt.py +137 -0
  11. hanzo_mcp-0.1.30/hanzo_mcp/tools/agent/tool_adapter.py +75 -0
  12. hanzo_mcp-0.1.30/hanzo_mcp/tools/common/__init__.py +18 -0
  13. hanzo_mcp-0.1.30/hanzo_mcp/tools/common/base.py +216 -0
  14. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp/tools/common/context.py +9 -5
  15. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp/tools/common/permissions.py +7 -3
  16. hanzo_mcp-0.1.30/hanzo_mcp/tools/common/session.py +91 -0
  17. hanzo_mcp-0.1.30/hanzo_mcp/tools/common/thinking_tool.py +123 -0
  18. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp/tools/common/validation.py +1 -1
  19. hanzo_mcp-0.1.30/hanzo_mcp/tools/filesystem/__init__.py +89 -0
  20. hanzo_mcp-0.1.30/hanzo_mcp/tools/filesystem/base.py +113 -0
  21. hanzo_mcp-0.1.30/hanzo_mcp/tools/filesystem/content_replace.py +287 -0
  22. hanzo_mcp-0.1.30/hanzo_mcp/tools/filesystem/directory_tree.py +286 -0
  23. hanzo_mcp-0.1.30/hanzo_mcp/tools/filesystem/edit_file.py +287 -0
  24. hanzo_mcp-0.1.30/hanzo_mcp/tools/filesystem/get_file_info.py +170 -0
  25. hanzo_mcp-0.1.30/hanzo_mcp/tools/filesystem/read_files.py +198 -0
  26. hanzo_mcp-0.1.30/hanzo_mcp/tools/filesystem/search_content.py +275 -0
  27. hanzo_mcp-0.1.30/hanzo_mcp/tools/filesystem/write_file.py +162 -0
  28. hanzo_mcp-0.1.30/hanzo_mcp/tools/jupyter/__init__.py +71 -0
  29. hanzo_mcp-0.1.30/hanzo_mcp/tools/jupyter/base.py +284 -0
  30. hanzo_mcp-0.1.30/hanzo_mcp/tools/jupyter/edit_notebook.py +295 -0
  31. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp/tools/jupyter/notebook_operations.py +73 -113
  32. hanzo_mcp-0.1.30/hanzo_mcp/tools/jupyter/read_notebook.py +165 -0
  33. hanzo_mcp-0.1.30/hanzo_mcp/tools/project/__init__.py +64 -0
  34. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp/tools/project/analysis.py +8 -5
  35. hanzo_mcp-0.1.30/hanzo_mcp/tools/project/base.py +66 -0
  36. hanzo_mcp-0.1.30/hanzo_mcp/tools/project/project_analyze.py +173 -0
  37. hanzo_mcp-0.1.30/hanzo_mcp/tools/shell/__init__.py +58 -0
  38. hanzo_mcp-0.1.30/hanzo_mcp/tools/shell/base.py +148 -0
  39. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp/tools/shell/command_executor.py +198 -317
  40. hanzo_mcp-0.1.30/hanzo_mcp/tools/shell/run_command.py +204 -0
  41. hanzo_mcp-0.1.30/hanzo_mcp/tools/shell/run_script.py +215 -0
  42. hanzo_mcp-0.1.30/hanzo_mcp/tools/shell/script_tool.py +244 -0
  43. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp.egg-info/PKG-INFO +72 -77
  44. hanzo_mcp-0.1.30/hanzo_mcp.egg-info/SOURCES.txt +51 -0
  45. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp.egg-info/requires.txt +7 -2
  46. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/pyproject.toml +18 -4
  47. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/tests/test_cli.py +31 -5
  48. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/tests/test_server.py +12 -13
  49. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/tests/test_validation.py +1 -1
  50. hanzo_mcp-0.1.21/hanzo_mcp/__init__.py +0 -3
  51. hanzo_mcp-0.1.21/hanzo_mcp/tools/__init__.py +0 -62
  52. hanzo_mcp-0.1.21/hanzo_mcp/tools/common/__init__.py +0 -1
  53. hanzo_mcp-0.1.21/hanzo_mcp/tools/common/thinking.py +0 -65
  54. hanzo_mcp-0.1.21/hanzo_mcp/tools/filesystem/__init__.py +0 -9
  55. hanzo_mcp-0.1.21/hanzo_mcp/tools/filesystem/file_operations.py +0 -1050
  56. hanzo_mcp-0.1.21/hanzo_mcp/tools/jupyter/__init__.py +0 -8
  57. hanzo_mcp-0.1.21/hanzo_mcp/tools/project/__init__.py +0 -1
  58. hanzo_mcp-0.1.21/hanzo_mcp/tools/shell/__init__.py +0 -1
  59. hanzo_mcp-0.1.21/hanzo_mcp.egg-info/SOURCES.txt +0 -29
  60. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp.egg-info/dependency_links.txt +0 -0
  61. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp.egg-info/entry_points.txt +0 -0
  62. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/hanzo_mcp.egg-info/top_level.txt +0 -0
  63. {hanzo_mcp-0.1.21 → hanzo_mcp-0.1.30}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Hanzo Industries Inc
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,9 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: hanzo-mcp
3
- Version: 0.1.21
4
- Summary: MCP server for accessing Hanzo APIs and Platform capabilities
5
- Author-email: Hanzo Dev <dev@hanzo.ai>
3
+ Version: 0.1.30
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: mcp
17
- Requires-Dist: pytest
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
- Hanzo AI + Platform capabilities via the Model Context Protocol (MCP).
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 enables access to Hanzo APIs and Platform capabilities, as well as providing development tools for managing and improving projects. By leveraging the Model Context Protocol, this server enables seamless integration with various MCP clients including Claude Desktop, allowing LLMs to directly access Hanzo's platform functionality.
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
  ![example](./doc/example.gif)
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
- ### Usage
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
126
-
127
- To get the best experience with Hanzo MCP, you need to add the provided system prompt to your Claude Desktop client. This system prompt guides Claude through a structured workflow for interacting with Hanzo platform services and managing project files.
128
-
129
- Follow these steps:
86
+ ### Quick Install
130
87
 
131
- 1. Locate the system prompt file in this repository at `doc/system_prompt`
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
88
+ ```bash
89
+ # Install using uv
90
+ uv pip install hanzo-mcp
137
91
 
138
- The system prompt provides Claude with:
92
+ # Or using pip
93
+ pip install hanzo-mcp
94
+ ```
139
95
 
140
- - A structured workflow for analyzing and modifying code
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
- This step is crucial as it enables Claude to follow a consistent approach when helping you with code modifications.
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,48 @@ 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
+ # Publish to PyPI
145
+ make publish
146
+
147
+ # Publish to Test PyPI
148
+ make publish-test
149
+ ```
150
+
151
+ ### Contributing
152
+
158
153
  To contribute to this project:
159
154
 
160
155
  1. Fork the repository
@@ -1,10 +1,10 @@
1
1
  # Hanzo MCP
2
2
 
3
- Hanzo AI + Platform capabilities via the Model Context Protocol (MCP).
3
+ An implementation of Hanzo capabilities using the Model Context Protocol (MCP).
4
4
 
5
5
  ## Overview
6
6
 
7
- This project provides an MCP server that enables access to Hanzo APIs and Platform capabilities, as well as providing development tools for managing and improving projects. By leveraging the Model Context Protocol, this server enables seamless integration with various MCP clients including Claude Desktop, allowing LLMs to directly access Hanzo's platform functionality.
7
+ 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.
8
8
 
9
9
  ![example](./doc/example.gif)
10
10
 
@@ -16,6 +16,8 @@ This project provides an MCP server that enables access to Hanzo APIs and Platfo
16
16
  - **File Operations**: Manage files with proper security controls through shell commands
17
17
  - **Code Discovery**: Find relevant files and code patterns across your project
18
18
  - **Project Analysis**: Understand project structure, dependencies, and frameworks
19
+ - **Agent Delegation**: Delegate complex tasks to specialized sub-agents that can work concurrently
20
+ - **Multiple LLM Provider Support**: Configure any LiteLLM-compatible model for agent operations
19
21
  - **Jupyter Notebook Support**: Read and edit Jupyter notebooks with full cell and output handling
20
22
 
21
23
  ## Tools Implemented
@@ -32,84 +34,27 @@ This project provides an MCP server that enables access to Hanzo APIs and Platfo
32
34
  | `run_command` | Execute shell commands (also used for directory creation, file moving, and directory listing) |
33
35
  | `run_script` | Execute scripts with specified interpreters |
34
36
  | `script_tool` | Execute scripts in specific programming languages |
35
- | `project_analyze_tool` | Analyze project structure and dependencies |
36
- | `read_notebook` | Extract and read source code from all cells in a Jupyter notebook with outputs |
37
- | `edit_notebook` | Edit, insert, or delete cells in a Jupyter notebook |
37
+ | `project_analyze_tool` | Analyze project structure and dependencies |
38
+ | `read_notebook` | Extract and read source code from all cells in a Jupyter notebook with outputs |
39
+ | `edit_notebook` | Edit, insert, or delete cells in a Jupyter notebook |
38
40
  | `think` | Structured space for complex reasoning and analysis without making changes |
41
+ | `dispatch_agent` | Launch one or more agents that can perform tasks using read-only tools concurrently |
39
42
 
40
43
  ## Getting Started
41
44
 
42
- ### Usage
43
-
44
- #### Configuring Claude Desktop
45
-
46
- 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:
47
-
48
- ```json
49
- {
50
- "mcpServers": {
51
- "hanzo": {
52
- "command": "uvx",
53
- "args": [
54
- "--from",
55
- "hanzo-mcp",
56
- "hanzo-mcp",
57
- "--allow-path",
58
- "/path/to/your/project"
59
- ]
60
- }
61
- }
62
- }
63
- ```
64
-
65
- Make sure to replace `/path/to/your/project` with the actual path to the project you want Claude to access.
66
-
67
- #### Advanced Configuration Options
68
-
69
- You can customize the server using other options:
70
-
71
- ```json
72
- {
73
- "mcpServers": {
74
- "hanzo": {
75
- "command": "uvx",
76
- "args": [
77
- "--from",
78
- "hanzo-mcp",
79
- "hanzo-mcp",
80
- "--allow-path",
81
- "/path/to/project",
82
- "--name",
83
- "custom-hanzo",
84
- "--transport",
85
- "stdio"
86
- ]
87
- }
88
- }
89
- }
90
- ```
91
-
92
- ### Configuring Claude Desktop System Prompt
93
-
94
- To get the best experience with Hanzo MCP, you need to add the provided system prompt to your Claude Desktop client. This system prompt guides Claude through a structured workflow for interacting with Hanzo platform services and managing project files.
95
-
96
- Follow these steps:
45
+ ### Quick Install
97
46
 
98
- 1. Locate the system prompt file in this repository at `doc/system_prompt`
99
- 2. Open your Claude Desktop client
100
- 3. Create a new project or open an existing one
101
- 4. Navigate to the "Project instructions" section in the Claude Desktop sidebar
102
- 5. Copy the contents of `doc/system_prompt` and paste it into the "Project instructions" section
103
- 6. Replace `{project_path}` with the actual absolute path to your project
47
+ ```bash
48
+ # Install using uv
49
+ uv pip install hanzo-mcp
104
50
 
105
- The system prompt provides Claude with:
51
+ # Or using pip
52
+ pip install hanzo-mcp
53
+ ```
106
54
 
107
- - A structured workflow for analyzing and modifying code
108
- - Best practices for project exploration and analysis
109
- - Guidelines for development, refactoring, and quality assurance
110
- - Special formatting instructions for mathematical content
55
+ For detailed installation and configuration instructions, please refer to [INSTALL.md](./doc/INSTALL.md).
111
56
 
112
- This step is crucial as it enables Claude to follow a consistent approach when helping you with code modifications.
57
+ Of course, you can also read [USEFUL_PROMPTS](./doc/USEFUL_PROMPTS.md) for some inspiration on how to use hanzo-mcp.
113
58
 
114
59
  ## Security
115
60
 
@@ -122,6 +67,48 @@ This implementation follows best practices for securing access to your filesyste
122
67
 
123
68
  ## Development
124
69
 
70
+ ### Setup Development Environment
71
+
72
+ ```bash
73
+ # Clone the repository
74
+ git clone https://github.com/hanzoai/mcp.git
75
+ cd mcp
76
+
77
+ # Install Python 3.13 using uv
78
+ make install-python
79
+
80
+ # Setup virtual environment and install dependencies
81
+ make setup
82
+
83
+ # Or install with development dependencies
84
+ make install-dev
85
+ ```
86
+
87
+ ### Testing
88
+
89
+ ```bash
90
+ # Run tests
91
+ make test
92
+
93
+ # Run tests with coverage
94
+ make test-cov
95
+ ```
96
+
97
+ ### Building and Publishing
98
+
99
+ ```bash
100
+ # Build package
101
+ make build
102
+
103
+ # Publish to PyPI
104
+ make publish
105
+
106
+ # Publish to Test PyPI
107
+ make publish-test
108
+ ```
109
+
110
+ ### Contributing
111
+
125
112
  To contribute to this project:
126
113
 
127
114
  1. Fork the repository
@@ -0,0 +1,3 @@
1
+ """Hanzo MCP - Implementation of Hanzo capabilities using MCP."""
2
+
3
+ __version__ = "0.1.8"
@@ -7,13 +7,13 @@ import sys
7
7
  from pathlib import Path
8
8
  from typing import Any, cast
9
9
 
10
- from hanzo_mcp.server import HanzoDevServer
10
+ from hanzo_mcp.server import HanzoServer
11
11
 
12
12
 
13
13
  def main() -> None:
14
- """Run the CLI for the Hanzo Dev MCP server."""
14
+ """Run the CLI for the Hanzo MCP server."""
15
15
  parser = argparse.ArgumentParser(
16
- description="MCP server for accessing Hanzo APIs and Platform capabilities"
16
+ description="MCP server implementing Hanzo capabilities"
17
17
  )
18
18
 
19
19
  _ = parser.add_argument(
@@ -25,20 +25,63 @@ def main() -> None:
25
25
 
26
26
  _ = parser.add_argument(
27
27
  "--name",
28
- default="hanzo",
29
- help="Name of the MCP server (default: hanzo)",
28
+ default="claude-code",
29
+ help="Name of the MCP server (default: claude-code)",
30
30
  )
31
31
 
32
32
  _ = parser.add_argument(
33
33
  "--allow-path",
34
34
  action="append",
35
35
  dest="allowed_paths",
36
- help="Add an allowed path (can be specified multiple times)",
36
+ help="Add an allowed path (can be specified multiple times, defaults to user's home directory)",
37
37
  )
38
38
 
39
39
  _ = parser.add_argument(
40
40
  "--project-dir", dest="project_dir", help="Set the project directory to analyze"
41
41
  )
42
+
43
+ _ = parser.add_argument(
44
+ "--agent-model",
45
+ dest="agent_model",
46
+ help="Specify the model name in LiteLLM format (e.g., 'openai/gpt-4o', 'anthropic/claude-3-sonnet')"
47
+ )
48
+
49
+ _ = parser.add_argument(
50
+ "--agent-max-tokens",
51
+ dest="agent_max_tokens",
52
+ type=int,
53
+ help="Specify the maximum tokens for agent responses"
54
+ )
55
+
56
+ _ = parser.add_argument(
57
+ "--agent-api-key",
58
+ dest="agent_api_key",
59
+ help="Specify the API key for the LLM provider (for development/testing only)"
60
+ )
61
+
62
+ _ = parser.add_argument(
63
+ "--agent-max-iterations",
64
+ dest="agent_max_iterations",
65
+ type=int,
66
+ default=10,
67
+ help="Maximum number of iterations for agent (default: 10)"
68
+ )
69
+
70
+ _ = parser.add_argument(
71
+ "--agent-max-tool-uses",
72
+ dest="agent_max_tool_uses",
73
+ type=int,
74
+ default=30,
75
+ help="Maximum number of total tool uses for agent (default: 30)"
76
+ )
77
+
78
+ _ = parser.add_argument(
79
+ "--enable-agent-tool",
80
+ dest="enable_agent_tool",
81
+ action="store_true",
82
+ default=False,
83
+ help="Enable the agent tool (disabled by default)"
84
+ )
42
85
 
43
86
  _ = parser.add_argument(
44
87
  "--install",
@@ -53,6 +96,12 @@ def main() -> None:
53
96
  install: bool = cast(bool, args.install)
54
97
  transport: str = cast(str, args.transport)
55
98
  project_dir: str | None = cast(str | None, args.project_dir)
99
+ agent_model: str | None = cast(str | None, args.agent_model)
100
+ agent_max_tokens: int | None = cast(int | None, args.agent_max_tokens)
101
+ agent_api_key: str | None = cast(str | None, args.agent_api_key)
102
+ agent_max_iterations: int = cast(int, args.agent_max_iterations)
103
+ agent_max_tool_uses: int = cast(int, args.agent_max_tool_uses)
104
+ enable_agent_tool: bool = cast(bool, args.enable_agent_tool)
56
105
  allowed_paths: list[str] = (
57
106
  cast(list[str], args.allowed_paths) if args.allowed_paths else []
58
107
  )
@@ -61,22 +110,44 @@ def main() -> None:
61
110
  install_claude_desktop_config(name, allowed_paths)
62
111
  return
63
112
 
64
- # If no allowed paths are specified, use the current directory
113
+ # If no allowed paths are specified, use the user's home directory
65
114
  if not allowed_paths:
66
- allowed_paths = [os.getcwd()]
115
+ allowed_paths = [str(Path.home())]
67
116
 
68
117
  # If project directory is specified, add it to allowed paths
69
118
  if project_dir and project_dir not in allowed_paths:
70
119
  allowed_paths.append(project_dir)
71
120
 
121
+ # Set project directory as initial working directory if provided
122
+ if project_dir:
123
+ # Expand user paths
124
+ project_dir = os.path.expanduser(project_dir)
125
+ # Make absolute
126
+ if not os.path.isabs(project_dir):
127
+ project_dir = os.path.abspath(project_dir)
128
+
129
+ # If no specific project directory, use the first allowed path
130
+ elif allowed_paths:
131
+ project_dir = allowed_paths[0]
132
+
72
133
  # Run the server
73
- server = HanzoDevServer(name=name, allowed_paths=allowed_paths)
134
+ server = HanzoServer(
135
+ name=name,
136
+ allowed_paths=allowed_paths,
137
+ project_dir=project_dir, # Pass project_dir for initial working directory
138
+ agent_model=agent_model,
139
+ agent_max_tokens=agent_max_tokens,
140
+ agent_api_key=agent_api_key,
141
+ agent_max_iterations=agent_max_iterations,
142
+ agent_max_tool_uses=agent_max_tool_uses,
143
+ enable_agent_tool=enable_agent_tool
144
+ )
74
145
  # Transport will be automatically cast to Literal['stdio', 'sse'] by the server
75
146
  server.run(transport=transport)
76
147
 
77
148
 
78
149
  def install_claude_desktop_config(
79
- name: str = "hanzo", allowed_paths: list[str] | None = None
150
+ name: str = "claude-code", allowed_paths: list[str] | None = None
80
151
  ) -> None:
81
152
  """Install the server configuration in Claude Desktop.
82
153
 
@@ -1,4 +1,4 @@
1
- """MCP server for accessing Hanzo APIs and Platform capabilities."""
1
+ """MCP server implementing Hanzo capabilities."""
2
2
 
3
3
  from typing import Literal, cast, final
4
4
 
@@ -12,21 +12,35 @@ from hanzo_mcp.tools.shell.command_executor import CommandExecutor
12
12
 
13
13
 
14
14
  @final
15
- class HanzoDevServer:
16
- """MCP server for accessing Hanzo APIs and Platform capabilities."""
15
+ class HanzoServer:
16
+ """MCP server implementing Hanzo capabilities."""
17
17
 
18
18
  def __init__(
19
19
  self,
20
- name: str = "hanzo",
20
+ name: str = "claude-code",
21
21
  allowed_paths: list[str] | None = None,
22
+ project_dir: str | None = None,
22
23
  mcp_instance: FastMCP | None = None,
24
+ agent_model: str | None = None,
25
+ agent_max_tokens: int | None = None,
26
+ agent_api_key: str | None = None,
27
+ agent_max_iterations: int = 10,
28
+ agent_max_tool_uses: int = 30,
29
+ enable_agent_tool: bool = False,
23
30
  ):
24
- """Initialize the Hanzo Dev server.
31
+ """Initialize the Hanzo server.
25
32
 
26
33
  Args:
27
34
  name: The name of the server
28
35
  allowed_paths: list of paths that the server is allowed to access
36
+ project_dir: Optional project directory to use as initial working directory
29
37
  mcp_instance: Optional FastMCP instance for testing
38
+ agent_model: Optional model name for agent tool in LiteLLM format
39
+ agent_max_tokens: Optional maximum tokens for agent responses
40
+ agent_api_key: Optional API key for the LLM provider
41
+ agent_max_iterations: Maximum number of iterations for agent (default: 10)
42
+ agent_max_tool_uses: Maximum number of total tool uses for agent (default: 30)
43
+ enable_agent_tool: Whether to enable the agent tool (default: False)
30
44
  """
31
45
  self.mcp = mcp_instance if mcp_instance is not None else FastMCP(name)
32
46
 
@@ -39,6 +53,11 @@ class HanzoDevServer:
39
53
  permission_manager=self.permission_manager,
40
54
  verbose=False, # Set to True for debugging
41
55
  )
56
+
57
+ # If project_dir is specified, set it as initial working directory for all sessions
58
+ if project_dir:
59
+ initial_session_id = name # Use server name as default session ID
60
+ self.command_executor.set_working_dir(initial_session_id, project_dir)
42
61
 
43
62
  # Initialize project analyzer
44
63
  self.project_analyzer = ProjectAnalyzer(self.command_executor)
@@ -54,13 +73,25 @@ class HanzoDevServer:
54
73
  self.permission_manager.add_allowed_path(path)
55
74
  self.document_context.add_allowed_path(path)
56
75
 
76
+ # Store agent options
77
+ self.agent_model = agent_model
78
+ self.agent_max_tokens = agent_max_tokens
79
+ self.agent_api_key = agent_api_key
80
+ self.agent_max_iterations = agent_max_iterations
81
+ self.agent_max_tool_uses = agent_max_tool_uses
82
+ self.enable_agent_tool = enable_agent_tool
83
+
57
84
  # Register all tools
58
85
  register_all_tools(
59
86
  mcp_server=self.mcp,
60
87
  document_context=self.document_context,
61
88
  permission_manager=self.permission_manager,
62
- project_manager=self.project_manager,
63
- project_analyzer=self.project_analyzer,
89
+ agent_model=self.agent_model,
90
+ agent_max_tokens=self.agent_max_tokens,
91
+ agent_api_key=self.agent_api_key,
92
+ agent_max_iterations=self.agent_max_iterations,
93
+ agent_max_tool_uses=self.agent_max_tool_uses,
94
+ enable_agent_tool=self.enable_agent_tool,
64
95
  )
65
96
 
66
97
  def run(self, transport: str = "stdio", allowed_paths: list[str] | None = None):
@@ -86,13 +117,13 @@ def main():
86
117
  import argparse
87
118
 
88
119
  parser = argparse.ArgumentParser(
89
- description="MCP server for accessing Hanzo APIs and Platform capabilities"
120
+ description="MCP server implementing Hanzo capabilities"
90
121
  )
91
122
 
92
123
  _ = parser.add_argument(
93
124
  "--name",
94
- default="hanzo",
95
- help="Name of the MCP server (default: hanzo)",
125
+ default="claude-code",
126
+ help="Name of the MCP server (default: claude-code)",
96
127
  )
97
128
 
98
129
  _ = parser.add_argument(
@@ -117,7 +148,7 @@ def main():
117
148
  allowed_paths: list[str] | None = args.allowed_paths
118
149
 
119
150
  # Create and run the server
120
- server = HanzoDevServer(name=name, allowed_paths=allowed_paths)
151
+ server = HanzoServer(name=name, allowed_paths=allowed_paths)
121
152
  server.run(transport=transport, allowed_paths=allowed_paths or [])
122
153
 
123
154