Skip to content

v0.3.0 - Docker Code Sandbox

Latest

Choose a tag to compare

@abrookins abrookins released this 26 Feb 15:44
· 13 commits to main since this release

What's New

Docker-based Code Execution Sandbox

A new built-in tool for executing code in isolated Docker containers. Works on Mac (via Docker Desktop/OrbStack) and Linux.

Features

  • One-shot execution with run_code_sandbox
  • Persistent sessions with sandbox_session_start/exec/stop/list
  • Multiple languages: Python, Node.js, Bash
  • Configurable isolation levels: minimal, standard, secure
  • Package installation: Install pip/npm packages before execution
  • Resource limits: Memory, CPU, and timeout controls

Security Features

  • Image allowlist (only pre-approved Docker images)
  • Package name validation (prevents command injection)
  • Resource caps (memory, CPU, timeout limits)
  • Session limits (max 10 concurrent sessions)
  • Container hardening (--security-opt no-new-privileges --cap-drop ALL)

Configuration

tool_views:
  default:
    custom_tools:
      - module: mcp_proxy.tools.sandbox.run_code_sandbox
      - module: mcp_proxy.tools.sandbox.sandbox_session_start
      - module: mcp_proxy.tools.sandbox.sandbox_session_exec
      - module: mcp_proxy.tools.sandbox.sandbox_session_stop
      - module: mcp_proxy.tools.sandbox.sandbox_session_list

Example Usage

# Basic execution
run_code_sandbox(code="print('hello')")

# With network access and packages
run_code_sandbox(
    code="import requests; print(requests.get('https://api.github.com').status_code)",
    packages=["requests"],
    isolation_level="minimal"
)

# Persistent session
session = sandbox_session_start(packages=["pandas"])
sandbox_session_exec(session_id=session["session_id"], code="import pandas as pd")
sandbox_session_stop(session_id=session["session_id"])

Documentation

See the Built-in Tools section in the reference documentation.