wasmer-sandbox-mcp
Provides tools for interacting with the Wasmer platform, including running Python code and commands inside isolated Wasmer sandboxes, managing sandbox files, installing Wasmer registry packages, and querying deployment and observability information from Wasmer Edge.
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., "@wasmer-sandbox-mcp Run Python in the sandbox to compute the first 15 Fibonacci numbers and print them."
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.
wasmer-sandbox-mcp
A Wasmer DX exercise, shaped as a working product: one Python package that ships two MCP
servers — an Edge-deployed Postgres/observability server and a host-local wasmer_sdk
sandbox companion — built specifically to push on Wasmer's newest surface and write down
every place it pushed back.
The primary deliverable is FEEDBACK.md — 40 issue-ready entries, each
with versions, a reproducer, verbatim output, and a proposed fix. The code exists to
generate that ledger honestly; read the ledger first.
Live app: https://wasmer-sandbox-mcp.wasmer.app/mcp
Why two servers
wasmer_sdk is a native host-only library. There is no wasix_wasm32 wheel for it and no
remote backend, so the sandbox SDK cannot run on Wasmer Edge — the platform its own
vendor ships (see FEEDBACK.md F-004). Nothing in the announcement says
this. So the split is not a design flourish: it is the finding, made executable. The Edge
server gets everything WASIX can carry; the sandbox server stays on the host, and the two
attach to the same MCP client at the same time.
Related MCP server: sandbox-mcp
Architecture
wasmer_mcp/server_edge.py builds an mcp 2.x MCPServer over streamable HTTP, stateless,
with JSON responses, bound explicitly to 0.0.0.0 on $PORT → $FASTMCP_PORT → 8000.
main.py is the anybuild entrypoint and also exposes a module-level ASGI app.
wasmer_mcp/db.py holds a small pg8000 layer over Edge Postgres — DSN assembled from the
five injected DB_* variables, TLS on, keyset pagination on the primary key.
wasmer_mcp/models.py is the boundary: every argument is parsed by pydantic before it
reaches SQL, so an invalid area is refused by the schema and never touches the database.
wasmer_mcp/sandbox.py owns a two-slot warm sandbox pool keyed by network policy
(network is a create-time parameter, so one slot cannot serve both), with a host-side
deadline around every run. wasmer_mcp/server_local.py serves those over stdio.
app.yaml carries the Postgres capability, the fr-roub1 region pin, and two cron jobs.
Tool surface
Edge server — wasmer-edge-echo, streamable HTTP at /mcp, needs the deployment.
Tool | When to use |
| Check the deployed instance: database reachability and latency, region, versions, uptime. |
| Save a note that outlives the conversation; returns its id. |
| Fetch one note back by the id |
| Browse notes newest-first, optionally narrowed by tag or text; paginate with |
| Report friction hit while using Wasmer, from inside a session, so it lands in the database. |
| Read those friction reports back, newest first. |
Local companion — wasmer-sandbox, stdio, needs wasmer_sdk on the host.
Tool | When to use |
| Execute Python inside an isolated Wasmer sandbox and get |
| Run any command available in the sandbox, with arguments. |
| Put a text file into the sandbox before running code against it. |
| Read a file the sandbox produced. |
| See what is in a sandbox directory, with kind and size. |
| Install a Wasmer registry package into the sandbox and list the commands it adds. |
| Check whether the slots are warm before a latency-sensitive call. |
| Throw away accumulated guest state and start clean. |
Sandbox state persists between calls by design — a file written by one tool is visible
to the next, and reset_sandbox is the escape hatch.
Both servers answer with the same grammar: success returns the payload object directly,
failure returns {"error": {"code", "message", "hint"}} where hint names the next action.
Quickstart
Local development
uv sync --extra local --extra dev
uv run --extra local wasmer-mcp-local # sandbox server over stdio
uv run python main.py # Edge server locally on 0.0.0.0:8000
uv run pytest -q # 42 offline tests, ~0.6 s, no networkWire it into Claude Code
.mcp.json is committed and works from a fresh clone:
{
"mcpServers": {
"wasmer-sandbox": {
"type": "stdio",
"command": "uv",
"args": ["run", "--extra", "local", "wasmer-mcp-local"]
},
"wasmer-edge-echo": {
"type": "http",
"url": "https://wasmer-sandbox-mcp.wasmer.app/mcp"
}
}
}The first sandbox call after a cold cache costs ~26 s; the server pre-warms in the
background and returns a warming error with a retry hint rather than blocking.
Deploy
WASMER_BIN=/path/to/wasmer-7.x/bin/wasmer scripts/deploy.shTwo things that script encodes, both learned the hard way:
The
wasmerCLI must be 7.x. anybuild 0.28.3 drives a 6.1.0 CLI throughwasmer run --volume, which it rejects, and 6.1.0's package upload dies on a bare HTTP 500 from the registry. 7.4.0 works first try (F-019, F-020).It builds from a staging copy of git-tracked files only. anybuild's Python provider copies the whole project directory into the image and ignores
.gitignore— 213 MB from a 100 KB project (F-021). Staging what git tracks also makes this path match push-to-deploy, which by definition sees only tracked files.
anybuild installs to ~/.anybuild/bin/anybuild (curl -fsSL https://anybuild.run/install | sh);
override with ANYBUILD_BIN.
Live checks and the feedback exporter
WASMER_LIVE=1 uv run pytest -q tests/test_live.py # one Edge round-trip, one sandbox run
uv run python scripts/export_feedback.py # feedback rows as ledger-shaped blocksThe live checks are skipped by default — a live-by-default suite is unrunnable offline. The
exporter writes to stdout and deliberately does not edit FEEDBACK.md: table rows are lower
fidelity than curated entries, and a human decides what gets promoted.
Push-to-deploy — USER ACTION
The repository is prepared so that a single push deploys, but the last mile requires an authenticated browser session and a GitHub app authorization. Do these in order:
Create the GitHub repository (your choice of name and visibility) and add it as
origin.Push
main.Open the Wasmer dashboard and select the
wasmer-sandbox-mcpapp.Open the app's Git settings and choose GitHub as the repository provider.
Authorize Wasmer for the repository or organization if prompted.
Select the repository, then select branch
mainas the production branch.Push a trivial commit and confirm a deployment starts on its own.
Before that link exists, a push does nothing — keep using scripts/deploy.sh. Once it
exists, app.yaml in the repository extends the app's configuration on every deployment,
so the region pin, the Postgres capability, and both cron jobs travel with the push.
GitHub Actions (optional, currently untested)
.github/workflows/deploy.yml is the alternative path: wasmerio/setup-wasmer@v3.1 pinned
to CLI 7.4.0, anybuild installed inline, then scripts/deploy.sh with WASMER_TOKEN from
repository secrets. It has never run — there is no repository yet — and it is included
for the comparison between the two paths, which is one of the things this exercise is for.
Do not enable both paths. A dashboard Git link and this workflow on the same branch deploy the same commit twice. Pick one; if you pick the dashboard, delete the workflow.
To use it: add WASMER_TOKEN as a repository secret, and disconnect the dashboard Git link.
Wasmer feature coverage
What this project actually exercised, and what it found. Ids are FEEDBACK.md entries.
Feature | Exercised how | Status | Ledger |
Edge: Python + uvicorn on WASIX | flat project, anybuild-built, | works, with workarounds | F-009, F-018, F-021 |
Edge: streamable-HTTP MCP |
| works | — |
Edge Postgres |
| works, after a driver swap | F-013, F-022, F-025, F-026 |
Edge cron: |
| works | F-027 |
Edge cron: |
| works with workaround | F-035, F-036, F-037, F-010, F-028 |
anybuild |
| works, with workarounds | F-019, F-021, F-024, F-025 |
| forced upgrade after three separate 6.1.0 failures | works on 7.4 only | F-017, F-019, F-020, F-012 |
SDK: sandbox create + run | two-slot warm pool; | works | F-031 |
SDK: timeouts | host-side deadline around every run, because the SDK's own | works, with workaround | F-029, F-030 |
SDK: filesystem | write / read / list, with guest paths normalised into the addressable root | works, with workaround | F-033, F-006 |
SDK: |
| partly broken | F-034 |
SDK: networking | create-time | works | F-032 |
Sandboxed SQL via | not attempted (stretch, cut) | not done | F-008 |
Edge email ( | not attempted — paid plan | not done | F-011 |
GitHub push-to-deploy | repository prepared; dashboard link is the user action above | pending | F-003, F-040 |
GitHub Actions deploy | workflow committed | untested | F-039 |
Repository map
Path | What |
| anybuild entrypoint and module-level ASGI app |
|
|
| the prune CLI, kept as the local runner and as the |
| Edge app configuration and the generated build definition |
| staged deploy; |
| 42 offline tests plus two live checks behind |
| the deliverable |
No secret is committed. DB_* are injected by the platform; WASMER_TOKEN lives only in
repository secrets or your shell.
Available Tools
8 toolsget_sandbox_infoA
Report whether the sandboxes are warm, and what they are running.
Use it when a call came back warming, when one was unexpectedly slow, or before a
long task. There are two sandboxes, one per network policy (off and host), warmed
independently; warm: false means the first call for that policy pays the ~26 s
download-and-compile cost.
Inputs: no named parameters. Returns: object
install_sandbox_packageA
Install a Wasmer registry package into the sandbox and report the commands it adds.
Use it to get a tool the sandbox does not already have — the guest starts with only
Python. package is a registry name like wasmer/edgejs or wasmer/edgejs@0.2.0.
The returned commands are exactly the names run_command can then call. The install
persists for the life of the sandbox, so it survives later calls until reset_sandbox.
Inputs: package (required), network. Returns: object
list_sandbox_dirA
List the contents of a directory inside the sandbox.
Use it to find out what is actually there before reading or running something —
especially after install_sandbox_package, or when a read_sandbox_file came back
not_found. Returns each entry's name, kind and size.
Inputs: path, network. Returns: object
read_sandbox_fileA
Read a text file from inside the sandbox.
Use it to collect a file that sandboxed code produced, or to check what an earlier
write_sandbox_file left behind. Long files come back capped as head + tail with the
elision marked, and truncated: true says so. network selects which sandbox, and a
file written to one is not visible in the other.
Inputs: path (required), network. Returns: object
reset_sandboxA
Throw away the sandbox's accumulated state and start a fresh one.
Use it when earlier files, installed packages or environment changes are getting in the
way, or when a sandbox is behaving oddly. Pass network as "off" or "host" to
reset just that one; omit it to reset both. The replacement warms in the background, so
the next call may answer warming — that is expected.
Inputs: network. Returns: object
run_commandA
Run any command available inside the Wasmer sandbox, with arguments.
Use it for non-Python work in the sandbox — a shell utility, or a binary that
install_sandbox_package added. command is the command name, and args its
arguments as a list (not a shell string: there is no shell splitting, quoting or
piping). Returns the same result shape as run_python.
The sandbox is long-lived, so this command sees files and packages left by earlier
calls, and its own side effects persist until reset_sandbox.
Inputs: command (required), cwd, env, args, +2 more. Returns: object
run_pythonA
Run Python code inside an isolated Wasmer sandbox and get back its output.
Use it to execute code you do not want touching this machine: untrusted snippets,
experiments, quick calculations, anything with side effects you would rather contain.
code is passed to python -c, so print what you want to see. Set network=true only
when the code must reach the internet — that routes to a second sandbox with the host's
network and its own separate state. Returns exit_code, stdout, stderr, reason
and duration_ms; a non-zero exit_code is a normal result, not an error.
The sandbox is long-lived: files written and packages installed by earlier calls are
still there, and anything this code writes stays for the next one. Call
reset_sandbox when you want a clean slate.
Inputs: code (required), stdin, network, timeout_s. Returns: object
write_sandbox_fileA
Write a text file inside the sandbox, creating parent directories as needed.
Use it to put a script, a fixture or input data where sandboxed code can read it —
run_python and run_command in the same sandbox see the same filesystem. Use an
absolute path such as /tmp/input.json. The network flag selects which sandbox,
and the two do not share a filesystem: write and read with the same value. Overwrites
an existing file without asking. Returns the path and the number of bytes written.
Inputs: path (required), content (required), network. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools are sharply distinguished (file read/write/list, package install, reset, info). The only potential confusion is run_python vs run_command, since run_command could also invoke Python, but the descriptions draw a clear boundary by directing run_command to non-Python work.
All eight tools follow a consistent snake_case verb_noun pattern (run_, get_, write_, read_, list_, install_, reset_). The run_ versus sandbox_ prefixes correspond to a meaningful semantic split between execution and sandbox management, so there is no real inconsistency.
Eight tools is well within the ideal 3-15 range and maps cleanly to the server's purpose: two executors, three filesystem operations, package installation, state inspection, and reset. Each tool earns its place with no redundant entries.
The domain — isolated code execution with persistent sandbox state — is well covered: execute, read/write/list files, install packages, inspect, and reset. The only minor gap is the lack of a dedicated file removal tool, but agents can work around it via run_command('rm', ...) or reset_sandbox.
Maintenance
Related MCP Connectors
Execution platform for AI agents on Firecracker microVMs in the EU. Interactive Linux sandboxes with root, templates for Python, Node.js, Go, Rust and a headless browser, public HTTPS URLs. Background jobs that outlive the connection, batches of up to 1,000 jobs with dependencies, hard cost caps reserved up front, execution receipts with SHA-256, log digests that fit the context. IPv4, dual-stack or IPv6-only with its own public address, allowlists or no network. WASI runtime for small tasks. Idle sandboxes sleep and keep their files. Also REST API, Python SDK and LangChain.
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Build, verify and deploy full-stack apps: Postgres, sign-in, workflows, realtime, AI, rollback.
Cloud Linux VMs for your agent: run code, Docker, files and HTTPS previews in a Sandboxer microVM.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceThe sessionless code interpreter. Securely run AI-generated code in stateful sandboxes that run forever.230MIT
- FlicenseNot gradedqualityDmaintenanceEnables secure execution of bash, Python, and Node.js code in isolated Firecracker microVMs with configurable timeouts and no network access.-
- AlicenseAqualityBmaintenanceEnables AI coding agents to safely run commands, install dependencies, test, and modify code inside disposable, policy-enforced Docker sandboxes isolated from the host, returning results and diffs.15MIT
- FlicenseNot gradedqualityBmaintenanceEnables AI coding agents to run shell commands, spawn persistent background tasks, and read/write files inside isolated remote container sandboxes on a VPS. It also provides project workspace listing, task attach/kill controls, and a searchable knowledge graph for memory continuity across sessions.-