Skip to main content
Glama
sh7vansh

chrome-orchestrator

by sh7vansh

Chrome Orchestrator

chrome-orchestrator 是一个轻量级 Python SDK 和 CLI,它抽象了无头浏览器环境中的 Docker 管理,特别是 Arthur 和 gloria-headless。

它运行一个常驻后台守护进程,充当统一的 HTTP 代理。AI 智能体请求浏览器会话时,守护进程会动态预配所需的 Docker 容器,挂载持久化存储,并无缝代理端口 3000 上的无状态 HTTP/SSE MCP(Model Context Protocol)端点。

功能

  • 守护进程代理架构: 暴露一个统一的端口(默认为 3000),并将 MCP 流量代理到动态分配的 Docker 容器(Arthur 使用端口 8000,Gloria 使用 8787)。

  • 智能体清单: SDK 返回一个包含环境指令的 ContainerManifest,使 AI 智能体能够自动理解它们刚刚预配的环境所具有的能力。

  • 持久化存储: 自动挂载本地目录(~/.chrome-orchestrator/data/<image>),以便在浏览器会话之间保留状态。

  • 主动健康监控: 守护进程会在后台主动监控容器健康状态,并在容器无响应时尝试重启。

Related MCP server: hronaut

环境

两个环境都使用 chrome 浏览器对象暴露了相同的 execute_python 工具,使 AI 智能体无论底层后端如何,都能无缝地编写 Python 代码。

  • Arthur(默认): 一个纯粹的极简 Chromium 环境,具有精确的 DOM 保真度,通过 CDP WebSockets 原生交互。非常适合 token 限制和标准浏览场景。

  • Gloria-Headless: 一个预配置了 uBlock Origin Lite 的环境,通过 Chrome Bridge 扩展(本机消息传递)进行交互。用于处理验证码规避等“硬核任务”,因为它的行为更像真实用户浏览器。

要求

  • Python 3.9+

  • 已安装并运行 Docker 或 Podman。对于 Docker,请确保拥有访问 Docker 守护进程(/var/run/docker.sock)的权限。对于 Podman,原生支持 rootful socket 访问(unix:///run/podman/podman.sock),可作为无缝后备方案。

安装

# From PyPI
pip install chrome-orchestrator

# Or without installing via uvx
uvx --from chrome-orchestrator orchestrator <command>

# Or from source
pip install -e .

使用

1. 启动守护进程

首先,启动后台守护进程代理。此服务必须运行,CLI 和 SDK 才能工作。

uvx --from chrome-orchestrator orchestrator daemon

默认情况下,守护进程运行在 http://0.0.0.0:3000。

2. CLI 用法

你可以通过 CLI 管理 arthur 和 gloria 容器:

# Provision an Arthur container
uvx --from chrome-orchestrator orchestrator arthur up

# Stop an Arthur container
uvx --from chrome-orchestrator orchestrator arthur down

# Provision a Gloria-headless container
uvx --from chrome-orchestrator orchestrator gloria up

# Stop all running orchestrator containers
uvx --from chrome-orchestrator orchestrator down

当你运行 up 时,编排器会预配容器,并输出一个静态 MCP 专用 URL,供你的客户端连接,例如 http://localhost:3000/arthur/mcp。

3. Python SDK 用法

AI 智能体和 Python 脚本可以使用 SDK 以编程方式预配环境和拆除环境:

from chrome_orchestrator import sdk

# Provision the environment (defaults to Arthur)
manifest = sdk.up(sdk.ContainerImage.ARTHUR)

print(f"Connected! MCP URL: {manifest.mcp_url}")
print(f"Agent Instructions:\n{manifest.instructions}")

# Your automation/MCP client connects to `manifest.mcp_url` here...

# Tear down the session when finished
sdk.down(sdk.ContainerImage.ARTHUR)

测试

项目使用 pytest 进行测试。测试面向最高层的接缝(CLI 和 SDK),并模拟 HTTP 代理交互。

pytest tests/

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    A
    maintenance
    Enables AI agents to control a persistent local browser with live tabs, navigation, interaction, inspection, and state management through MCP.
    6
    -
  • A
    license
    B
    quality
    C
    maintenance
    Deploys a hosted, authenticated MCP server that lets AI assistants drive a real headless browser over HTTP, enabling navigation, clicking, typing, and reading pages without local browser setup.
    23
    6,555,401 npm
    Apache 2.0