Sandbox MCP Server
サンドボックス MCP サーバー
コード実行のための分離されたDocker環境を提供するMCPサーバー。このサーバーでは、以下のことが可能です。
任意のDockerイメージでコンテナを作成する
複数のプログラミング言語でコードを記述して実行する
パッケージをインストールして開発環境をセットアップする
分離されたコンテナでコマンドを実行する
前提条件
Python 3.9以上
Dockerがインストールされ実行中
uv パッケージ マネージャー (推奨)
Docker MCP サーバー(推奨)
Related MCP server: Docker MCP Server
インストール
このリポジトリをクローンします:
git clone <your-repo-url>
cd sandbox_serveruv を使用して仮想環境を作成し、アクティブ化します。
uv venv
source .venv/bin/activate # On Unix/MacOS
# Or on Windows:
# .venv\Scripts\activate依存関係をインストールします:
uv pip install .Claude Desktopとの統合
Claude Desktop の設定ファイルを開きます。
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
サンドボックス サーバーの構成を追加します。
{
"mcpServers": {
"sandbox": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/sandbox_server",
"run",
"sandbox_server.py"
],
"env": {
"PYTHONPATH": "/absolute/path/to/sandbox_server"
}
}
}
}/absolute/path/to/sandbox_serverプロジェクト ディレクトリへの実際のパスに置き換えます。
Claudeデスクトップを再起動します
使用例
基本的な使い方
Claude Desktop に接続すると、次のことが可能になります。
Python コンテナを作成します。
Could you create a Python container and write a simple hello world program?さまざまな言語でコードを実行します。
Could you create a C program that calculates the fibonacci sequence and run it?パッケージをインストールして使用します。
Could you create a Python script that uses numpy to generate and plot some random data?環境の保存と再生
サーバーは、開発環境を保存および再現するためのいくつかの方法を提供します。
永続コンテナの作成
コンテナを作成するときに、それを永続化することができます。
Could you create a persistent Python container with numpy and pandas installed?これにより、次のコンテナが作成されます。
Claude Desktop が終了しても実行を継続します
Docker経由で直接アクセス可能
インストールされたすべてのパッケージとファイルを保存します
サーバーは次の指示を提供します:
コンテナに直接アクセスする(
docker exec)コンテナの停止と起動
不要になったら削除する
コンテナの状態を保存しています
環境を設定したら、それを Docker イメージとして保存できます。
Could you save the current container state as an image named 'my-ds-env:v1'?これにより、次のようになります。
次のすべてを含む新しい Docker イメージを作成します。
インストールされたパッケージ
作成されたファイル
構成の変更
環境を再利用するための手順を提供する
その後、このイメージを共有したり、新しいコンテナの開始点として使用したりできます。
Could you create a new container using the my-ds-env:v1 image?Dockerfilesの生成
環境を完全に再現可能にするには、Dockerfile を生成します。
Could you export a Dockerfile that recreates this environment?生成された Dockerfile には次のものが含まれます。
ベースイメージの仕様
作成されたファイル
追加のセットアップ手順のテンプレート
この Dockerfile を使用すると次のことができます。
環境設定を他の人と共有する
開発環境のバージョン管理
ビルドプロセスを変更およびカスタマイズする
さまざまなシステムに展開
推奨ワークフロー
再現可能な開発環境の場合:
永続コンテナを作成します。
Create a persistent Python container for data science work必要なパッケージをインストールし、環境を設定します。
Install numpy, pandas, and scikit-learn in the containerセットアップをテストします。
Create and run a test script to verify the environment状態を保存します:
Save this container as 'ds-workspace:v1'Dockerfile をエクスポートします。
Generate a Dockerfile for this environmentこれにより、環境を再作成するための複数のオプションが提供されます。
保存したDockerイメージを直接使用する
Dockerfile から修正を加えてビルドする
必要に応じて元のコンテナにアクセスする
セキュリティノート
すべてのコードは分離されたDockerコンテナ内で実行される
使用後は容器が自動的に除去されます
ファイルシステムはコンテナ間で分離されている
ホストシステムへのアクセスが制限されています
プロジェクト構造
sandbox_server/
├── sandbox_server.py # Main server implementation
├── pyproject.toml # Project configuration
└── README.md # This file利用可能なツール
サーバーは 3 つの主なツールを提供します。
create_container_environment: 指定されたイメージで新しいDockerコンテナを作成するcreate_file_in_container: コンテナ内にファイルを作成するexecute_command_in_container: コンテナ内でコマンドを実行するsave_container_state: コンテナの状態を永続コンテナに保存しますexport_dockerfile: 永続的な環境を作成するために docker ファイルをエクスポートしますexit_container: 終了時にコンテナを閉じて環境をクリーンアップします
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Related MCP Connectors
Execute code in 8 languages (Python, JS, TS, Go, Java, C++, C, Bash) in gVisor sandboxes.
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Execution platform for AI agents on Firecracker microVMs in the EU. Interactive Linux sandboxes with root, templates for Python, Node.js, Go, Rust and a headless browser, public HTTPS URLs. Background jobs that outlive the connection, batches of up to 1,000 jobs with dependencies, hard cost caps reserved up front, execution receipts with SHA-256, log digests that fit the context. IPv4, dual-stack or IPv6-only with its own public address, allowlists or no network. WASI runtime for small tasks. Idle sandboxes sleep and keep their files. Also REST API, Python SDK and LangChain.
Run Python, Java, C, C++, C#, Go, Rust and 39 more languages, each run in a fresh, offline sandbox.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceFacilitates isolated code execution within Docker containers, enabling secure multi-language script execution and integration with language models like Claude via the Model Context Protocol.5MIT
- AlicenseNot gradedqualityDmaintenanceEnables secure execution of shell commands and file operations within isolated Docker containers. Provides process management, interactive input handling, and comprehensive file system operations for containerized development environments.128 npm6MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to safely execute code in isolated Docker containers with resource limits and security controls, supporting session management and automatic dependency installation.MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to securely execute Python and C++ code snippets inside disposable, isolated Docker containers and receive structured results.31MIT