sandboxmcp
Secure, polyglot code execution engine for AI agents with MCP support
Part of the MCP AI Suite.
Features
- Polyglot execution -- run Python, JavaScript (Node), and shell in isolated environments
- Process backend for zero-dependency local execution with resource limits
- Docker hardened mode -- fully isolated containers with memory limits, CPU quotas, and network control
- Code validation with auto-fix for common issues and dangerous-pattern rejection
- Secret vault -- in-memory or environment-based credential injection without exposing secrets to agent output
- Network egress control -- global allowlist of permitted domains, default deny-all
- Host access guard -- optional controlled access to host commands with allow/block lists and auto-approve mode
- Web tools -- web search, page fetching, and browser rendering (lazily delegated to websearchmcp; requires the optional
browserextra) - Full audit logging via SQLite -- every execution, approval, and security event recorded
Installation
pip install mcpaisuite-sandboxmcp
# Optional extras:
pip install "mcpaisuite-sandboxmcp[docker]" # Docker backend support
pip install "mcpaisuite-sandboxmcp[browser]" # Web tools (web_search / fetch_webpage / browser_fetch via websearchmcp)
pip install "mcpaisuite-sandboxmcp[workspacemcp]" # workspacemcp suite integration
pip install "mcpaisuite-sandboxmcp[planningmcp]" # planningmcp suite integration
pip install "mcpaisuite-sandboxmcp[dev]" # Development tools
pip install "mcpaisuite-sandboxmcp[all]" # Docker + browser + suite integrations
The web tools (web_search, fetch_webpage, browser_fetch) are lazily imported from
websearchmcp at call time and require the browser extra
(or all). Without it, those tools raise an import error while the rest of sandboxmcp works normally.
Quick Start
from sandboxmcp import SandboxFactory, ExecutionRequest, Language
sandbox = SandboxFactory.default()
result = await sandbox.execute(ExecutionRequest(
code='print("Hello from sandbox!")',
language=Language.python,
))
print(result.stdout) # "Hello from sandbox!"
MCP Server
sandboxmcp serve
Configuration
| Variable | Default | Description |
|---|---|---|
SANDBOXMCP_BACKEND |
process |
Execution backend: process or docker |
SANDBOXMCP_MAX_CONCURRENT |
4 |
Max concurrent executions |
SANDBOXMCP_NETWORK |
false |
Enable network access |
SANDBOXMCP_HOST_ACCESS |
false |
Enable host command execution |
SANDBOXMCP_HOST_AUTO_APPROVE |
false |
Auto-approve host commands |
SANDBOXMCP_VAULT |
memory |
Vault backend: memory or env |
SANDBOXMCP_AUDIT |
sqlite |
Audit backend: memory or sqlite |
SANDBOXMCP_MAX_RAM_MB |
512 |
Max RAM per execution (MB) |
SANDBOXMCP_TIMEOUT |
60 |
Execution timeout (seconds) |
Docker Hardened Mode
For maximum isolation, use the Docker backend:
sandbox = SandboxFactory.create(
default_backend="docker",
image="python:3.12-slim",
memory_limit="256m",
network_mode="none",
)
This runs each execution in a disposable container with enforced memory limits, CPU quotas, and no network access.
API Reference
SandboxPipeline
The central orchestrator for code execution with full security pipeline.
await sandbox.execute(request: ExecutionRequest) -> SandboxResult
await sandbox.create_session(language, namespace) -> Session
await sandbox.execute_in_session(session_id, code) -> SandboxResult
await sandbox.list_sessions() -> list[Session]
SandboxFactory
SandboxFactory.default() # Process backend, in-memory vault, no network
SandboxFactory.from_env() # Build from environment variables
SandboxFactory.from_yaml("config.yaml") # Build from YAML config
SandboxFactory.create(default_backend="docker", enable_network=True, ...)
Architecture
SandboxPipeline orchestrates a security pipeline: incoming code passes through CodeValidator (syntax check, dangerous-pattern scan, auto-fix), then to the execution backend (Process or Docker), with NetworkGuard controlling egress and InMemoryVault injecting secrets. An AsyncJobQueue manages concurrency, and all events are recorded by the audit logger.
Testing
pip install -e ".[dev]"
pytest tests/ -v
License
Apache-2.0 — see LICENSE.
Open source for individuals and open-source projects. For commercial use in closed-source products, a commercial license is available — contact contact@mcpaisuite.com.
Release files for mcpaisuite-sandboxmcp 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mcpaisuite_sandboxmcp-1.1.0.tar.gz | 88.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcpaisuite_sandboxmcp-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 159.6 kB
Release files / mcpaisuite_sandboxmcp-1.1.0.tar.gz
| Download URL | mcpaisuite_sandboxmcp-1.1.0.tar.gz |
|---|---|
| Size | 88.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f007fc5f26fee306eea53f0c1d7be13c25d2bde72b36ed03ea6fefb6e63744a
|
|
BLAKE2b-256 checksum How to use checksums |
43f7d109410496d4cd40bdacf2f3587c1640538ea925a5cb209d1a38727f7bff
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.
Transparency logRelease files / mcpaisuite_sandboxmcp-1.1.0-py3-none-any.whl
| Download URL | mcpaisuite_sandboxmcp-1.1.0-py3-none-any.whl |
|---|---|
| Size | 70.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
176e6bb69f314f286e5a92d710c054f57fae15d28931bb4e0f8a123881d8e8d7
|
|
BLAKE2b-256 checksum How to use checksums |
b6415a5c3df06d9874cc5fbd962d61b5998875cd357a9d444f1b6cc9285eda0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.
Transparency log