4,500+ servers built on MCP Fusion
Vinkius
E2B logo
Vinkius
LangChain logo

How to Use the E2B MCP in LangChain

Run untrusted code safely in 150ms sandboxes directly from your LangChain chains and agents.

See Vinkius in Action

Works with every AI agent you already use

…and any MCP-compatible client

E2B MCP on Cursor AI Code Editor MCP Client E2B MCP on Claude Desktop App MCP Integration E2B MCP on OpenAI Agents SDK MCP Compatible E2B MCP on Visual Studio Code MCP Extension Client E2B MCP on GitHub Copilot AI Agent MCP Integration E2B MCP on Google Gemini AI MCP Integration E2B MCP on Lovable AI Development MCP Client E2B MCP on Mistral AI Agents MCP Compatible E2B MCP on Amazon AWS Bedrock MCP Support
MCP Servers - Free for Subscribers
LangChain

Connect E2B MCP to LangChain

Create your Vinkius account to connect E2B to LangChain and route execution through our secure gateway. The platform manages server hosting, runtime updates, and security layers. Configuration requires no manual server provisioning.

GDPR Free for Subscribers

Run untrusted code safely inside LangChain chains

Your LangChain agents often need to execute arbitrary code to solve math problems or analyze data. By integrating this MCP Server, your agent can spin up a secure Firecracker microVM using `create_sandbox` and run Python or JavaScript safely without risking your host machine. Once the execution finishes, the agent can fetch the output and feed it directly into the next link of the chain. You can trace this entire data flow in LangSmith, seeing exactly when the VM was created and when it was destroyed with `kill_sandbox`.

Chain sandbox lifecycles across complex agent runs

LangChain excels at multi-step reasoning where one tool's output feeds another. When your chain requires a persistent runtime, the agent can call `create_sandbox` to start a session, run multiple commands, and query `list_sandboxes` to keep track of active environments across execution steps. This setup lets your LangChain agents build on top of previous code executions in the same sandbox. When the agent completes its run, it calls `kill_sandbox` to tear down the microVM and avoid resource leaks.

Trace sandbox execution latency inside LangSmith

Debugging code execution in LangChain is notoriously tricky when you don't know why a step failed. Because this MCP Server integrates directly with your agent, every call to `create_sandbox` and command execution is captured as a distinct step in your LangSmith traces. You get clear visibility into the 150ms cold-start latency and can pinpoint exactly where a script failed. This takes the guesswork out of monitoring ephemeral environments across complex LangChain pipelines.

Setup guide

Set up E2B MCP in LangChain

Prerequisites

  • Python 3.10+ installed
  • langchain-mcp-adapters + langgraph packages
  • Active Vinkius subscription with a valid endpoint token
  1. 1

    Install dependencies

    Run pip install langchain-mcp-adapters langgraph langchain-openai. The MCP adapters package converts MCP tools into native LangChain BaseTool objects.

  2. 2

    Connect via HTTP transport

    Use MultiServerMCPClient with "transport": "http" pointing to your Vinkius endpoint. Replace [YOUR_TOKEN_HERE] with your token from cloud.vinkius.com.

  3. 3

    Create a ReAct agent

    Pass the discovered tools to create_react_agent() from LangGraph. The agent automatically routes E2B tool calls through the MCP protocol.

  4. 4

    Run with any LLM

    Swap ChatOpenAI for ChatAnthropic, ChatGoogleGenerativeAI, or any LangChain-compatible model. The MCP tools work identically across all providers.

agent.py
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI

async with MultiServerMCPClient({
    "e2b-mcp": {
        "transport": "http",
        "url": "https://edge.vinkius.com/[YOUR_TOKEN_HERE]/mcp",
    }
}) as client:
    tools = client.get_tools()

    agent = create_react_agent(
        ChatOpenAI(model="gpt-4o"),
        tools,
    )
    result = await agent.ainvoke({
        "messages": "List recent E2B transactions"
    })
    print(result["messages"][-1].content)

Independent Platform Disclaimer: Vinkius is an independent platform and is not affiliated with, endorsed by, sponsored by, verified by, or otherwise authorized by E2B. All third-party trademarks, logos, and brand names are the property of their respective owners. Their use on this website is strictly for informational purposes to identify service compatibility and interoperability.

Why Choose Vinkius

Vinkius connects your tools to AI with real-time monitoring and automatic cost savings — all from one dashboard.

Real-time monitoring

Live

visibility into every interaction

Connect your favorite tools to your AI and see exactly what's happening — every request, every response, in real time.

Built-in savings

60%

lower AI costs

Vinkius compresses data between your apps and your AI automatically. Lower bills every month — no configuration required.

Single dashboard

One

place for every integration

Every tool your AI connects to, managed from a single screen. One account, complete control.

Common questions about E2B MCP in LangChain

You install the LangChain MCP adapter package and configure the server URL. Once connected, you pass the `create_sandbox` and `kill_sandbox` tools directly into your agent's tool list so it can execute code dynamically.
Yes. Your LangChain agent can call `create_sandbox` multiple times to run parallel tasks and use `list_sandboxes` to track them. Each microVM runs in its own isolated environment.
The default timeout is 300 seconds, but your LangChain agent can specify different parameters when calling `create_sandbox`. If an agent hangs, you can use `kill_sandbox` to force-terminate the microVM.
Yes. When your agent calls `create_sandbox`, it can request templates like python3 or node. This gives your LangChain agent a pre-configured runtime environment instantly.
Every script your LangChain agent runs is executed within an isolated Firecracker microVM. Once `kill_sandbox` is called, the entire filesystem is permanently wiped from the secure host, leaving no residual data behind.

Start using the E2B MCP today

We host it, we monitor it, we maintain it. You just paste one token.

Built & Managed by Vinkius 30s setup 3 tools

We've already built the connector for E2B. Just plug in your AI agents and start using Vinkius.

No hosting. No infrastructure. No complex setup.
All 3 tools are live and waiting. You're up and running in seconds.

Claude Claude
ChatGPT ChatGPT
Cursor Cursor
Gemini Gemini
Windsurf Windsurf
VS Code VS Code
JetBrains JetBrains
Vercel Vercel
+ other MCP clients

Vinkius gives your AI agents access to the full catalog of app connectors, all fully managed, secure, and enterprise-ready. One subscription, every tool you need.

Zero hosting required Full MCP catalog included Enterprise-grade security Auto-updated by Vinkius

Built, hosted, and secured by Vinkius. You just connect and go.