AI Decision System
Replayable, offline-verifiable records for AI-assisted go/no-go decisions: experiment promotions, typed model answers and human-approved actions.
보안 Python 실행, 아티팩트 캡처·가상 환경·LM Studio 연동 MCP 서버
A MCP server for secure Python code execution with artifact capture, virtual environment support, and LM Studio integration
개발 도구PythonGitHub @scooter-lacroix직접 설치운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
설치형 프로젝트는 배포 도메인 없이도 확인할 수 있습니다. 개인 저장소는 GitHub 로그인으로, 조직 저장소는 위의 저장소 확인 파일로 직접 확인해 주세요.
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
General-purpose Python execution sandbox for MCP clients, with persistent execution, artifact capture, Manim rendering, guarded shell access, and lightweight web app workflows.
Sandbox MCP is designed to stay broadly useful across coding assistants and MCP directories. It can run Python, generate plots and files, render Manim animations, launch or export small Flask/Streamlit demos, and expose prompts/resources that help an LLM discover how to use the sandbox well.
See the Sandbox MCP server creating beautiful mathematical animations with Manim:README 전문 보기 ↗General-purpose Python execution sandbox for MCP clients, with persistent execution, artifact capture, Manim rendering, guarded shell access, and lightweight web app workflows.
Sandbox MCP is designed to stay broadly useful across coding assistants and MCP directories. It can run Python, generate plots and files, render Manim animations, launch or export small Flask/Streamlit demos, and expose prompts/resources that help an LLM discover how to use the sandbox well.
See the Sandbox MCP server creating beautiful mathematical animations with Manim:
Alternative formats: MP4 Video | GIF Animation
Example: 3D mathematical animation generated automatically by the sandbox
# Clone the repository
git clone https://github.com/scooter-lacroix/sandbox-mcp.git
cd sandbox-mcp
# Install with uv (recommended)
uv venv && uv pip install -e .
# Run the MCP server
uv run sandbox-server-stdio
.venvChoose the right isolation level for your use case:
| Level | Isolation | Performance | Use Case |
|---|---|---|---|
| In-Process | Session globals only | ⭐⭐⭐⭐⭐ | Single LLM, trusted code |
| Process Pool | Process-level module isolation | ⭐⭐⭐⭐ | Multiple LLMs, resource limits |
| Worktree | Filesystem isolation via git | ⭐⭐⭐ | Parallel development workflows |
| Container | Full OS-level isolation | ⭐⭐ | Untrusted code, production |
Process Pool Example:
from sandbox.sdk import LocalSandbox, SandboxConfig, IsolationLevel
config = SandboxConfig(
isolation_level=IsolationLevel.PROCESS_POOL,
max_workers=4,
memory_limit_mb=256,
)
async with LocalSandbox.create(name="my-session", config=config) as sandbox:
result = await sandbox.run("print('Isolated execution')")
See SECURITY.md for detailed threat model and isolation strategies.
Install the latest stable release from PyPI:
# Using uv (fastest)
uv pip install sandbox-mcp
# Or using pip
pip install sandbox-mcp
For immediate use with AI applications:
# Run directly with uvx
uvx sandbox-mcp
For the latest development version:
# Using uv
uvx git+https://github.com/scooter-lacroix/sandbox-mcp.git
# Or clone and install
git clone https://github.com/scooter-lacroix/sandbox-mcp.git
cd sandbox-mcp
uv venv
uv pip install -e .
For contributing or customization:
git clone https://github.com/scooter-lacroix/sandbox-mcp.git
cd sandbox-mcp
uv venv
uv pip install -e ".[dev]"
git clone https://github.com/scooter-lacroix/sandbox-mcp.git
cd sandbox-mcp
python -m venv .venv
# On Linux/Mac:
source .venv/bin/activate
# On Windows:
# .venv\\Scripts\\activate
pip install -e ".[dev]"
# Check version
sandbox-mcp --version
# Test HTTP server
sandbox-server --help
# Test stdio server
sandbox-mcp --help
# Start HTTP server (web integration)
sandbox-server
# Start stdio server (LM Studio integration)
sandbox-mcp
# Backward-compatible stdio alias
sandbox-server-stdio
The Sandbox MCP server supports multiple integration methods:
For LM Studio, Claude Desktop, VS Code, and other MCP-compatible applications:
{
"mcpServers": {
"sandbox": {
"command": "uvx",
"args": ["git+https://github.com/scooter-lacroix/sandbox-mcp.git"],
"env": {},
"start_on_launch": true
}
}
}
For locally installed versions:
{
"mcpServers": {
"sandbox": {
"command": "sandbox-server-stdio",
"args": [],
"env": {},
"start_on_launch": true
}
}
}
For web-based integrations:
# Start HTTP server
python -m sandbox.mcp_sandbox_server --port 8765
Then configure your application:
{
"mcpServers": {
"sandbox": {
"transport": "http",
"url": "http://localhost:8765/mcp",
"headers": {
"Authorization": "Bearer your-token-here"
}
}
}
}
VS Code/Cursor/Windsurf (using MCP extension):
{
"mcp.servers": {
"sandbox": {
"command": "sandbox-server-stdio",
"args": [],
"env": {},
"transport": "stdio"
}
}
}
Jan AI:
{
"mcp_servers": {
"sandbox": {
"command": "sandbox-server-stdio",
"args": [],
"env": {}
}
}
}
OpenHands:
{
"mcp": {
"servers": {
"sandbox": {
"command": "sandbox-server-stdio",
"args": [],
"env": {}
}
}
}
}
Sandbox MCP exposes a broader tool surface than the quick table below. For the machine-readable catalog used by marketplace-style listings, see docs/marketplace-profile.json.
| Tool | Description |
|---|---|
execute | Execute Python code with artifact capture |
shell_execute | Execute shell commands safely with security filtering |
list_artifacts | List generated artifacts |
cleanup_artifacts | Clean up temporary files |
get_execution_info | Get environment diagnostics |
start_repl | Start interactive session |
start_web_app | Launch Flask/Streamlit apps |
cleanup_temp_artifacts | Maintenance operations |
create_manim_animation | Create mathematical animations using Manim |
list_manim_animations | List all created Manim animations |
cleanup_manim_animation | Clean up specific animation files |
get_manim_examples | Get example Manim code snippets |
manim_storyboard_skill turns a concept into a storyboard, ready-to-render Manim code, and a suggested sandbox workflow.manim_scene_template creates a focused Manim scene from a concept, duration target, and quality preset.sandbox_example_template creates runnable artifact-focused examples for plots, images, tables, or generated files.sandbox_web_app_template creates small Flask or Streamlit demos ready for start_web_app or export_web_app.sandbox://server/overview exposes a succinct server summary and capability map.sandbox://catalog/interfaces exposes a machine-readable list of tools, prompts, resources, skills, and templates.For local IDE assistants, use sandbox-server-stdio. For remote or directory-hosted use cases such as MCPHub-compatible listings, run the HTTP server behind TLS and authentication, then point clients at the Streamable HTTP endpoint:
python -m sandbox.mcp_sandbox_server
# Optional for hosted deployments
SANDBOX_MCP_HOST=0.0.0.0 SANDBOX_MCP_PORT=8765 python -m sandbox.mcp_sandbox_server
Deployment checklist:
export_web_app and build_docker_image when you want to turn sandbox-generated demos into deployable examples.docs/marketplace-profile.json and deployment notes in docs/marketplace.md.import asyncio
from sandbox import PythonSandbox
async def local_example():
async with PythonSandbox.create_local(name="my-sandbox") as sandbox:
# Execute Python code
result = await sandbox.run("print('Hello from local sandbox!')")
print(await result.output())
# Execute code with artifacts
plot_code = """
import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.figure(figsize=(8, 6))
plt.plot(x, y)
plt.title('Sine Wave')
plt.show() # Automatically captured as artifact
"""
result = await sandbox.run(plot_code)
print(f"Artifacts created: {result.artifacts}")
# Execute shell commands
cmd_result = await sandbox.command.run("ls", ["-la"])
print(await cmd_result.output())
asyncio.run(local_example())
import asyncio
from sandbox import PythonSandbox
async def remote_example():
async with PythonSandbox.create_remote(
server_url="http://127.0.0.1:5555",
api_key="your-api-key",
name="remote-sandbox"
) as sandbox:
# Execute Python code in secure microVM
result = await sandbox.run("print('Hello from microVM!')")
print(await result.output())
# Get sandbox metrics
metrics = await sandbox.metrics.all()
print(f"CPU usage: {metrics.get('cpu_usage', 0)}%")
print(f"Memory usage: {metrics.get('memory_usage', 0)} MB")
asyncio.run(remote_example())
import asyncio
from sandbox import NodeSandbox
async def node_example():
async with NodeSandbox.create(
server_url="http://127.0.0.1:5555",
api_key="your-api-key",
name="node-sandbox"
) as sandbox:
# Execute JavaScript code
js_code = """
console.log('Hello from Node.js!');
const sum = [1, 2, 3, 4, 5].reduce((a, b) => a + b, 0);
console.log(`Sum: ${sum}`);
"""
result = await sandbox.run(js_code)
print(await result.output())
asyncio.run(node_example())
import asyncio
from sandbox import LocalSandbox, SandboxOptions
async def builder_example():
config = (SandboxOptions.builder()
.name("configured-sandbox")
.memory(1024)
.cpus(2.0)
.timeout(300.0)
.env("DEBUG", "true")
.build())
async with LocalSandbox.create(**config.__dict__) as sandbox:
result = await sandbox.run("import os; print(os.environ.get('DEBUG'))")
print(await result.output()) # Should print: true
asyncio.run(builder_example())
# Execute simple code
result = execute(code="print('Hello, World!')")
code = """
import matplotlib.pyplot as plt
import numpy as np
# Generate plot
x = np.linspace(0, 10, 100)
y = np.sin(x)
plt.figure(figsize=(8, 6))
plt.plot(x, y, 'b-', linewidth=2)
plt.title('Sine Wave')
plt.xlabel('x')
plt.ylabel('sin(x)')
plt.grid(True)
plt.show() # Automatically captured as artifact
"""
result = execute(code)
# Returns JSON with base64-encoded PNG
flask_code = """
from flask import Flask, jsonify
app = Flask(__name__)
@app.route('/')
def home():
return '<h1>Sandbox Flask App</h1>'
@app.route('/api/status')
def status():
return jsonify({"status": "running", "server": "sandbox"})
"""
result = start_web_app(flask_code, "flask")
# Returns URL where app is accessible
# Install packages via shell
result = shell_execute("uv pip install matplotlib")
# Check environment
result = shell_execute("which python")
# List directory contents
result = shell_execute("ls -la")
# Custom working directory and timeout
result = shell_execute(
"find . -name '*.py' | head -10",
working_directory="/path/to/search",
timeout=60
)
# Simple circle animation
manim_code = """
from manim import *
class SimpleCircle(Scene):
def construct(self):
circle = Circle()
circle.set_fill(PINK, opacity=0.5)
self.play(Create(circle))
self.wait(1)
"""
result = create_manim_animation(manim_code, quality="medium_quality")
# Returns JSON with video path and metadata
# Mathematical graph visualization
math_animation = """
from manim import *
class GraphPlot(Scene):
def construct(self):
axes = Axes(
x_range=[-3, 3, 1],
y_range=[-3, 3, 1],
x_length=6,
y_length=6
)
axes.add_coordinates()
graph = axes.plot(lambda x: x**2, color=BLUE)
graph_label = axes.get_graph_label(graph, label="f(x) = x^2")
self.play(Create(axes))
self.play(Create(graph))
self.play(Write(graph_label))
self.wait(1)
"""
result = create_manim_animation(math_animation, quality="high_quality")
# List all animations
animations = list_manim_animations()
# Get example code snippets
examples = get_manim_examples()
# Import error with detailed diagnostics
result = execute(code="import nonexistent_module")
# Returns structured error with sys.path info
# Security-blocked shell command
result = shell_execute("rm -rf /")
# Returns security error with blocked pattern info
sandbox-mcp/
├── src/
│ └── sandbox/ # Main package
│ ├── __init__.py # Package initialization
│ ├── mcp_sandbox_server.py # HTTP MCP server
│ ├── mcp_sandbox_server_stdio.py # stdio MCP server
│ ├── server/ # Server modules
│ │ ├── __init__.py
│ │ └── main.py
│ └── utils/ # Utility modules
│ ├── __init__.py
│ └── helpers.py
├── tests/
│ ├── test_integration.py # Main test suite
│ └── test_simple_integration.py
├── pyproject.toml # Package configuration
├── README.md # This file
├── .gitignore
└── uv.lock # Dependency lock file
Manages the execution environment:
Non-intrusive artifact capture:
FastMCP-powered server with:
Important: Sandbox MCP is designed for single-user development scenarios, not multi-tenant production use.
✅ Isolated execution contexts for LLM code generation ✅ Artifact management and capture ✅ Path traversal prevention ✅ Session isolation
❌ Multi-tenant isolation ❌ Protection against malicious code ❌ Process-level security boundaries
For production use or multi-tenant scenarios, use RemoteSandbox with container isolation.
See SECURITY.md for complete threat model.
For comprehensive usage information, troubleshooting guides, and advanced features:
Run the test suite to verify installation:
uv run pytest tests/ -v
Test categories include:
uv run pytestFor development setup:
uv venv && uv pip install -e ".[dev]"
This project includes minor inspiration from:
The majority of the functionality in this project is original implementation focused on MCP server integration and enhanced Python execution environments.