# cmdshellmcp

> cmdshellmcp is an open-source MCP server for developer tools. Allowlist-restricted command-shell MCP server for giving AI agents limited local file. It is available on CLI, API, Self-hosted and Linux.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, Self-hosted, Linux
- **Repository:** https://github.com/ag88/cmdshellmcp
- **GitHub stars:** 4
- **License:** MIT
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

cmdshellmcp lets an MCP client run a curated set of Unix commands and perform file reads, writes, copies and deletions within a chosen working directory, without handing the agent a full terminal. Commands are passed as a name plus an argument list, and every command must appear on an allowlist defined in a JSON config file. Piping and redirection are not supported.

Beyond shell commands, the server exposes tools for scripted text edits with GNU sed that leave numbered backups and return unified diffs, unified diff patch application through GNU patch, and HTTP fetching with optional HTML prettification. Bearer token authentication is on by default, and audit logging can go to stdout or a file.

The project is aimed at developers who want an AI coding agent to inspect a project, make reviewable changes and fetch documentation in a contained setup, typically inside a disposable container. The README repeatedly warns that allowlisted interpreters or file-writing commands can defeat the restrictions, so it is not a general-purpose hardened sandbox.

## Features

- **Allowlisted command execution:** Runs only commands named in a config allowlist, passed as an argument array rather than a raw shell string.
- **Scoped file operations:** Reads, writes, lists, copies, moves and deletes files under a configured working directory using lexical path checks.
- **Reviewable sed edits:** Applies sed scripts in sandbox mode with numbered backups and returns a unified diff for each edit.
- **Patch application:** Applies unified diffs to a named file via GNU patch while blocking path-changing options.
- **Token authentication and audit logs:** Generates a bearer token by default and records audit events to stdout or a log file.
- **Docker sandbox setup:** Includes a Dockerfile, setup scripts and a systemd unit for running the server in a Debian container.

## Good for

- Letting a coding agent inspect repository and log files in a project folder
- Making small, reviewable text substitutions with automatic backups
- Applying small patches proposed by an AI model
- Fetching documentation pages for an agent during a local task
- Running a limited set of diagnostic commands on a disposable machine

## Tools

From the tool list in its README, going by the names, 1 of 12 tools deletes data and 4 change data; 4 names don't say. From the server's own tool labels and tool names; not verified by us.

- `cmdshell`: Runs one configured Unix command with arguments.
- `writeFile` (name suggests: changes): Writes text to a file beneath the current working directory.
- `readFile` (name suggests: reads): Reads a UTF-8 text file beneath the current working directory.
- `listFiles` (name suggests: reads): Lists the entries in a directory beneath the configured working directory.
- `copyFile`: Copies a regular file beneath the configured working directory.
- `moveRenameFile` (name suggests: changes): Moves or renames a regular file.
- `deleteFile` (name suggests: deletes): Deletes a regular file.
- `mkdir`: Creates one directory.
- `rmdir`: Removes one empty directory.
- `editFile` (name suggests: changes): Edits an existing text file using GNU sed with numbered backups.
- `applyPatch` (name suggests: changes): Applies a unified diff to one named file using GNU patch.
- `fetch` (name suggests: reads): Fetches a URL, optionally prettifying HTML.

## FAQ

### How does the server decide which commands can run?

Only commands listed in the allowed_commands config key, or passed with --allow, can be executed. Command names are checked before execution.

### Are pipes or redirects supported?

No. Piping and redirects are not allowed, and arguments are passed as a list instead of a shell string.

### Does cmdshellmcp require authentication?

Yes, bearer token authentication is enabled by default. A random token is generated at startup unless a fixed token is configured, and --noauth disables it.

### What transports does cmdshellmcp support?

It runs over streamable HTTP by default on 127.0.0.1:8003, with an --sse option for SSE transport and a --stdio mode.

### Is cmdshellmcp free?

Yes. cmdshellmcp is open source, so you can use and self-host it for free.

### What are the best alternatives to cmdshellmcp?

The closest alternatives to cmdshellmcp are mcp-shell-server, mcp-shell, cli-mcp-server, Sandbox Env MCP and mcp-linux-tools.

## Where this comes from

- Description: written from the project's README.

## Alternatives

- [mcp-shell-server](https://ai-powered.com/mcp/mcp-shell-server): mcp-shell-server is an open-source MCP server for developer tools.
- [mcp-shell](https://ai-powered.com/mcp/mcp-shell): mcp-shell is an open-source MCP server for developer tools.
- [cli-mcp-server](https://ai-powered.com/mcp/cli-mcp-server): cli-mcp-server is an open-source MCP server for developer tools.
- [Sandbox Env MCP](https://ai-powered.com/mcp/sandbox-env-mcp): Sandbox Env MCP is an open-source MCP server for developer tools.
- [mcp-linux-tools](https://ai-powered.com/mcp/mcp-linux-tools): mcp-linux-tools is an open-source MCP server for developer tools.
- [mcp-server-commands](https://ai-powered.com/mcp/mcp-server-commands-2): mcp-server-commands is an open-source MCP server for developer tools.
- [MCP Console Automation](https://ai-powered.com/mcp/mcp-console-automation): MCP Console Automation is an open-source MCP server for browser automation.
- [Imali Commander](https://ai-powered.com/mcp/imali-commander): Imali Commander is a freemium MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/cmdshellmcp
