lambda-microvm-sandbox-mcp
Provides tools to create, manage, and destroy disposable AWS Lambda MicroVM sandboxes, allowing command execution, file operations, and port forwarding in isolated Firecracker VMs within your own AWS account.
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., "@lambda-microvm-sandbox-mcpCreate a sandbox, upload the project, run tests, then destroy."
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.
lambda-microvm-sandbox-mcp
Give your AI coding agent a disposable Linux machine instead of your laptop.
lambda-microvm-sandbox-mcp is an MCP server
that lets Claude Code, Kiro and other MCP clients create isolated sandboxes on
AWS Lambda MicroVMs, run commands in them, move files in and out, and throw
them away. Each sandbox is a fresh Firecracker VM in your own AWS account with
git, Python, Node.js and a C toolchain preinstalled, and it boots in about two
seconds.
Why
Real isolation. Commands run in a Firecracker VM, not in a container on your machine. A
rm -rfor a maliciousnpm installcannot touch your files or your credentials: the VM has no IAM role and only reaches the internet.Fast and cheap. A sandbox is ready in ~2 s, suspends automatically while the agent is thinking (no compute charges), resumes in ~1 s on the next call, and is destroyed after at most 8 hours. A 2 GB sandbox costs about $0.13 per hour while running.
Nothing to host. No servers, clusters or daemons. One
setupcommand builds the VM image in your account; the MCP server runs locally vianpx.Made for agents. Tools return structured results, long commands time out cleanly, output is capped, and the agent is told exactly what to do when something is missing.
Related MCP server: agent-sandbox-mcp
How it works
Claude Code / Kiro ──stdio──▶ lambda-microvm-sandbox-mcp (npx, on your machine)
│ AWS SDK: RunMicrovm, tokens, suspend/resume/terminate
▼
AWS Lambda MicroVMs
│ HTTPS + per-VM auth token + per-VM secret
▼
Firecracker VM (Amazon Linux 2023)
└─ sandbox-agent: exec / files API, lifecycle hooks, sudo relayThe MCP server is the only thing that holds AWS credentials. It starts VMs from
an image you built once, mints short-lived tokens, and talks to a small agent
inside each VM. Commands run as an unprivileged sandbox user with passwordless
sudo, so agents can sudo dnf install what they need without being able to
kill the agent that controls the VM.
Quick start
1. Build the sandbox image in your AWS account (once, about three minutes).
MicroVM images cannot be shared between accounts, so setup creates a private
S3 bucket, a least-privilege build role and the image from assets shipped in
the npm package. It shows the plan and asks before creating anything.
npx lambda-microvm-sandbox-mcp setup --region ap-northeast-1
npx lambda-microvm-sandbox-mcp doctor --region ap-northeast-1 # verifyPrefer infrastructure as code? Deploy
cloudformation/prerequisites.yaml
and pass its outputs: setup --bucket <name> --build-role-arn <arn>.
2. Register the server with your agent.
Claude Code (.mcp.json in your project):
{
"mcpServers": {
"lambda-sandbox": {
"command": "npx",
"args": ["-y", "lambda-microvm-sandbox-mcp", "--region", "ap-northeast-1"]
}
}
}Kiro (.kiro/settings/mcp.json):
{
"mcpServers": {
"lambda-sandbox": {
"command": "npx",
"args": ["-y", "lambda-microvm-sandbox-mcp"],
"env": { "AWS_REGION": "ap-northeast-1" },
"autoApprove": ["sandbox_exec", "sandbox_read_file", "sandbox_list_files", "sandbox_status", "sandbox_list"]
}
}
}The server uses your normal AWS credential chain (AWS_PROFILE, SSO, env vars).
3. Ask your agent to use it.
Create a sandbox, upload this project into it, run the test suite there and report the failures. Destroy the sandbox when you are done.
The agent will call sandbox_create, sandbox_upload_dir, sandbox_exec,
read what it needs, and finish with sandbox_destroy.
Tools
Tool | What it does |
| Start a VM and wait until it accepts commands. Returns |
| Run a bash command with |
| File operations, absolute or relative to |
| Move directories in and out as tar.gz ( |
| Expose a port inside the sandbox as |
| Pause compute billing while keeping state; suspended VMs auto-resume on the next call. |
| State and reason; VMs that Lambda already terminated are reported once. |
| Tail the VM's CloudWatch logs (optional, needs |
| Terminate the VM. |
Every option of the server has a flag and an environment variable; run
npx lambda-microvm-sandbox-mcp --help. The full reference lives in
packages/mcp-server/README.md.
Cost and limits
Running sandbox (2 GB / 1 vCPU, ARM) | ≈ $0.13 per hour, billed per second |
Suspended sandbox | no compute charge |
Image snapshot storage | ≈ $0.08 per GB-month, minimum one week |
Sandbox lifetime |
|
Auto-suspend | after |
Bandwidth to a 2 GB sandbox | about 4 MB/s, so keep uploads small |
The agent is reminded in every tool description to destroy sandboxes it no
longer needs. sandbox_list shows anything still running.
Security model
The VM has no IAM execution role by default. Your AWS credentials stay on your machine; the sandbox can only reach the public internet (or nothing, with
--no-internet-egress). Opt in to a CloudWatch-Logs-only role (setup --execution-role, then--execution-role-arn) when you want the VM's own logs.Every request to a VM carries a Lambda-issued token that is valid for one VM and one port, plus a per-VM secret generated at creation and delivered through the
/runlifecycle hook. Neither is ever written into the image.Commands run as user
sandbox.sudoworks, but as a shim that relays to the root agent over a group-restricted unix socket, because the container runs withno_new_privileges.as_root: trueonsandbox_execdoes the same.Known sandboxes are stored in
~/.lambda-sandbox/sandboxes.json(mode 0600).The image is Amazon Linux 2023 minimal, so
dnfis reallymicrodnfand the defaultpython3is 3.9. Add what you need withsudo dnf install -y ….
Repository layout
packages/mcp-server– the npm package: MCP server,setup,doctor, CloudFormation template.packages/sandbox-agent– the agent baked into the VM image and itsDockerfile.docs/– research notes and the implementation log.
See CONTRIBUTING.md for development, tests, CI and releases.
License
This server cannot be deployed
Maintenance
Related MCP Connectors
Linux microVM sandboxes for AI agents: run commands, files, processes, pause and wake.
Persistent Linux microVMs for agents: root, internet, sub-second resume and a public URL.
- mcp-serverOAuthai.cdbx
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
MCP server for Superserve sandboxes: create, exec, and manage Firecracker microVMs
Related MCP Servers
- AlicenseAqualityBmaintenanceConnects AI agents to microsandbox for creating lightweight sandboxes, executing code, managing files, and monitoring resources.19449 npm15Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to create, manage, and execute code in isolated Firecracker microVM sandboxes via the MCP protocol, with support for sandbox lifecycle and file operations.3Apache 2.0
- AlicenseNot gradedqualityAmaintenanceEnables time-travel debugging for AI agent sandboxes using Firecracker microVMs, with tools for code execution, file operations, and VM snapshot/restore via MCP.63 PyPI1MIT
- AlicenseAqualityBmaintenanceEnables AI coding agents to safely execute code, run tests, and build projects inside disposable Docker sandboxes, protecting the host machine through enforced isolation, filesystem snapshots, and network controls.15MIT