# code-sandbox-mcp

> MCP Server

This repository provides a secure code execution environment using Docker containers, enabling AI applications to safely run code in isolated environments with features like flexible container management and real-time logging.

## Overview

- **Category:** Developer Tools
- **Language:** Go
- **Stars:** 326
- **Forks:** 13
- **Owner:** Automata-Labs-team
- **GitHub:** https://github.com/Automata-Labs-team/code-sandbox-mcp
- **Created:** 2025-01-26T08:18:21+00:00
- **Updated:** 2025-03-28T06:32:23+00:00
- **Source:** https://model-context-protocol.com/servers/secure-code-execution-docker-sandbox

## Setup

## Setup

### Prerequisites

- Docker installed and running
  - [Install Docker for Linux](https://docs.docker.com/engine/install/)
  - [Install Docker Desktop for macOS](https://docs.docker.com/desktop/install/mac/)
  - [Install Docker Desktop for Windows](https://docs.docker.com/desktop/install/windows-install/)

### Quick Install

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

#### Windows
```powershell
# 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](https://github.com/Automata-Labs-team/code-sandbox-mcp/releases)
2. Place the binary in a directory in your PATH
3. Make it executable (Unix-like systems only):
   ```bash
   chmod +x code-sandbox-mcp
   ```

## Tools

## Available Tools

1.  Flexible Container Management: Create and manage isolated Docker containers for code execution.
2.  Custom Environment Support: Use any Docker image as your execution environment.
3.  File Operations: Easy file and directory transfer between host and containers.
4.  Command Execution: Run any shell commands within the containerized environment.
5.  Real-time Logging: Stream container logs and command output in real-time.
6.  Auto-Updates: Built-in update checking and automatic binary updates.
7.  Multi-Platform: Supports Linux, macOS, and Windows.
8. `sandbox_initialize`: Initialize a new compute environment for code execution.
9. `copy_project`: Copy a directory to the sandboxed filesystem.
10. `write_file`: Write a file to the sandboxed filesystem.
11. `sandbox_exec`: Execute commands in the sandboxed environment.
12. `copy_file`: Copy a single file to the sandboxed filesystem.
13. `sandbox_stop`: Stop and remove a running container sandbox.
14. Container Logs Resource: A dynamic resource that provides access to container logs.
