Sandboxrun

io.github.CloudCorpRecords由 GitHub 账号 CloudCorpRecords 发布v0.1.0更新于 Nov 1, 2026

Run code in a secure E2B sandbox from the CLI or a stdio MCP server.

概览

AI 生成的概览

在临时的 E2B 云端沙箱中运行 Python 代码,返回输出、结果与错误,让助手不必在你本机执行代码。

可以做什么
  • 在新建的 E2B 沙箱中运行 Python 代码片段,返回沙箱 id、打印输出、结构化结果、日志行以及代码抛出的错误。
  • 代码使用 Jupyter Notebook 语法,表达式与单元格行为与笔记本一致。
  • 每次调用都会从 code-interpreter 模板创建全新沙箱,各次运行之间不共享状态。
适用场景
适合助手写完 Python 代码后验证其能否真正运行,或希望代码不在自己机器上执行的场景。它只提供单一工具,更适合快速验证而非长时间会话。
运行要求
通过 npx(需 Node.js)或 Docker 镜像以 stdio 在本地运行。需要 E2B 账号,并在 E2B_API_KEY 环境变量中提供 API 密钥,缺失时每次运行都会失败。需要能访问 E2B API 的网络。
安装前请注意
E2B_API_KEY 是会产生费用的第三方凭据,会以 X-API-Key 请求头发送给 E2B API,请勿写入共享配置。代码及其输出会离开本机进入 E2B 云端沙箱,避免在代码片段中放入密钥或私密数据。沙箱为临时性,调用之间不会保留任何内容。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Sandboxrun,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

sandboxrun

sandboxrun gives an agent a safe place to run code it just wrote. Hand it a snippet and it comes back with what the snippet printed, the values it produced, and any error it hit — all executed inside a short-lived E2B sandbox, never on your own machine. It runs from the command line or as an MCP server for agents.

An E2B API key is required. Put it in the E2B_API_KEY environment variable; the key is sent to the API as the X-API-Key header and never appears in output. When the variable is missing, every run fails with an error that names it.

Install

bash
npx @reneturcios/sandboxrun run "print(6 * 7)"

Or run the container image:

bash
docker run -i -e E2B_API_KEY ghcr.io/cloudcorprecords/sandboxrun

The container defaults to the MCP server (see below). Pass CLI arguments to use it as a CLI instead.

CLI

bash
export E2B_API_KEY="your E2B API key"
# Run a snippet inlinesandboxrun run "print('hello from the sandbox')"
# Run a file's contentssandboxrun run --file analysis.py
# Machine-readable outputsandboxrun run "import math; print(math.pi)" --json
sandboxrun --version

Exit codes: 0 on success, 1 when a run fails (including a missing E2B_API_KEY, an API error, or an error raised by the code itself), 2 for usage errors.

MCP server

One bin serves both faces. The mcp subcommand starts a stdio MCP server:

bash
npx -y @reneturcios/sandboxrun mcp

MCP client configuration:

json
{  "mcpServers": {    "sandboxrun": {      "command": "npx",      "args": ["-y", "@reneturcios/sandboxrun", "mcp"],      "env": { "E2B_API_KEY": "your E2B API key" }    }  }}

Tools

ToolInputWhat it returns
run_codecode (string, required)The execution as a text block: the sandbox id, printed output, structured results, log lines, and any error the code raised. Code uses Jupyter notebook syntax.

The documented E2B MCP server exposes this single tool, and sandboxrun exposes exactly that tool — nothing extra.

Under the hood each call creates a fresh sandbox from the code-interpreter template (POST https://api.e2b.app/sandboxes) and then executes the code in it. The upstream SDK talks to the sandbox's Jupyter kernel over a websocket channel; this rebuild shapes the execution as a REST request behind the same seam and records that transport simplification in its build report.

Development

bash
npm installnpm run build   # tsc -> dist/npm test        # node test runner over test/*.test.ts, no network (fake fetch fixtures)npm run dev     # run the CLI from source via tsx

License

MIT — see LICENSE.

来源:README.md,提交 226de0e

工具

1

run_code

Run python code in a secure sandbox by E2B. Using the Jupyter Notebook syntax.

输入参数code必填

版本历史

1
  1. v0.1.0最新Nov 1, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分