Code Sandbox

by automata-labs-team

132 stars
682 downloads
Not rated
GitHub

About

Provides a sandboxed code execution environment for secure, multi-language code running with resource limits and network restrictions.

Details

Author
automata-labs-team
Repository
Automata-Labs-team/code-sandbox-mcp
GitHub stars
132
Downloads
682
License
MIT License
Categories
Developer Tools, Other, AI, Productivity, Design, Search, Automation, API, Project Management

- 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

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Code Sandbox
    Command (node, npx, python, etc.) /path/to/code-sandbox-mcp

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

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

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.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

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

Linux

{
    "env": [],
    "args": [],
    "command": "/path/to/code-sandbox-mcp"
}

Macos

{
    "env": [],
    "args": [],
    "command": "/path/to/code-sandbox-mcp"
}

Windows

{
    "env": [],
    "args": [],
    "command": "C:\\path\\to\\code-sandbox-mcp.exe"
}

Code Sandbox MCP 🐳

smithery badge

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

- Docker installed and running
- Install Docker for Linux
- Install Docker Desktop for macOS
- Install Docker Desktop for Windows

Quick Install

Linux, MacOS

curl -fsSL https://raw.githubusercontent.com/Automata-Labs-team/code-sandbox-mcp/main/install.sh | bash

Windows

```powershell
No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.