Agent Sandbox MCP Server
Click on "Deploy 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., "@Agent Sandbox MCP Serverremove the build directory, but ask me to approve it first"
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.
Cursor & Claude Code Agent Sandbox MCP Server | Safe Shell for Copilot & Codex
An MCP server that adds a reviewable safety gate before an AI coding agent runs risky shell or file operations. It works with Cursor, Claude Code, Copilot CLI, Codex, and any MCP client that can launch a local stdio server.
The server is intentionally small: safe read-only commands run immediately; commands that look destructive return a one-time approval request; a human explicitly approves or rejects that request through a second MCP tool.
Why this exists
AI coding agents are useful precisely because they can operate a terminal. That also means a mistaken rm, an over-broad Git cleanup, or a network-piped script can damage a working tree. This project makes the decision visible at the command boundary without requiring a container runtime.
Related MCP server: Host Terminal MCP
Install
git clone https://github.com/YOUR_USER/cursor-claude-agent-sandbox-mcp.git
cd cursor-claude-agent-sandbox-mcp
python -m venv .venv
source .venv/bin/activate
python -m pip install -e .Configure an MCP client
Add the following to the client’s MCP configuration. Replace the path with the absolute path to your checkout.
{
"mcpServers": {
"agent-sandbox": {
"command": "/ABSOLUTE/PATH/agent-sandbox-mcp/.venv/bin/agent-sandbox-mcp"
}
}
}The same stdio configuration is suitable for Cursor, Claude Code MCP configuration, Copilot CLI MCP configuration, and Codex MCP configuration. Consult each client’s current documentation for the location of its configuration file.
Tools
run_sandboxed_command
Inputs:
command: shell command to inspect and, when safe, runcwd: optional working directory (defaults to the server process directory)timeout: optional timeout in seconds, from 1 to 300
For a low-risk command, the result contains stdout, stderr, and an exit code. For a risky command, the result contains a request_id and a structured risk report. No risky command is run at this stage.
approve_command
Inputs:
request_id: the one-time ID returned byrun_sandboxed_commandapproved:trueto execute,falseto reject
Approval requests are held in memory and consumed exactly once. Restarting the server clears them.
Example
An agent asks to run:
rm -rf src/The server returns approval_required with a critical finding. A human can inspect the exact command and either call approve_command(..., approved=false) or explicitly approve it. A harmless command such as git status can run immediately.
Safety model and limitations
This MVP is a policy gate, not a container or kernel sandbox. It uses conservative pattern matching and human approval. It does not guarantee that every shell trick, encoded command, alias, environment-variable expansion, or program-level side effect will be detected. Approved commands execute with the server process’s operating-system permissions and environment.
For stronger isolation, run this server inside a disposable container or restricted OS account, keep the working directory narrow, and review commands before approval. Future work can add an argv-based execution mode, configurable policy files, audit logs, and container backends.
Development
python -m pip install -e '.[dev]'
pytestThe policy module has no MCP dependency, so its tests are fast and easy to run in a minimal environment.
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
Security gateway for AI agents: policy, approval, and audited execution, no secrets shared.
Fail-closed policy guardrails for AI agents running kubectl, terraform, helm, and argocd.
Runtime permission, approval, and audit layer for AI agent tool execution.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides safe shell command execution capabilities for AI agents and tools like VS Code Copilot through a whitelist-based filtering system.-
- AlicenseAqualityFmaintenanceEnables AI assistants to execute terminal commands on a host machine with configurable, granular permission controls and safety protections. It features multiple security modes, including allowlists and manual approval, to ensure safe command execution within specified directories.6Apache 2.0
- AlicenseNot gradedqualityAmaintenanceEnables AI coding assistants to execute shell commands locally, intercepting deterministic commands like git status and npm test before they reach the LLM, saving tokens and reducing latency.16 npm38MIT
- FlicenseAqualityAmaintenanceEnables coding agents to perform workspace-confined file operations, read-only Git inspection, and structured shell commands, while requiring out-of-band human approval for mutations and external executions and maintaining an audit trail.143-