Code MCP Server

MCP server for E2B code sandbox - Execute code and commands in secure E2B sandboxes

Local serverstdioPython

What is the Code MCP server?

Code MCP server is a locally run integration for AI assistants that speak the Model Context Protocol. MCP server for E2B code sandbox - Execute code and commands in secure E2B sandboxes.

What you get

MCP (Model Context Protocol) server for E2B code sandbox. This server provides tools to create, manage, and execute code in secure E2B sandboxes.

  • Create Sandbox — Create new E2B sandboxes with customizable timeout and template
  • Kill Sandbox — Terminate existing sandboxes by ID
  • Run Code — Execute Python code in sandboxes using Jupyter Notebook syntax
  • Run Command — Execute shell commands in sandboxes

Setting it up

Installation goes through your MCP client rather than a global install: point it at code-sandbox-mcp on PyPI and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

What the assistant can call

Once Code is connected, these are the calls the assistant has available:

  • Configuration — Add the following configuration to your MCP client settings JSON file (e.g., ~/.config/claude_desktop/claude_desktop_config.json for Claude Desktop

Configuration and credentials

You will need 2 environment variables: E2B_API_KEY, E2B_DOMAIN. The server will not start without them, which is usually why the tools fail to appear on a first run. Keep credentials in your client's env block or a secrets manager rather than in a file you might commit.

Before you rely on it

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Missing credentials fail quietly in some clients — if no tools show up, check the environment block first.
  • MCP clients confirm each tool call by default. Leave that on until you have watched what the code mcp server does with a few real requests.

Choosing this one

This sits in the developer tooling group, where several servers overlap in what they claim to do but differ sharply once you actually set them up. Code's toolset — Configuration — is a fair guide to whether it matches your workflow.

This entry was verified against Code's own documentation before publication; SyncDev keeps the directory reviewed rather than auto-generated.

Available tools

ToolWhat it does
ConfigurationAdd the following configuration to your MCP client settings JSON file (e.g., ~/.config/claude_desktop/claude_desktop_config.json for Claude Desktop, or .cursor/mcp.json for Cursor):

How to install the Code MCP server

{
  "mcpServers": {
    "code-sandbox-mcp": {
      "command": "uv",
      "args": ["run", "code-sandbox-mcp"],
      "env": {
        "E2B_API_KEY": "your_api_key_here",
        "E2B_DOMAIN": "your_domain_here"
      }
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
E2B_API_KEYCredential the server authenticates with.Yes
E2B_DOMAINConfiguration value read at startup.Optional

Example prompts to try

  • Use Code to Configuration.

Frequently asked questions

It connects Code to MCP-compatible AI assistants such as Claude and Cursor, exposing 1 tool (Configuration) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Code directly.