Code Sandbox

Developer tools

An MCP server to create secure code 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.

Your AI app calls the Code Sandbox MCP server, which does the work through tools like local_src_dir, dest_dir, file_contents and local_src_file and sends the result back to the chat.

About Code Sandbox

Code Sandbox is a community MCP server from Automata-Labs-team, filed in our directory under developer tools. An MCP server to create secure code 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.

The README for Code Sandbox lists tools such as image, container_id, local_src_dir and dest_dir, which your AI app can call once the server is connected.

At a glance

Publisher
Automata-Labs-team (community)
Runs
See the README for setup
Written in
Go
License
MIT
GitHub stars
328

Tools Code Sandbox gives your AI app

  • image(string, optional): Docker image to use as the base environment.
  • container_idThat can be used with other tools to interact with this environment.
  • local_src_dir(string, required): Path to a directory in the local file system.
  • dest_dir(string, optional): Path to save the src directory in the sandbox environment.
  • file_name(string, required): Name of the file to create.
  • file_contents(string, required): Contents to write to the file.
  • commands(array, required): List of command(s) to run in the sandboxed environment.
  • local_src_file(string, required): Path to a file in the local file system.
  • dest_path(string, optional): Path to save the file in the sandbox environment.

Tool names as the Code Sandbox README lists them. Your AI app shows the live list once Code Sandbox is connected.

How to set up Code Sandbox

  1. Follow the install steps in the Code Sandbox README; it is written in Go, so have that toolchain ready.
  2. Check the Code Sandbox README for keys or settings; the registry lists none that Code Sandbox requires.
  3. Add Code Sandbox to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Code Sandbox tools to confirm the connection.
  5. Run one read-only task with Code Sandbox first, such as a call to image, before you allow anything that writes or sends.

Code Sandbox compared with similar servers

  • Wx Mp by WhiteNightShadow has fewer GitHub stars than Code Sandbox (328 against 328); both are community servers, and both run locally.
  • Gimp by gimp-mcp has more GitHub stars than Code Sandbox (329 against 328); both are community servers, and both run locally.
  • Neovim by bigcodegen has fewer GitHub stars than Code Sandbox (325 against 328); both are community servers, and both run locally. The Neovim README lists 13 tools to Code Sandbox's 9.

Before you connect Code Sandbox

  • Give Code Sandbox its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Code Sandbox tool call until you trust what it does with them.
  • Treat text that Code Sandbox fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Code Sandbox on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Code Sandbox

How marketing and sales teams put Code Sandbox to work, by company size. Pick the size closest to yours and start Code Sandbox on one use case.

Small business

  • A small business with a developer can use Code Sandbox to ship site and tracking fixes faster, with the AI reading the code it changes.
  • Technical founders can ask Code Sandbox to explain and fix a marketing site issue without context switching between tools.
  • Code Sandbox runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Growth engineers can use Code Sandbox to build landing pages, tracking and integrations in fewer cycles, with reviews kept in the normal flow.
  • Marketing ops engineers can connect Code Sandbox to keep scripts and automations documented and versioned as they change.
  • Start with image and container_id, the tools Code Sandbox lists first, and add more once the team trusts the results.

Enterprise

  • Enterprise engineering teams can roll out Code Sandbox with repo scopes and audit logs, so agents work only where they are allowed.
  • Platform teams can standardize on Code Sandbox so web and marketing engineering share one reviewed way of working with AI.
  • Code Sandbox is a community server, so have security review the code and pin a version before Code Sandbox touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Code Sandbox README

From Automata-Labs-team/code-sandbox-mcp on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

Code Sandbox MCP 🐳

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.

🌟 Features

  • Flexible Container Management: Create and manage isolated Docker containers for code execution
  • Custom Environment Support: Use any Docker image as your execution environment
  • File Operations: Easy file and directory transfer between host and containers
  • Command Execution: Run any shell commands within the containerized environment
  • Real-time Logging: Stream container logs and command output in real-time
  • Auto-Updates: Built-in update checking and automatic binary updates
  • Multi-Platform: Supports Linux, macOS, and Windows

🚀 Installation

Prerequisites
Quick Install
Linux, MacOS
curl -fsSL https://raw.githubusercontent.com/Automata-Labs-team/code-sandbox-mcp/main/install.sh | bash
Windows
# Run in PowerShell
irm https://raw.githubusercontent.com/Automata-Labs-team/code-sandbox-mcp/main/install.ps1 | iex

The installer will:

  1. Check for Docker installation
  2. Download the appropriate binary for your system
  3. Create necessary configuration files
Manual Installation
  1. Download the latest release for your platform from the releases page
  2. Place the binary in a directory in your PATH
  3. Make it executable (Unix-like systems only):
    chmod +x code-sandbox-mcp
    

🛠️ Available Tools

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
    • Default: 'python:3.12-slim-bookworm'

Returns:

  • container_id that can be used with other tools to interact with this environment
copy_project

Copy a directory to the sandboxed filesystem.

Parameters:

  • container_id (string, required): ID of the container returned from the initialize call
  • local_src_dir (string, required): Path to a directory in the local file system
  • dest_dir (string, optional): Path to save the src directory in the sandbox environment
write_file

Write a file to the sandboxed filesystem.

Parameters:

  • container_id (string, required): ID of the container returned from the initialize call
  • file_name (string, required): Name of the file to create
  • file_contents (string, required): Contents to write to the file
  • dest_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 call
  • commands (array, required): List of command(s) to run in the sandboxed environment
    • Example: ["apt-get update", "pip install numpy", "python script.py"]
copy_file

Copy a single file to the sandboxed filesystem.

Parameters:

  • container_id (string, required): ID of the container returned from the initialize call
  • local_src_file (string, required): Path to a file in the local file system
  • dest_path (string, optional): Path to save the file in the sandbox environment
sandbox_stop

Stop and remove a running container sandbox.

Parameters:

  • container_id (string, required): ID of the container to stop and remove

Description: Gracefully stops the specified container with a 10-second timeout and removes it along with its volumes.

Container Logs Resource

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.

🔐 Security Features

  • Isolated execution environment using Docker containers
  • Resource limitations through Docker container constraints
  • Separate stdout and stderr streams

🔧 Configuration

Claude Desktop

The installer automatically creates the configuration file. If you need to manually configure it:

Linux
// ~/.config/Claude/claude_desktop_config.json
{
    "mcpServers": {
        "code-sandbox-mcp": {
            "command": "/path/to/code-sandbox-mcp",
            "args": [],
            "env": {}
        }
    }
}
macOS
// ~/Library/Application Support/Claude/claude_desktop_config.json
{
    "mcpServers": {
        "code-sandbox-mcp": {
            "command": "/path/to/code-sandbox-mcp",
            "args": [],
            "env": {}
        }
    }
}
Windows
// %APPDATA%\Claude\claude_desktop_config.json
{
    "mcpServers": {
        "code-sandbox-mcp": {
            "command": "C:\\path\\to\\code-sandbox-mcp.exe",
            "args": [],
            "env": {}
        }
    }
}
Other AI Applications

For other AI applications that support MCP servers, configure them to use the code-sandbox-mcp binary as their code execution backend.

🛠️ Development

If you want to build the project locally or contribute to its development, see DEVELOPMENT.md.

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

Questions about Code Sandbox

What is the Code Sandbox MCP server?

An MCP server to create secure code 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. Code Sandbox is maintained by Automata-Labs-team on GitHub at Automata-Labs-team/code-sandbox-mcp, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Code Sandbox MCP server?

Code Sandbox doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (Automata-Labs-team/code-sandbox-mcp). Like most servers, Code Sandbox ends with a command or URL you paste into your AI app's MCP config.

Does Code Sandbox need an API key?

The registry lists no required keys for Code Sandbox. Check the Code Sandbox README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Code Sandbox an official MCP server?

No. Code Sandbox is a community server maintained by Automata-Labs-team. Community servers can be excellent; read the code and the open issues before you give Code Sandbox access to company data.

What license is Code Sandbox under?

Code Sandbox is released under the MIT license, according to its GitHub repository. The license covers the code of Code Sandbox; the service it connects to has its own terms.