by tumf
Secure MCP server for whitelisted shell command execution with stdin, argv pipelines, timeouts, and structured audit logging.
# Add to your Claude Code skills
git clone https://github.com/tumf/mcp-shell-serverGuides for using mcp servers skills like mcp-shell-server.
mcp-shell-server is an open-source mcp servers skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by tumf. Secure MCP server for whitelisted shell command execution with stdin, argv pipelines, timeouts, and structured audit logging. It has 202 GitHub stars.
mcp-shell-server's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/tumf/mcp-shell-server" and add it to your Claude Code skills directory (see the Installation section above).
mcp-shell-server is primarily written in Python. It is open-source under tumf on GitHub, so you can review or fork the full source.
Yes. AgentsLLM lists many other MCP Servers skills you can browse and compare side by side. Open the MCP Servers category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh mcp-shell-server against similar tools.
No comments yet. Be the first to share your thoughts!
Top skills in this category by stars
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
A trusted execution server implementing the Model Context Protocol (MCP). It runs allowlisted commands as argv arrays, with stdin input, contained redirection, a minimal child environment, execution limits, and structured audit logging.
This package is not a sandbox. Allowing a command delegates that program the server process's existing OS authority. Read Trusted execution contract before configuring it.
Development and releases follow Branch and release flow.
<, >, and >> targets must stay inside the requested working directoryRead this before the configuration examples below. The server emits the same warning once at startup through its logger (stderr); MCP stdout framing is unchanged.
mcp-shell-server enforces a boundary around its own behavior:
ALLOW_COMMANDS, ALLOW_PATTERNS),<, >, and >> redirection contained under the requested working directory,Allowing a command is authority delegation: the allowed program runs with the server process's existing OS identity, filesystem access, network access, and credentials. ALLOW_COMMANDS and ALLOW_PATTERNS restrict only the command names the server launches directly. They do not guarantee containment of:
The command-specific rejection rules described under Security are best-effort defense in depth against known dangerous argument forms. They are non-exhaustive, and they are not a proof that an allowed program is safe.
A trusted, authenticated MCP client does not make the content it processes trusted. Model-provided text, fetched web pages, issue text, and repository contents are untrusted input even when the client itself is trusted, and an LLM can be induced to construct a request from that content.
If any request or any file the server can reach may derive from untrusted input, run the server inside an independently enforced OS boundary (container, VM, jail, or OS policy) that provides:
Keep the allowlist as narrow as the workload allows; a narrow allowlist reduces exposure but never substitutes for the boundary above.
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"shell": {
"command": "uvx",
"args": [
"mcp-shell-server"
],
"env": {
"ALLOW_COMMANDS": "ls,cat,pwd,grep,wc,touch,find"
}
},
}
}
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"shell": {
"command": "uv",
"args": [
"--directory",
".",
"run",
"mcp-shell-server"
],
"env": {
"ALLOW_COMMANDS": "ls,cat,pwd,grep,wc,touch,find"
}
},
}
}
To install Shell Server for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install mcp-shell-server --client claude
pip install mcp-shell-server
ALLOW_COMMANDS="ls,cat,echo" uvx mcp-shell-server
# Or using the alias
ALLOWED_COMMANDS="ls,cat,echo" uvx mcp-shell-server
The ALLOW_COMMANDS (or its alias ALLOWED_COMMANDS ) environment variable specifies which commands are allowed to be executed. Commands can be separated by commas with optional spaces around them.
Valid formats for ALLOW_COMMANDS or ALLOWED_COMMANDS:
ALLOW_COMMANDS="ls,cat,echo" # Basic format
ALLOWED_COMMANDS="ls ,echo, cat" # With spaces (using alias)
ALLOW_COMMANDS="ls, cat , echo" # Multiple spaces
ALLOW_PATTERNS can be used for comma-separated regular expressions that match command names. Each pattern is applied with full-match semantics, so ALLOW_PATTERNS="ls" allows only the command name ls and does not allow lsof or ls -la. Patterns and command names containing whitespace or shell metacharacters are rejected; do not use ALLOW_PATTERNS to describe shell command strings or argument-level policies.
ALLOW_PATTERNS="python[0-9.]*,node" # Command-name patterns only
Allowlisting a command name is not a sandbox for that program's own argument-level execution features. The server applies default argument hardening even when the binary is allowed: known exec-capable vectors such as find -exec/-execdir/-ok/-okdir, shell/interpreter launchers and JS runtimes such as deno/bun, awk system(), tar external-program options such as tar --checkpoint-action=exec (every checkpoint action is denied), env, xargs, command-wrapper tools such as timeout/nice/nohup/setarch/strace/valgrind, shell-escape tools such as sed/less/vim/ssh, common alternate names such as gfind/gawk/gtar/bsdtar/gsort, GNU sort options that select an external program, output path, external file list, or external temporary directory (--compress-program, -o/--output, --files0-from, and -T/--temporary-directory, including abbreviated and clustered forms such as --co, --o, -ro FILE, and -rT DIR), all Git command-scoped configuration overrides, persistent git config writes, and the Git subcommand execution options described below are rejected before subprocess creation. For example, ALLOW_COMMANDS="git" does not permit git -c user.name=Example status, git -c alias.pwn=!sh -c "touch marker" pwn, or git config alias.pwn '!sh -c "touch marker"'; every global git -c <name=value> and git -c<name=value> override is rejected regardless of its key or value. Dangerous names such as setarch, strace, valgrind, deno, and bun are rejected categorically, including version or attach-only forms such as deno --version or strace -p PID, and an allowlist entry cannot override this.
Git subcommand execution options are rejected by a finite Git 2.53.0 option grammar: git grep pager selection (-O, attached and clustered forms such as -OP, -nOP, -1OP, and --open-files-in-pager with any non-empty prefix such as --op), git rebase execution (-x, attached and clustered forms such as -xP, -qxP, and --exec with any non-empty prefix such as --ex, including after operands), every git filter-branch invocation, and git bisect run when run directly follows bisect. On every other subcommand, --exec and its non-empty prefixes (--e, --ex, --exe) stay rejected as remote-helper selectors (for example git push --exec=PROG). Values consumed by global options (-C, --git-dir, --work-tree, --namespace, ...) and by value-taking grep/rebase options (-e, -f, --context, --onto, -s, -X, --strategy-option, ...) are data and are not rescanned, so git grep -e -O data and git rebase --onto --exec are allowed; an unconsumed -- or --end-of-options ends grep/rebase option parsing, and grep also stops at its first operand except for (/). Unknown short letters and ambiguous prefixes that include a target (such as git grep --o=P) are conservatively rejected. git send-email program selectors are rejected by