Skip to main content
Glama

agy-browse

agy-browse 是为 Google Antigravity 打造的本地真实浏览器协同与自动化 MCP 插件套件(架构受 anomalyco/browse 启发)。

通过轻量本地 Relay 服务、Chrome/Edge MV3 扩展以及 Stdio MCP Server,Agent 可以在保留你原有浏览器登录态、Cookie 与扩展生态的前提下安全接管指定标签页,执行无障碍快照、表单交互、网络与控制台排查,并在遇到登录、2FA、人机验证或关键确认时无缝交由人工接管(Handoff)。


系统架构

Antigravity Agent
   │  (Stdio MCP JSON-RPC 2.0)
   ▼
@agy-browse/cli (`bin.mjs mcp`)
   │  (Loopback HTTP + Bearer Token, 自动拉起 Relay)
   ▼
@agy-browse/relay (127.0.0.1:19978 / 19980..19987)
   ├── 路由与工具分发: @agy-browse/relay + @agy-browse/page
   │  (WebSocket /extension · ECDH P-256 + HKDF-SHA256 + HMAC-SHA256)
   ▼
@agy-browse/extension (Chrome / Edge MV3 Extension)
   │  (`chrome.debugger` CDP 1.3 + `chrome.tabs` / `chrome.tabGroups`)
   ▼
真实 Chromium / Edge 标签页

Monorepo 包职责

包名

目录

职责说明

@agy-browse/protocol

packages/protocol

冻结常量(DEFAULT_EXTENSION_ID、端口表、ENV_KEYS)、协议类型、Web Crypto ECDH/HKDF/HMAC 助手、校验器与 24 个工具 Schema

@agy-browse/page

packages/page

隐身隔离世界执行、可访问性快照与 @eN 引用、拟真贝塞尔输入与遮挡检测、人机验证检测、网络/密码脱敏、截图与 PDF、批量步骤执行

@agy-browse/relay

packages/relay

本地 HTTP/WS 中继服务、配对码与浏览器凭证管理、Host/Origin/Bearer/CDP 安全护栏、标签页生命周期与借出/归还/Handoff 调度

@agy-browse/cli

packages/cli

CLI 命令入口(serve / mcp / pair / status / tabs / install / 直接调用工具)、Stdio MCP Server、Antigravity 原生插件安装器

@agy-browse/extension

packages/extension

Chrome/Edge MV3 扩展(基于 vercel-labs/ui @ui-sdk/web + @ui-sdk/core 构建),支持工具栏一键借出/收回、浮动人工接管卡片、选项与配对界面


Related MCP server: uisight

快速安装到 Antigravity

1. 构建项目

在仓库根目录执行(需 Node.js >= 20 与 pnpm):

pnpm install
pnpm build

2. 安装 Antigravity 原生插件

运行 CLI 安装器将 agy-browse 插件(含 plugin.json、mcp_config.json、rules/AGENTS.md、skills/agy-browse/SKILL.md)安装到 Antigravity 插件目录(仓库提供 mcp_config.example.json 作为脱敏模板,运行 install 时会自动按你的本机绝对路径生成实际 mcp_config.json):

node packages/cli/dist/bin.mjs install --all

支持的选择性安装参数:

  • --workspace:仅安装到当前工作区 .agents/plugins/agy-browse/

  • --global:仅安装到用户全局 ~/.gemini/config/plugins/agy-browse/

  • --t3:仅安装到本机检测到的 C:\Users\<user>\.t3\userdata\providers\antigravity\*\config\plugins\agy-browse\

  • --all:同时安装到上述全部 Antigravity 插件目录(不加参数时默认等效 --all)

安全边界:agy-browse install 仅操作工作区 .agents/plugins/ 与本机 Antigravity 配置目录,绝不触碰 ~/.claude.json、~/.claude/settings.json 或全局 CLAUDE.md。

卸载插件(可选附带 --stop-relay 停止后台 Relay):

node packages/cli/dist/bin.mjs uninstall --all --stop-relay

加载浏览器扩展与配对

1. 加载未打包扩展

  1. 打开 Chrome 或 Edge,访问 chrome://extensions/(Edge 为 edge://extensions/)。

  2. 开启右上角 开发者模式(Developer mode)。

  3. 点击 加载已解压的扩展程序(Load unpacked),选择目录:

    <repo>/packages/extension/dist
  4. 由于扩展 manifest.json 固定了 "key" 公钥,加载后扩展 ID 恒定为:

    fhcpdokjkfalpaafjnfbncjcjholhanb

2. 配对连接

在终端执行:

node packages/cli/dist/bin.mjs pair

CLI 会自动确保本地 Relay 启动并生成一次性 8 位配对码(格式 XXXX-XXXX,有效期 10 分钟),同时输出一键配对地址:

chrome-extension://fhcpdokjkfalpaafjnfbncjcjholhanb/settings.html#code=XXXX-XXXX&port=19978

打开上述扩展设置页(或从扩展图标右键 选项 进入),填入配对码并点击 配对并连接 即可。可使用 --wait 参数等待新浏览器完成连接:

node packages/cli/dist/bin.mjs pair --wait

查看/撤销已配对浏览器:

node packages/cli/dist/bin.mjs pair --list
node packages/cli/dist/bin.mjs pair --revoke <browserId>

全部 24 个 MCP 工具一览

控制与管理(Relay 层)

工具名称

属性

核心参数

功能说明

browse_status

只读

browser?, includeSettings?

查询 Relay 健康状态、已连接浏览器、活动/借出标签页及扩展设置

browse_tabs

读写

action (list/open/close/focus/update/group/ungroup/cleanup), tab?, id?, url?, group?, allowedOrigins?, readOnly?, keepOpen?, keepVisible?, browser?, newWindow?, windowOf?

列出、打开、关闭/收回、聚焦、更新选项、分组/取消分组或清理标签页

browse_handoff

读写

action (start/wait/finish), tab, message?, timeoutMs?

发起人工接管、等待用户点击继续或由 Agent 主动结束等待

browse_settings

读写

action (get/set), browser?, settings?

读取或修改扩展与 Relay 运行偏好(放置位置、分组模式、空闲回收、静音等)

导航、快照与页面交互(Page 层)

工具名称

属性

核心参数

功能说明

browse_navigate

读写

tab, url?, action? (goto/back/forward/reload), waitUntil?, timeoutMs?

跳转到指定 URL 或执行前进、后退、刷新并等待加载状态

browse_snapshot

只读

tab, interactiveOnly?, includeHidden?, maxDepth?, selector?, frame?

在隔离世界中生成紧凑可访问性树并分配稳定引用(如 @e1)

browse_click

读写

tab, ref?, selector?, x?, y?, button?, clickCount?, modifiers?, timeoutMs?

点击引用元素、CSS 选择器元素或指定视口坐标(含遮挡检查)

browse_fill

读写

tab, ref?, selector?, value, submit?, timeoutMs?

清空并填充输入框/文本域(密码与 OTP 字段返回值自动脱敏)

browse_type

读写

tab, ref?, selector?, text, delayMs?, submit?, timeoutMs?

逐字符模拟键盘输入并触发完整按键事件

browse_press

读写

tab, key, ref?, selector?, modifiers?, timeoutMs?

发送单键或组合快捷键(如 Enter、Escape、Control+a)

browse_select

读写

tab, ref?, selector?, values, by? (value/label/index), timeoutMs?

选择 <select> 下拉框的一个或多个选项

browse_hover

读写

tab, ref?, selector?, timeoutMs?

将鼠标悬停到指定元素上方

browse_drag

读写

tab, sourceRef?/sourceSelector?/sourceX?/sourceY?, targetRef?/targetSelector?/targetX?/targetY?, steps?, timeoutMs?

执行元素或坐标之间的拖拽操作

browse_scroll

读写

tab, ref?, selector?, direction?, amount?, deltaX?, deltaY?, intoView?

按方向、像素偏移滚动页面/容器,或将元素滚动到可视区域

browse_wait_for

只读

tab, ref?, selector?, state?, text?, url?, loadState?, ms?, timeoutMs?

等待元素状态、页面文本、URL 匹配、加载事件或固定时长

browse_dialog

读写

tab, action (accept/dismiss/status), promptText?

查看、确认或取消 JS alert/confirm/prompt/beforeunload 对话框

browse_upload

读写

tab, ref?, selector?, files, timeoutMs?

将 FILE_ROOTS 允许范围内的本地文件附加到文件上传控件

browse_eval

读写

tab, expression, awaitPromise?, frame?

在页面上下文执行 JS 表达式并返回可 JSON 序列化的结果

调试取证、环境模拟与批量执行

工具名称

属性

核心参数

功能说明

browse_screenshot

只读

tab, ref?, selector?, fullPage?, format? (png/jpeg/webp), quality?

捕获视口、整页或单个元素的截图

browse_pdf

只读

tab, landscape?, printBackground?, scale?, paperWidth?, paperHeight?, pageRanges?, outputPath?

导出页面 PDF(返回 Base64 或写入允许的输出路径)

browse_network

只读

tab, action? (list/get/clear), requestId?, urlFilter?, resourceType?, status?, limit?, includeBody?

查看或清空网络请求与响应详情(敏感凭据自动脱敏)

browse_console

只读

tab, action? (list/clear), level?, limit?

查看或清空浏览器控制台日志与未捕获异常

browse_emulate

读写

tab, viewport?, colorScheme?, timezoneId?, locale?, geolocation?, offline?, userAgent?, reset?

模拟视口尺寸、深浅色主题、时区、语言、地理位置、UA 或离线状态

browse_execute

读写

tab, steps, stopOnError?

按顺序批量执行多个 browse_* 工具步骤,减少 MCP 往返次数


典型工作流

1. 人工接管(browse_handoff)

当遇到需要登录、短信/OTP 双因素认证、CAPTCHA/Turnstile 人机验证或高风险付款确认时,Agent 不会尝试绕过验证,而是发起接管:

  1. Agent 调用 browse_handoff(action: "start", message: "请完成登录后点击继续")。

  2. 扩展自动展开对应标签组,在页面右下角注入隔离 Shadow DOM 浮动卡片(徽章变为 WAIT 琥珀色),并可选发送桌面通知。

  3. 你在页面完成登录或验证后,亲自点击浮动卡片上的「继续」按钮(扩展仅接受 event.isTrusted === true 的真实用户点击)。

  4. Agent 自动解除阻塞并重新抓取页面快照继续执行。

2. 工具栏借出与随时收回(ON / RUN / WAIT)

除了由 Agent 打开新标签页外,你也可以直接点击浏览器工具栏上的 Antigravity Browse 扩展图标,将当前所在网页借出给 Agent:

  • 无徽章:普通用户标签页,Agent 完全不可见、不可触碰。

  • ON(翠绿 #10b981):已借出给 Agent,当前处于空闲待命状态。

  • RUN(天蓝 #3b82f6):Agent 正在该标签页上执行操作。

  • WAIT(琥珀 #f59e0b):处于 browse_handoff 等待用户接管状态。

  • 随时一键收回:任务进行中或结束后,再次点击工具栏扩展图标即可立即 detach 收回控制权;即使 Agent 对借出标签页调用 close,Relay 也只会安全收回而不会关闭你的标签页。


安全模型与环境变量

多层安全防线

  1. 非对称密钥绑定 + ECDH 前向安全双向认证:

    • 配对码采用 8 位抗混淆字符集(10 分钟过期),连续错误 5 次立即作废所有待配对码。

    • 握手基于 Web Crypto ECDH P-256 + HKDF-SHA256 + HMAC-SHA256,派生并持久化每浏览器独立密钥。

  2. 本地回环隔离与 CSRF 防护:

    • Relay 仅监听 127.0.0.1(默认 19978,占用时回退 19980..19987)。

    • 所有受保护 HTTP 端点校验 Authorization: Bearer <token>(0o600 权限持久化)、Host 回环白名单及跨站 Origin / Sec-Fetch-Site 拦截。

    • WebSocket /extension 严格校验 chrome-extension://fhcpdokjkfalpaafjnfbncjcjholhanb 及显式允许的扩展源。

  3. 浏览器与页面护栏:

    • CDP 危险指令黑名单拦截(禁止 Browser.close、Browser.crash、全局清除 Cookie/缓存、修改权限等)。

    • 危险协议拦截(禁止 chrome://、edge://、chrome-extension://、devtools://、javascript:、view-source:、text/html data URL,默认禁止 file://)。

    • readOnly 只读模式、allowedOrigins 来源限制与 FILE_ROOTS 文件路径防穿越检查。

    • 凭据脱敏:browse_fill 对密码/OTP 字段遮蔽日志输出;browse_network 对认证请求头、Cookie、URL 查询参数与 JSON 密钥字段及 JWT 自动脱敏。

环境变量配置(AGY_BROWSE_*)

环境变量

说明

默认值

AGY_BROWSE_PORT

固定 Relay 监听端口(设置后不做端口回退)

19978(回退 19980..19987)

AGY_BROWSE_HOST

Relay 绑定与探测主机地址

127.0.0.1

AGY_BROWSE_DATA_DIR

Relay Token、状态、配对与日志存储目录

Windows: %LOCALAPPDATA%\agy-browsePOSIX: ~/.local/share/agy-browse

AGY_BROWSE_TOOLS

暴露的工具子集:all(全部 24 个)、plain(不含 browse_execute)、execute(核心管理 + browse_execute)或逗号分隔列表

all

AGY_BROWSE_EXTENSION_ORIGINS

额外允许连接 /extension 的扩展 Origin(逗号分隔)

仅 chrome-extension://fhcpdokjkfalpaafjnfbncjcjholhanb

AGY_BROWSE_FILE_ROOTS

允许 browse_upload 与 browse_pdf 访问的额外目录(分号/路径分隔)

当前工作目录与系统临时目录

AGY_BROWSE_ALLOW_FILE_URLS

是否允许导航至 file:// 本地文件 URL(1/true 启用)

false

AGY_BROWSE_ALLOW_FOREGROUND

是否允许打开或切至前台焦点标签页(1/true 启用)

false(默认后台打开)

AGY_BROWSE_HUMAN_INPUT

是否默认启用拟真贝塞尔指针轨迹与输入延迟(1/true 启用)

false(亦受扩展设置控制)

AGY_BROWSE_IDLE_TAB_TTL_MS

Agent 打开的空闲标签页自动清理超时时间(毫秒)

1800000(30 分钟)

AGY_BROWSE_EXTENSION_TIMEOUT_MS

Relay 等待扩展执行单条指令的超时时间(毫秒)

30000(30 秒)


开发、测试与 CLI 常用命令

Workspace 开发命令

# 全量构建所有子包(protocol -> page -> relay -> cli -> extension)
pnpm build

# 全量 TypeScript 类型检查
pnpm typecheck

# 运行全量单元测试
pnpm test

# 清理构建产物
pnpm clean

CLI 常用命令

# 前台启动 Relay 服务(可指定端口与主机)
node packages/cli/dist/bin.mjs serve --port 19978 --host 127.0.0.1

# 启动 Stdio MCP Server(供 Antigravity 等 MCP 客户端调用)
node packages/cli/dist/bin.mjs mcp

# 查看当前 Relay 与浏览器/标签页状态(支持 --json)
node packages/cli/dist/bin.mjs status --json

# 列出标签页 / 聚焦等待中的 handoff 标签页 / 列出支持工具
node packages/cli/dist/bin.mjs tabs --json
node packages/cli/dist/bin.mjs show [tab]
node packages/cli/dist/bin.mjs tools

# 直接通过 CLI 调用任意 browse_* 工具
node packages/cli/dist/bin.mjs browse_navigate --tab app --url https://example.com
node packages/cli/dist/bin.mjs browse_snapshot --tab app --interactiveOnly true
node packages/cli/dist/bin.mjs browse_tabs --json '{"action":"open","id":"app","url":"https://example.com"}'

# 停止或重启后台 Relay
node packages/cli/dist/bin.mjs stop
node packages/cli/dist/bin.mjs restart

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    • LiveChat (Text) MCP server for ChatGPT, Claude and any AI agent: list chats, reply in chat, tag chat, transfer chat, archive chat and save canned response in your own LiveChat (Text) account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to LiveChat (Text) yourself; Cotlet does not store your password and you need no LiveChat (Text) API key. About the official LiveChat (Text) API: LiveChat (Text) has a full REST API, the Agent Chat API and the Configuration API, but only a narrow official MCP server (checked 17 Oct 2026). The server at mcp.text.com documents 8 tools that all read: search, fetch, chat transcripts, archived chats, tickets and tags. Setup and FAQ: https://cotlet.dev/integrations/livechat-api-mcp-server

    • Zendesk MCP server for ChatGPT, Claude and any AI agent: list tickets, reply to ticket, update ticket, apply macro, add internal note and search tickets in your own Zendesk account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Zendesk yourself; Cotlet does not store your password and you need no Zendesk API key. About the official Zendesk API: Zendesk has a full REST API, the Support API (also called the Ticketing API), but no documented Zendesk-hosted MCP server for working tickets (checked 16 Oct 2026). Zendesk's MCP documentation covers the MCP client, where Zendesk calls other servers. Setup and FAQ: https://cotlet.dev/integrations/zendesk-api-mcp-server

      https://cotlet.dev/mcp/v1/zendesk
    • Freshchat MCP server for ChatGPT, Claude and any AI agent: list conversations, read conversation, send reply, assign conversation, resolve conversation with label, list canned responses and get CSAT report in your own Freshchat account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Freshchat yourself; Cotlet does not store your password and you need no Freshchat API key. About the official Freshchat API: Freshchat has a REST API (v2) but no official MCP server (checked 22 Oct 2026). Freshworks' MCP integration covers Freshdesk and Freshservice, and its docs do not list Freshchat. Setup and FAQ: https://cotlet.dev/integrations/freshchat-api-mcp-server

    • Zammad MCP server for ChatGPT, Claude and any AI agent: search tickets, update ticket, reply to customer, add internal note, run macro and merge tickets in your own Zammad account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to Zammad yourself; Cotlet does not store your password and you need no Zammad API key. About the official Zammad API: Zammad has a full REST API but no official MCP server (checked 22 Oct 2026). The API docs say it allows all operations the UI has, and it needs an access token or OAuth set up on your own instance, which an admin can switch off. Setup and FAQ: https://cotlet.dev/integrations/zammad-api-mcp-server

      https://cotlet.dev/mcp/v1/zammad

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Gives an agent a real, watchable Chrome window to open and read pages, click and type, take screenshots, and inspect console messages, network requests, and script output. It also records performance traces and runs Lighthouse audits, with each chat getting its own browser that closes when the chat ends.
      1
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables an agent and a human to share the same live mobile and desktop browser sessions while measured UI findings — contrast ratios, touch-target sizes, overflow, clipping, and theme drift — come back as precise selector-attached text rather than screenshot guesses. It also lets the agent navigate, tap, type, scroll, switch device profiles and light/dark themes, and read the notes a person pinned to a specific frame.
      155 npm
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to attach to a real Chrome or Edge session over CDP and drive it through accessibility-tree snapshots, stable element refs, ref-based actions, and advisory screenshot/coordinate tools for canvas or sparse pages. It supports compact snapshot, act, snapshot workflows for forms, dashboards, and logged-in or geo-correct browsing.
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Lets AI agents drive the user's real Chromium browser, including opening and controlling tabs, taking screenshots, capturing network traffic, recording screen activity, and handing control back for logins or payments while using the user's existing sessions, logins, and extensions.
      1,134
      MIT