tumf_mcp-shell-server
MCP Shell Server is a secure server for executing whitelisted shell commands remotely, using the Model Context Protocol. It features input support via stdin, secure command execution, and safety measures like command whitelisting and shell operator validation.
MCP Shell Server
A secure shell command execution server implementing the Model Context Protocol (MCP). This server allows remote execution of whitelisted shell commands with support for stdin input.
Features
- Secure Command Execution: Only whitelisted commands can be executed
- Standard Input Support: Pass input to commands via stdin
- Comprehensive Output: Returns stdout, stderr, exit status, and execution time
- Shell Operator Safety: Validates commands after shell operators
- Timeout Control: Set maximum execution time for commands
Usage
Starting the Server
The ALLOW_COMMANDS
environment variable specifies which commands are allowed to be executed. Commands can be separated by commas with optional spaces around them.
Security
The server implements several security measures including command whitelisting, shell operator validation, and prevention of shell injection.
Development
Clone the repository and install dependencies to set up the development environment.
API Reference
Request Arguments
- command: Command and its arguments
- stdin: Input to be passed to the command
- directory: Working directory for command execution
- timeout: Maximum execution time
Response Fields
- stdout: Standard output
- stderr: Standard error
- status: Exit status code
- execution_time: Time taken to execute
- error: Error message if failed
Requirements
- Python 3.11 or higher
- mcp>=1.1.0