How to integrate E2b MCP with Grok Build

Connect Grok Build to E2b MCP. Run a python script to analyze csv data, execute javascript code to validate user input, and more from your terminal, 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

How to integrate E2b MCP with Grok Build

Grok Build is xAI's terminal coding agent. It runs on Grok 4.5, plans its work before it acts, and can run multiple sub-agents in parallel. It also reads Claude Code's MCP configuration, so any server you already have in a .mcp.json is picked up with no changes.

In this guide, I will show you how to connect your E2b account to Grok Build through Composio, so it can run a Python script to analyze CSV data, execute JavaScript code to validate user input, start a sandbox and list installed packages, and more without leaving the terminal. Composio holds the OAuth tokens for you, and Grok Build only calls the tools you approve.

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

Also integrate E2b with

Why use Composio over a standalone MCP server?

  • Read and write access. Composio's E2b integration lets Grok Build take real actions like creating drafts, sending updates, and labeling records, not just reading data.
  • 1,700+ SaaS toolkits out of the box. One endpoint gives you a full catalog of pre-built connectors, from Gmail and Slack to Notion, Linear, and Salesforce.
  • One MCP server for every app. Wire up a single Composio server instead of maintaining a separate MCP entry for each app.
  • Smart, context-aware tool loading. Grok Build caps how many tools it holds in a single request. Composio loads only the tools a task needs, so you do not spend that budget on tools you are not using.
  • Cross-app automation. Chain actions across apps in one run. Pull a thread, summarize it in Notion, and post the highlights to Slack from a single prompt.

Prerequisites

  • Grok Build installed and signed in. Install with curl -fsSL https://x.ai/cli/install.sh | bash on macOS or Linux, or irm https://x.ai/cli/install.ps1 | iex on Windows PowerShell. On first launch Grok opens a browser to authenticate; for headless or CI use, set an XAI_API_KEY environment variable instead (create the key at console.x.ai).
  • Access to the E2b account you want to connect.
  • The Composio MCP endpoint. Composio's server is remote and hosted, so there is nothing to run locally and no tunnel to set up.

Step-by-step: Connect E2b to Grok Build

1. Install and verify Grok Build

Install the CLI, then restart your shell so the grok binary lands on your PATH:

bash
curl -fsSL https://x.ai/cli/install.sh | bash
which grok

On Windows, install with PowerShell instead: irm https://x.ai/cli/install.ps1 | iex. If which grok returns a path, you are set. Grok Build runs on Grok 4.5 by default; you can switch models inside the session with /model <name>.

2. Add the Composio server

Add Composio as a remote HTTP MCP server with the grok mcp add command:

bash
grok mcp add --transport http composio https://connect.composio.dev/mcp

You can also add and manage servers from inside a session. Run /mcps to open the extensions modal on the MCP tab, then add a new server and paste the Composio URL. Added this way, Grok auto-detects the name from the URL and lists the server as connect:

bash
https://connect.composio.dev/mcp
Grok Build /mcps extensions modal listing MCP servers Grok Build adding the Composio MCP server with its URL

Grok also reads Claude Code-style config, so an entry in ~/.grok/config.toml or a project .mcp.json works the same way.

3. Authenticate

Composio uses OAuth. In the /mcps modal, select the Composio server and press i to authenticate (Grok also triggers this browser flow automatically the first time it uses a Composio tool). Click Allow to authorize access. Grok stores the tokens under ~/.grok/mcp_credentials.json, and /mcps shows Composio as connected.

Grok Build prompting to authenticate the Composio MCP server Composio authorization screen with the Allow button for Grok Build

4. Start building

Ask Grok to work with your E2b account through Composio. On the first E2b action, Composio prompts you to connect the account through OAuth. Approve the scopes once, and Composio handles token refresh from there.

What you can do after connecting E2b

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

Security + privacy notes (important)

  • Use least-privilege access. Grant only the E2b scopes you actually need.
  • Review OAuth scopes before approving. Check that the requested scopes match what you expect Composio and Grok Build to do.
  • Keep write actions human-reviewed. Grok Build proposes a plan before it acts. Leave that approval step on for actions like sending messages or editing records.
  • Keep secrets out of version control. Your XAI_API_KEY and any tokens should never be committed. Use environment variables or a secrets manager.
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