E2B Sandbox MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
An MCP (Model Context Protocol) server that connects Claude Code with E2B cloud sandboxes, giving you isolated Linux VMs to work on any GitHub repository without touching your local machine.
What It Does
This server provides Claude Code with 29 tools to create cloud sandboxes, clone repos, run commands, manage files, and perform git operations — all in a secure, disposable Linux environment.
**Your local machine stays untouched.** Every operation happens inside an E2B sandbox VM.
Token Savings
Running commands through E2B sandboxes instead of local Bash reduces the tokens consumed per conversation. Tool outputs are structured and truncated (100KB per stream, 200KB total), so large build/test outputs don't flood your context window.
| Project Size | Example | Local Bash Tokens | E2B Sandbox Tokens | Savings |
|---|---|---|---|---|
| **Small** | Express API, ~10 files | ~15K-25K | ~10K-18K | ~20-30% |
| **Medium** | Next.js app, 50-100 files | ~50K-100K | ~25K-45K | ~40-55% |
| **Large** | Monorepo, 500+ files | ~200K-500K+ | ~60K-120K | ~60-75% |
**Why it scales:** A local npm install on a monorepo can dump 10K+ lines into context. A full test suite adds thousands more. With E2B, those outputs are capped and structured. Background processes (sandbox_exec_background) return only a process ID — zero streaming output. Directory listings are capped at 1000 entries. The result: your context window stays available for actual work instead of being consumed by terminal noise.
Use Cases
Work on Any GitHub Repo Remotely
Clone any repository into a sandbox, run its build and test suite, make changes, and push — without ever installing the project locally.
Safe Experimentation
Try risky changes — dependency upgrades, major refactors, migration scripts — in a throwaway environment. If it breaks, sandbox_kill and start fresh.
Persistent Development Sessions
Pause a sandbox when you're done for the day, resume it tomorrow with all your files and state intact. No more rebuilding environments from scratch.
Preview Dev Servers
Start a web app in a sandbox and get a public URL to preview it in your browser — no port forwarding or tunneling needed.
Multi-Repo Parallel Work
Spin up multiple sandboxes, clone different repos, work on all of them simultaneously. Each sandbox is fully isolated.
Clean CI-Like Testing
Run your full test suite in a fresh Linux environment. Catch "works on my machine" issues before pushing to CI.
Open Source Contributions
Fork a repo, clone it in a sandbox, make your changes, commit, and push to your fork — all without local project setup.
Code Review in a Live Environment
Clone a PR branch into a sandbox, run the tests, inspect the changes, and verify the behavior — without checking out the branch locally.
Getting Started
Prerequisites
- Node.js >= 18
- Claude Code CLI installed
- E2B API key (free tier available)
- GitHub Personal Access Token (optional, for private repos and push)
1. Register with Claude Code
No separate install needed — just point Claude Code at the npm package with npx:
Restart Claude Code after adding the server.
Alternative: global install
If you prefer a global install instead of npx:
2. Use It
Start Claude Code and ask it to work on any repo:
> "Create a sandbox, clone https://github.com/expressjs/express, and run the test suite"