Skip to main content
Glama

browserd

一个持续录制的 Chromium,带可编程 DevTools,通过 MCP 暴露给 AI。

不是“由 LLM 驱动的 Playwright”——而是一个记录它所看到的一切的浏览器守护进程, 所以你的代理可以询问在你想到提问之前发生的流量。

Node TypeScript MCP Tools Tests


这实际上是什么

大多数浏览器 MCP 服务器封装了 Playwright,让模型点击东西。这只是开发者打开浏览器所做的事情的一小部分。

browserd 运行一个真实、有头的 Chromium,你可以自己使用,同时代理在旁观察。它持有一条持久的 CDP 连接,持续记录网络、控制台、异常和导航,并将它们存储在 SQLite 中。当模型最终提出问题时,它查询的是数据库——而不是浏览器。

   AI ──MCP──> browserd ──CDP──> Chromium (headed, yours to use)
                  │
                  ├── network recorder ──┐
                  ├── console recorder ──┼──> SQLite + content-addressed blobs
                  ├── page recorder ─────┤
                  └── target manager ────┘        (bodies, traces, heap snapshots)

这个区别很重要。问一个普通的浏览器自动化 MCP“为什么结账失败?”它什么也没有——请求已经消失了。问 browserd,它有载荷、响应体、控制台错误、堆栈跟踪和确切的源代码行。


你的代理可以做什么

查看

截图(视口 / 整页 / 元素)以真实图像块返回。带有稳定 eNN 引用的无障碍快照——比视觉更便宜、更可靠,适合决定点击什么。

操作

点击、悬停、输入、组合键、滚动、选择、上传、处理对话框。在设备模拟下回退到触摸派发。

网络

每个请求都带有所有标头(包括实际在线上传输的内容)、请求载荷、响应体、发起者、时序、重定向链、WebSocket 帧。录制在第一个页面脚本运行之前就已武装。

控制台

console.* 输出和带有堆栈的未捕获异常,在导航之间保留。还有带 DevTools 命令行 API($$$$x)的 Runtime.evaluate

DOM / CSS

结构轮廓、DevTools 所显示的完整级联,以及 css.explain_visibility——它会指出隐藏你元素的规则,而不是交给你一份样式表。

调试器

带条件的真实断点、单步执行、调用帧、作用域链、帧上求值。从暂停的堆栈中读取局部变量。

存储

localStorage、sessionStorage、cookies、IndexedDB(读写)、Cache Storage、配额。

性能分析

CPU 采样、JS 覆盖率、流式写入磁盘的跟踪、用于泄漏排查的带有构造函数级差异对比的堆快照、进程/CPU 信息。

模拟

受控时钟、时区、CPU 节流、网络条件、设备模拟、地理位置、视觉缺陷和故障注入。

人们没想到的部分

时间旅行。 time.run("30m") 推进时钟并触发每个到期的计时器——一个 60 秒的间隔立即触发 30 次。time.jump("30m") 向前跳跃,每个计时器只触发一次,即“合上笔记本电脑三个小时”的情况。不同的 bug 类别,不同的工具。

time.install({ time: "2030-01-01T00:00:00Z" })   # page now believes it is 2030
time.run({ duration: "30m" })                     # 30 interval ticks, no waiting
time.freeze()                                     # pin it and inspect

故障注入。 问“如果保存需要 20 秒,UI 会做什么?”然后真的去发现。

fault.delay({ url: "**/api/save", delay: "20s" })
fault.replace_response({ url: "**/api/user", status: 500, body: {...} })
fault.drop_next({ url: "**/api/payment", count: 1 })

泄漏排查。 两张堆快照和一个差异,按构造函数报告,并指出分离的 DOM 节点——这是经典的泄漏特征。

人 ↔ AI 交接。 inspector.pick 启用真正的 DevTools 元素选择器,让你自己点击出问题的元素;代理读回一个节点句柄。page.highlight 则是相反方向。


安装

要求 Node ≥ 20.11。当存在 Playwright 的捆绑构建时,Chromium 会从其中解析(品牌 Chrome 137+ 移除了 --load-extension;捆绑构建仍然保留),否则从系统安装中解析。

git clone <your-remote> browserd && cd browserd
npm install
npm run build

将其注册到你的 MCP 客户端

node scripts/install-mcp.mjs

它会检测 Claude Desktop、Claude Code、Codex CLI、Cursor、Windsurf 和 VS Code,合并到它们现有的配置中(先写一个 .bak),并且绝不覆盖其他服务器。

node scripts/install-mcp.mjs --print            # show the JSON, change nothing
node scripts/install-mcp.mjs --client codex     # just one client
node scripts/install-mcp.mjs --headless         # auto-launch headless
node scripts/install-mcp.mjs --http --port 7331 # register the HTTP endpoint instead

支持的客户端:Claude DesktopClaude CodeCodex CLICursorWindsurfVS Code。Codex 使用 [mcp_servers.browserd] TOML 片段而不是 JSON;安装程序会精准地编辑该文件,以便注释和你的其他设置得以保留。

然后确认每个客户端都能真正启动它:

npm run verify-mcp
  OK    Claude Code      174 tools advertised
  OK    Codex CLI        174 tools advertised
  OK    VS Code          174 tools advertised

这会读取真实的配置文件,并与其指定的任何内容完成 MCP 握手,因此过时的路径或手工编辑的条目会被发现,而不是假定可以工作。

或者手动添加:

{
  "mcpServers": {
    "browserd": {
      "command": "node",
      "args": ["/absolute/path/to/browserd/dist/cli.js"]
    }
  }
}

重启你的客户端。不需要打开浏览器——第一个需要浏览器的工具调用会启动它。

试试看

问你的代理:

打开 news.ycombinator.com,给我看截图,然后告诉我每个耗时超过 500ms 的请求,以及最慢的请求返回了什么。

或者,完整演示:

前往我在 localhost:3000 的应用,点击 Checkout,并告诉我为什么失败。

它会截取失败画面,读取控制台错误,找到失败的请求,向你展示载荷和 400 响应体,在已加载的源码中搜索调用函数,然后给你文件和行号。


直接运行守护进程

node dist/cli.js                 # MCP over stdio (default)
node dist/cli.js --http          # Streamable HTTP on 127.0.0.1:7331/mcp
node dist/cli.js --tools         # print the tool surface and exit
node dist/cli.js --help

标志

含义

--port N

HTTP 端口(默认 7331;0 选择空闲端口)

--host HOST

HTTP 绑定地址(默认 127.0.0.1——不要公开暴露

--profile NAME

自动启动的浏览器使用的配置文件

--headless

自动无头启动。默认是有可见窗口,你也可以使用

--no-auto-launch

从不隐式生成;要求 browser.launch

--log-level LEVEL

trace | debug | info | warn | error

环境变量:AGENTBROWSER_HOMEAGENTBROWSER_PORTAGENTBROWSER_LOG_LEVELAGENTBROWSER_HEADLESS

HTTP 模式仅绑定回环地址并验证 Origin——此端点是完全的浏览器控制,开放网络上的页面绝不能访问它。


两条设计规则

1. 先记录,后查询

Chromium 推送事件;守护进程持久化它们。无需预先武装任何东西,模型思考时也不会错过任何事件。历史在导航、标签页关闭和守护进程重启后仍然存在。

这是关键:收集器在启用域之前订阅 CDP 事件,目标管理器将新目标保持在 waitForDebuggerOnStart,直到仪器化生效。这就是“我们没有错过请求”这一事实成立而非仅仅是可能的原因。

2. 大型载荷绝不进入上下文

200MB 的响应存储为内容寻址的 blob,并作为工件句柄返回。代理使用 artifact.searchartifact.read_linesartifact.json_query(JSONPath 子集)读取它。跟踪、堆快照、DOM 转储和控制台导出也是如此。

工具默认是查询优先:dom.summary 先于 dom.get_htmlnetwork.summarize 先于 network.list_requestsjs.search_source 先于 js.get_source


人类和 AI 共用一个浏览器

浏览器是有头的,并且是你的。browser.set_control_mode 进行仲裁:

模式

含义

observe

AI 读取一切,不改变任何东西

shared

双方共同驱动(默认)

agent

AI 拥有输入

paused

AI 冻结;读取仍然有效

每个变更工具都会检查这一点——包括原始的 cdp.send 逃生舱口。


工具面

174 个工具。node dist/cli.js --tools 列出所有工具。

browser.*      list, launch, connect, status, list_targets, set_control_mode, close
page.*         navigate, screenshot, snapshot, click, type, press, scroll, extract_text,
               wait_for, highlight, dialogs, viewport, frames, tabs
dom.*          summary, query, inspect, get_html, set_html, set_attribute, remove, export
css.*          computed, matched_rules, set_style, stylesheets, explain_visibility
js.*           evaluate, list_scripts, get_source, search_source
console.*      query, exceptions, export, clear
network.*      list_requests, get_request, get_body, summarize, search_bodies,
               list_websockets, ws_messages, export_har, simulate, clear
storage.*      local/session, cookies, indexeddb, caches, usage, export
debugger.*     enable, breakpoints, pause, resume, step, call_frames,
               evaluate_on_frame, inspect_object, wait_for_pause
inspector.*    pick, picked, element, parents, children, snapshot, accessibility_tree
profile.*      start/stop/status (presets: cpu, slow-page, hang, memory-leak, full)
profiler.*     cpu, coverage, trace, long_tasks
memory.*       heap.snapshot, heap.compare, gc, usage
time.*         install, freeze, run, jump, resume, set_fixed_date, set_wall_clock, virtual
device.*       preset, viewport, orientation, reset
environment.*  timezone, locale, color_scheme, reduced_motion, vision, status, reset
fault.*        abort, delay, replace_response, drop_next, modify_headers, list, clear
artifact.*     list, stat, read, read_lines, search, json_query, export
cdp.send       escape hatch to any raw CDP method

测试

npm test                      # build + live MCP suite + HTTP suite
npm run test:live             # 117 checks: real MCP client, real Chromium, local fixture
npm run test:live:headed      # same, with a visible window
npm run test:deep             # 35 checks against a real public site
npm run test:http             # Streamable HTTP transport + origin guard
npm run test:real             # headed narrated walkthrough on live sites

每个测试套件都会启动真实服务器并连接真正的 MCP 客户端——断言通过 tools/call 进行,因此模式验证、处理器接线和操作都一起覆盖。

它们断言的是行为,而不是调用返回了内容:

  • 一个 400 的请求载荷和响应体都可读

  • 一个 700KB 的响应作为工件返回,内联 ~500 个字符

  • time.run("30m") 触发一个 60 秒的间隔恰好 30 次time.jump 触发它一次

  • 从暂停的调用帧中读取一个局部变量total=75tax=15

  • observe 模式拒绝 3/3 个变更,同时允许读取

  • 导出的 HAR 可解析回有效的 HAR 1.2

  • 堆快照作为真实的 .heapsnapshot 加载

tests/deep-dive.mjs 针对实时 Hacker News 运行:记录了 14 个真实请求,带有 h2/nginx/远程 IP 详情,从线上读取了 34KB 的响应体,1285 节点的 DOMSnapshot,1603 节点的无障碍树,以及检测到的 8MB 堆增量。


布局

src/
  cdp/        persistent WebSocket, flat-session multiplexing
  browser/    launcher, target manager (auto-attach + debugger hold), registry, faults
  collect/    network, console, page and execution-context recorders
  store/      SQLite schema, blob store, artifact store
  ops/        the actual capabilities, independent of MCP
  mcp/        tool definitions and server wiring
  cli.ts      stdio / HTTP entry point
tests/        live MCP suites
scripts/      install-mcp.mjs

MCP 是守护进程的一个接口,而不是守护进程本身。src/index.ts 导出核心,因此 CLI、REST 层或测试工具可以直接驱动它。

数据位于 ~/.agent-browser(用 AGENTBROWSER_HOME 移动它):browserd.dbblobs/artifacts/profiles/logs/


安全说明

  • 仅绑定回环地址。此端点是对持有你登录会话的浏览器的完全控制

  • ~/.agent-browser/profiles 下的浏览器配置文件包含 cookies 和会话令牌。录制的响应体包含你访问的页面返回的任何内容。两者都被 gitignore;请保持这样。

  • --net-log-capture-mode=Everything 可能包含线上的原始字节。只在你拥有的流量上使用它。

  • cdp.send 是不受限制的 CDP,仅受控制模式门控。


已知限制

  • Debugger.setScriptSource 实时编辑已从当前 Chromium 中移除 — 请编辑源代码并重新加载。

  • Network.getRequestPostData 可能会省略 multipart 上传中的文件,因此“每次上传的 每一个字节”不能仅靠该路径保证。请使用 capture_netlog 启动以获取 堆栈级详细信息(DNS、套接字、TLS)。

  • 受控时钟是通过 addScriptToEvaluateOnNewDocument 安装的假定时器垫片, 而非 Playwright 的 Clock API,因为守护进程使用原始 CDP。 time.virtual 暴露了 Chromium 自己的虚拟时间策略; 两者不能在同一目标上结合,守护进程拒绝叠加它们。

  • 触摸仿真刻意设置 Emulation.setEmitTouchEventsForMouse: 该标志会使 Chromium 永久停止确认 Input.dispatchMouseEventpage.click 改为合成点击。

  • ontouchstart in window 在文档创建时决定,因此重新加载后才会出现。 navigator.maxTouchPoints 立即可用。

  • Target.openDevToolsdevtools.open)是实验性的,某些构建版本会拒绝它。

  • 传感器仿真尚未实现。原始进程内存读/写不在范围内—— 这需要单独的调试器适配器。


许可证

MIT

-
license - not tested
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • Live browser debugging for AI assistants — DOM, console, network via MCP.

  • A paid remote MCP for AI agent browser DevTools MCP, built to return verdicts, receipts, usage logs,

  • A paid remote MCP for AI agent browser MCP session, built to return verdicts, receipts, usage logs,

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Kawai-Senpai/Browsered'

If you have feedback or need assistance with the MCP directory API, please join our Discord server