mcp-shell
Supports containerized deployment for secure isolation of shell command execution
Supports command execution on Unix-like systems including Linux
Supports command execution on macOS operating system
Provides secure shell command execution capabilities with configurable security constraints, command validation, and execution limits
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-shelllist files in the current directory"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-shell
MCP server that runs shell commands. Your LLM gets a tool; you get control over what runs and how.
Built on mark3labs/mcp-go. Written in Go.
Run it
Docker (easiest):
docker run -it --rm -v /tmp/mcp-workspace:/tmp/mcp-workspace sonirico/mcp-shell:latestFrom source:
git clone https://github.com/sonirico/mcp-shell && cd mcp-shell
make install
mcp-shellRelated MCP server: MCP Shell Server
Configure it
Secure mode is the default. With no config file, mcp-shell boots in secure
mode and registers only typed tools: file reads, grep/glob, git inspection,
and (opt-in) file/git writes and operator-defined scripts. There is no raw
shell command. You only need a config file to change the defaults below. To
run fully unrestricted you must opt in explicitly:
MCP_SHELL_ALLOW_UNSAFE=1 mcp-shell # disables secure mode; the only tool is shell_execTo customize the policy, point to a YAML config:
export MCP_SHELL_SEC_CONFIG_FILE=/path/to/security.yaml
mcp-shellSecure mode (default) — typed tools only, every path confined to working_directory:
security:
enabled: true
working_directory: /tmp/mcp-workspace
max_execution_time: 30s
max_output_size: 1048576
run_as_user: ""
audit_log: true
# Expose file and git write tools (write_file, edit_file, mkdir, move,
# delete, git_add, git_commit, git_switch, git_restore, git_stash). Off by
# default.
writes_enabled: false
# Operator-defined scripts exposed through the run_script tool. The client
# picks a name; the argv is yours and cannot be altered.
# scripts:
# test: ["go", "test", "./..."]
# lint: ["golangci-lint", "run"]Wire it up
Claude Desktop — add to your MCP config:
{
"mcpServers": {
"shell": {
"command": "docker",
"args": ["run", "--rm", "-i", "sonirico/mcp-shell:latest"],
"env": { "MCP_SHELL_LOG_LEVEL": "info" }
}
}
}For custom config, mount the file and set the env:
{
"command": "docker",
"args": ["run", "--rm", "-i", "-v", "/path/to/security.yaml:/etc/mcp-shell/security.yaml", "-e", "MCP_SHELL_SEC_CONFIG_FILE=/etc/mcp-shell/security.yaml", "sonirico/mcp-shell:latest"]
}Tools
Secure mode (the default) registers these typed tools. * marks a required
parameter.
Tool | Parameters | Available |
| path*, offset, limit, tail | always |
| path, depth, include_hidden | always |
| pattern*, path, newer_than, max_results | always |
| pattern*, path, glob, ignore_case, context, files_only, count, max_results | always |
| path* | always |
| path_a*, path_b* | always |
| always | |
| always | |
| max_count, ref, path, author, grep, since, until, oneline, follow | always |
| ref, ref_to, staged, path, stat_only, name_only | always |
| ref, path, stat_only | always |
| path*, ref, line_start, line_end | always |
| all, merged | always |
| pattern | always |
| ref* | always |
| path, untracked | always |
| always | |
| always | |
| path*, content*, append | writes_enabled |
| path*, old_string*, new_string*, replace_all | writes_enabled |
| path* | writes_enabled |
| from*, to* | writes_enabled |
| path*, recursive | writes_enabled |
| paths, all | writes_enabled |
| message*, all | writes_enabled |
| branch*, create | writes_enabled |
| paths*, staged | writes_enabled |
| action*, message | writes_enabled |
| name* | scripts |
Every path parameter is resolved against working_directory (symlinks
followed); anything outside it is rejected. Git paths and refs are passed
positionally and validated: a ref starting with - is rejected. There are no
network tools; push, fetch and clone are not offered.
Unrestricted mode: shell_exec exists only with MCP_SHELL_ALLOW_UNSAFE=1, runs the command through bash -c with no validation, by design, and it is the only tool registered in that mode.
Environment variables
Variable | Description |
| Path to security YAML (overrides built-in secure defaults) |
| Set |
| Server name (default: "mcp-shell 🐚") |
| debug, info, warn, error, fatal |
| json, console |
| stdout, stderr, file |
Development
make install dev-tools # deps + goimports, golines
make fmt test lint
make docker-build # build image locally
make release # binary + docker imageSecurity
Default: Secure mode. The server builds every command's argv itself; the client never supplies a shell string. Only typed tools are registered.
Path confinement: every path parameter is resolved against
working_directory, symlinks followed, and anything that resolves outside it is rejected.Git hardening: paths are passed after
--, refs after--end-of-options, and a ref starting with-is rejected. Git runs withGIT_CONFIG_NOSYSTEM=1,GIT_CONFIG_GLOBAL=/dev/null,core.fsmonitor,core.pagerandcore.hooksPathneutralised, and--no-ext-diff --no-textconvon log/diff/show/blame.Minimal environment: child processes get only
PATH,HOMEandLANG, never the server's own environment or.envsecrets.Writes and scripts are opt-in:
writes_enabled: trueexposes the file/git write tools; a non-emptyscriptsmap exposesrun_script. Both are off by default.Unrestricted: only via
MCP_SHELL_ALLOW_UNSAFE=1. The only tool registered isshell_exec, which runsbash -cwith no validation. Fine for local dev, dangerous otherwise.Docker: Runs as non-root, Alpine-based. Use it in production. Best paired with an OS sandbox (read-only FS, dropped caps) as defense-in-depth.
Threat model, guarantees, and the scope for vulnerability reports live in SECURITY.md. Read it before opening an advisory.
Migrating from 0.x
Secure mode no longer validates a shell_exec command string; it exposes
typed tools instead. A config file's security: block no longer accepts:
Removed key | Replacement |
| not needed; typed tools never shell out |
| not needed; each tool runs a fixed, server-built argv |
| not needed; same as above |
| not needed; same as above |
| not needed; same as above |
Loading a config file that still sets one of these fails at startup with an
error naming the key. There is no more "legacy mode" and no
security-legacy.yaml example. If you need raw shell access, set
MCP_SHELL_ALLOW_UNSAFE=1 to get shell_exec back; it is no longer
constrained by the security: block at all.
Contributing
Fork, branch, make fmt test, open a PR.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Remote MCP server for supportsheep: run AI interviews and manage support content for your blog.
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Remote MCP server for AI.TV creators — delegate account operations to your AI agent over MCP.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceA secure and pluggable MCP server to run terminal commands on your local machine or cloud server — remotely, safely, and with LLMs or agentic clients.-
- AlicenseBqualityAmaintenanceA secure MCP server for shell operations, terminal management, and process control, enabling AI assistants to safely execute commands and manage interactive sessions.132046MIT
- AlicenseNot gradedqualityCmaintenanceUniversal MCP server that wraps any CLI tool, enabling AI assistants to run commands via natural language.MIT
- AlicenseAqualityBmaintenanceAn MCP server that enables AI clients to execute shell, Python, and Node commands on the local machine across platforms.31MIT
Appeared in Searches
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sonirico/mcp-shell'
If you have feedback or need assistance with the MCP directory API, please join our Discord server