Cmdshellmcp logo

Cmdshellmcp

by ag88

Constrained MCP command, file, patch, and URL tools with allowlisted execution, path checks, authentication, and audit logging.

Install Cmdshellmcp

Run the project’s own setup commands, in order.

Setup steps from the project

ag88/cmdshellmcp installs with its own steps rather than a config we can generate, so these are copied as-is. Follow them in order and run the commands in a terminal. Source: github.com

  1. 1. Install
    pip install fastmcp requests beautifulsoup4
    
  2. 2. Install
    pip install -r requirements.txt
    
  3. 3. Start the server
    python cmdshellmcp2.py --conf /path/to/cmdshellmcp.json --cwd /path/to/project
    
  4. 4. Start the server
    python cmdshellmcp2.py
    
  5. 5. Start the server
    python cmdshellmcp2.py --sse
    
  6. 6. Start the server
    python cmdshellmcp2.py --cwd /path/to/project
    

Overview

ag88/cmdshellmcp exposes constrained Unix command execution, file management, text editing, patching, and HTTP fetching through MCP. Commands must be included in an explicit allowlist, while individual file and editing tools can be disabled in configuration. It runs in Python with FastMCP over streamable HTTP by default or SSE when selected, and requires a configured working directory. Reach for it when an agent needs limited local workspace operations inside a carefully protected sandbox rather than unrestricted shell access.

Use cases

  • Run approved Unix utilities against a project workspace
  • Edit and patch source files through MCP tools
  • Fetch and inspect web content from an agent workflow
  • Restrict destructive file tools for a specific deployment
  • Audit local agent operations in a disposable sandbox

Key features

  • Allowlisted Unix command execution
  • Workspace-scoped file operations
  • Sed editing and unified patch application
  • HTTP fetching with optional HTML prettification
  • Bearer authentication with generated tokens
  • Configurable tool disabling and audit logging

Tools9

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

Self-reported~106 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

Recent health check succeeded.

Adoption & maintenance

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

GitHub stars3Stargazers on the source repository.
Last commit1mo agoMost recent push to the default branch.
Tools exposed9Callable tools this server registers over MCP.

How Cmdshellmcp works

What ag88/cmdshellmcp does

ag88/cmdshellmcp provides MCP tools for running selected Unix commands and manipulating files within a configured working directory. Its command interface accepts a command name and an argument list, but execution is limited to names in the configured allowed_commands list. The server also exposes file reading, writing, listing, copying, moving, renaming, deletion, directory creation, and directory removal operations.

Editing support includes sed-based text changes with numbered backups and unified-diff application through patch. A URL-fetching capability can retrieve HTTP content and optionally prettify HTML. These operations let an MCP client perform common project or workspace tasks without receiving a general-purpose shell tool.

How it works

The Python implementation uses the fastmcp package. It listens on 127.0.0.1:8003 with streamable HTTP unless started with --sse, which selects the SSE transport. Both HTTP modes include CORS handling for browser-based MCP clients.

A JSON configuration file is mandatory. The server chooses an explicitly supplied --conf file first, then checks /etc/cmdshellmcp.d/cmdshellmcp.json and /usr/local/python/cmdshellmcp/cmdshellmcp.json. It does not automatically search the current directory, and startup fails if the selected file is missing, unreadable, invalid, or lacks a working directory supplied through either configuration or --cwd.

Path checks attempt to stop command arguments from escaping cwd, although the checks are heuristic rather than a complete security boundary. Authentication is enabled by default with a generated bearer token, or a fixed token can be set through configuration or --auth. Audit records can be written to standard output and optionally to a file.

Setup and configuration

Install the Python dependencies in a virtual environment or directly into the target environment:

bash
python -m venv .venv
source .venv/bin/activate
pip install fastmcp requests beautifulsoup4

GNU sed with its --sandbox option and diff must also be installed for editFile; those executables do not need to be included in allowed_commands.

Start the service with an explicit configuration and workspace:

bash
python cmdshellmcp2.py --conf /path/to/cmdshellmcp.json --cwd /path/to/project

Important configuration keys include host, port, cwd, allowed_commands, disableTools, auth, auditlog, quiet, shellnopathchk, and editdelbk. disableTools takes exact, case-sensitive MCP tool names, allowing write or destructive operations to be omitted. Use --sse to select SSE transport.

Tools and capabilities

  • Run allowlisted commands with positional arguments and flags.
  • Read, write, append, list, copy, move, rename, and delete files.
  • Create and remove directories under the configured workspace.
  • Apply sed edits with optional numbered backups.
  • Apply unified patches with configurable leading path-component stripping.
  • Fetch URLs and optionally format returned HTML.
  • Enforce bearer authentication and emit audit logs.

Limitations and notes

This server still provides remote command execution. Allowing commands such as bash, sh, python, perl, sudo, or docker can undermine the intended restrictions, and commands that write files may cause substantial damage. The path validation is pattern-based and may both block legitimate paths and miss unsafe behavior based on command semantics.

Run it as an unprivileged user in a disposable Docker container or virtual machine, restrict filesystem, network, credential, and device access, and review the default and configured command allowlists before use. Avoid --noauth, and do not expose the service to untrusted clients or untrusted models.

Written by AllMCPs with AI assistance from the project’s README and listing data. How we build listings

Reviews

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

Frequently Asked Questions about Cmdshellmcp

ag88/cmdshellmcp is an MCP server that connects AI clients to a controlled local workspace and selected Unix commands. Its main tools cover allowlisted command execution, file operations, sed-based editing, unified patch application, and URL fetching, with authentication, path checks, configurable tool disabling, and audit logging.

Install it by cloning the repository, optionally creating a Python virtual environment, and installing `fastmcp`, `requests`, and `beautifulsoup4`. GNU `sed` with `--sandbox` and `diff` are also required for `editFile`. Start it with a JSON configuration and a configured or supplied working directory.

Configure it with a mandatory JSON file containing at least a working directory through `cwd`, unless `--cwd` is supplied. Set `allowed_commands`, `disableTools`, `auth`, host, port, audit logging, and path-check behavior as needed. Select the file with `--conf` or use one of the two default locations.

Run `python cmdshellmcp2.py --sse` to select the SSE transport. The server otherwise uses streamable HTTP by default, with the configured host and port. A valid configuration file and working directory are still required.

Yes. Authentication is enabled by default and generates a bearer token at startup. You can instead provide a fixed token through the configuration file's `auth` field or the `--auth` option. Avoid `--noauth` when the service could be reached by untrusted clients.

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 PreviewCmdshellmcp AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/ag88-cmdshellmcp?style=directory)](https://allmcps.com/mcp/ag88-cmdshellmcp)
HTML Embed
<a href="https://allmcps.com/mcp/ag88-cmdshellmcp"><img src="https://allmcps.com/api/badge/ag88-cmdshellmcp?style=directory" alt="Cmdshellmcp on AllMCPs" /></a>