How to integrate E2b MCP with Pi

Connect Pi 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.

27 Tools

Introduction

Pi is a minimal, self-extensible coding agent that lives in your terminal — one agent loop over Claude, GPT-5, Gemini, Grok, DeepSeek, and 20+ other providers, with maximum extension surface and minimum product opinion. Its core ships four tools (read, write, edit, bash) and self-extends at runtime through skills, extensions, and packages.

This guide explains the easiest and most robust way to connect your E2b account to Pi. You can do this through either Composio Connect CLI or Composio Connect MCP. Because Pi already runs shell commands as first-class tools and ships no built-in MCP, the CLI is the recommended path — it's faster to set up, needs no server config, and chains multi-step tasks more reliably. The MCP path is also fully supported through Pi's official pi-mcp-adapter extension.

Also integrate E2b with

What is Composio Connect?

Composio Connect is a consumer offering that lets anyone plug 1,000+ applications directly into their agent harness — including Pi. It can:

  • Search and load tools from relevant toolkits on-demand, reducing context usage.
  • Chain multiple tools to accomplish complex workflows via a remote workbench, without excessive back-and-forth with the LLM.
  • Manage app authentication end-to-end with zero manual overhead.

Connect E2b to Pi with Composio

Prerequisites: Install Pi

Pi needs Node.js 18+ (Node 22 recommended). Install the agent globally with npm:

bash
npm install -g --ignore-scripts @earendil-works/pi-coding-agent

On Linux or macOS you can use the installer script instead:

bash
curl -fsSL https://pi.dev/install.sh | sh

Then run pi in any project directory and authenticate your model provider — use /login inside Pi for subscription providers (Claude Pro/Max, ChatGPT, GitHub Copilot), or set an API key such as ANTHROPIC_API_KEY before starting. Confirm it's working:

bash
pi --version

Full first-run details are in the Pi Quickstart.

Option 1: Composio CLI (recommended)

Pi runs shell commands as first-class tools, so the Composio Universal CLI is the most natural fit — no MCP server to configure and reliable multi-step tool chaining. Install and authenticate:

bash
# Install the Composio CLI
curl -fsSL https://composio.dev/install | bash

# Log in to Composio
composio login

Connect to E2b

Ask Pi to connect to E2b, or simply request any E2b-related task. Under the hood Pi calls Composio commands like any other shell tool:

bash
composio search "what can I do with E2b?"
composio link e2b

On the first E2b call, composio link e2b opens an OAuth prompt so you can authorize access. After that, every E2b command works with your stored credentials automatically — just talk to Pi and it will search, execute, and chain E2b tools as needed.

Option 2: Composio MCP

Pi's core intentionally ships no built-in MCP, but the official pi-mcp-adapter extension adds full MCP support — exposing every server through a single lightweight proxy tool (~200 tokens) instead of loading hundreds of tool definitions into context.

1. Install the MCP adapter extension

bash
pi install npm:pi-mcp-adapter

Restart Pi after installation.

2. Add the Composio MCP server

Create (or edit) a .mcp.json file in your project root, or ~/.config/mcp/mcp.json for a user-global setup:

bash
{
  "mcpServers": {
    "composio": {
      "url": "https://connect.composio.dev/mcp"
    }
  }
}

The adapter connects lazily by default — the server won't start until Pi actually calls one of its tools, and cached metadata keeps search and describe working without a live connection.

3. Authenticate

Run /mcp-auth inside Pi to open the authentication modal and select composio from the list. Complete the sign-in in your browser, then on the consent screen click Allow access to authorize Composio. Once approved, the server shows as connected inside Pi:

Pi /mcp-auth modal listing the composio MCP server
Composio OAuth consent screen with the Allow access button
Composio MCP server connected inside Pi

4. Done!

Confirm the server is live with /mcp to open the interactive panel, then ask Pi to connect to E2b or request any E2b-related task — it will prompt you to authorize E2b on first use.

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 so your agent can perform E2b operations on your behalf.

Way Forward

With E2b connected, Pi can now act on your behalf whenever you ask it to.

From here, you can extend Pi further:

  • Connect more apps: Calendar, Slack, Notion, Linear, and hundreds of others are available through the same Composio Connect setup. Each new integration compounds what Pi can do for you.
  • Build workflows across tools: Once multiple apps are connected, Pi can chain actions together — turn an email into a calendar invite, a Slack message into a Linear ticket, or a meeting note into a follow-up draft.
  • Lean into Pi's extension surface: Wrap common E2b flows as Pi skills or prompt templates so recurring tasks become one-line commands, and use directTools in the MCP adapter to promote your most-used E2b tools into Pi's tool list directly.

If you run into trouble or want to share what you've built, join the community or check out the Docs for deeper configuration options.

TOOLS

Supported Tools

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

Connect to Sandbox

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

Create Template

Tool to create a new E2B template with specified configuration.

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 Webhook

Tool to unregister a webhook and stop receiving lifecycle events.

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

Tool to retrieve the latest lifecycle events for a particular sandbox instance.

Get Sandbox Metrics

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

Get Team Metrics

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

Get Team Maximum Metrics

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

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 Webhook Configuration

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

List All Sandboxes

Tool to list all running and paused sandboxes associated with your team.

List Sandboxes Metrics

Tool to retrieve timestamped CPU, memory, and disk usage metrics for multiple sandboxes.

List Team Sandbox Lifecycle Events

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

List All Templates

Tool to list all available E2B templates for your team.

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

Tool to start a build for an E2B template.

Update Template

Tool to update an E2B template configuration.

Update Webhook Configuration

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

FAQ

Frequently asked questions

With a standalone E2b MCP server, the agents and LLMs can only access a fixed set of E2b tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from E2b and many other apps based on the task at hand, all through a single MCP endpoint.

Yes, you can. Pi fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right E2b tools.

Yes, absolutely. You can configure which E2b scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your E2b data and credentials are handled as safely as possible.

Start with E2b.It takes 30 seconds.

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

Start building