cubesandbox-browser-sandbox
CubeSandbox 浏览器运行时
面向 CubeSandbox 上 browser_use 的生产镜像与模板契约,基于腾讯云按摘要固定的 sandbox-browser 镜像。每个沙箱都包含两种工作负载能力:
在
9000上运行持久的上游 Chromium/CDP,以及在8931上运行由 s6 管理的@playwright/mcp@0.0.79HTTP 服务,以 UID 1000 运行;在
/run/browser-use/runs提供可写的非 root Run 监督器存储,并在10000-10001上提供两个 Run 拥有的无头 Chromium CDP 槽位。
runtime 目标要求 RUNTIME_MARKER=sha256:<64 lowercase hex>。该标记写入 /etc/browser-use/runtime-marker,并且必须与 browser_use 中随单一模板 ID 一起提升的标记一致。
构建与验证
source_digest="$(git archive HEAD | sha256sum | cut -d' ' -f1)"
marker="sha256:$(printf '%s:runtime' "${source_digest}" | sha256sum | cut -d' ' -f1)"
docker build --target runtime --build-arg "RUNTIME_MARKER=${marker}" \
-t cubesandbox-browser-sandbox .
docker run -d --cap-add=SYS_ADMIN --shm-size=2g --name browser-runtime \
cubesandbox-browser-sandbox
docker exec --user user browser-runtime browser-sandbox-smoke mcp
docker exec --user user browser-runtime browser-sandbox-smoke run
docker exec --user user browser-runtime browser-sandbox-mcp-smoke该流程证明持久 MCP 能在同一沙箱中与两个并发的 Run 拥有的 Chromium 进程共存。SYS_ADMIN 仅本地 Docker 需要,以便 Chromium 能创建沙箱命名空间;CubeSandbox 提供部署后的隔离。
依赖项和基础镜像不可变:npm 包通过完整性锁定,Python 验证器依赖通过哈希锁定,两个构建阶段均使用镜像摘要,发布时生成 SBOM 和 SLSA 来源证明,并使用 Cosign 对推送的摘要进行无密钥签名。使用 uv pip compile requirements.in -o requirements.txt --generate-hashes 重新生成 Python 锁文件。
Related MCP server: project-tendril
发布与模板
工作流在 ghcr.io/hirotasoshu/cubesandbox-browser-sandbox 下发布 latest、sha-<commit> 和发布标签。提升必须将标签解析为 image@sha256:...;浮动镜像引用将被拒绝:
scripts/create-template.sh \
ghcr.io/hirotasoshu/cubesandbox-browser-sandbox@sha256:<digest>默认模板别名是 browser-use-runtime-medium,具有 2 vCPU、4 GiB 内存和 20 GiB 可写层。它暴露 envd 49983、持久 CDP 9000、MCP 8931 以及 Run CDP 槽位 10000-10001。只有持久 CDP 作为启动探针,因为 Run 端口在 Run 拥有它们之前一直处于空闲状态。
Cube 流量访问令牌是入口边界。MCP 仅允许动态 Cube 主机名,因为 Cube 在转发流量前会验证令牌。创建模板后,配置提供方 PID 上限和强制私有/链路本地出口拒绝,然后运行实时契约:
python -m venv .venv
.venv/bin/pip install -r requirements.txt
CUBE_TEMPLATE_ID=<template-id> \
CUBE_RUNTIME_MARKER=sha256:<runtime-marker> \
E2B_API_KEY=<cube-api-key> \
E2B_API_URL=<cube-api-url> \
.venv/bin/python scripts/verify-template.py实时检查创建一个安全沙箱并同时验证两种工作负载:标记和文件 API、公共/私有网络策略、所有三个浏览器端点上的认证 CDP、流量令牌拒绝、精确的 MCP 工具定义、MCP 导航以及不安全工具隔离。
最终提升权限仍由 browser_use 提供方一致性套件决定。仅凭镜像构建成功不得启用生产模式。
安全
CDP 和 Playwright MCP 授予浏览器控制权;MCP 的不安全工具等同于主机 RCE。切勿将应用密钥注入沙箱。保持流量令牌强制启用,仅使用不可变的镜像和标记值,强制执行提供方 PID 限制,并要求拒绝私有/链路本地流量。
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
Cloud browser, web extraction, screenshots, and remote CDP tools for AI agents.
Hosted real Google Chrome MCP with per-user persistent state. Navigate, click, type, screenshot.
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables browser automation and web scraping by exposing Playwright tools through an HTTP-based MCP server. Users can navigate pages, interact with web elements, capture screenshots, and extract structured content using a persistent Chromium instance.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to operate an isolated local Chromium browser through MCP, with semantic snapshots, ref-based actions, search, research, crawling, and CDP access.Apache 2.0
- AlicenseNot gradedqualityCmaintenanceEnables AI agents and clients to control a real Chromium browser through MCP tool calls, including navigation, clicking, typing, JavaScript evaluation, screenshots, and DOM snapshots. Supports multiple isolated sessions over authenticated HTTP with no disk writes.Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to drive a live, persistent self-hosted Chromium session over MCP, running browser actions via Playwright/CDP, capturing page snapshots, screenshots and videos, and managing uploads and downloads in the same tabs and signed-in accounts a human user can take over at any time.Apache 2.0