@@ -4,10 +4,35 @@ A secure shell command execution server implementing the Model Context Protocol
4
4
5
5
## Features
6
6
7
- - ** Secure Command Execution** : Only whitelisted commands can be executed
8
- - ** Standard Input Support** : Pass input to commands via stdin
9
- - ** Comprehensive Output** : Returns stdout, stderr, exit status, and execution time
10
- - ** Shell Operator Safety** : Validates commands after shell operators (;, &&, ||, |)
7
+ * ** Secure Command Execution** : Only whitelisted commands can be executed
8
+ * ** Standard Input Support** : Pass input to commands via stdin
9
+ * ** Comprehensive Output** : Returns stdout, stderr, exit status, and execution time
10
+ * ** Shell Operator Safety** : Validates commands after shell operators (; , &&, ||, |)
11
+
12
+ ## MCP client setting in your Claude.app
13
+
14
+ ``` shell
15
+ code ~ /Library/Application\ Support/Claude/claude_desktop_config.json
16
+ ```
17
+
18
+ ``` json
19
+ {
20
+ "mcpServers" : {
21
+ "shell" : {
22
+ "command" : " uv" ,
23
+ "args" : [
24
+ " --directory" ,
25
+ " ." ,
26
+ " run" ,
27
+ " mcp-shell-server"
28
+ ],
29
+ "env" : {
30
+ "ALLOW_COMMANDS" : " ls,cat,pwd,grep,wc,touch,find"
31
+ }
32
+ },
33
+ }
34
+ }
35
+ ```
11
36
12
37
## Installation
13
38
@@ -26,6 +51,7 @@ ALLOW_COMMANDS="ls,cat,echo" uvx mcp-shell-server
26
51
The ` ALLOW_COMMANDS ` environment variable specifies which commands are allowed to be executed. Commands can be separated by commas with optional spaces around them.
27
52
28
53
Valid formats for ALLOW_COMMANDS:
54
+
29
55
``` bash
30
56
ALLOW_COMMANDS=" ls,cat,echo" # Basic format
31
57
ALLOW_COMMANDS=" ls ,echo, cat" # With spaces
@@ -50,6 +76,7 @@ ALLOW_COMMANDS="ls, cat , echo" # Multiple spaces
50
76
### Response Format
51
77
52
78
Successful response:
79
+
53
80
``` json
54
81
{
55
82
"stdout" : " command output" ,
@@ -60,6 +87,7 @@ Successful response:
60
87
```
61
88
62
89
Error response:
90
+
63
91
``` json
64
92
{
65
93
"error" : " Command not allowed: rm" ,
@@ -83,12 +111,14 @@ The server implements several security measures:
83
111
### Setting up Development Environment
84
112
85
113
1 . Clone the repository
114
+
86
115
``` bash
87
116
git clone https://github.com/yourusername/mcp-shell-server.git
88
117
cd mcp-shell-server
89
118
```
90
119
91
120
2 . Install dependencies including test requirements
121
+
92
122
``` bash
93
123
pip install -e " .[test]"
94
124
```
@@ -120,9 +150,9 @@ pytest
120
150
121
151
## Requirements
122
152
123
- - Python 3.11 or higher
124
- - mcp>=1.1.0
153
+ * Python 3.11 or higher
154
+ * mcp>=1.1.0
125
155
126
156
## License
127
157
128
- MIT License - See LICENSE file for details
158
+ MIT License - See LICENSE file for details
0 commit comments