跳过安装。2 分钟内即可运行。
在 cloud.anythingmcp.com 开始免费试用,一键添加 E2B,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。
摘要
用 AI 管理团队的 E2B 云沙箱:列出、启动、查看、暂停、恢复和延长沙箱,读取它们的日志以及 CPU、内存和磁盘指标,并浏览团队的模板、构建和快照。
试试这样问
E2B 的示例提示
点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。
Claude 是 AI,可能会出错。请核对回答。
💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → E2B、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无
git clone、无本地服务器。
E2B + Microsoft Copilot
用 AI 管理团队的 E2B 云沙箱:列出、启动、查看、暂停、恢复和延长沙箱,读取它们的日志以及 CPU、内存和磁盘指标,并浏览团队的模板、构建和快照。
前提条件
完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:
E2B_API_KEY
步骤 1 — 获取凭证
设置大约需要 2 分钟。你需要一个 E2B 账户;运行中的沙箱按秒向团队计费(Hobby 套餐附带免费额度)。
- 登录 https://e2b.dev/dashboard,打开 Keys(https://e2b.dev/dashboard?tab=keys)。
- 复制一个团队 API 密钥。它以
e2b_开头;个人访问令牌(sk_e2b_...)在这里无效。 - 把它粘贴到
E2B_API_KEY。连接器通过X-API-Key请求头发送它,该密钥代表整个团队。 - 安装连接器并运行
e2b_list_sandboxes检查密钥。
哪些工具会产生费用:e2b_create_sandbox 启动沙箱,e2b_resume_sandbox 恢复已暂停的沙箱。运行中的沙箱按秒对 CPU 和内存计费,直到超时、被暂停或被终止;e2b_set_sandbox_timeout 把结束时间往后推时,计费也会相应延长。AI 会在启动、恢复或延长沙箱之前征求你的确认,保持较短的 timeout,并在工作完成后暂停沙箱或让它们到期。读取类工具免费,已暂停的沙箱不收取计算费用。
模板:e2b_list_default_templates 显示 E2B 的现成模板,例如 base、code-interpreter-v1 和 desktop,以及 CPU、内存、磁盘和 envd 版本;e2b_list_templates 列出团队自己的模板及其别名、构建状态和启动次数;e2b_list_template_builds 列出某个模板的构建。
启动沙箱:e2b_create_sandbox 接收 template_id(ID 或别名,默认 base)、以秒为单位的 timeout(默认 300),以及可选的 metadata(用于之后查找的字符串键值对)、env_vars、auto_pause(超时时暂停而不是结束)和 allow_internet_access。响应包含 sandboxID 和 domain。AI 不会把你未批准的密钥信息放进 env_vars。
查看:e2b_list_sandboxes 可按 state(running 或 paused)、template、metadata(如 user=abc&app=prod)和 started_after 过滤;e2b_get_sandbox 显示模板、资源、开始和结束时间、状态及网络设置;e2b_get_sandbox_logs 读取系统和进程日志,可按最低级别或搜索文本(区分大小写)过滤;e2b_get_sandbox_metrics 显示 CPU、内存和磁盘使用量随时间的变化。
生命周期:e2b_set_sandbox_timeout 从现在起设置新的结束时间并替换原来的时间,因此设置较短的值会让沙箱更早结束。e2b_pause_sandbox 冻结沙箱及其文件,默认也包括内存(memory: false 只保留文件系统,恢复时沙箱会重新启动);e2b_resume_sandbox 恢复沙箱,或延长正在运行的沙箱;e2b_list_snapshots 列出已保存的快照。
安装时关闭的工具:e2b_kill_sandbox。它无法撤销(进程、内存和文件都会丢失),因此由工作区管理员在团队需要时开启。
运行代码不属于本连接器:命令、文件和代码解释器由每个沙箱自身提供(其 envd 代理位于 https://<port>-<sandboxID>.e2b.app),并使用各自的访问令牌;团队 API 密钥不能发送到运行生成代码的沙箱中。如需运行代码,请使用 E2B SDK(e2b、@e2b/code-interpreter)或封装了它们的工具。沙箱访问令牌会从响应中移除。
数据格式:时间为 UTC 的 ISO 8601 格式;指标的 start 和 end 为 Unix 秒,日志的 cursor 值为 Unix 毫秒。cpuCount 是 vCPU 数,memoryMB 和 diskSizeMB 以兆字节计。
分页:e2b_list_sandboxes、e2b_list_templates、e2b_list_template_builds 和 e2b_list_snapshots 接收 limit(默认 50,最多 100),在 _headers.x-next-token 中返回下一页令牌,列表本身位于 data 中;AI 会把令牌作为 next_token 传回,直到它不再出现。e2b_list_sandboxes 还返回 _headers.x-total-running。e2b_get_sandbox_logs 从某个 cursor 起按 forward 或 backward 返回最多 1,000 行(默认 100 行)。
限制:团队有同时运行的沙箱数量上限。timeout 受套餐限制:Hobby 为 1 小时,Pro 为 24 小时。
常见错误:400 表示参数错误(例如超时超过套餐上限);401 表示密钥错误,或使用了访问令牌而不是团队 API 密钥;403 表示团队无权使用该模板;404 表示沙箱或模板不存在(超时的沙箱已被移除);409 表示沙箱已暂停或正在暂停;429 表示同时运行的沙箱或请求过多(AI 会等待,而不是循环重试);500 和 503 是 E2B 端的问题。
该连接器不在沙箱内运行代码、命令或文件操作,也不构建模板。
步骤 2 — 安装 adapter
curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d
步骤 3 — 在 Microsoft Copilot 中添加连接器
你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(
https://cloud.anythingmcp.com/mcp/…)。本指南中出现YOUR_SERVER_ID的地方都用它替换。
Microsoft Copilot 通过在 Copilot Studio 中构建的智能体使用 MCP 服务器:把 AnythingMCP 作为工具添加到智能体,然后把智能体发布到 Microsoft 365 Copilot 和 Teams。Copilot Studio 从 Microsoft 的云端通过 Streamable HTTP 连接,AnythingMCP 支持这种方式。
- 在 Copilot Studio 中打开你的智能体(或新建一个),进入 Tools,选择 Add a tool → New tool → Model Context Protocol。
- 填写 Server name(例如
AnythingMCP)、说明连接器用途的 Server description,以及 Server URLhttps://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID。Copilot Studio 根据描述决定何时调用该服务器。 - 身份验证选择 API key,把 Type 设为 Header,请求头名称填
X-API-Key,然后选择 Create。 - 在 Add tool 中选择 Create a new connection,粘贴 AnythingMCP 的 MCP API 密钥(MCP Servers → 你的服务器 → API keys),然后选择 Add to agent。
- 在智能体的 Test 窗格中试一试:提出需要用到
E2B的工具的请求。 - 选择 Publish,然后进入 Channels → Microsoft 365 and Microsoft Teams,保持勾选 Make agent available in Microsoft Copilot,再选择 Add channel。See agent in Teams 会为你安装该智能体;在 Microsoft 365 Copilot 中输入 @ 并选择该智能体。
希望每个用户各自登录?请选择 OAuth 2.0 → Dynamic discovery 代替 API 密钥:每个用户会在智能体首次调用时登录 AnythingMCP。
自托管?请用你实例的公网 HTTPS 地址替换 https://cloud.anythingmcp.com。Copilot Studio 从 Microsoft 的云端连接,因此 localhost 无法使用。
可用工具
| Tool | What it does |
|---|---|
e2b_list_sandboxes | List the E2B sandboxes of the team, newest first: sandbox id, template, alias, state (running or paused), start and end time, CPU, memory… |
e2b_get_sandbox | Read one E2B sandbox: template and alias, state, start and end time, CPU, memory and disk, envd version, domain, internet access, network… |
e2b_create_sandbox | Start a new E2B sandbox from a template |
e2b_set_sandbox_timeout | Set when an E2B sandbox ends: timeout seconds counted from now, replacing the previous end time (a shorter value ends it sooner) |
e2b_pause_sandbox | Pause a running E2B sandbox, saving its files and, by default, its memory, so it can be resumed later with e2b_resume_sandbox |
e2b_resume_sandbox | Resume a paused E2B sandbox (or extend a running one) and return its details |
e2b_kill_sandbox | Kill an E2B sandbox immediately |
e2b_get_sandbox_logs | Read the logs of one E2B sandbox (system and process output) with timestamp, level and message; filter by minimum level or a search string |
e2b_get_sandbox_metrics | Read the resource use of one E2B sandbox over time: CPU count and usage percent, memory and disk used and total, per timestamp |
e2b_list_templates | List the team's E2B templates: template id, aliases and names, build id and status, CPU, memory and disk, public flag, spawn count, last… |
e2b_list_template_builds | List the builds of one E2B template with build id, status, CPU, memory, disk, envd version and dates |
e2b_list_default_templates | List E2B's ready-made default templates (such as base, code-interpreter-v1 and desktop) with their aliases, CPU, memory, disk and envd… |
e2b_list_snapshots | List the team's E2B sandbox snapshots with id, name, the sandbox they came from and dates; filter by sandbox or name |
示例提示
- “现在有哪些 E2B 沙箱在运行?每个用的是什么模板,什么时候结束?”
- “用元数据 user=demo 启动一个 code-interpreter-v1 沙箱,运行 10 分钟,并告诉我它的 sandbox id。”
- “显示沙箱 ixk2b9z0 的错误日志。”
- “沙箱 ixk2b9z0 自启动以来用了多少 CPU 和内存?”
- “暂停所有带有元数据 app=staging 且正在运行的沙箱。”
FAQ
这适用于哪个 Copilot? 适用于工作中的 Microsoft 365 Copilot,通过 Copilot Studio 的智能体实现。面向个人账户的 Microsoft Copilot 应用无法添加自己的 MCP 服务器。
我需要什么? 一个可以使用 Copilot Studio 的工作账户(许可证或试用版),用于构建智能体。在 Microsoft 365 Copilot 或 Teams 中使用它的人需要拥有该智能体的访问权限:把它共享给他们,或请管理员为整个组织发布。如果你的组织对 Power Platform 连接器设置了数据策略,这些策略同样适用于 MCP 服务器。
智能体不调用工具。 检查请求头名称是否正好是 X-API-Key,密钥是否属于与 URL 相同的 MCP 服务器,并把 Server description 写得具体:Copilot Studio 根据它决定何时调用服务器。每次修改后重新发布智能体;在已打开的对话中输入 "start over" 即可使用新版本。
下一步
这份指南对你有帮助吗?