
mcp-shell-server
MCP server that runs allowlisted shell commands with argv arrays, contained redirection
The repository was last updated 17 days ago and is published under MIT.
mcp-shell-server is an open-source MCP server for developer tools. It is available on CLI, API, Linux, macOS and Windows.
- Pricing
- Open source
- Platforms
- CLI, API, Linux
- GitHub stars
- 202
- Last commit
- Language
- Python
- License
- MIT
Similar MCP servers
About mcp-shell-server
Gives an MCP client a way to run a fixed set of command-line programs on the host machine. Commands are passed as argument arrays rather than shell strings, so nothing is interpreted by a shell, and optional stdin, pipelines and a working directory can be supplied per request.
The operator chooses which command names may run through environment variables such as ALLOW_COMMANDS and ALLOW_PATTERNS. The server adds timeouts, output byte caps, a minimal child environment that keeps parent secrets out, and structured audit records with secret-like values redacted. Redirection targets are kept inside the requested directory, and a set of argument forms that can launch other programs is rejected by default.
The README is explicit that this is not a sandbox: an allowed program keeps the server's operating system permissions, network access and credentials. It is aimed at developers and operators who want an agent to run controlled commands and who can place the server inside a container, VM or similar isolation when inputs may be untrusted.
What it does
- Argument-array execution
- Allowed commands run through subprocess argv without any shell-string interpretation.
- Command allowlisting
- Command names are permitted by exact list or by full-match regex patterns set in environment variables.
- Contained redirection
- Input and output redirection targets must stay inside the requested working directory.
- Execution limits
- Default and maximum timeouts plus per-stream output byte caps are enforced on the server.
- Minimal child environment
- Child processes receive a small allowlisted environment so server secrets are not inherited.
- Structured audit logs
- Each invocation logs its outcome with redacted argv and no raw output bodies.
Good for
- Letting an assistant run grep, find or wc over a project folder
- Running an allowlisted build or test tool and reading its output
- Piping text through a fixed set of utilities during an agent workflow
- Auditing which commands an AI client executed and why some were rejected
Pricing
Open source
Free and open source under the MIT license.
mcp-shell-server FAQ
Is mcp-shell-server a sandbox?
No. The README states it is not a sandbox, and allowed programs keep the server process's operating system authority. Untrusted inputs need external container or VM isolation.
How do I choose which commands are allowed?
Set ALLOW_COMMANDS to a comma-separated list of command names, or use ALLOW_PATTERNS for full-match regular expressions on command names.
Does mcp-shell-server run commands through a shell?
No. Commands and pipelines are executed with asyncio.create_subprocess_exec using argv arrays, so user strings are not passed to a shell.
What are the default timeout and output limits?
The default timeout is 30 seconds, the maximum is 300 seconds, and output defaults to 1 MiB per stdout or stderr stream.
Is mcp-shell-server free?
Yes. mcp-shell-server is open source, so you can use and self-host it for free.
What are the best alternatives to mcp-shell-server?
The closest alternatives to mcp-shell-server are cmdshellmcp, mcp-shell, cli-mcp-server, mcp-server-commands and Ssh Client MCP Server.
Where this comes from
- Description: written from the project's README.



