e2b MCP

MCP安全风控

提供方 cased

安全风控 stdio · 本地进程 API Key 社区 / 第三方
查看接入方式

e2b-mcp是一个在E2B沙箱中安全运行MCP服务器的工具,提供隔离执行环境、自动资源管理和工具发现功能,适用于AI代理平台、SaaS应用和开发者工具等多种场景。

一句话选型结论

按资料字段整理

e2b MCP 属于安全风控类 MCP 服务器,stdio · 本地进程,API Key,有可直接执行的安装命令。接入前先确认权限范围;涉及写入、删除或付款的操作,建议先在测试环境验证。

分类安全风控 传输方式stdio · 本地进程 鉴权API Key 部署方式本地部署
GitHub 星标 12 仓库热度,无公开仓库时显示未标注
工具数 未标注 暴露给模型的工具数量
资源 / 提示词 0 / 0 资源与提示词模板数量
维护方 社区 / 第三方 核验等级 仅资料核对

工具与能力

安全风控
数量来自来源目录的标注,具体工具清单以官方文档为准
工具数量未标注暴露给模型可调用的工具个数
资源数量0可读取的资源条目
提示词数量0内置提示词模板数量

能力标签

适用场景

安全执行Python本地部署沙箱环境工具发现资源管理多语言支持

安装与配置

stdio · 本地进程 API Key
客户端在本机拉起子进程,数据不出本机
pip install -e ".[dev]"

这条命令只是入口,具体启动参数请按官方文档补齐,不要直接照搬到别的服务器。

  1. 1
    准备运行环境

    stdio 服务在本地起进程,需要先装好 Node.js 等运行时,再按安装命令拉取依赖。

  2. 2
    安装服务

    复制上面的安装命令执行;命令里带占位符的位置,换成自己的密钥或路径。

  3. 3
    写入客户端配置

    在客户端的 MCP 配置里填好启动命令和参数,保存后完全退出客户端再打开,让新配置生效。

  4. 4
    验证是否可用

    连接成功后随便调一个只读工具,确认能返回结果,再接入正式流程。

典型使用场景

3 类
按分类与标签整理的常见用法,具体以官方文档为准
资产与漏洞排查

盘点资产、扫漏洞、看暴露面。

日志与审计

汇总日志、查异常行为。

合规检查

按规则检查配置与权限是否合规。

选择建议

选之前先看这几条
按条目字段给出的判断,不替你决定用不用

值得选的地方

  • 有现成的安装命令,不用自己找入口,照着跑就能起服务。

先想清楚的地方

  • stdio 方式要求本地装好运行时(如 Node.js),换机器要重新装一遍。
  • 使用前要准备好API Key对应的凭据,并按最小权限配置。
  • 资料没标注工具数量,实际能力要装好后确认。
  • 版本更新与行为细节以官方仓库为准。

更适合

  • 需要在安全风控场景里让模型直接调用外部能力的人。
  • 想先快速试一下、能接受在本地或自有环境跑服务的人。

不太适合

  • 完全不想在本地装环境的人。
  • 不方便管理密钥或第三方授权的人。
  • 需要厂商级 SLA 和技术支持的生产环境。

同类对比

6 个同类
同分类里挑最接近的几条,字段以各自详情页为准
MCP 服务器工具数传输方式部署方式安装命令最后核验
e2b MCP当前 未标注 stdio · 本地进程 本地部署 有 2026-05-17
Cyber Strike AI 75 未标注 未标注 无 2026-05-17
mcp-for-beginners 未标注 stdio · 本地进程 本地部署 有 2026-04-13
casdoor 未标注 stdio · 本地进程 本地部署 有 2026-04-12
kubeshark 未标注 stdio · 本地进程 本地部署 有 2026-04-11
Modelcontextprotocol C22988b0 未标注 stdio · 本地进程 本地部署 有 2026-05-17

服务器档案

安全风控
字段来自项目仓库与公开索引,中文说明由本站标注
提供方cased上游标注的维护方 cased
分类安全风控本站按上游分类展示
连接方式stdio · 本地进程客户端在本机拉起子进程,数据不出本机
鉴权方式API Key远程服务建议用最小权限凭据
维护方社区 / 第三方核验等级 仅资料核对
包名 / 运行时未标注 · 未标注本地安装时用到的包标识与运行时
部署类型本地部署上游给出的部署形态
最近核验2026-05-17上游最后核验时间

详细介绍

18.1 KB
来自项目仓库与上游目录的原文,未做删改

e2b-mcp

Run MCP (Model Context Protocol) servers securely in E2B sandboxes.

e2b-mcp provides a simple way to execute MCP servers in isolated cloud environments, enabling safe execution of untrusted tools and code. Instead of running MCP servers directly on your host system, they run inside secure E2B sandboxes with automatic resource management and cleanup.

Use Cases

We built e2b-mcp so Cased can run MCP servers on behalf of users, and
integrate with our DevOps agent. But e2b-mcp has many use cases:

AI Agent Platforms

  • Safe Tool Execution: Let AI agents use file operations, git commands, and web APIs without compromising your infrastructure
  • User-Specific Sandboxes: Run MCP servers with each user's credentials and permissions in isolated environments
  • Dynamic Tool Discovery: Discover and provision new capabilities for agents on-demand

SaaS Applications

  • Multi-Tenant Tool Execution: Safely execute user-requested operations (file processing, data analysis) in dedicated sandboxes
  • API Gateway for MCP: Expose MCP tools as REST endpoints with built-in security and isolation
  • Serverless MCP: Scale MCP server instances based on demand without infrastructure management

Developer Tools & IDEs

  • Code Execution Environments: Provide secure code execution for online IDEs and coding platforms
  • Plugin Sandboxing: Run untrusted MCP plugins safely without affecting the host environment
  • CI/CD Integration: Execute build/test tools in isolated environments with controlled access

Enterprise Solutions

  • Compliance & Security: Meet security requirements by isolating all tool execution
  • Customer Onboarding: Let customers try tools and integrations safely before deployment
  • Managed AI Services: Offer AI capabilities to customers without exposing backend systems

Features

  • Secure Execution: Run MCP servers in isolated E2B sandboxes
  • CLI & API: Both command-line interface and Python API
  • Tool Discovery: Automatically discover tools from MCP servers
  • Async/Sync Support: Both async and synchronous execution modes
  • Auto Cleanup: Automatic sandbox and resource management
  • Package Management: Automatic installation of MCP server dependencies

Installation```bash

uv pip install e2b-mcp


## Prerequisites

1. **E2B API Key**: Get your free API key from e2b.dev
2. **Environment Variable**: Set `E2B_API_KEY` in your environment```bash
export E2B_API_KEY="your_api_key_here"

Quick Start

CLI Usage```bash

Add a GitHub MCP server

e2b-mcp server add github \
--command "npx -y @modelcontextprotocol/server-github" \
--env GITHUB_PERSONAL_ACCESS_TOKEN=your_token

Discover available tools

e2b-mcp tools list github

Execute a tool

e2b-mcp tools execute github search_repositories \
--params '{"query": "python", "per_page": 5}'

Quick one-shot execution (no config save)

e2b-mcp quick "npx -y @modelcontextprotocol/server-filesystem /tmp" \
list_directory --param path=/tmp

Multi-package installation with install-commands

e2b-mcp server add complex_server \
--command "python /app/server.py" \
--install-commands "apt-get update" \
--install-commands "apt-get install -y git curl" \
--install-commands "pip install requests beautifulsoup4" \
--env DATA_DIR=/app/data

Node.js MCP server setup

e2b-mcp server add nodejs_fs \
--command "node filesystem-server.js" \
--install-commands "curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -" \
--install-commands "apt-get install -y nodejs" \
--install-commands "npm install @modelcontextprotocol/server-filesystem"


### Python API```python
import asyncio
from e2b_mcp import E2BMCPRunner, ServerConfig

async def main():
    # Create runner
    runner = E2BMCPRunner()

    # Add MCP server
    runner.add_server(ServerConfig(
        name="filesystem",
        command="npx -y @modelcontextprotocol/server-filesystem /tmp",
        description="File system operations"
    ))

    # Discover tools
    tools = await runner.discover_tools("filesystem")
    print(f"Found {len(tools)} tools")

    # Execute a tool
    result = await runner.execute_tool(
        "filesystem",
        "write_file",
        {"path": "/tmp/example.txt", "content": "Hello World!"}
    )
    print(result)

# Run async code
asyncio.run(main())

📖 CLI Documentation

Server Management```bash

Add a new MCP server configuration

e2b-mcp server add <name> --command "<command>" [options]

List all configured servers

e2b-mcp server list [--json]

Remove a server configuration

e2b-mcp server remove <name> [--yes]


**Add Server Options:**
- `--command`: Command to run the MCP server (required)
- `--env KEY=VALUE`: Environment variables (can be used multiple times)
- `--install-commands`: Installation commands to run (can be used multiple times)
- `--description`: Server description
- `--timeout`: Timeout in minutes (default: 10)

### Tool Operations```bash
# List tools from a configured server
e2b-mcp tools list &lt;server_name&gt; [--json]

# Execute a tool
e2b-mcp tools execute &lt;server_name&gt; &lt;tool_name&gt; [options]

Execute Tool Options:
- --params: Tool parameters as JSON string
- --param key=value: Individual parameters (can be used multiple times)
- --json: Output raw JSON response

Quick Execute```bash

Execute without saving server config

e2b-mcp quick "<command>" <tool_name> [options]


**Quick Execute Options:**
- `--params`: Tool parameters as JSON string
- `--param key=value`: Individual parameters
- `--env KEY=VALUE`: Environment variables
- `--json`: Output raw JSON response

### Configuration```bash
# Show current configuration
e2b-mcp config [--show]

# Edit configuration file
e2b-mcp config --edit

# Reset all configuration
e2b-mcp config --reset

CLI Examples```bash

GitHub integration

export GITHUB_TOKEN="your_token"
e2b-mcp server add github \
--command "npx -y @modelcontextprotocol/server-github" \
--env GITHUB_PERSONAL_ACCESS_TOKEN=$GITHUB_TOKEN

e2b-mcp tools execute github search_repositories \
--params '{"query": "e2b", "per_page": 3}'

Filesystem operations

e2b-mcp server add fs \
--command "npx -y @modelcontextprotocol/server-filesystem /tmp"

e2b-mcp tools execute fs write_file \
--param path=/tmp/test.txt \
--param content="Hello CLI!"

e2b-mcp tools execute fs read_file \
--param path=/tmp/test.txt

Using quick execute for one-offs

e2b-mcp quick "npx -y @modelcontextprotocol/server-filesystem /tmp" \
list_directory --param path=/tmp --json


Configuration is stored in `~/.e2b-mcp/servers.json` and can be shared across different environments.

## Configuration

### Server Configuration```python
from e2b_mcp import ServerConfig

# Method 1: Using ServerConfig class
config = ServerConfig(
    name=&quot;my_server&quot;,
    command=&quot;python -m my_mcp_server --stdio&quot;,
    install_commands=[  # Installation commands for any package manager
        &quot;apt-get update&quot;,
        &quot;apt-get install -y nodejs npm&quot;,
        &quot;npm install express&quot;,
        &quot;pip install additional-package&quot;
    ],
    description=&quot;My custom MCP server&quot;,
    timeout_minutes=10,
    env={&quot;DEBUG&quot;: &quot;1&quot;}  # Optional environment variables
)
runner.add_server(config)

# Method 2: Using dictionary
runner.add_server_from_dict(&quot;my_server&quot;, {
    &quot;command&quot;: &quot;python -m my_mcp_server --stdio&quot;,
    &quot;install_commands&quot;: [
        &quot;pip install requests beautifulsoup4&quot;,
        &quot;apt-get install -y curl&quot;
    ],
    &quot;description&quot;: &quot;My custom MCP server&quot;,
    &quot;timeout_minutes&quot;: 10,
    &quot;env&quot;: {&quot;DEBUG&quot;: &quot;1&quot;}
})

# Example: Node.js MCP server
runner.add_server_from_dict(&quot;nodejs_server&quot;, {
    &quot;command&quot;: &quot;node mcp-server.js&quot;,
    &quot;install_commands&quot;: [
        &quot;curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -&quot;,
        &quot;sudo apt-get install -y nodejs&quot;,
        &quot;npm install @modelcontextprotocol/server-filesystem&quot;
    ],
    &quot;description&quot;: &quot;Node.js MCP server&quot;
})

# Example: Rust MCP server
runner.add_server_from_dict(&quot;rust_server&quot;, {
    &quot;command&quot;: &quot;./target/release/mcp-server&quot;,
    &quot;install_commands&quot;: [
        &quot;curl --proto &#x27;=https&#x27; --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y&quot;,
        &quot;source ~/.cargo/env&quot;,
        &quot;cargo build --release&quot;
    ],
    &quot;description&quot;: &quot;Rust-based MCP server&quot;
})

Configuration Parameters

  • name: Unique identifier for the MCP server
  • command: Command to start the MCP server
  • install_commands: Flexible installation commands (optional)
  • description: Human-readable description
  • timeout_minutes: Sandbox timeout (default: 10 minutes)
  • env: Environment variables (optional)

API Reference

E2BMCPRunner

Main class for managing MCP servers in E2B sandboxes.

Methods

__init__(api_key: Optional[str] = None)

Initialize the runner with an E2B API key.

add_server(config: ServerConfig) -&gt; None

Add an MCP server configuration.

add_server_from_dict(name: str, config_data: Dict[str, Any]) -&gt; None

Add an MCP server configuration from a dictionary.

list_servers() -&gt; List[str]

List all configured server names.

async discover_tools(server_name: str) -&gt; List[Tool]

Discover tools from an MCP server.

async execute_tool(server_name: str, tool_name: str, params: Dict[str, Any]) -&gt; Dict[str, Any]

Execute a tool on an MCP server.

execute_tool_sync(server_name: str, tool_name: str, params: Dict[str, Any]) -&gt; Dict[str, Any]

Synchronous wrapper for execute_tool.

async create_session(server_name: str) -&gt; AsyncContextManager[Session]

Create a managed MCP session (advanced usage).

Examples

Basic Tool Execution```python

import asyncio
from e2b_mcp import E2BMCPRunner

async def main():
runner = E2BMCPRunner()

# Add a simple test server
runner.add_server_from_dict(&quot;test&quot;, {
    &quot;command&quot;: &quot;python /tmp/test_mcp_server.py&quot;,
    &quot;description&quot;: &quot;Test server with basic tools&quot;
})

# Execute tools
time_result = await runner.execute_tool(&quot;test&quot;, &quot;get_time&quot;, {&quot;format&quot;: &quot;iso&quot;})
echo_result = await runner.execute_tool(&quot;test&quot;, &quot;echo&quot;, {&quot;text&quot;: &quot;Hello!&quot;})

print(f&quot;Time: {time_result}&quot;)
print(f&quot;Echo: {echo_result}&quot;)

asyncio.run(main())


### Synchronous Usage```python
from e2b_mcp import E2BMCPRunner

runner = E2BMCPRunner()
runner.add_server_from_dict(&quot;test&quot;, {
    &quot;command&quot;: &quot;python /tmp/test_mcp_server.py&quot;
})

# Synchronous execution
result = runner.execute_tool_sync(&quot;test&quot;, &quot;get_time&quot;, {&quot;format&quot;: &quot;readable&quot;})
print(result)

Session Management (Advanced)```python

async def advanced_usage():
runner = E2BMCPRunner()
runner.add_server_from_dict("filesystem", {
"command": "python -m mcp_server_filesystem --stdio",
"package": "mcp-server-filesystem"
})

# Manage session lifecycle manually
async with runner.create_session(&quot;filesystem&quot;) as session:
    print(f&quot;Session ID: {session.session_id}&quot;)
    print(f&quot;Sandbox ID: {session.sandbox_id}&quot;)

    # Session automatically cleaned up when exiting context

## Supported MCP Servers

e2b-mcp works with any MCP server that supports the standard MCP protocol. Some popular servers include:

- **mcp-server-filesystem**: File system operations
- **mcp-server-git**: Git repository management
- **mcp-server-sqlite**: SQLite database operations
- **mcp-server-brave-search**: Web search capabilities
- **mcp-server-slack**: Slack integration

## Security

e2b-mcp provides several layers of security:

1. **Sandbox Isolation**: All MCP servers run in isolated E2B sandboxes
2. **Network Isolation**: Sandboxes have controlled network access
3. **Resource Limits**: Automatic CPU, memory, and time limits
4. **Auto Cleanup**: Sandboxes are automatically destroyed after use
5. **No Host Access**: MCP servers cannot access your local file system

## Error Handling```python
from e2b_mcp import E2BMCPRunner, MCPError

try:
    runner = E2BMCPRunner()
    result = await runner.execute_tool(&quot;nonexistent&quot;, &quot;tool&quot;, {})
except MCPError as e:
    print(f&quot;MCP operation failed: {e}&quot;)
except ValueError as e:
    print(f&quot;Configuration error: {e}&quot;)

Development

Local Development```bash

Clone the repository

git clone https://github.com/cased/e2b-mcp.git
cd e2b-mcp

Install in development mode

pip install -e ".[dev]"

Format and lint code using the provided script

./scripts/format

Or run individual tools manually

black .
ruff check .


### Development Scripts

The project includes helpful development scripts in the `scripts/` directory:

#### Format Script (`./scripts/format`)
Automatically formats and lints the codebase:
- Runs `black` for code formatting
- Runs `ruff check --fix --unsafe-fixes` for linting and auto-fixes
- Runs `ruff format` for import sorting
- Runs `mypy` for type checking```bash
./scripts/format

Release Script (./scripts/release)

Handles the complete professional release process with comprehensive pre-flight checks:
- Version Validation: Ensures provided version matches pyproject.toml
- Pre-flight Checks: Validates git state, branch, and required tools
- Environment Validation: Checks PyPI credentials and dependencies
- Build & Publish: Builds package and publishes to PyPI automatically
- Git Tagging: Creates and pushes git tags to GitHub
- GitHub Releases: Optionally creates GitHub releases with auto-generated notes

Prerequisites for Release:```bash

1. Set PyPI credentials (required)

export TWINE_USERNAME=token
export TWINE_PASSWORD='your-pypi-api-token'

2. Install required tools

pip install build twine

3. Optional: Install GitHub CLI for release creation

brew install gh # or equivalent for your system


**Release Process:**```bash
# 1. Update version in pyproject.toml manually
# version = &quot;0.2.0&quot;

# 2. Commit the version change
git add pyproject.toml
git commit -m &quot;Bump version to 0.2.0&quot;

# 3. Run release script with the same version
./scripts/release 0.2.0

What the Release Script Does:
- ✅ Validates version matches pyproject.toml
- ✅ Checks for clean git state and proper branch
- ✅ Verifies PyPI credentials and required tools
- ✅ Builds package with python -m build
- ✅ Publishes to PyPI with twine upload
- ✅ Creates and pushes git tag (v0.2.0)
- ✅ Optionally creates GitHub release with auto-generated notes
- ✅ Handles virtual environment deactivation/reactivation for clean builds

Security Features:
- Multiple confirmation prompts before destructive actions
- Validates all prerequisites before starting
- Clean error handling with helpful messages
- Safe virtual environment handling

Testing

The package includes both unit tests and integration tests:

Unit Tests

Run fast unit tests that don't require E2B API access:```bash

Run only unit tests (fast)

pytest tests/test_basic.py

Run with verbose output

pytest tests/test_basic.py -v


#### Integration Tests
Run comprehensive integration tests that create real E2B sandboxes:```bash
# Set E2B API key (required for integration tests)
export E2B_API_KEY=&quot;your_api_key&quot;

# Run integration tests
pytest tests/test_integration.py -v

# Run all tests including integration
pytest -v

Test Commands```bash

Run only unit tests (no E2B API key needed)

pytest -m "not integration"

Run only integration tests (E2B API key required)

pytest -m integration

Run all tests

pytest

Run with coverage

pytest --cov=e2b_mcp

Run specific test

pytest tests/test_integration.py::TestE2BMCPIntegration::test_tool_discovery -v


#### Integration Test Categories

- **Basic Functionality**: Session creation, tool discovery, tool execution
- **Package Installation**: Testing MCP servers with pip dependencies
- **Environment Variables**: Testing custom environment configuration
- **Error Handling**: Testing failure scenarios and cleanup
- **Performance**: Concurrent sessions and rapid creation/destruction
- **Stress Testing**: Multiple simultaneous operations

**Note**: Integration tests create real E2B sandboxes and may take several minutes to complete. They require a valid E2B API key.

### Running Examples```bash
# Set E2B API key
export E2B_API_KEY=&quot;your_api_key&quot;

# Run basic example
python examples/basic_usage.py

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Related Projects

  • MCP (Model Context Protocol) - The protocol this library implements
  • E2B - Secure cloud sandboxes for AI
  • MCP Servers - Official MCP server implementations

Package Management

e2b-mcp supports flexible package installation across different ecosystems using install_commands:

Installation Commands```python

runner.add_server(ServerConfig(
name="multi_lang_server",
command="node server.js",
install_commands=[
# System packages
"apt-get update",
"apt-get install -y build-essential",
# Node.js ecosystem
"curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -",
"apt-get install -y nodejs",
"npm install express @modelcontextprotocol/server-filesystem",
# Python packages
"pip install requests beautifulsoup4",
# Custom setup
"mkdir -p /app/data",
"chmod 755 /app/data"
]
))


### Package Manager Examples

#### Node.js/npm```python
runner.add_server_from_dict(&quot;nodejs_mcp&quot;, {
    &quot;command&quot;: &quot;node mcp-server.js&quot;,
    &quot;install_commands&quot;: [
        &quot;apt-get update&quot;,
        &quot;apt-get install -y nodejs npm&quot;,
        &quot;npm install express sqlite3&quot;
    ]
})

Python with pip```python

runner.add_server_from_dict("python_mcp", {
"command": "python server.py",
"install_commands": [
"pip install --upgrade pip",
"pip install fastapi uvicorn pandas numpy"
]
})


#### Rust with cargo```python
runner.add_server_from_dict(&quot;rust_mcp&quot;, {
    &quot;command&quot;: &quot;./target/release/mcp-server&quot;,
    &quot;install_commands&quot;: [
        &quot;curl --proto &#x27;=https&#x27; --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y&quot;,
        &quot;source ~/.cargo/env&quot;,
        &quot;cargo build --release&quot;
    ]
})

System Dependencies```python

runner.add_server_from_dict("system_mcp", {
"command": "python git_server.py",
"install_commands": [
"apt-get update",
"apt-get install -y git curl wget",
"pip install gitpython"
]
})
```

Configuration

常见问题

7 问
答案由本站依据条目字段整理,不引用上游原文
e2b MCP 怎么安装?

在客户端按下面的安装命令接入:pip install -e ".[dev]"。装完在客户端配置里引用同一个包或端点。

e2b MCP 怎么在客户端里配置?

它的传输方式未标注,在客户端 MCP 配置里按官方文档填写启动命令和参数,保存后重启客户端生效。

e2b MCP 收费吗?

本站不代收费用,也没有标注具体价格。是否收费取决于服务本身和背后的接口额度,正式使用前按官方说明确认。

e2b MCP 需要 API Key 吗?

资料标注需要API Key认证,使用前准备好对应凭据,并按最小权限配置。

e2b MCP 能提供哪些能力?

资料显示能力标签包括 安全执行、工具发现、Python、资源管理。具体工具清单以官方文档为准。

e2b MCP 需要什么运行环境?

属于本地进程,需要在本机装好运行环境。

e2b MCP 是本地还是远程?

它是本地进程(stdio),由客户端在本机拉起。传输方式为stdio · 本地进程。

热门专题

按标签挑服务器
全部专题 →

服务器信息以作者仓库与官方文档为准;分类、传输方式与鉴权方式的中文说明为中文整理,最近核验 2026-05-17。