by Automata-Labs-team
Provides a secure sandbox environment for executing code within Docker containers, enabling AI applications to run untrusted code safely.
Code Sandbox creates isolated Docker containers that serve as execution environments for arbitrary code. It is designed for AI applications that need to run user‑generated or dynamic code while protecting the host system through containerization and resource limits.
sandbox_initialize
tool, optionally specifying a Docker image (default: python:3.12-slim-bookworm
). The call returns a container_id
.copy_project
, copy_file
, or write_file
to place code and resources inside the container.sandbox_exec
with a list of shell commands (e.g., installing dependencies, running scripts).containers://{id}/logs
).sandbox_stop
.Configuration for AI clients (Claude Desktop, other MCP‑compatible tools) involves pointing the client to the code-sandbox-mcp
binary in the appropriate config file (Linux/macOS/Windows paths provided).
Q: Do I need Docker installed? A: Yes, Docker must be running on the host machine; the installer checks for it.
Q: Which languages are supported? A: Any language that can run inside a Docker image. Use a custom image to add runtimes.
Q: How are resources limited? A: Limits are applied through Docker container constraints (CPU, memory, etc.).
Q: Can I stream logs while a command runs?
A: Yes, the containers://{id}/logs
resource provides real‑time log output.
Q: How do I update the server? A: The binary includes an auto‑update checker that fetches the latest release automatically.
A secure sandbox environment for executing code within Docker containers. This MCP server provides AI applications with a safe and isolated environment for running code while maintaining security through containerization.
curl -fsSL https://raw.githubusercontent.com/Automata-Labs-team/code-sandbox-mcp/main/install.sh | bash
# Run in PowerShell
irm https://raw.githubusercontent.com/Automata-Labs-team/code-sandbox-mcp/main/install.ps1 | iex
The installer will:
chmod +x code-sandbox-mcp
sandbox_initialize
Initialize a new compute environment for code execution. Creates a container based on the specified Docker image.
Parameters:
image
(string, optional): Docker image to use as the base environment
Returns:
container_id
that can be used with other tools to interact with this environmentcopy_project
Copy a directory to the sandboxed filesystem.
Parameters:
container_id
(string, required): ID of the container returned from the initialize calllocal_src_dir
(string, required): Path to a directory in the local file systemdest_dir
(string, optional): Path to save the src directory in the sandbox environmentwrite_file
Write a file to the sandboxed filesystem.
Parameters:
container_id
(string, required): ID of the container returned from the initialize callfile_name
(string, required): Name of the file to createfile_contents
(string, required): Contents to write to the filedest_dir
(string, optional): Directory to create the file in (Default: ${WORKDIR})sandbox_exec
Execute commands in the sandboxed environment.
Parameters:
container_id
(string, required): ID of the container returned from the initialize callcommands
(array, required): List of command(s) to run in the sandboxed environment
copy_file
Copy a single file to the sandboxed filesystem.
Parameters:
container_id
(string, required): ID of the container returned from the initialize calllocal_src_file
(string, required): Path to a file in the local file systemdest_path
(string, optional): Path to save the file in the sandbox environmentsandbox_stop
Stop and remove a running container sandbox.
Parameters:
container_id
(string, required): ID of the container to stop and removeDescription: Gracefully stops the specified container with a 10-second timeout and removes it along with its volumes.
A dynamic resource that provides access to container logs.
Resource Path: containers://{id}/logs
MIME Type: text/plain
Description: Returns all container logs from the specified container as a single text resource.
The installer automatically creates the configuration file. If you need to manually configure it:
// ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"code-sandbox-mcp": {
"command": "/path/to/code-sandbox-mcp",
"args": [],
"env": {}
}
}
}
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"code-sandbox-mcp": {
"command": "/path/to/code-sandbox-mcp",
"args": [],
"env": {}
}
}
}
// %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"code-sandbox-mcp": {
"command": "C:\\path\\to\\code-sandbox-mcp.exe",
"args": [],
"env": {}
}
}
}
For other AI applications that support MCP servers, configure them to use the code-sandbox-mcp
binary as their code execution backend.
If you want to build the project locally or contribute to its development, see DEVELOPMENT.md.
This project is licensed under the MIT License - see the LICENSE file for details.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.