Initialize a new compute environment for code execution using a Docker container
Copy a project directory from the host to the container
Copy a single file from the host to the container
Copy a file from the container to the host filesystem
Execute a shell command within the container
Stop and remove a running container sandbox
Code Sandbox provides a secure environment for executing code within isolated Docker containers. It enables AI applications to safely run code while maintaining security through containerization, supporting multiple programming languages and environments. The sandbox offers flexible container management, custom environment support via Docker images, and comprehensive file operations between host and containers. With real-time logging and command execution capabilities, it creates a robust foundation for secure code execution across Linux, macOS, and Windows platforms.
Code Sandbox creates secure, isolated environments for executing code using Docker containers. This tool is particularly valuable for AI applications that need to run untrusted or experimental code safely without compromising the host system.
Before installing Code Sandbox, ensure you have Docker installed and running on your system:
For Linux and macOS:
curl -fsSL https://raw.githubusercontent.com/Automata-Labs-team/code-sandbox-mcp/main/install.sh | bash
For Windows (PowerShell):
irm https://raw.githubusercontent.com/Automata-Labs-team/code-sandbox-mcp/main/install.ps1 | iex
chmod +x code-sandbox-mcp
Code Sandbox provides a suite of tools for managing containerized environments:
sandbox_initialize
with your preferred Docker imageexecute_command
sandbox_stop
Initialize a Python sandbox:
# Tool: sandbox_initialize
# Parameters: {"image": "python:3.12-slim-bookworm"}
Copy a project into the sandbox:
# Tool: copy_project
# Parameters: {"container_id": "your_container_id", "source_path": "./my_project", "destination_path": "/app"}
Execute code in the sandbox:
# Tool: execute_command
# Parameters: {"container_id": "your_container_id", "command": "cd /app && python main.py"}
Retrieve output files:
# Tool: copy_file_from_sandbox
# Parameters: {"container_id": "your_container_id", "source_path": "/app/output.txt", "destination_path": "./results/output.txt"}
Stop the sandbox when finished:
# Tool: sandbox_stop
# Parameters: {"container_id": "your_container_id"}
While Code Sandbox provides isolation through Docker containers, be aware of potential security implications: