sandbox-mcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
sandbox-mcp
One isolated microVM per AI agent: a desktop, a browser and a private workspace, served over MCP.
Table of contents
Related MCP server: Qubicl
Overview
AI agents that run shell commands and drive a browser should not do it on your own machine. sandbox-mcp is a small standalone service that gives every agent its own Cloud Hypervisor virtual machine, with a lightweight desktop, Chromium, and the agent's working folder mounted at /workspace.
Agents talk to it through the Model Context Protocol (MCP) over Streamable HTTP. Each request carries a bearer token, and the token alone decides which agent, and therefore which VM, it belongs to. Tools never accept an agent id, so one agent cannot address another agent's sandbox.
Problem | How sandbox-mcp handles it |
Agent commands run with your user's rights | Commands run as an unprivileged user inside a KVM microVM |
Agents can see each other's files | Each VM only mounts its own workspace through virtio-fs |
A busy agent blocks the others | Blocking VM calls run off the event loop, so agents stay independent |
Network access is all or nothing at host level | Network is a per-agent switch; with it off the VM has no NIC at all |
Hard to see what an agent did | Every tool call is written to a timestamped audit log |
Why Cloud Hypervisor
An agent that runs arbitrary shell commands and browses arbitrary websites is untrusted code. The isolation boundary has to hold even if that code finds a kernel bug.
Separate kernel per agent. A Docker container shares the host's Linux kernel, so one kernel exploit inside a container can reach the host and every other agent. Each Cloud Hypervisor VM boots its own kernel behind KVM hardware virtualization, so an escape has to break the hypervisor, not just the kernel.
Small, memory-safe hypervisor. Cloud Hypervisor is written in Rust and only emulates modern virtio devices, with no legacy hardware. That is a much smaller attack surface than a general-purpose emulator like QEMU.
Workspace mounting with virtio-fs. The agent's real folder on the host appears inside the VM at
/workspace, with no copying or syncing. Firecracker, the other popular microVM, does not support virtio-fs, so it can't mount a live host folder this way.Control without a network. virtio-vsock gives the host a private channel into the guest. That is why networking can be switched off completely and the tools still work.
Fast enough for a desktop. Each VM runs a full guest with Chromium and a VNC desktop, and still boots to a ready helper in a few seconds.
Hard resource limits. vCPU and RAM are fixed per VM by the hypervisor, so one runaway agent can't starve the others.
Open source and proven. It's a Linux Foundation project and one of the hypervisors behind Kata Containers.
Docker container | Firecracker | QEMU | Cloud Hypervisor | |
Own kernel per agent | No (shared host kernel) | Yes | Yes | Yes |
Hypervisor attack surface | n/a | Very small | Large | Small |
Live host folder mount (virtio-fs) | Yes (bind mount) | No | Yes | Yes |
Host control channel with network off | Yes | Yes (vsock) | Yes (vsock) | Yes (vsock) |
Features
One VM per agent using Cloud Hypervisor, booted on demand and idempotent on restart
Desktop and browser in every VM: Chromium driven through Playwright over CDP, plus a VNC view bound to
127.0.0.1onlyWorkspace mount: the agent's folder appears at
/workspacethrough virtio-fsHost control over virtio-vsock, so control keeps working when guest networking is off
Optional network per agent: its own tap device and NAT, with VM-to-VM and VM-to-host traffic dropped
Token tenancy: tokens are printed once at registration and only their sha256 is stored
Limits: max VMs, total RAM budget, per-agent vCPU and RAM, clamped exec timeouts, capped output sizes
Audit log in
[YYYY-MM-DD HH:MM:SS.mmm | step | STATUS]:format; file contents are logged by length onlyTests: unit tests without VMs and named integration tests that boot real VMs
Architecture
flowchart LR
A1[Agent A<br/>MCP client] -- "HTTP + Bearer token A" --> S
A2[Agent B<br/>MCP client] -- "HTTP + Bearer token B" --> S
S["sandbox-mcp<br/>(127.0.0.1, MCP server)"] --> R[(agents.toml<br/>token sha256 to agent)]
S --> L[[audit log]]
S -- "spawn / stop" --> VA
S -- "spawn / stop" --> VB
subgraph VA[VM for agent A]
GA[sbx-agent.py<br/>vsock 5000] --- CA[Chromium + desktop]
WA[/workspace/]
end
subgraph VB[VM for agent B]
GB[sbx-agent.py<br/>vsock 5000] --- CB[Chromium + desktop]
WB[/workspace/]
end
FA[(agent A folder)] -. virtio-fs .-> WA
FB[(agent B folder)] -. virtio-fs .-> WBHow one tool call flows:
sequenceDiagram
participant C as MCP client
participant S as sandbox-mcp
participant V as Cloud Hypervisor VM
participant G as sbx-agent.py (guest)
C->>S: exec {cmd} + Bearer token
S->>S: sha256(token) to agent id, check limits
S->>V: CONNECT 5000 over vsock socket
V->>G: JSON line {op: exec, cmd}
G->>G: run as user "agent" in /workspace, with timeout
G-->>S: {exit_code, stdout, stderr}
S->>S: write audit line
S-->>C: tool resultInside the guest, sbx-agent.py listens on vsock port 5000 and handles exec, read_file, write_file and browser requests. VNC is spliced from a host port on 127.0.0.1 to vsock port 5900.
Security model
flowchart TB
subgraph Host
S[sandbox-mcp]
T1[tap for VM 1]
T2[tap for VM 2]
end
V1[VM 1] --- T1
V2[VM 2] --- T2
T1 -. "dropped" .- T2
T1 -. "dropped (except replies)" .-> S
T1 -- "NAT, only when network = true" --> I((Internet))Tenancy comes from the token, never from a tool argument. A client that sends an
agent_idhas it stripped.Paths are resolved inside
/workspace; anything that escapes is rejected.Network off (the default) means the VM gets no network device, only vsock.
Network on gives the VM its own tap and subnet. Traffic between VMs and new connections into the host are dropped; outbound traffic is NAT'ed.
VNC listens on loopback only.
Logs never contain tokens or file contents.
Known limit: with network on, a VM can reach private addresses beyond the host, such as your LAN, through NAT. Blocking private ranges is on the roadmap.
Tech stack
Layer | Technology |
Hypervisor | Cloud Hypervisor on KVM |
Shared folders | virtiofsd (virtio-fs) |
Host and guest control | virtio-vsock, JSON lines |
MCP server | Python 3.12, |
Guest image | Alpine Linux, Python 3, Node 22, Chromium, playwright-core |
Networking | Linux tap devices, iptables NAT and drop rules |
Tests | pytest, pytest-asyncio, httpx |
Install
Requirements:
Linux with KVM (tested on WSL2 Ubuntu with nested KVM)
Root, for tap devices, iptables, and the first-time image and hypervisor install
curl,sha256sum,mkfs.ext4,mount,chroot,taron the host (normal on Ubuntu)
git clone https://github.com/tecadrise-ai/sandbox-mcp.git
cd sandbox-mcp
sudo bash fetch-hypervisor.sh # Cloud Hypervisor, guest kernel, virtiofsd into /opt/sandbox-mcp/bin
sudo bash build-image.sh # Alpine guest disk at /var/lib/sandbox-mcp/base/alpine.ext4
sudo bash run-sandbox-mcp.sh # venv, config, start the server
sudo PYTHONPATH=. /opt/sandbox-mcp/venv/bin/python -m sandbox_mcp.register --agent-id demo --workspace /path/to/workspacePoint an MCP client at http://127.0.0.1:8765/mcp with Authorization: Bearer <token> (the token is printed once at register). Stop with sudo bash stop-sandbox-mcp.sh.
Runtime state lives in /var/lib/sandbox-mcp and /run/sandbox-mcp.
Guest image
build-image.sh builds a 4G ext4 disk from the official Alpine 3.21 minirootfs (latest 3.21.x patch, checksum-verified). The guest gets bash, curl, git, Python 3, Node, Chromium, playwright-core 1.52.0, Xvfb, openbox, x11vnc, xdotool, user agent (uid 1000), and /usr/local/bin/start-desktop.sh.
Rebuild: sudo FORCE=1 bash build-image.sh. Write to another path with OUT=. Change the Alpine series with ALPINE_VERSION=3.21. Extra or fewer apk packages: set PACKAGES to a space-separated list before running the script.
Chromium keeps its profile in /tmp inside the VM, so cookies and logins reset on every VM start. Files in /workspace persist.
Configuration
Copy sandbox-mcp.example.toml to sandbox-mcp.toml (git-ignored).
Key | Meaning |
| Bind address; keep |
| Admission limits for all VMs together |
| Per-agent sparse disk copies |
| Audit logs, |
| Image and hypervisor paths |
| Exec time limits |
Each agent is registered once. Per-agent settings are workspace, vcpu, ram_mb, vnc_port and network.
sudo PYTHONPATH=. /opt/sandbox-mcp/venv/bin/python -m sandbox_mcp.register --agent-id demo --workspace /path/to/workspaceThe token is printed once; only its sha256 goes into agents.toml. In v1 this file is the registry; a product UI is planned to replace it.
Usage
Point any MCP client at http://127.0.0.1:<listen_port>/mcp with the header Authorization: Bearer <token>.
{
"mcpServers": {
"sandbox": {
"url": "http://127.0.0.1:8765/mcp",
"headers": { "Authorization": "Bearer <token>" }
}
}
}A typical session: sandbox_start, then exec, read_file, write_file and the browser tools, then sandbox_stop.
MCP tools
Tool | What it does |
| Boot the VM (idempotent) and wait until the guest helper is ready |
| Stop the VM, virtiofsd, the VNC forwarder and the tap |
| Running state, pid, uptime, vCPU, RAM, RSS, VNC address, network |
| Run a command as the unprivileged guest user in |
| Files relative to |
| Drive Chromium through Playwright |
| URL, title and visible text (8 KB) |
| PNG returned as an MCP image and saved under |
Output is capped at 64 KB per stream and 1 MB per file. Exec timeouts kill the whole process group.
Project structure
sandbox-mcp/
├── sandbox_mcp/
│ ├── server.py # MCP server, auth middleware, tools
│ ├── vm.py # VM lifecycle, virtiofsd, tap and iptables
│ ├── vsock.py # host side of the vsock channel
│ ├── registry.py # agents.toml, token hashing
│ ├── register.py # register CLI
│ ├── config.py # sandbox-mcp.toml loader
│ ├── limits.py # admission and timeout limits
│ ├── paths.py # workspace path guard
│ ├── audit.py # audit log
│ ├── logutil.py # timestamped log lines
│ ├── inject.py # copies guest helpers into the agent disk image
│ └── guest/
│ ├── init.sh # guest init
│ ├── sbx-agent.py # guest helper on vsock 5000
│ └── sbx-browser.js # Playwright browser driver
├── tests/sandbox/ # unit and integration tests
├── build-image.sh # Alpine guest disk from official minirootfs
├── fetch-hypervisor.sh # Cloud Hypervisor, kernel, virtiofsd into /opt/sandbox-mcp/bin
├── run-sandbox-mcp.sh # install and start
├── stop-sandbox-mcp.sh # stop
├── run-tests.sh # run the test suite (Linux)
├── run_all_tests.bat # run the test suite through WSL (Windows)
├── sandbox-mcp.example.toml
└── requirements.txtTesting
sudo bash run-tests.sh # Linux
run_all_tests.bat # Windows, through WSLUnit tests (no VM): token mapping, unknown tokens, tool schemas without
agent_id, path guards, timeout clamping, admission limits.Integration tests (real VMs): start and status, exec, files, cross-agent denial, exec timeout, concurrent agents not blocking each other, VM-to-VM and VM-to-host isolation with outbound NAT still working, browser, VNC handshake, and cleanup with no VMs, taps or firewall rules left behind.
Test logs are written to tests/sandbox/logs/.
Roadmap
Block private address ranges when network is on
Disk snapshots and restore
Idle reaper for unused VMs
Outbound domain allowlist
Secrets injection into the guest
Metrics endpoint
VNC passwords
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Run commands, code and file operations for AI agents in Cloud Hypervisor microVM sandboxes.
Persistent Linux computers for AI agents: desktop, signed-in browser, vault, apps and shell.
Secure Linux sandboxes for AI agents, as MCP tools.
Give your agent its own cloud: Postgres, Redis, a sandbox or any Docker image, in one MCP call.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceProvides an AI agent with a fixed, isolated Linux desktop workspace, enabling bounded screen capture, input control, and application launching via MCP.-
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to operate a real, private, local Docker-based computer with durable files, terminal access, web research, and a persistent browser or desktop. It supports multiple agent clients via MCP or OpenAPI, with live viewing and human takeover.13Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to work in a persistent, isolated Linux workspace with file management, Bash execution, SSH/SFTP access, and durable storage while keeping workloads contained from the host and private networks.MIT

briqofficial
AlicenseNot gradedqualityBmaintenanceEnables agents to deploy, run, expose, inspect, and manage isolated cloud environments, including databases, caches, browsers, GitHub-hosted apps, and arbitrary OCI images, via MCP tools.2MIT