How to integrate E2b MCP with Codex

Connect Codex to E2b MCP. Run a python script to analyze csv data, execute javascript code to validate user input, and more using natural language, with authentication handled for you.

E2b logoE2b
Api Key

E2b is an open-source platform for running code in secure, sandboxed environments. It enables safe multi-language code execution for AI-powered apps.

59 Tools

Introduction

Codex is one of the most popular coding harnesses out there. And MCP makes the experience even better. With the E2b MCP integration, Codex can create and pause sandboxes, build sandbox templates, check sandbox logs and metrics, set timeouts, and configure webhooks, all without leaving the terminal or the app, whichever you prefer.

For exact tool slugs and parameter tables, see the tool catalog in the Composio docs.

Also integrate E2b with

Why use Composio?

Apart from a managed and hosted MCP server, you will get:

  • CodeAct: A dedicated workbench that allows GPT to write its code to handle complex tool chaining. Reduces to-and-fro with LLMs for frequent tool calling.
  • Large tool responses: Handle them to minimise context rot.
  • Dynamic just-in-time access to 20,000 tools across 1700+ other Apps for cross-app workflows. It loads the tools you need, so GPTs aren't overwhelmed by tools you don't need.

How to install E2b MCP in Codex

Run the setup command

Run this command in your terminal to add the Composio MCP server to Codex.

Terminal

It will initiate the authentication in a browser window, authorize Codex to access your Composio account.

Composio authentication page

(Optional) Authenticate with OAuth

To authenticate manually, run the login command to open a browser window and authorize Codex to access your Composio account.

bash
codex mcp login composio

Verify the connection

Run codex mcp list to confirm Composio appears as a registered MCP server.

bash
codex mcp list

Codex App

Codex App follows the same approach as VS Code.

  1. Click ⚙️ on the bottom left → MCP Servers → + Add servers → Streamable HTTP:
  2. Fill the header and Key fields with { "x-consumer-api-key" = "ck_*******" }.
  3. The Key is the Composio API key, that you can find on dashboard.composio.dev
  4. Click on Authenticate and authorize Codex to your Composio account and you're all set.
Codex App MCP setup
  1. Restart and verify if it's there in .codex/config.toml
bash
[mcp_servers.composio]
url = "https://connect.composio.dev/mcp"
http_headers = { "x-consumer-api-key" = "ck_*******" }

Try it

Ask Codex for a E2b task. The first time, Composio asks you to connect your E2b account.

For example, ask it to:

  • "Run a Python script to analyze CSV data"
  • "Execute JavaScript code to validate user input"
  • "Start a sandbox and list installed packages"

What is the E2b MCP server, and what's possible with it?

The E2b MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your E2b account. It provides structured and secure access to your sandboxes, templates, and webhooks, so your agent can create and manage sandboxes, configure templates, control sandbox lifecycles, and manage webhook notifications on your behalf.

  • Sandbox creation and monitoring: Have your agent create sandboxes from templates, connect to existing environments, inspect sandbox details, and list active or paused sandboxes.
  • Sandbox lifecycle control: Let the agent pause, refresh, or permanently delete sandboxes based on your development and testing needs.
  • Timeout management: Direct your agent to set sandbox timeouts and extend how long an active environment remains available.
  • Template creation and builds: Instruct your agent to create sandbox templates, review available templates, and start template builds with your chosen configuration.
  • Lifecycle event notifications: Have your agent register, review, list, or remove webhooks that receive sandbox lifecycle events for your team.

Conclusion

You've successfully integrated E2b with Codex using Composio's MCP server. Now you can interact with E2b directly from your terminal, VS Code, or the Codex App using natural language commands.

Key benefits of this setup:

  • Seamless integration across CLI, VS Code, and standalone app
  • Natural language commands for E2b operations
  • Managed authentication through Composio
  • Access to 20,000+ tools across 1700+ apps for cross-app workflows
  • CodeAct workbench for complex tool chaining

Next steps:

  • Try asking Codex to perform various E2b operations
  • Explore cross-app workflows by connecting more toolkits
  • Build automation scripts that leverage Codex's AI capabilities
TOOLS

Supported Tools

Every E2b action and event your agent gets out of the box.

Assign Template Tags

Assign tags to an existing E2B template build identified by a name:tag target.

Check Template Alias

Check whether an E2B template alias exists and return its template ID and visibility.

Check Template Tag

Check whether an E2B template tag has at least one ready build.

Connect to Sandbox

Tool to connect to an existing E2B sandbox and retrieve its details.

Connect to Sandbox (V2)

Connect to an existing E2B sandbox and return its details, resuming it if paused.

Count Template Tags

Count distinct tags of an E2B template that have at least one ready build.

Create Secured Sandbox (V2)

Create a sandbox from a template using POST /v2/sandboxes.

Create Sandbox Snapshot

Create a persistent snapshot from an existing E2B sandbox's current state.

Create Template

Tool to create a new E2B template with specified configuration.

Create Volume

Create a new E2B team volume and return its identifier and content access token.

Create Webhook

Tool to register a new webhook to receive sandbox lifecycle events for the team.

Delete Sandbox

Tool to terminate and permanently delete a running E2B sandbox instance.

Delete Template

Permanently delete an E2B template that is no longer needed.

Delete Template Tags

Delete multiple tags from a named E2B template.

Delete Volume

Delete an existing E2B team volume by its identifier.

Delete Webhook

Tool to unregister a webhook and stop receiving lifecycle events.

Fork Sandbox

Fork a running E2B sandbox by briefly pausing it, taking a full-memory snapshot, and resuming it with its ID and expiration unchanged.

Check API Health

Tool to check the health status of the E2B API.

Get Sandbox

Tool to retrieve detailed information about a specific sandbox by its ID.

Get Sandbox Logs

Tool to retrieve logs from a specific E2B sandbox instance.

Get Sandbox Lifecycle Events

Retrieve lifecycle events for a specific sandbox, with pagination and sort options.

Get Sandbox Logs V2

Retrieve structured logs for an existing E2B sandbox using the v2 API.

Get Sandbox Metrics

Tool to retrieve timestamped CPU, memory, and disk usage metrics for a sandbox.

Get Secret

Get an existing secret's metadata by identifier or canonical lower-case name.

Get Team Metrics

Retrieve timestamped team metrics, including concurrent sandbox counts and sandbox start rates, with optional time bounds.

Get Team Maximum Metrics

Tool to retrieve the maximum value for a specific team metric in a given interval.

Get Template Build Logs

Retrieve structured logs for an existing E2B template build.

Get Template Build Status

Tool to get the status of a template build.

Get Template Files

Tool to get an upload link for a tar file containing build layer files.

Get Volume

Get a team volume's ID, name, content auth token and optional BYOC domain.

Get Webhook Configuration

Tool to retrieve the current webhook configuration for a specific webhook.

Get Webhook Stats

Get aggregate delivery counts, failures, durations, and time buckets for an existing webhook.

List API Keys

List all API keys for the selected team, including masked key details.

List Default Templates

List platform default templates, ordered by template ID, excluding deleted templates.

List All Sandboxes

List team sandboxes with state and metadata filters, a page size, and an optional pagination token.

List Sandboxes Metrics

Retrieve timestamped CPU, memory, and disk usage metrics for multiple sandboxes, keyed by sandbox ID.

List Sandboxes V2

List a page of team sandboxes using GET /v2/sandboxes with optional filters.

List Secrets

List a page of the project's secret metadata, without stored secret values.

List Snapshots

List a page of team snapshots, optionally filtered by source sandbox or name.

List Teams

List all teams for the authenticated user, including their API keys.

List Team Sandbox Lifecycle Events

Tool to retrieve the latest lifecycle events across all sandboxes associated with the team.

List Template Builds

List a page of builds for an existing E2B template, including template metadata.

List All Templates

Tool to list all available E2B templates for your team.

List Templates V2

List a page of E2B templates using GET /v2/templates, optionally selecting a team.

List Template Tag Assignments

List one page of ready build assignments for an E2B template tag, newest first.

List Template Tag Groups

List a page of E2B template tags with their most recent ready assignments.

List Template Tags

List all tags for an existing E2B template, including build IDs and assignment times.

List Volumes

List all volumes belonging to the authenticated team.

List Webhook Deliveries

List a page of delivery attempts for an existing team webhook, grouped by event.

List All Webhooks

Tool to retrieve all registered webhooks for your team.

Pause Sandbox

Tool to pause a running E2B sandbox preserving its filesystem and memory state.

Create Sandbox

Tool to create a new E2B sandbox from a template.

Set Sandbox Timeout

Tool to set the timeout for an E2B sandbox.

Refresh Sandbox

Tool to refresh an E2B sandbox and extend its time to live.

Start Template Build

Start a build for an E2B template with specific configuration.

Update Sandbox Network

Replace the network configuration of a running E2B sandbox.

Update Template

Update an E2B template's public or private visibility by template ID.

Update Template (V2)

Update an existing E2B template's public or team-only visibility using the v2 API and return its names.

Update Webhook Configuration

Tool to update an existing webhook configuration including URL, enabled status, and subscribed events.

FAQ

Frequently asked questions

Start with E2b.It takes 30 seconds.

Managed auth, hosted MCP servers, and every E2b tool your agent needs.Free to start.

Start building