Sandbox MCP

MIT License
48
  • Linux
  • Apple

Integrations

  • Uses Docker containers to provide secure, isolated execution environments for code generated by LLMs

  • Pulls default sandboxes from GitHub during initialization of the MCP server

  • Provides a sandbox to execute JavaScript code using Node.js in an isolated environment

Sandbox MCP is a Model Context Protocol (MCP) server that enables LLMs (MCP hosts/clients) to run code in secure, isolated Docker containers.

While LLMs are really good at generating code, most can't run the code they generate. You end up running this untested code directly on your machine, which could have drastic unintended consequences.

Giving LLMs the tools to test the code safely prevents such issues and helps you generate more accurate code in fewer iterations.

Sandbox MCP gives the LLMs an easy-to-use execution environment that anyone can create and configure through a simple, AI-native MCP server that runs locally.

Inspired by Codapi. Some sandboxes are the same as Codapi sandboxes.

Use Cases

Sandbox MCP can be used for many different tasks, including but not limited to:

  • Secure code execution: Run any code generated by an LLM in a secure, isolated environment, protecting your system from untrusted or potentially harmful code.
  • Code testing: Automatically test and validate code in various languages and or configurations in various environments before integrating it into larger projects or production systems.
  • User code validation: Safely execute and check user-submitted code or scripts, ensuring they behave as expected and do not perform malicious actions.
  • Network troubleshooting: Diagnose connectivity issues, test endpoints, and analyze network performance using isolated network tools, all without exposing your system.
  • Educational and interview coding: Instantly compile and run code snippets for learning, teaching, or technical interviews, providing immediate feedback in a safe, temporary environment.
  • Automated code review and feedback: Enable LLMs to execute, test, and review code automatically, offering actionable feedback or suggestions before code is merged or deployed.

Demo

This demo shows how Sandbox MCP works with Claude Desktop.

Try the video if the GIF isn't clear.

Installation

Download Binary

You can download the appropriate binary for your operating system (for example, Darwin) and processor architecture (arm64) from the Releases page (sandbox-mcp_Darwin_arm64.tar.gz).

Install via Go

Prerequisites:

  • Go 1.24 or higher
go install github.com/pottekkat/sandbox-mcp/cmd/sandbox-mcp@latest

Get the path to the sandbox-mcp binary:

which sandbox-mcp

Build from Source

See the Development section.

Usage

Initilization

Before you use sandbox-mcp with LLMs, you need to initialize its configuration:

# Create the configuration directory in # $XDG_CONFIG_HOME/sandbox-mcp and pull # the default sandboxes from GitHub sandbox-mcp --pull # Build the Docker images for the sandboxes sandbox-mcp --build

Note

Make sure you have Docker installed and running.

With MCP Hosts/Clients

Add this to your claude_desktop_config.json for Claude Desktop or mcp.json for Cursor IDE:

{ "mcpServers": { "sandbox-mcp": { "command": "path/to/sandbox-mcp", "args": [ "--stdio" ] } } }

Note

Make sure to replace path/to/sandbox-mcp with the actual path to the sandbox-mcp binary.

Available Sandboxes

SandboxDescription
shellA secure, isolated Linux environment for running lightweight commands that does not require network access.
pythonSafely execute Python code in a secure, isolated environment.
rustCompile and run Rust code in an isolated environment.
network-toolsUse various network utilities in an isolated Linux sandbox. Perfect for network diagnostics and troubleshooting. See https://github.com/jonlabelle/docker-network-tools for a list of available tools.
goRun Go code securely in an isolated environment with network access.
javascriptRun JavaScript code in an isolated environment using Node.js.
apisixRun a lightweight instance of Apache APISIX, which can be configured through a YAML file and can be interacted through the curl command provided in the main.sh file. For example, curl -sI http://127.0.0.1:9080/ip.
javaCompile and run Java code in an isolated sandbox. Supports Java preview features.

Important

Your Own Sandbox

You can create and add your own sandboxes in $XDG_CONFIG_HOME/sandbox-mcp/sandboxes. A sandbox is essentially a Dockerfile and a JSON configuration. Check out the examples and the guide to learn more.

Development

Fork and clone the repository:

git clone https://github.com/username/sandbox-mcp.git

Change into the directory:

cd sandbox-mcp

Install dependencies:

make deps

Build the project:

make build

Update your MCP servers configuration to point to the local build:

{ "mcpServers": { "sandbox-mcp": { "command": "/path/to/sandbox-mcp/dist/sandbox-mcp", "args": [ "--stdio" ] } } }

License

MIT License

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

Sandbox MCP

  1. Demo
    1. Installation
      1. Download Binary
      2. Install via Go
      3. Build from Source
    2. Usage
      1. Initilization
      2. With MCP Hosts/Clients
    3. Available Sandboxes
      1. Development
        1. License

          Related MCP Servers

          • -
            security
            A
            license
            -
            quality
            A secure, container-based implementation of the Model Context Protocol (MCP) that provides sandboxed environments for AI systems to safely execute code, run commands, access files, and perform web operations.
            Last updated -
            4
            Python
            Apache 2.0
            • Linux

          View all related MCP servers

          ID: meacct2993