SuperAPIAI Directory

cmdshellmcp

github.com · Other AI tools

cmdshellmcp is a restricted command shell MCP server for AI agents, implemented in Python with fastmcp. It exposes only a limited set of Unix commands through a whitelist mechanism and provides tools such as file read/write, patch application, and URL fetching, enabling MCP clients to perform local tasks in a controlled environment without opening unrestricted shell access. It listens on 127.0.0.1:8003 by default, supports streaming HTTP or SSE transport, and enables Bearer Token authentication by default. The project explicitly warns that it provides remote command execution capability and must only be run as an unprivileged user in a disposable sandbox (such as a Docker container or virtual machine), and should not be used with untrusted clients or LLMs.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsLinux

About this tool

cmdshellmcp is a restricted command shell MCP server written in Python, implemented based on the fastmcp package, designed to let AI agents perform local tasks within a limited scope. Through a whitelist mechanism it only allows execution of preconfigured Unix commands, and it provides tools such as file operations, patch application, and URL fetching, avoiding opening unrestricted shell access to MCP clients.

Main capabilities include: shell command execution within the whitelist; file reading, writing, listing, copying, moving, renaming, deleting, and basic directory creation/deletion within the configured working directory; transactional text editing using sed (with numbered backups and unified diff); applying unified diff patches via patch; HTTP fetching with optional HTML beautification; Bearer Token authentication enabled by default (a secure token is randomly generated at startup); audit log output to stdout and/or a file; path restrictions to prevent escaping the current working directory.

Usage: first clone the repository, install dependencies (via requirements.txt), and prepare a required JSON configuration file. The configuration file is searched in order: the file specified by --conf, /etc/cmdshellmcp.d/cmdshellmcp.json, /usr/local/python/cmdshellmcp/cmdshellmcp.json; the current directory is not searched automatically. Example startup command: python cmdshellmcp2.py --conf FILE --cwd PATH. By default it listens on 127.0.0.1:8003 and uses streaming HTTP transport; add --sse to use SSE transport instead. Authentication is enabled by default, and the startup log displays the randomly generated token; a fixed token can also be set via --auth or the auth field in the configuration file; --noauth disables authentication and is extremely insecure. Other command-line options include --host, --port, --allow, --disableTools, --editdelbk, --shellnopathchk, --quiet, --auditlog, --stdio, etc.

Applicable scenarios: in a disposable Docker container or virtual machine sandbox, let AI agents perform controlled coding assistance tasks, such as file editing, patch application,limited command execution and web fetching. The project also provides Debian-based Docker sandbox system container setup files (Dockerfile, DOCKER.md, service unit files, etc.); the container includes three users: root, admin (with sudo), and codeagent (without sudo, running cmdshellmcp).

Limitations and security warnings: this server provides remote command execution (RCE) capability, which is generally regarded as a serious security vulnerability. If the whitelist includes powerful commands such as bash, sh, python, perl, sudo, docker, etc., they may be exploited by attackers or untrusted LLMs to bypass restrictions and take control of the system. Path checks are only heuristic checks based on string pattern matching; they do not resolve symbolic links or understand command-specific options, and they are not a complete filesystem sandbox. It must only be run as an unprivileged user in a protected, disposable sandbox, and the whitelist must be carefully reviewed. It should not be used with untrusted clients or LLMs. --stdio mode implies --noauth, which reduces security, and is only for specific scenarios (such as when authentication is handled by mcp-proxy).

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools