cmd-exec-mcp
Enables isolated command execution inside Docker containers via the execute_sandbox tool, with configurable images, mounts, and security restrictions.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cmd-exec-mcprun 'ls -la' in /tmp"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
cmd-exec-mcp
English
A simple command execution MCP server supporting local execution, Docker/OpenSandbox sandbox isolation, and SSH remote execution.
Features
Local (
execute_local): Execute commands on the host machine,cwdrequiredSandbox (
execute_sandbox): Isolated execution in Docker containers or OpenSandbox, ephemeralRemote (
execute_remote): Execute commands via SSH on remote servers, supports standard/custom dual-mode configSecurity mode: restricted (whitelist + blacklist) / full mode
Sequential / parallel execution
Timeout control
Logging
Installation
git clone https://github.com/<user>/cmd-exec-mcp.git
cd cmd-exec-mcp
uv syncMCP Client Configuration
{
"mcpServers": {
"cmd-exec-mcp": {
"command": "uv",
"args": ["run", "--directory", "D:\\your_path\\cmd-exec-mcp", "main.py"]
}
}
}Configuration
Edit config.py:
Config | Default | Description |
|
| Security mode: |
|
| List mode: |
|
| Whitelist commands |
|
| Blacklist commands |
|
| Force shell: |
|
| WSL distro name (when |
|
| WSL username (when |
|
| Sandbox backend: |
|
| Docker sandbox security mode |
|
| Docker sandbox list mode |
|
| Docker sandbox blacklist |
|
| Docker sandbox whitelist |
|
| Docker sandbox default image |
|
| Mount directory ( |
|
| Docker sandbox startup prefix (mirrors, etc.) |
|
| OpenSandbox template image |
|
| OpenSandbox entrypoint script |
|
| OpenSandbox runtime versions + mirrors |
|
| OpenSandbox Server host |
|
| OpenSandbox Server port |
|
| OpenSandbox API Key (required for production) |
|
| Timeout in seconds (-1 for unlimited) |
|
| stdout truncation length when using |
|
| Return field toggles |
|
| SSH config mode: |
| — | SSH Host alias for standard mode |
|
| Persistent SSH connection |
|
| SSH connection timeout in seconds |
|
| Log file path |
|
| Log level |
OpenSandbox Prerequisites
To use the OpenSandbox backend (SANDBOX_BACKEND = "opensandbox"):
Prerequisite: Docker Desktop installed and running
Install the server (global):
uv tool install opensandbox-serverDeploy config:
copy docs\opensandbox\.sandbox.toml %USERPROFILE%\.sandbox.tomlSwitch backend:
config.py→SANDBOX_BACKEND = "opensandbox"API Key: can be arbitrary for local dev, but don't leave it empty or it will block for manual confirmation; set
SANDBOX_OPEN_API_KEYin production
opensandbox-serveris started automatically on firstexecute_sandboxcall and cleaned up viaatexit.
SSH Remote Execution Prerequisites
Standard mode: configure
~/.ssh/configand setSSH_HOST_NAMEto the Host aliasCustom mode: create
.envin the project root, referencing.env.example:SSH_HOST=192.168.1.100 SSH_PORT=22 SSH_USER=root SSH_KEY_PATH=~/.ssh/id_rsa SSH_PASSWORD= SSH_KNOWN_HOSTS=true
Tools
execute_local
Execute a command on the host machine.
{
"command": "echo hello",
"parallel": false,
"timeout": 30,
"cwd": "/tmp",
"env": { "KEY": "value" },
"fields": { "stdout": true, "stderr": false }
}Param | Type | Default | Description |
| str | required | Command, use |
| str | required | Working directory |
| bool | false | Run commands in parallel |
| int | 30 | Timeout in seconds, -1 for unlimited |
| dict | null | Environment variables |
| dict | null | Return field filter |
| str | null | Override shell: |
| str | "" | Write full stdout to disk, return truncated preview |
execute_sandbox
Execute a command in a sandbox (Docker/OpenSandbox, determined by SANDBOX_BACKEND).
{
"command": "echo hello",
"parallel": false,
"timeout": 30,
"env": { "KEY": "value" },
"fields": { "stdout": true, "stderr": false }
}Param | Type | Default | Description |
| str | required | Command |
| bool | false | Run in parallel |
| int | 30 | Timeout in seconds |
| dict | null | Environment variables |
| dict | null | Return field filter |
| str | "" | Write full stdout to disk, return truncated preview |
execute_remote
Execute a command on a remote server via SSH. See SSH prerequisites above.
{
"command": "ls -la",
"parallel": false,
"timeout": 30,
"env": { "KEY": "value" },
"fields": { "stdout": true, "stderr": false }
}Param | Type | Default | Description |
| str | required | Command |
| bool | false | Run in parallel |
| int | 30 | Timeout in seconds |
| dict | null | Environment variables |
| dict | null | Return field filter |
| str | "" | Write full stdout to disk, return truncated preview |
Testing
uv run pytest tests/ -vLogging
Logs are written to log.txt in the project root, format:
2026-07-30 12:00:00 [INFO] local: execute: echo hello
2026-07-30 12:00:00 [INFO] local: exit_code=0 duration=0.012License
MIT
Related MCP server: dynamic-mcp
中文
一个简单的命令执行 MCP,支持本地执行、纯 Docker/OpenSandbox 沙箱隔离执行和 SSH 远程执行。
功能
本地执行 (
execute_local): 在宿主机执行命令,cwd 必填沙箱执行 (
execute_sandbox): 在 Docker 容器或 OpenSandbox 沙箱中隔离执行,用完即焚远程执行 (
execute_remote): 通过 SSH 在远程服务器执行命令,支持 standard/custom 双模式配置安全模式: 受限模式(白名单+黑名单)/ 完全模式
单步/并行执行
超时控制
日志记录
安装
git clone https://github.com/<user>/cmd-exec-mcp.git
cd cmd-exec-mcp
uv syncMCP 客户端配置
{
"mcpServers": {
"cmd-exec-mcp": {
"command": "uv",
"args": ["run", "--directory", "D:\\your_path\\cmd-exec-mcp", "main.py"]
}
}
}配置
编辑 config.py:
配置 | 默认值 | 说明 |
|
| 安全模式 |
|
| 列表模式: |
|
| 白名单 |
|
| 黑名单 |
|
| 强制指定 Shell: |
|
| WSL 发行版名( |
|
| WSL 用户名( |
|
| 沙箱后端: |
|
| 纯docker沙箱安全模式 |
|
| 纯docker沙箱列表模式 |
|
| 纯docker沙箱黑名单 |
|
| 纯docker沙箱白名单 |
|
| 纯docker沙箱默认镜像 |
|
| 挂载目录( |
|
| 纯docker启动命令前缀(换源等) |
|
| OpenSandbox 模板镜像 |
|
| OpenSandbox 入口脚本 |
|
| OpenSandbox 运行时版本+镜像源 |
|
| OpenSandbox Server 地址 |
|
| OpenSandbox Server 端口 |
|
| OpenSandbox API Key(生产必填) |
|
| 超时秒数(-1 无限制) |
|
| 输出落盘时 stdout 截断长度 |
|
| 返回字段开关 |
|
| SSH 配置模式: |
| — | standard 模式 SSH Host 别名 |
|
| SSH 长连接复用 |
|
| SSH 连接超时秒数 |
|
| 日志文件路径 |
|
| 日志级别 |
OpenSandbox 前置条件
如需使用 OpenSandbox 后端 (SANDBOX_BACKEND = "opensandbox"):
前置依赖:Docker Desktop 已安装运行
安装 Server(全局):
uv tool install opensandbox-server部署配置:
copy docs\opensandbox\.sandbox.toml %USERPROFILE%\.sandbox.toml切换后端:
config.py→SANDBOX_BACKEND = "opensandbox"API Key:本地开发随意,但不建议留空,否则会阻塞让你手动确认;生产环境设
SANDBOX_OPEN_API_KEY
首次调用
execute_sandbox时自动拉起opensandbox-server,atexit自动清理。
SSH 远程执行前置条件
standard 模式:已配置
~/.ssh/config,设置SSH_HOST_NAME为 Host 别名custom 模式:项目根目录创建
.env,参考.env.example:SSH_HOST=192.168.1.100 SSH_PORT=22 SSH_USER=root SSH_KEY_PATH=~/.ssh/id_rsa SSH_PASSWORD= SSH_KNOWN_HOSTS=true
工具
execute_local
在宿主机执行命令。
{
"command": "echo hello",
"parallel": false,
"timeout": 30,
"cwd": "/tmp",
"env": { "KEY": "value" },
"fields": { "stdout": true, "stderr": false }
}参数 | 类型 | 默认 | 说明 |
| str | 必填 | 命令,并行模式用 |
| str | 必填 | 工作目录 |
| bool | false | 是否并行执行 |
| int | 30 | 超时秒数,-1 无限制 |
| dict | null | 环境变量 |
| dict | null | 返回字段过滤 |
| str | null | 指定 Shell: |
| str | "" | 输出过长时落盘,返回截断预览 |
execute_sandbox
在沙箱中执行命令(Docker/OpenSandbox,由 SANDBOX_BACKEND 决定)。
{
"command": "echo hello",
"parallel": false,
"timeout": 30,
"env": { "KEY": "value" },
"fields": { "stdout": true, "stderr": false }
}参数 | 类型 | 默认 | 说明 |
| str | 必填 | 命令 |
| bool | false | 是否并行 |
| int | 30 | 超时秒数 |
| dict | null | 环境变量 |
| dict | null | 返回字段过滤 |
| str | "" | 输出过长时落盘,返回截断预览 |
execute_remote
通过 SSH 在远程服务器执行命令,配置见 SSH 前置条件。
{
"command": "ls -la",
"parallel": false,
"timeout": 30,
"env": { "KEY": "value" },
"fields": { "stdout": true, "stderr": false }
}参数 | 类型 | 默认 | 说明 |
| str | 必填 | 命令 |
| bool | false | 是否并行 |
| int | 30 | 超时秒数 |
| dict | null | 环境变量 |
| dict | null | 返回字段过滤 |
| str | "" | 输出过长时落盘,返回截断预览 |
测试
uv run pytest tests/ -v日志
日志写入项目根目录 log.txt,格式:
2026-07-30 12:00:00 [INFO] local: execute: echo hello
2026-07-30 12:00:00 [INFO] local: exit_code=0 duration=0.012协议
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
AlicenseAqualityFmaintenanceMCP server to give every agent an ephemeral Linux sandboxes for executing shell commands.Last updated145MIT- AlicenseBqualityBmaintenanceDynamic MCP server for Node.js enabling runtime tool creation, management, and execution in isolated sandboxes (Docker or Node).Last updated8311MIT
- FlicenseAqualityBmaintenanceCross-platform MCP server for policy-controlled command execution on Linux and Windows, with no SSH dependency.Last updated3
- Alicense-qualityBmaintenanceMCP server that executes caller-supplied Python code in a network-isolated, locked-down sandbox and returns stdout/stderr/exit code. Supports stdio, HTTP, and SSE transports with optional auth.Last updated1MIT
Related MCP Connectors
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
An MCP server that let you interact with Cycloid.io Internal Development Portal and Platform
A MCP server built for developers enabling Git based project management with project and personal…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/YC-CLT/cmd-exec-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server