E2B MCP Server

Official

Give your assistant a real code sandbox — isolated cloud VMs for actually running the code it writes.

Local serverstdioTypeScriptApache-2.0 400

What is the E2B MCP server?

LLMs write code fluently but can't know whether it runs. The E2B MCP server closes that loop by giving your assistant a sandbox: an isolated cloud microVM (Firecracker-based, ~150ms startup) where it can execute Python or JavaScript, see the real output, hit real exceptions, and iterate until things actually work.

The quality difference is easy to underestimate. Ask an assistant for a data-transformation script and you get plausible code; ask it to run that script on a sample in a sandbox and you get code that has already survived contact with reality — off-by-one pagination, encoding surprises, a NaN where the docs promised a number. Verified output beats confident guessing every time.

Because the sandbox is isolated from your machine, it's also the safe way to let a model execute code at all. Nothing it runs can touch your filesystem, your credentials or your network position; the blast radius is a disposable VM that vanishes when the session ends. That's the correct architecture for agentic code execution, and E2B made it the easy default rather than an infrastructure project.

Typical uses run from "quick calculator for anything" (parsing a CSV, testing a regex against real strings, checking whether an algorithm handles the edge case) up to full analysis sessions where the assistant installs packages, processes uploaded data and returns charts. The free tier is generous enough for individual development, and the same sandboxes scale up under products via E2B's SDKs when you graduate from chat to shipping.

Getting more out of a session

  • Execution state persists across calls in a sandbox the way a notebook kernel does, so a DataFrame built in one step is still there in the next. Ask the assistant to stay in the same sandbox rather than re-pasting data.
  • Sandboxes idle out after a few minutes by default. Long analyses go better as a handful of substantial calls than as a trickle of one-liners that keeps respawning the VM.
  • !pip install works inside the Python sandbox because the microVM has outbound network access — which also means it can fetch a public dataset directly instead of you uploading one.
  • Nothing on your own disk is visible in there. Whatever the code operates on has to arrive inline in the snippet or be downloaded by the code itself.

What you can do with it

Verified code generation

The assistant runs what it writes, hits the real errors, and hands you code that already works.

Safe execution of untrusted code

Model-generated code runs in a disposable microVM, never on your machine.

Data analysis on demand

Parse files, crunch numbers and produce results inside the conversation.

Available tools

ToolWhat it does
run_codeExecute Python or JavaScript in an isolated cloud sandbox and return stdout, stderr and results

How to install the E2B MCP server

{
  "mcpServers": {
    "e2b": {
      "command": "npx",
      "args": ["-y", "@e2b/mcp-server"],
      "env": { "E2B_API_KEY": "your-e2b-api-key" }
    }
  }
}

Configuration

An E2B account and API key. Free tier covers development use; Node.js 18+ for the connector.

VariableDescriptionRequired
E2B_API_KEYAPI key from the E2B dashboard (free tier available)e.g. e2b_...Yes

Example prompts to try

  • Write a function that parses this date format, then run it against these ten examples to prove it works.
  • Run a quick simulation: if churn is 4% monthly, how many of 10,000 users remain after two years?
  • Test whether this regex handles unicode domains — run it on some tricky cases.

Frequently asked questions

Isolation. Model-generated code can be wrong in destructive ways; in an E2B sandbox the worst case is a dead disposable VM, not your filesystem. It's the difference between a firing range and your living room.