Get the FREE Ultimate OpenClaw Setup Guide →

mcp

Giving Claude ability to run code with E2B via MCP (Model Context Protocol)

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio e2b-dev-mcp-server npx -y e2b

How to use

The E2B MCP Server extends your Claude Desktop environment with code-interpreting capabilities via the E2B Sandbox. It supports two editions: a JavaScript edition and a Python edition, each providing tooling to interpret and run user-provided code within a safe sandbox. With this MCP server running, Claude Desktop can invoke the sandboxed interpreters to execute code snippets, evaluate results, and return outputs back to the host application. This enables dynamic code evaluation, experimentation, and integration of custom logic into your Claude-based workflows. The server acts as the bridge between Claude and the E2B sandbox, exposing endpoints and tooling that you can leverage from your client app.

To use the tools, start the MCP server and ensure your client (e.g., Claude Desktop) connects to it as configured in your environment. You can choose the JavaScript or Python edition depending on the language you want to support for interpretation. The JavaScript edition provides a sandboxed JS execution environment and utilities for handling input/output securely, while the Python edition exposes a Python runtime with a curated standard library and safety checks. Utilize the client’s configuration to route code execution requests to the appropriate interpreter in the sandbox, and handle results or errors back in your app.

How to install

Prerequisites:

  • Node.js and npm (for the JavaScript edition and runtime)
  • Python (for the Python edition, if you intend to use Python tasks)
  • Internet access to install dependencies via npm/npx

Installation steps:

  1. Install the MCP server via Smithery (recommended for Claude integration):

    • Run: npx @smithery/cli install e2b --client claude
  2. If you prefer manual setup without Smithery, install the JavaScript edition dependencies:

    • Ensure Node.js and npm are installed
    • Install the e2b package (as documented in the repository): npm install -g e2b
  3. Start the MCP server:

    • For the Smithery-based flow, follow the provided Smithery command output after installation
    • If running locally, ensure your environment is configured to start the server and listen on the expected port (as defined by your setup)
  4. Configure your client (Claude Desktop) to connect to the MCP server endpoint as produced during runtime. If using the JavaScript edition, point to the JavaScript runtime; if using the Python edition, configure the Python runtime accordingly.

Additional notes

Tips and considerations:

  • Environment variables: you may need to configure API keys or sandbox options for the E2B service. Consider vars like E2B_API_KEY, E2B_SANDBOX_URL, and E2B_CLIENT_ID as placeholders to set in your environment.
  • Security: code is executed in a sandbox; ensure your host application enforces appropriate sandbox policies and resource limits.
  • Versioning: the JavaScript and Python editions may have version-specific features. Align client usage with the edition you deploy.
  • Debugging: check logs from the MCP server if the client cannot connect. Verify that the server is listening on the expected port and that any firewall rules allow traffic.
  • Updates: use Smithery or your package manager to pull the latest E2B MCP server updates when available.

Related MCP Servers

Sponsor this space

Reach thousands of developers