mcp-linux-sandbox
Provides a disposable Debian sandbox environment where an MCP client can run shell commands, install packages with apt, and persist files under /workspace across container recycling.
Provides a disposable Linux sandbox environment for running arbitrary shell commands, installing packages, and managing files, with /workspace persistence across container recycling.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-linux-sandboxinstall ffmpeg and extract the audio from /workspace/video.mp4 as mp3"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-linux-sandbox
A disposable Debian Linux sandbox exposed as an MCP server, so a chat client
(FlowDown, Claude Desktop, anything speaking Streamable HTTP) can run real shell
commands — apt install, curl, ffmpeg, Python — and hand files back to you.
Each conversation gets its own container. Files under /workspace survive
container recycling; installed packages and running processes do not.
MCP client ──Bearer──▶ nginx (TLS)
├── /mcp/<random>/ ──▶ 127.0.0.1:8000 FastMCP
└── /dl/<signed> ──▶ (same) file links
│
▼
podman exec mcpsb-<label>
│
┌────────────┴────────────┐
▼ ▼
container writable layer volume /workspace
(packages, /tmp — dies) (files — survives)Files
Path | What it is |
| The MCP server: |
| Base image for sandbox containers (Debian + common CLI tools) |
| Pinned Python dependencies |
| Creates |
| Idempotent install/update: venv, image, systemd units |
| End-to-end checks that speak MCP over HTTP |
| Stops leftover containers on service stop |
| Deletes stale volumes (dry-run by default) |
|
|
| The two |
| Copy to |
Related MCP server: railway-sandbox-mcp
Install
sudo dnf install -y podman catatonit # catatonit is needed by podman --init
./env.sh # creates mcp-sandbox.env, generates the signing key
vim mcp-sandbox.env # set MCP_PUBLIC_BASE
./install.sh # refuses to run while that is still the placeholderThen wire up nginx — copy both blocks from nginx/mcp-sandbox.conf into your
existing TLS server {}, replacing the path and token placeholders:
generate the bearer token with
openssl rand -hex 32on Fedora,
sudo setsebool -P httpd_can_network_connect 1, or nginx gets 502sudo nginx -t && sudo systemctl reload nginx
Client configuration
Field | Value |
Endpoint |
|
Headers |
|
Tool confirmation | leave it ON — this is a remote code-execution endpoint |
Add this to the client's system prompt, or the per-conversation isolation does not happen:
When you call
run_command, pass asandboxlabel. At the start of a new conversation pick a NEW short label (for exampleamber-otter) and use that same label for every call in the conversation. Never reuse a label from an earlier conversation, and do not change it mid-conversation.
Verify with, from the install directory (install.sh copies selftest.py there):
cd ~/mcp-linux-sandbox # or wherever SANDBOX_HOME points
./venv/bin/python selftest.py --url https://your.host:8443/mcp/<path>/ --token <token>
./venv/bin/python selftest.py --url http://127.0.0.1:8000/mcp # bypasses nginxSandbox labels
Tools take a sandbox label, and label → container → volume is one to one: a
label with no container yet gets a fresh, empty one. Labels are normalised, so
Amber Otter and amber-otter reach the same sandbox.
The label has to come from the model because the client sends one MCP session id
for the whole app rather than one per conversation, and no per-conversation field
exists in the request. It is a convention rather than a guarantee — a model that
reuses a label reaches the old container — but every result echoes
[sandbox <key>] [new], so a collision is visible rather than silent.
Settings
Setting | Default | Effect |
| 300 s | Recycle idle containers. Cleanup only: lowering it loses |
| 2 | Concurrent containers. Beyond it the least-recently-used is evicted ( |
| 900 s | Ceiling on the model's |
| 2 GiB | Refuse to start a sandbox when the volume filesystem is nearly full. Checked at container creation only — it will not stop a single large write. |
| 3600 s | Download links are HMAC-signed with an expiry, so a leaked URL is bounded in time and scope. |
| 1.5 MiB / 48 KiB | Attached images are also sent to the model (~2 MB ≈ 20k tokens); oversized files fall back to a link. |
| Verified to land in the cgroup ( | |
| Without an init as PID 1, exited children pile up as zombies against | |
|
| |
| Keeps setuid binaries from being exploitable. |
Volumes are never deleted by the server. gc-volumes.sh handles that on a timer
and is dry-run by default.
Security
This endpoint executes arbitrary commands. Treat it accordingly.
Keep the client's tool-confirmation prompt enabled. It is the only human gate on what actually runs.
Anything that can reach
/mcp/can run code; anything that can reach/dl/can read the sandbox volume. Keep the bearer token andMCP_SIGN_KEYout of URLs, screenshots,.fdmcp-style exports, cloud drives and git.present_fileserves regular files under/workspaceand follows no symlink in any path component, so a link created inside the sandbox cannot reach host files.Containers are rootless (
podman, nosudo) and can reach the LAN by default. If that matters, drop the network (--network=none) or move the container onto an--internalnetwork behind a proxy — but installing packages needs network, so pick one.Isolation is namespace + seccomp + cgroups, not a VM. It is the right level for "stop the model from trashing my host"; it is not gVisor/Kata.
Limitations
The sandbox boundary is the model's own label discipline, as described above.
Concurrent conversations share the container budget. With
SANDBOX_MAX=2, a third conversation evicts the LRU container — packages go, files stay.Restarting the service invalidates the client's MCP session; the client has to re-verify.
Image attachments depend on the client. FlowDown attaches MCP
imagecontent; other clients may not.gc-volumes.sh's age heuristic (newest mtime in the volume) has not been validated on btrfs. KeepDRY_RUN=1until you have watched it for a while.
Verified behaviour
Checked end-to-end against a live deployment (Raspberry Pi, Fedora 44 aarch64, rootless podman, cgroup v2, behind nginx):
Check | Result |
Debian userland, tools present | ✅ trixie; |
Network + | ✅ |
Same label reuses container | ✅ same |
New label, fresh container | ✅ different |
Files survive recycling | ✅ marker file kept its old hostname after rebuild |
Writable layer is discarded | ✅ |
Idle reaper | ✅ containers recycled after the idle window |
LRU eviction at | ✅ count stayed |
Exit codes | ✅ |
Container-side timeout | ✅ rc=124, process actually killed |
| ✅ |
cgroup limits applied | ✅ |
| ✅ rendered as an attachment |
| ✅ inlined / signed URL |
Path traversal | ✅ rejected |
Symlink escape | ✅ rejected |
Oversized image | ✅ falls back to a link |
Link expiry and signature tampering | ✅ expired and tampered URLs rejected |
Credential redaction in | ✅ |
Not yet exercised: the over-age branch of gc-volumes.sh.
This server cannot be deployed
Maintenance
Related MCP Connectors
Operate Linux, macOS and Windows from your LLM. Every action runs through an auditable allowlist.
- mcp-serverOAuthai.cdbx
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
A persistent Linux computer for your AI: what it installs and writes survives the session.
Remote shell and detached long-running jobs on your own machines — no SSH, open ports or VPN.
Related MCP Servers
FlicenseNot gradedqualityCmaintenanceEnables AI assistants to execute Python, JavaScript, Bash, and Go code in blazing-fast (~0.1ms startup), isolated cloud containers with secure, ephemeral environments that auto-destroy after use.156-- FlicenseNot gradedqualityBmaintenanceEnables ChatGPT to create, manage, and execute commands in ephemeral isolated Linux sandboxes on Railway, with file operations and checkpointing.-
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to operate a persistent Linux sandbox in the cloud, running commands, managing files, using Git, and publishing artifacts through a Streamable HTTP MCP endpoint.-
- AlicenseNot gradedqualityBmaintenanceEnables 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