Skip to content

Commit 815e038

Browse files
committed
docs(README): update features and usage sections for clarity and consistency
docs(README): improve formatting and add examples for ALLOW_COMMANDS variable docs(README): enhance development setup instructions and add license section
1 parent 168d76a commit 815e038

File tree

1 file changed

+45
-31
lines changed

1 file changed

+45
-31
lines changed

README.md

Lines changed: 45 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,17 @@ A secure shell command execution server implementing the Model Context Protocol
44

55
## Features
66

7-
* **Secure Command Execution**: Only whitelisted commands can be executed
8-
* **Stdin 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 (;, &&, ||, |)
1111

1212
## Installation
1313

1414
```bash
1515
pip install mcp-shell-server
1616
```
1717

18-
Or install from source:
19-
20-
```bash
21-
git clone https://github.com/yourusername/mcp-shell-server.git
22-
cd mcp-shell-server
23-
pip install -e .
24-
```
25-
2618
## Usage
2719

2820
### Starting the Server
@@ -31,11 +23,16 @@ pip install -e .
3123
ALLOW_COMMANDS="ls,cat,echo" uvx mcp-shell-server
3224
```
3325

34-
The `ALLOW_COMMANDS` environment variable specifies which commands are allowed to be executed.
26+
The `ALLOW_COMMANDS` environment variable specifies which commands are allowed to be executed. Commands can be separated by commas with optional spaces around them.
3527

36-
### Making Requests
28+
Valid formats for ALLOW_COMMANDS:
29+
```bash
30+
ALLOW_COMMANDS="ls,cat,echo" # Basic format
31+
ALLOW_COMMANDS="ls ,echo, cat" # With spaces
32+
ALLOW_COMMANDS="ls, cat , echo" # Multiple spaces
33+
```
3734

38-
Example requests to the server:
35+
### Request Format
3936

4037
```python
4138
# Basic command execution
@@ -53,7 +50,6 @@ Example requests to the server:
5350
### Response Format
5451

5552
Successful response:
56-
5753
```json
5854
{
5955
"stdout": "command output",
@@ -64,7 +60,6 @@ Successful response:
6460
```
6561

6662
Error response:
67-
6863
```json
6964
{
7065
"error": "Command not allowed: rm",
@@ -80,35 +75,54 @@ Error response:
8075
The server implements several security measures:
8176

8277
1. **Command Whitelisting**: Only explicitly allowed commands can be executed
83-
2. **Shell Operator Validation**: Commands after shell operators are also validated against the whitelist
78+
2. **Shell Operator Validation**: Commands after shell operators (;, &&, ||, |) are also validated against the whitelist
8479
3. **No Shell Injection**: Commands are executed directly without shell interpretation
8580

86-
## Environment Variables
81+
## Development
8782

88-
* `ALLOW_COMMANDS`: Comma-separated list of allowed commands (e.g., "ls, cat, echo")
83+
### Setting up Development Environment
84+
85+
1. Clone the repository
86+
```bash
87+
git clone https://github.com/yourusername/mcp-shell-server.git
88+
cd mcp-shell-server
89+
```
90+
91+
2. Install dependencies including test requirements
92+
```bash
93+
pip install -e ".[test]"
94+
```
95+
96+
### Running Tests
97+
98+
```bash
99+
pytest
100+
```
89101

90102
## API Reference
91103

92-
### Request Format
104+
### Request Arguments
93105

94-
| Field | Type | Description |
95-
|----------|------------|-----------------------------------------------|
96-
| command | string[] | Command and its arguments as array elements |
97-
| stdin | string | (Optional) Input to be passed to the command |
106+
| Field | Type | Required | Description |
107+
|----------|------------|----------|-----------------------------------------------|
108+
| command | string[] | Yes | Command and its arguments as array elements |
109+
| stdin | string | No | Input to be passed to the command |
98110

99-
### Response Format
111+
### Response Fields
100112

101113
| Field | Type | Description |
102114
|----------------|---------|---------------------------------------------|
103115
| stdout | string | Standard output from the command |
104116
| stderr | string | Standard error output from the command |
105117
| status | integer | Exit status code |
106118
| execution_time | float | Time taken to execute (in seconds) |
107-
| error | string | (Optional) Error message if failed |
119+
| error | string | Error message (only present if failed) |
108120

109121
## Requirements
110122

111-
* Python 3.11 or higher
112-
* uvicorn
113-
* fastapi
114-
* mcp-core
123+
- Python 3.11 or higher
124+
- mcp>=1.1.0
125+
126+
## License
127+
128+
MIT License - See LICENSE file for details

0 commit comments

Comments
 (0)