MCP Shell logo

MCP Shell

by sonirico

Runs approved shell commands through MCP with configurable validation, output limits, timeouts, and audit logging.

Install MCP Shell

Pick your client, then add it in one click or paste the config.

No confirmed install command yet

We only publish a config when the install details come from the project itself — its README, its docs, or a verified owner. We haven’t found those for sonirico/mcp-shell, and we’d rather show nothing than a guess you’d paste into your client.

Open setup steps on GitHub

Overview

The sonirico/mcp-shell MCP server exposes a tool for running shell commands through MCP. It accepts a command and an optional base64 output flag, then returns exit status, output, timing, and security details. Secure mode is enabled by default and limits execution to approved, classified utilities without shell interpretation. Reach for it when an agent needs controlled command execution in a local workspace or Docker environment.

Use cases

  • Run read-only workspace commands for an AI agent
  • Inspect files and search project contents through MCP
  • Execute approved Git queries in a controlled environment
  • Audit command execution with configured logs

Key features

  • MCP shell-command execution tool
  • Secure executable and argument policies
  • Execution time and output-size limits
  • Optional audit logging
  • Docker deployment with workspace mounting
  • Base64 encoding for command output

Tools29

What MCP Shell lets your agent do. Expand a tool for its parameters.

Self-reported~127 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked Today

Recent health check succeeded.

16/17 checks healthy over the last 79d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars108Stargazers on the source repository.
Last commit1mo agoMost recent push to the default branch.
Tools exposed29Callable tools this server registers over MCP.
Directory activity5 viewsConfig copies, upvotes, and views on AllMCPs.

How MCP Shell works

What sonirico/mcp-shell MCP server does

The sonirico/mcp-shell MCP server gives an MCP-compatible agent one tool for executing shell commands. The tool requires a command string and accepts an optional base64 boolean that encodes standard output and standard error in the response. Results include the command, status, exit code, stdout, stderr, and execution time; security details may also be returned.

It is intended for situations where an agent needs access to command-line utilities while the operator retains control over which commands can run. Docker is supported as a deployment option, and the example mounts a workspace into the container.

How it works

By default, the server starts in secure mode even when no configuration file is present. This mode does not invoke a shell interpreter. It parses the input and accepts only one fully literal simple command, rejecting shell features such as pipes, command lists, substitutions, redirections, and globs.

Allowed executables must be listed in policy and must also be classified as safe. Built-in examples include read-oriented utilities such as ls, cat, grep, find, head, and tail. Some commands, including git, find, sort, and uniq, use argument policies that permit only explicitly approved options or operations. Interpreters and wrappers such as bash, python, env, timeout, and xargs are rejected in secure mode, even if added to the allowlist.

The policy can also set blocked argument patterns, a maximum execution duration, a maximum output size, a working directory, and audit logging. The sonirico/mcp-shell MCP server can therefore apply command and resource restrictions before execution, but secure mode is an early-rejection layer rather than a complete sandbox.

Setup and configuration

The project provides a Docker image and a source-based installation path. A basic Docker invocation is:

Terminal
docker run -it --rm -v /tmp/mcp-workspace:/tmp/mcp-workspace sonirico/mcp-shell:latest

When building from source, the documented sequence clones the repository, runs make install, and starts mcp-shell.

Set MCP_SHELL_SEC_CONFIG_FILE to load a YAML security policy instead of relying on the built-in secure defaults. MCP_SHELL_ALLOW_UNSAFE=true disables validation and permits unrestricted execution; the project explicitly warns against using this setting in production. Logging can be adjusted with MCP_SHELL_LOG_LEVEL, MCP_SHELL_LOG_FORMAT, and MCP_SHELL_LOG_OUTPUT.

Claude Desktop can connect through a Docker stdio configuration. A custom policy file can be mounted into the container and selected with MCP_SHELL_SEC_CONFIG_FILE.

Tools and capabilities

The sonirico/mcp-shell MCP server provides one shell-command execution tool with these inputs:

  • command: required command text.
  • base64: optional boolean for encoding stdout and stderr.

Configuration supports executable allowlists, command-string policies in legacy mode, blocked patterns, execution timeouts, output limits, working-directory selection, and audit logging. Secure mode is the recommended policy. Legacy mode enables shell execution and uses allowlists or blocklists over command strings, so its injection risk depends on the policy.

Limitations and notes

Unrestricted execution is available only through an explicit environment-variable opt-in and is dangerous outside local development. Secure mode does not itself provide process isolation. The Docker image runs as a non-root user on Alpine, but the documentation recommends additional operating-system controls such as a read-only filesystem and dropped capabilities for defense in depth.

Git handling is restricted to read-only subcommands, with diff and text conversion drivers suppressed and a minimal environment. Child processes do not inherit server or .env secrets. The repository directs users to its security documentation for the detailed threat model and vulnerability-reporting scope.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about MCP Shell

Run the published Docker image with `docker run -it --rm -v /tmp/mcp-workspace:/tmp/mcp-workspace sonirico/mcp-shell:latest`, or clone the repository, run `make install`, and start `mcp-shell`.

Yes. The README provides a Claude Desktop stdio configuration that launches the Docker image with the `docker` command.

It starts in secure mode without a configuration file, using a narrow allowlist of read-only utilities and rejecting shell interpretation. This is an early-reject layer, not a complete sandbox.

Set `MCP_SHELL_SEC_CONFIG_FILE` to a YAML policy containing the desired security settings. An executable must be both allowlisted and classified as safe in secure mode.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewMCP Shell AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/sonirico-mcp-shell?style=directory)](https://allmcps.com/mcp/sonirico-mcp-shell)
HTML Embed
<a href="https://allmcps.com/mcp/sonirico-mcp-shell"><img src="https://allmcps.com/api/badge/sonirico-mcp-shell?style=directory" alt="MCP Shell on AllMCPs" /></a>