cli-mcp-server 0.1.1__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.
@@ -0,0 +1,233 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: cli-mcp-server
|
3
|
+
Version: 0.1.1
|
4
|
+
Summary: Command line interface for MCP clients with secure execution and customizable security policies
|
5
|
+
Project-URL: Homepage, https://github.com/MladenSU/cli-mcp-server
|
6
|
+
Project-URL: Documentation, https://github.com/MladenSU/cli-mcp-server#readme
|
7
|
+
Project-URL: Repository, https://github.com/MladenSU/cli-mcp-server.git
|
8
|
+
Project-URL: Bug Tracker, https://github.com/MladenSU/cli-mcp-server/issues
|
9
|
+
Author-email: Mladen <fangs-lever6n@icloud.com>
|
10
|
+
License: MIT
|
11
|
+
Keywords: cli,command-line,console,execute,mcp,security,terminal
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
13
|
+
Classifier: Intended Audience :: Developers
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
21
|
+
Requires-Python: >=3.10
|
22
|
+
Requires-Dist: mcp>=1.0.0
|
23
|
+
Description-Content-Type: text/markdown
|
24
|
+
|
25
|
+
# CLI MCP Server
|
26
|
+
|
27
|
+
---
|
28
|
+
|
29
|
+
A secure Model Context Protocol (MCP) server implementation for executing controlled command-line operations with
|
30
|
+
comprehensive security
|
31
|
+
features.
|
32
|
+
|
33
|
+

|
34
|
+

|
35
|
+

|
36
|
+
|
37
|
+
---
|
38
|
+
|
39
|
+
# Table of Contents
|
40
|
+
|
41
|
+
1. [Overview](#overview)
|
42
|
+
2. [Features](#features)
|
43
|
+
3. [Configuration](#configuration)
|
44
|
+
4. [Available Tools](#available-tools)
|
45
|
+
- [run_command](#run_command)
|
46
|
+
- [show_security_rules](#show_security_rules)
|
47
|
+
5. [Usage with Claude Desktop](#usage-with-claude-desktop)
|
48
|
+
- [Development/Unpublished Servers Configuration](#developmentunpublished-servers-configuration)
|
49
|
+
- [Published Servers Configuration](#published-servers-configuration)
|
50
|
+
6. [Security Features](#security-features)
|
51
|
+
7. [Error Handling](#error-handling)
|
52
|
+
8. [Development](#development)
|
53
|
+
- [Prerequisites](#prerequisites)
|
54
|
+
- [Building and Publishing](#building-and-publishing)
|
55
|
+
- [Debugging](#debugging)
|
56
|
+
9. [License](#license)
|
57
|
+
|
58
|
+
---
|
59
|
+
|
60
|
+
## Overview
|
61
|
+
|
62
|
+
This MCP server enables secure command-line execution with robust security measures including command whitelisting, path
|
63
|
+
validation, and
|
64
|
+
execution controls. Perfect for providing controlled CLI access to LLM applications while maintaining security.
|
65
|
+
|
66
|
+
## Features
|
67
|
+
|
68
|
+
- 🔒 Secure command execution with strict validation
|
69
|
+
- ⚙️ Configurable command and flag whitelisting
|
70
|
+
- 🛡️ Path traversal prevention
|
71
|
+
- 🚫 Shell operator injection protection
|
72
|
+
- ⏱️ Execution timeouts and length limits
|
73
|
+
- 📝 Detailed error reporting
|
74
|
+
- 🔄 Async operation support
|
75
|
+
|
76
|
+
## Configuration
|
77
|
+
|
78
|
+
Configure the server using environment variables:
|
79
|
+
|
80
|
+
| Variable | Description | Default |
|
81
|
+
|----------------------|------------------------------------------|--------------------|
|
82
|
+
| `ALLOWED_DIR` | Base directory for command execution | Required |
|
83
|
+
| `ALLOWED_COMMANDS` | Comma-separated list of allowed commands | `ls,cat,pwd` |
|
84
|
+
| `ALLOWED_FLAGS` | Comma-separated list of allowed flags | `-l,-a,--help` |
|
85
|
+
| `ALLOWED_PATTERNS` | Comma-separated file patterns | `*.txt,*.log,*.md` |
|
86
|
+
| `MAX_COMMAND_LENGTH` | Maximum command string length | `1024` |
|
87
|
+
| `COMMAND_TIMEOUT` | Command execution timeout (seconds) | `30` |
|
88
|
+
|
89
|
+
## Available Tools
|
90
|
+
|
91
|
+
### run_command
|
92
|
+
|
93
|
+
Executes whitelisted CLI commands within allowed directories.
|
94
|
+
|
95
|
+
**Input Schema:**
|
96
|
+
|
97
|
+
```json
|
98
|
+
{
|
99
|
+
"command": {
|
100
|
+
"type": "string",
|
101
|
+
"description": "Command to execute (e.g., 'ls -l' or 'cat file.txt')"
|
102
|
+
}
|
103
|
+
}
|
104
|
+
```
|
105
|
+
|
106
|
+
### show_security_rules
|
107
|
+
|
108
|
+
Displays current security configuration and restrictions.
|
109
|
+
|
110
|
+
## Usage with Claude Desktop
|
111
|
+
|
112
|
+
Add to your `~/Library/Application\ Support/Claude/claude_desktop_config.json`:
|
113
|
+
|
114
|
+
> Development/Unpublished Servers Configuration
|
115
|
+
|
116
|
+
```json
|
117
|
+
{
|
118
|
+
"mcpServers": {
|
119
|
+
"cli-mcp-server": {
|
120
|
+
"command": "uv",
|
121
|
+
"args": [
|
122
|
+
"--directory",
|
123
|
+
"<path/to/the/repo>/cli-mcp-server",
|
124
|
+
"run",
|
125
|
+
"cli-mcp-server"
|
126
|
+
],
|
127
|
+
"env": {
|
128
|
+
"ALLOWED_DIR": "</your/desired/dir>",
|
129
|
+
"ALLOWED_COMMANDS": "ls,cat,pwd,echo",
|
130
|
+
"ALLOWED_FLAGS": "-l,-a,--help,--version",
|
131
|
+
"ALLOWED_PATTERNS": "*.txt,*.log,*.md",
|
132
|
+
"MAX_COMMAND_LENGTH": "1024",
|
133
|
+
"COMMAND_TIMEOUT": "30"
|
134
|
+
}
|
135
|
+
}
|
136
|
+
}
|
137
|
+
}
|
138
|
+
```
|
139
|
+
|
140
|
+
> Published Servers Configuration
|
141
|
+
|
142
|
+
```json
|
143
|
+
{
|
144
|
+
"mcpServers": {
|
145
|
+
"cli-mcp-server": {
|
146
|
+
"command": "uvx",
|
147
|
+
"args": [
|
148
|
+
"cli-mcp-server"
|
149
|
+
],
|
150
|
+
"env": {
|
151
|
+
"ALLOWED_DIR": "</your/desired/dir>",
|
152
|
+
"ALLOWED_COMMANDS": "ls,cat,pwd,echo",
|
153
|
+
"ALLOWED_FLAGS": "-l,-a,--help,--version",
|
154
|
+
"ALLOWED_PATTERNS": "*.txt,*.log,*.md",
|
155
|
+
"MAX_COMMAND_LENGTH": "1024",
|
156
|
+
"COMMAND_TIMEOUT": "30"
|
157
|
+
}
|
158
|
+
}
|
159
|
+
}
|
160
|
+
}
|
161
|
+
```
|
162
|
+
|
163
|
+
## Security Features
|
164
|
+
|
165
|
+
- ✅ Command whitelist enforcement
|
166
|
+
- ✅ Flag validation
|
167
|
+
- ✅ Path traversal prevention
|
168
|
+
- ✅ Shell operator blocking
|
169
|
+
- ✅ Command length limits
|
170
|
+
- ✅ Execution timeouts
|
171
|
+
- ✅ Working directory restrictions
|
172
|
+
|
173
|
+
## Error Handling
|
174
|
+
|
175
|
+
The server provides detailed error messages for:
|
176
|
+
|
177
|
+
- Security violations
|
178
|
+
- Command timeouts
|
179
|
+
- Invalid command formats
|
180
|
+
- Path security violations
|
181
|
+
- Execution failures
|
182
|
+
|
183
|
+
## Development
|
184
|
+
|
185
|
+
### Prerequisites
|
186
|
+
|
187
|
+
- Python 3.10+
|
188
|
+
- MCP protocol library
|
189
|
+
|
190
|
+
## Development
|
191
|
+
|
192
|
+
### Building and Publishing
|
193
|
+
|
194
|
+
To prepare the package for distribution:
|
195
|
+
|
196
|
+
1. Sync dependencies and update lockfile:
|
197
|
+
```bash
|
198
|
+
uv sync
|
199
|
+
```
|
200
|
+
|
201
|
+
2. Build package distributions:
|
202
|
+
```bash
|
203
|
+
uv build
|
204
|
+
```
|
205
|
+
|
206
|
+
> This will create source and wheel distributions in the `dist/` directory.
|
207
|
+
|
208
|
+
3. Publish to PyPI:
|
209
|
+
```bash
|
210
|
+
uv publish --token {{YOUR_PYPI_API_TOKEN}}
|
211
|
+
```
|
212
|
+
|
213
|
+
### Debugging
|
214
|
+
|
215
|
+
Since MCP servers run over stdio, debugging can be challenging. For the best debugging
|
216
|
+
experience, we strongly recommend using the [MCP Inspector](https://github.com/modelcontextprotocol/inspector).
|
217
|
+
|
218
|
+
You can launch the MCP Inspector via [`npm`](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) with
|
219
|
+
this command:
|
220
|
+
|
221
|
+
```bash
|
222
|
+
npx @modelcontextprotocol/inspector uv --directory {{your source code local directory}}/unichat-mcp-server run unichat-mcp-server
|
223
|
+
```
|
224
|
+
|
225
|
+
Upon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
|
226
|
+
|
227
|
+
## License
|
228
|
+
|
229
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
230
|
+
|
231
|
+
---
|
232
|
+
|
233
|
+
For more information or support, please open an issue on the project repository.
|
@@ -0,0 +1,5 @@
|
|
1
|
+
cli_mcp_server-0.1.1.dist-info/METADATA,sha256=i0nxSXCRdhvOKKSoA6yM8s6q7IkUZuKrA9_SFA08U34,6740
|
2
|
+
cli_mcp_server-0.1.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
3
|
+
cli_mcp_server-0.1.1.dist-info/entry_points.txt,sha256=07bDmJJSXg-6VCFEFTOlsGoxI-0faJafT1yEEjUdN-U,55
|
4
|
+
cli_mcp_server-0.1.1.dist-info/licenses/LICENSE,sha256=85rOR_IMpb2VzXBA4VCRZh_KWlaO1Rly8HDYDwGgMWk,1062
|
5
|
+
cli_mcp_server-0.1.1.dist-info/RECORD,,
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Mladen
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|