AL

automata-labs-team/code-sandbox-mcp

部署与 DevOps官方

本页由 AI 翻译,技术细节请以原文为准。 查看原文

327 stars 38 forks 质量 68 趋势 19MIT

一个MCP服务器,用于创建安全的代码沙盒环境,用于在Docker容器内执行代码。该MCP服务器为AI应用提供了一个安全且隔离的运行代码环境......

概览

一个安全的沙箱环境,用于在 Docker 容器内执行代码。该 MCP 服务器为 AI 应用提供了一个安全且隔离的运行环境,同时通过容器化维护代码安全。 - : 创建和管理隔离的 Docker 容器用于代码执行 - : 使用任意 Docker 镜像作为执行环境 - : 方便主机和容器间的文件和目录传输 - : 在容器化环境中运行任何 shell 命令 - : 实时流容器日志和命令输出 - : 内置更新检查和自动二进制更新 - 支持 Linux、macOS 和 Windows - Docker 已安装并运行中 - Linux 安装 Docker - macOS 安装 Docker Desktop - Windows 安装 Docker Desktop 安装程序将:1. 检查是否安装了Docker 2.下载适合你系统的二进制文件 3.创建必要的配置文件 1. 从发布页面下载你平台的最新版本 2.

概述(AI 翻译)

一个安全的沙箱环境,用于在 Docker 容器内执行代码。该 MCP 服务器为 AI 应用提供了一个安全且隔离的运行环境,同时通过容器化维护代码安全。

🌟 特色

  • 灵活容器管理:创建和管理隔离的Docker容器以执行代码
  • 自定义环境支持:使用任意Docker镜像作为执行环境
  • 文件操作:主机与容器之间的文件和目录传输简便
  • 命令执行:在容器化环境中运行任何壳级命令
  • 实时日志:实时流容器日志和命令输出
  • 自动更新:内置更新检查和自动二进制更新
  • 多平台:支持 Linux、macOS 和 Windows

🚀 安装

先决条件

  • Docker 安装并运行
  • 安装 Linux Docker
  • 安装 macOS Docker Desktop
  • 安装 Docker Desktop for Windows

快速安装

Linux,MacOS

窗户

安装人员将:

  1. 检查是否安装了 Docker
  2. 下载适合你系统的二进制文件
  3. 创建必要的配置文件

手动安装

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

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
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

// ~/.config/Claude/claude_desktop_config.json { "mcpServers": { "code-sandbox-mcp": { "command": "/path/to/code-sandbox-mcp", "args": [], "env": {} } } }