MCP server for Docker sandbox execution with pass-through-env support
Project description
sunaba
Most AI coding tools optimize for humans. sunaba optimizes for frontier LLMs.
Less context. Less trust. More structure.
An MCP server that runs an AI's test → verify → publish workflow inside disposable Docker containers. It assumes the model is already capable, so it spends its effort elsewhere: stripping away the context bloat, the broad host trust, and the raw-log noise that frontier models don't need — and shouldn't have.
What's different
Most sandboxing tools are built around a human watching a terminal. This one is built around a model reasoning over a small, structured context window:
- The LLM is assumed competent. No sprawling toolset to hand-hold it — a small set of first-class verbs (search, edit, verify, publish) plus an image full of CLIs it already knows.
- The context is never polluted. The payload — issue bodies, source files, diffs — stays inside the container. The model carries only
run_ids, handles, and structured summaries. - Output is structured, not raw. A green run is one line; a failure is
{test, error, file, line}. No 5000-line logs scrolling through the context window. - Trust is structural, not policy. The host is cut off by construction, so you grant the AI less standing access — not more careful prompts.
The result is an MCP whose value is as much about what it withholds from the model — context, trust, noise — as what it gives it.
Why sandbox?
AI coding agents that operate directly on the host filesystem carry maximum risk: a single rm -rf ~ or git push --force can destroy your working environment, SSH keys, and git configuration.
This MCP routes all AI operations through disposable Docker containers with structural safety guarantees:
| Guarantee | Mechanism |
|---|---|
| AI operations never touch the host | All file ops, package installs, and test runs happen inside the container. |
| No network by default | allow_network=True must be explicitly set. AI can't accidentally call external APIs or push to remotes. |
| Non-root execution | Container runs as unprivileged user sandbox. No sudo, no system package modifications. |
| VCS tokens stay host-side | The container never receives a GITHUB_TOKEN. Token values are masked in all output (KEY=***). |
| Audit trail | Every operation is recorded in an append-only journal (~/.sunaba/journal.log). |
Reducing host permissions
By placing a disposable container as a middle layer, you can turn off broad host execution permissions in your AI client. Host-level shell tools become unnecessary for the vast majority of tasks.
Design Philosophy
Four principles drive every decision in Sunaba:
- Security and convenience are not a tradeoff — the sandbox dissolves it: Inside the container, the AI operates with maximum convenience (like a local shell). To the host, the AI is structurally cut off, allowing you to disable local shell permissions.
- AI-first: return structure and diffs, not raw logs: Sunaba strips logs, ANSI colors, and library stack traces, returning only structured test failures (
{test, error, file, line}) or diffs. This keeps context windows small and reasoning accurate. - Defend the sandbox boundary — not "dangerous" commands: We do not try to filter "dangerous" commands inside the container. Instead, we strictly isolate the boundary using a default-deny Egress Proxy and host-side token resolution.
- The payload never passes through the LLM: Issue bodies, codebases, and diffs stay inside the container. The AI only carries resource handles, run IDs, and structured summaries.
For the full detailed rationale, see Design Decisions.
Typical Workflow
The core developer workflow is centered around a single 5-step loop:
clone_repo # Pull the repository into a fresh container
↓
write_file_sandbox # Edit in place (or transform_file for bulk/computed edits)
↓
verify_in_container # Lint + type-check, then runs tests → structured result
↓
checkpoint # Cheap in-container Git save point (no token, no gate)
↓
publish # Stage, squash checkpoints, push, and create PR (VCS token host-side)
The heavy data (repositories, full diffs, raw logs) lives and dies inside the container. The model only carries run_ids and structured summaries.
Quick Start (WSL2 / Linux Daemon Setup)
Sunaba is designed to run as a resident background service (daemon) under systemd to avoid stdio client timeouts (60 seconds) and support persistent token rotation.
Follow these three phases to install and start the service:
Phase 1: Install
Create a Python virtual environment and install the package from PyPI:
python -m venv ~/.local/share/sunaba-venv
~/.local/share/sunaba-venv/bin/pip install sunaba
To track unreleased main instead:
~/.local/share/sunaba-venv/bin/pip install git+https://github.com/masuda-masuo/sunaba
Phase 2: Setup (Keystore Setup)
The operator scripts live in the repository — the PyPI package ships the server, not the scripts — so clone it first:
git clone https://github.com/masuda-masuo/sunaba
cd sunaba
Register your GitHub App credentials into the OS keystore:
./scripts/setup.sh
Phase 3: Enable the systemd Service
./scripts/install-systemd.sh ~/.local/share/sunaba-venv
For client configurations (such as connecting Claude Desktop via mcp-remote) and advanced configurations, see the Daemon Setup Guide.
Prerequisites & First-Run Pitfalls
- Docker daemon must be running:
docker infoshould succeed before you start. - The first initialization can take several minutes: The first call to
sandbox_initializepulls the base sandbox images from GHCR. If using stdio, this can trigger client timeouts. We recommend using the systemd Daemon Setup to handle this. - Network is off by default: Anything that touches the network inside the container (e.g.
clone_repo,package_install) requires settingallow_network=Trueduring initialization.
Troubleshooting
| Symptom | Likely Cause | Fix |
|---|---|---|
Cannot connect to the Docker daemon |
Docker isn't running | Start Docker Desktop or dockerd. |
permission denied on docker.sock |
User isn't in docker group |
sudo usermod -aG docker $USER and log back in. |
sandbox_initialize times out |
Pulling image from GHCR exceeds 60s client timeout | Switch to the systemd background daemon. |
BLOCKED by egress proxy |
Host not allowlisted or allow_network is false |
Pass allow_network=True or add the host to SUNABA_ALLOWED_EGRESS_HOSTS. |
Documentation Map
Dive deeper into specific topics:
- Daemon Setup Guide: Detailed instructions on running Sunaba as a background
systemduser service, configuring token rotation, and connecting IDE clients. - Security & Network Containment: The Egress Proxy design, allowed host configurations, and token isolation details.
- Sandbox Images: Details on the
base,python, andgoDocker images, included tools, and language auto-detection. - MCP Tool Reference: A complete reference table of every tool — 22 by default, plus 5 opt-in observability tools.
- Observability & Dashboard: The local web dashboard, append-only execution logging, replay traces, and push notification triggers.
- Contributing Guide: Local developer setup instructions (
pip install -e .[test]) and test commands. - Design Decisions: Detailed rationale and design logs.
- Changelog: Release version history and migration guides.
Known Limitations
- No local export (No host write-back): To prevent host contamination, file transfer is strictly one-way (host → container). The only way to export changes from the sandbox is via
publishto a GitHub repository. Purely local projects that are not hosted on GitHub cannot be round-tripped. - Job state is in-memory: Background job results (
sandbox_exec_background) are lost on server restart. Userun_container_and_execfor critical one-shot operations. - Job list grows unbounded: Completed job results accumulate in memory (not an issue for typical short-lived sessions).
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sunaba-0.9.0.tar.gz.
File metadata
- Download URL: sunaba-0.9.0.tar.gz
- Upload date:
- Size: 311.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e98a53aad8ee8bb3e3bf9fbb70141ddf7fb44e8aa2f73d5e8a430319165ec1d9
|
|
| MD5 |
1f8057b53bca21cabfb6f8775baa2bb5
|
|
| BLAKE2b-256 |
6b61f1d753f4ae8d7477e0ccb6c2e8f0889c12023b200f07d6ad9acf667de9ab
|
Provenance
The following attestation bundles were made for sunaba-0.9.0.tar.gz:
Publisher:
publish-pypi.yml on masuda-masuo/sunaba
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sunaba-0.9.0.tar.gz -
Subject digest:
e98a53aad8ee8bb3e3bf9fbb70141ddf7fb44e8aa2f73d5e8a430319165ec1d9 - Sigstore transparency entry: 2152661647
- Sigstore integration time:
-
Permalink:
masuda-masuo/sunaba@0b38356ae5d0990f7e42761ba4e4137458b43d83 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/masuda-masuo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@0b38356ae5d0990f7e42761ba4e4137458b43d83 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sunaba-0.9.0-py3-none-any.whl.
File metadata
- Download URL: sunaba-0.9.0-py3-none-any.whl
- Upload date:
- Size: 193.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34b6a1b9a0fa7e9b6b7d1b983f29b515fa2c8a100eef108bd9829e6e885cf70b
|
|
| MD5 |
7e59e307e0ca19dcfbe1ebd6c4d070bc
|
|
| BLAKE2b-256 |
e315549827d196de8f942897877f97ee6b95a5fe35d3bf56e6f8ce04dbd8ca23
|
Provenance
The following attestation bundles were made for sunaba-0.9.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on masuda-masuo/sunaba
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sunaba-0.9.0-py3-none-any.whl -
Subject digest:
34b6a1b9a0fa7e9b6b7d1b983f29b515fa2c8a100eef108bd9829e6e885cf70b - Sigstore transparency entry: 2152661738
- Sigstore integration time:
-
Permalink:
masuda-masuo/sunaba@0b38356ae5d0990f7e42761ba4e4137458b43d83 -
Branch / Tag:
refs/tags/v0.9.0 - Owner: https://github.com/masuda-masuo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@0b38356ae5d0990f7e42761ba4e4137458b43d83 -
Trigger Event:
release
-
Statement type: