f2b-mcp-gateway
Exposes f2b-sandbox capabilities as MCP tools for creating, managing, and running commands in sandboxes, enabling AI agents to execute code and manipulate files in isolated environments.
README
f2b-mcp-gateway
灵境云 MCP 网关:把 AI 沙箱能力暴露为 Model Context Protocol tools,供 Claude Desktop、Cursor 等 MCP 客户端调用。
| 项 | 说明 |
|---|---|
| 传输 | stdio(V1);Streamable HTTP 后置 |
| 上游 | f2b-sandbox /v1(经 @f2b/sdk) |
| 密钥 | 仅进程 env:F2B_API_KEY / F2B_SANDBOX_URL;不向客户端回显 |
工具映射
| MCP tool | 沙箱能力 |
|---|---|
sandbox_create |
POST /v1/sandboxes |
sandbox_list |
GET /v1/sandboxes |
sandbox_get |
GET /v1/sandboxes/{id} |
sandbox_run |
POST /v1/sandboxes/{id}/commands |
sandbox_write_file |
POST /v1/sandboxes/{id}/files |
sandbox_read_file |
GET /v1/sandboxes/{id}/files?path= |
sandbox_list_files |
GET .../files?list=1 |
sandbox_kill |
DELETE /v1/sandboxes/{id} |
本地开发
前置:f2b-sandbox 在 http://127.0.0.1:8787 运行(F2B_AUTH_MODE=off 或提供 F2B_API_KEY)。
# 同级目录需有 f2b-sdk-js、f2b-spec(file: 依赖)
pnpm install
pnpm typecheck
pnpm smoke # → MCP_SMOKE_OK
pnpm start # stdio 服务(需 MCP 客户端拉起)
环境变量
| 变量 | 默认 | 说明 |
|---|---|---|
F2B_SANDBOX_URL |
http://127.0.0.1:8787 |
沙箱服务根 URL |
F2B_PATH_PREFIX |
/v1 |
API 前缀 |
F2B_API_KEY |
(空) | 用户 API Key;鉴权关闭时可省略 |
Claude Desktop 示例配置
{
"mcpServers": {
"lingjing": {
"command": "pnpm",
"args": ["--dir", "/path/to/f2b-mcp-gateway", "exec", "tsx", "src/index.ts"],
"env": {
"F2B_SANDBOX_URL": "http://127.0.0.1:8787",
"F2B_API_KEY": "f2b_sk_…"
}
}
}
}
安全
- 网关不持有 / 转发 Cube 管理密钥;只持用户侧
F2B_API_KEY调灵境云沙箱 HTTP。 - 日志写 stderr;stdout 专供 MCP JSON-RPC。
- 正式 npm 发布延后到产品 1.0;现阶段
file:/ git 依赖。
相关仓
- 契约:f2b-spec
- 沙箱服务:f2b-sandbox
- TS SDK:f2b-sdk-js
- 文档:f2b-docs
Apache-2.0
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.