Skip to content
E2B Docs
MCP gateway

Overview

Connect to 200+ tools through the Model Context Protocol

E2B provides a batteries-included MCP gateway that runs inside sandboxes, giving you type-safe access to 200+ MCP tools from the Docker MCP Catalog or custom MCPs through a unified interface. This integration gives developers instant access to tools like Browserbase, Exa, Notion, Stripe, or GitHub.

The Model Context Protocol (MCP) is an open standard for connecting AI models to external tools and data sources. E2B sandboxes provide an ideal environment for running MCP tools, giving AI full access to an internet-connected Linux machine where it can safely install packages, write files, run terminal commands, and AI-generated code.

import Sandbox from 'e2b'

const sbx = await Sandbox.create({
    mcp: {
        browserbase: {
            apiKey: process.env.BROWSERBASE_API_KEY!,
            geminiApiKey: process.env.GEMINI_API_KEY!,
            projectId: process.env.BROWSERBASE_PROJECT_ID!,
        },
        exa: {
            apiKey: process.env.EXA_API_KEY!,
        },
        airtable: {
            airtableApiKey: process.env.AIRTABLE_API_KEY!,
        },
    },
});

const mcpUrl = sbx.getMcpUrl();
const mcpToken = await sbx.getMcpToken();

// You can now connect the gateway to any MCP client, for example claude:
// This also works for your local claude!
await sbx.commands.run(`claude mcp add --transport http e2b-mcp-gateway ${mcpUrl} --header "Authorization: Bearer ${mcpToken}"`, { timeoutMs: 0, onStdout: console.log, onStderr: console.log });

await sbx.commands.run(
    `echo 'Use browserbase and exa to research open positions at e2b.dev. Collect your findings in Airtable.' | claude -p --dangerously-skip-permissions`,
    { timeoutMs: 0, onStdout: console.log, onStderr: console.log }
)

Documentation

Was this page helpful?Suggest editsRaise issue

On this page