What is MCP Shell Server?
A secure shell command execution server implementing the Model Context Protocol (MCP). It allows remote execution of a pre‑whitelisted set of shell commands with optional stdin input, designed for controlled, auditable command‑line access from MCP clients.
How to use MCP Shell Server?
Install with pip install mcp-shell-server or automatically via Smithery (npx -y @smithery/cli install mcp-shell-server --client claude). Set the ALLOW_COMMANDS (or ALLOWED_COMMANDS) environment variable with comma‑separated command names, then start the server with ALLOW_COMMANDS="ls,cat,echo" uvx mcp-shell-server. Configure the MCP client (e.g., Claude Desktop) with a JSON entry pointing to this command and any required environment variables.
Key features of MCP Shell Server
- Argv‑based execution without shell‑string interpretation
- Standard input support passed to commands via stdin
- Returns stdout, stderr, exit status, and execution time
- Safe pipeline support validating argv segments
- Server‑side default timeout, maximum timeout, and output byte caps
- Contained redirection restricting
<, >, >> to the working directory
- Minimal child environment; secrets are not inherited by default
- Structured audit logging with redaction of sensitive values
Use cases of MCP Shell Server
- Enabling AI assistants to safely run diagnostic commands like
ls, grep, or cat
- Automating file operations with controlled input/output redirection
- Integrating with MCP clients (e.g., Claude Desktop) for secure shell task execution
- Auditing all command executions via structured event logs
- Running whitelisted tools in a containerized or restricted environment
Comments