by Automata-Labs-team
Provides a secure sandbox environment for executing code within Docker containers, enabling AI applications to run code safely and in isolation.
Creates and manages isolated Docker containers that serve as execution environments for arbitrary code. It abstracts container lifecycle, file transfer, command execution, and log streaming, giving AI services a reliable way to run user‑provided scripts without compromising host security.
curl … | bash
; Windows: PowerShell irm … | iex
). The installer checks Docker, downloads the binary, and creates a config file.sandbox_initialize
tool, optionally specifying a Docker image (default python:3.12-slim-bookworm
). It returns a container_id
.copy_project
, copy_file
, or write_file
to place code and resources inside the container.sandbox_exec
with an array of shell commands (e.g., install dependencies, run scripts).containers://{id}/logs
resource or read stdout/stderr streams.sandbox_stop
.Q: Do I need Docker installed? A: Yes, Docker must be running on the host; the installer validates this.
Q: Can I use a custom Docker image?
A: Absolutely – pass the image
parameter to sandbox_initialize
with any valid image name.
Q: How are resources limited? A: Limits are applied via Docker container constraints (CPU, memory) that you can configure when building your image.
Q: Is there automatic cleanup?
A: Containers persist until you call sandbox_stop
; the stop command gracefully shuts down and removes the container and its volumes.
Q: How do I access logs programmatically?
A: Use the dynamic resource containers://{id}/logs
, which returns the full log as plain text.
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.
Discover more MCP servers with similar functionality and use cases
by zed-industries
Provides real-time collaborative editing powered by Rust, enabling developers to edit code instantly across machines with a responsive, GPU-accelerated UI.
by cline
Provides autonomous coding assistance directly in the IDE, enabling file creation, editing, terminal command execution, browser interactions, and tool extension with user approval at each step.
by continuedev
Provides continuous AI assistance across IDEs, terminals, and CI pipelines, offering agents, chat, inline editing, and autocomplete to accelerate software development.
by github
Enables AI agents, assistants, and chatbots to interact with GitHub via natural‑language commands, providing read‑write access to repositories, issues, pull requests, workflows, security data and team activity.
by block
Automates engineering tasks by installing, executing, editing, and testing code using any large language model, providing end‑to‑end project building, debugging, workflow orchestration, and external API interaction.
by RooCodeInc
An autonomous coding agent that lives inside VS Code, capable of generating, refactoring, debugging code, managing files, running terminal commands, controlling a browser, and adapting its behavior through custom modes and instructions.
by lastmile-ai
A lightweight, composable framework for building AI agents using Model Context Protocol and simple workflow patterns.
by firebase
Provides a command‑line interface to manage, test, and deploy Firebase projects, covering hosting, databases, authentication, cloud functions, extensions, and CI/CD workflows.
by gptme
Empowers large language models to act as personal AI assistants directly inside the terminal, providing capabilities such as code execution, file manipulation, web browsing, vision, and interactive tool usage.