开源项目 Browser Harness:单条 Prompt 让 Claude Code、Codex 和 Cursor 接管已登录的真实 Chrome
英文标题:📦 browser-use/browser-harness
Browser Use 开源了全新工具 Browser Harness(基于 MIT 许可证),允许 Claude Code、Codex、Cursor 等编程 Agent 通过单条提示词快速配置,直接接管开发者已登录的真实 Chrome 浏览器,执行页面浏览、点击输入与文件下载等操作。该工具基于 Chrome DevTools Protocol (CDP),且 Agent 在执行任务时遇到缺失的辅助功能可自动编写 helper 脚本,使 Harness 随任务积累持续自我完善。在 BU Bench V2.1 基准任务测试中,Browser Harness 在任务完成度持平主流工具的同时,取得了最低的中位数 Token 消耗(2.1M)与最低的模型成本($0.042/任务)。该项目显著降低了 Agent 深度融入个人真实开发工作流的门槛,推动了具备自进化能力浏览器 Agent 的落地。
2.3 KB
1.3 MB
49.5 KB
63.7 KB
中文
Browser Harness 允许 Claude Code、Codex 或 Cursor 使用你真实的 Chrome 浏览器:在以你的身份登录的状态下打开页面、点击、输入、读取和下载。只需将一条提示词粘贴到你的编程 Agent 中即可完成配置。它通过 DevTools 协议(CDP)与 Chrome 通信,并且 Agent 会在工作过程中自行编写缺失的 helper,因此 Harness 能够随着每个任务的进行变得越来越强大。项目开源,采用 MIT 许可证。
在 Browser Use Cloud 中体验 browser-harness,或将配置提示词粘贴到你的编程 Agent 中。
● agent: wants to upload a file
│
● agent-workspace/agent_helpers.py → helper missing
│
● agent writes it agent_helpers.py
│ + custom helper
✓ file uploaded
你将再也不需要自己操作浏览器。
任务:“打开我的 X 个人主页,找到我最新的 20 条视频帖子,并将它们下载下来。”
粘贴至 Claude Code 或 Codex(Cursor 用户请使用下方的 MCP 配置):
Install or upgrade browser-harness to the latest stable version with uv using Python 3.12, register the skill from browser-harness skill, and connect it to my browser. Ask whether I want local browser recordings enabled; default to no and preserve my existing preference on upgrades. Follow https://github.com/browser-use/browser-harness/blob/main/install.md if setup or connection fails.
Agent 将会打开 chrome://inspect/#remote-debugging。首次配置时,请勾选该复选框以便 Agent 连接到你的浏览器:
与其他浏览器工具对比
| 适用工具 | 驱动的浏览器 | 在你自己的 Chrome 中需要批准的内容 |
|---|---|---|
| Browser Harness | Claude Code、Codex、Cursor,以及任何通过 browser-harness-mcp 连接的 MCP 客户端 |
你正在运行且已登录的 Chrome |
| Playwright MCP | 任何 MCP 客户端(Claude Code、Codex、Cursor、Copilot 等) | 默认使用其自带的浏览器 profile。使用 --extension(Playwright 扩展)或 --cdp-endpoint 时连接你的 Chrome |
| Playwright CLI | Claude Code、GitHub Copilot 及其他运行 shell 命令的 Agent | 默认使用其自带的浏览器。使用 attach --extension=chrome 或 attach --cdp=chrome 时连接你的 Chrome |
| Chrome DevTools MCP | 任何 MCP 客户端(Claude Code、Cursor、Copilot、Antigravity 等),外加 CLI | 默认使用带有专属 profile 的新 Chrome。使用 --autoConnect 连接你的 Chrome 144+ |
| agent-browser | Claude Code、Codex、Cursor、Gemini CLI、Copilot 等,提供带 skill 的 CLI 以及 MCP 服务端 | 默认使用自带的 Chrome for Testing。使用 --profile 复制你的 Chrome profile。使用 --auto-connect 或 --cdp 连接你正在运行的 Chrome |
| Claude in Chrome | 搭配 Claude 扩展的 Claude Code(CLI 或 VS Code),使用直接的 Anthropic 订阅计划(Pro、Max、Team、Enterprise)登录,不能使用 API Key | 你已登录的 Chrome、Edge 或其他 Chromium 浏览器 |
| ChatGPT Browser 与浏览器扩展 | ChatGPT 桌面应用中的 Codex 和 ChatGPT 对话,不支持 Codex CLI 或 Codex IDE 扩展 | 浏览器:独立的 profile。扩展:你的 Chrome、Edge、Brave、Opera 或 Vivaldi profile |
Browser Use 在 200 个公开 BU Bench V2.1 任务中的 100 个任务上进行了对照评估(bu2-001 至 bu2-100;101-200 未运行)。测试时间为 2026-10-14。
- 每个工具使用相同的 Agent:Codex CLI 0.144.6,GPT-6 Luna,中等推理能力(medium reasoning),关闭网络搜索。使用相同的固定 Judge(frozen judge)。
- Browser Harness 以其 CLI 和 SKILL.md 的形式提供给 Agent,而非
browser-harness-mcp。Playwright MCP 和 Chrome DevTools MCP 以默认设置作为 MCP 服务端运行。agent-browser 以其 CLI 和 skill 运行。 - 每个工具都通过 CDP 驱动同一个全新启动的 Browser Use 云端浏览器。这并不衡量每个工具的默认模式或本地 Chrome 模式。
- 每个任务运行一次。Agent 失败从不重试。运行器(Runner)、浏览器和 Judge 故障重试一次(Browser Harness 重试 3 个任务,Playwright MCP 4 个,Chrome DevTools MCP 6 个,agent-browser 0 个)。
| 工具 | 平均评分标准得分 0-100 (95% CI) | 完全解决率 | 任务中位数输入 Token 数 | 任务中位数模型成本 (GPT-6 Luna 标价) | 任务中位数 Agent 耗时 |
|---|---|---|---|---|---|
| Browser Harness a6426f84 (main) | 60.4 (55.2-65.4) | 11% | 2.1M | $0.042 | 9.0 分钟 |
| Playwright MCP 0.0.83 | 60.0 (55.1-65.0) | 11% | 4.4M | $0.066 | 8.3 分钟 |
| Chrome DevTools MCP 1.10.1 | 61.0 (55.8-65.9) | 11% | 6.7M | $0.097 | 8.7 分钟 |
| agent-browser 0.39.1 | 56.3 (51.1-61.5) | 9% | 3.3M | $0.056 | 11.2 分钟 |
没有任何工具在得分上具有绝对优势:与 Browser Harness 的每一次配对差异,其 95% 置信区间(CI)均包含零(其他工具减去 Browser Harness:agent-browser -4.0,CI -10.0 至 +1.8;Playwright MCP -0.4,-6.6 至 +5.7;Chrome DevTools MCP +0.6,-5.6 至 +6.6)。
Browser Harness 拥有最低的中位数输入 Token 数(2.1M 对比 3.3-6.7M)以及最低的中位数模型成本($0.042 对比 $0.056-0.097)。模型成本不包含浏览器、代理(proxy)和评测 Judge。它的耗时慢于 Playwright MCP 和 Chrome DevTools MCP(中位数 9.0 分钟对比 8.3 和 8.7 分钟),但快于 agent-browser(11.2 分钟)。这些是中位数,没有置信区间。
agent-browser 的首次运行已被作废:因我方配置缺陷导致它启动了本地浏览器,而非共享云端浏览器。该行展示的是纠正后的重新运行结果。
仅使用 Codex 进行了测试。Claude Code、Cursor、Playwright CLI 和 Claude in Chrome 未参与测试。方法与逐任务得分参见:coding-agent-browser-tools.json。
什么时候该选择其他工具
- Playwright(Test、MCP 或 CLI):对你自己的应用进行隔离、可复现的 CI 测试,在没有个人登录态的干净浏览器中运行。
- Chrome DevTools MCP:性能追踪(traces)和 DevTools 调试(网络、控制台、源码映射堆栈追踪)。
- Claude in Chrome:你仅使用 Claude,并且拥有 Pro、Max、Team 或 Enterprise 订阅计划。
- Cursor 内置浏览器:Agent 不需要你已登录的 Chrome。它在每个工作区独立的 profile 中运行。
OpenAI 的 Codex 在其设置中将浏览器功能标记为“Browser use”。这与本仓库背后的 Browser Use 公司是分开独立的。
通过 Browser Use Cloud 实现规模化扩展
在本地浏览器中处理已登录的个人工作。当你需要并行运行多个浏览器,并具备实时预览、代理、隐身防检测(stealth)、CAPTCHA 验证码破解等功能时,可通过 Browser Use Cloud 进行扩展。
browser-harness-mcp 通过 stdio 将浏览器控制 helper 暴露为 MCP 工具,因此任何 MCP 客户端(Claude Code、Devin、Cursor 等)都可以直接驱动浏览器,而无需自行编写第二套 CDP 层。配置与客户端设置请参见 docs/MCP.md。
将以下内容添加到你项目中的 .cursor/mcp.json,或添加到适用于所有项目的 ~/.cursor/mcp.json。该配置需要安装 uv。
{ "mcpServers": { "browser-harness": { "type": "stdio", "command": "uvx", "args": ["--from", "browser-harness[mcp]", "browser-harness-mcp"] } } }
欢迎提交 Bug 修复、文档改进以及由 Agent 生成的领域技能(domain skills)。详见 CONTRIBUTING.md。
The Bitter Lesson of Agent Harnesses · Web Agents That Actually Learn
English / 原文
Browser Harness lets Claude Code, Codex or Cursor use your real Chrome browser: open pages, click, type, read and download, logged in as you. Paste one prompt into your coding agent to set it up. It talks to Chrome over the DevTools Protocol (CDP), and the agent writes any missing helper as it works, so the harness gets better with each task. Open source, MIT licensed.
Try browser-harness in Browser Use Cloud or paste the setup prompt into your coding agent.
● agent: wants to upload a file
│
● agent-workspace/agent_helpers.py → helper missing
│
● agent writes it agent_helpers.py
│ + custom helper
✓ file uploaded
You will never use the browser again.
Task: "Open my X profile, find my latest 20 video posts, and download them."
Paste into Claude Code or Codex (Cursor: use the MCP config below):
Install or upgrade browser-harness to the latest stable version with uv using Python 3.12, register the skill from `browser-harness skill`, and connect it to my browser. Ask whether I want local browser recordings enabled; default to no and preserve my existing preference on upgrades. Follow https://github.com/browser-use/browser-harness/blob/main/install.md if setup or connection fails.
The agent will open chrome://inspect/#remote-debugging. On first setup, tick the checkbox so the agent can connect to your browser:
Compared with other browser tools
| Works with | Browser it drives | What you approve in your own Chrome
---|---|---|---
Browser Harness | Claude Code, Codex, Cursor, any MCP client via browser-harness-mcp | Your running Chrome, logged in as you | Whole browser: on Chrome 144+, tick remote debugging in chrome://inspect, then click Allow
Playwright MCP | Any MCP client (Claude Code, Codex, Cursor, Copilot and more) | Its own browser profile by default. Your Chrome with --extension (Playwright Extension) or --cdp-endpoint | Chosen tabs (one tab group per client) via the extension, approval skippable with a token; or whole browser via --cdp-endpoint
Playwright CLI | Claude Code, GitHub Copilot and other agents that run shell commands | Its own browser by default. Your Chrome with attach --extension=chrome or attach --cdp=chrome | Chosen tab via the Playwright Extension, or whole browser via --cdp
Chrome DevTools MCP | Any MCP client (Claude Code, Cursor, Copilot, Antigravity and more), plus a CLI | A new Chrome with a dedicated profile by default. Your Chrome 144+ with --autoConnect | Whole browser: the same Chrome 144+ toggle and Allow dialog; the server sees every open window of that profile
agent-browser | Claude Code, Codex, Cursor, Gemini CLI, Copilot and more, as a CLI with a skill, plus an MCP server | Its own Chrome for Testing by default. A copy of your Chrome profile with --profile. Your running Chrome with --auto-connect or --cdp | Whole browser via --auto-connect or --cdp: the same Chrome 144+ toggle and Allow dialog
Claude in Chrome | Claude Code (CLI or VS Code) with the Claude extension, signed in with a direct Anthropic plan (Pro, Max, Team, Enterprise), not an API key | Your Chrome, Edge or other Chromium browser, logged in as you | Per site: allow sites in the extension, or per action in Claude Code (auto mode can skip the per-site check). Claude works in a tab group it opens
ChatGPT Browser and browser extension | Codex and ChatGPT chats in the ChatGPT desktop app, not Codex CLI or the Codex IDE extension | Browser: a separate profile. Extension: your Chrome, Edge, Brave, Opera or Vivaldi profile | Per site: asks before each new website (allow once, for this site, or for all sites)
Matched eval by Browser Use on 100 of the 200 public BU Bench V2.1 tasks (bu2-001 to bu2-100; 101-200 not run). Measured 2026-10-14.
- Same agent for every tool: Codex CLI 0.144.6, GPT-6 Luna, medium reasoning, web search off. Same frozen judge.
- Browser Harness was given to the agent as its CLI and SKILL.md, not
browser-harness-mcp. Playwright MCP and Chrome DevTools MCP ran as MCP servers with default settings. agent-browser ran as its CLI and skill. - Every tool drove the same fresh Browser Use cloud browser over CDP. This does not measure each tool's default or local-Chrome mode.
- One run per task. Agent failures were never retried. Runner, browser and judge failures were rerun once (Browser Harness 3 tasks, Playwright MCP 4, Chrome DevTools MCP 6, agent-browser 0).
| Tool | Mean rubric score 0-100 (95% CI) | Fully solved | Median input tokens per task | Median model cost per task (GPT-6 Luna list price) | Median agent time per task |
|---|---|---|---|---|---|
| Browser Harness a6426f84 (main) | 60.4 (55.2-65.4) | 11% | 2.1M | $0.042 | 9.0 min |
| Playwright MCP 0.0.83 | 60.0 (55.1-65.0) | 11% | 4.4M | $0.066 | 8.3 min |
| Chrome DevTools MCP 1.10.1 | 61.0 (55.8-65.9) | 11% | 6.7M | $0.097 | 8.7 min |
| agent-browser 0.39.1 | 56.3 (51.1-61.5) | 9% | 3.3M | $0.056 | 11.2 min |
No tool wins on score: every paired difference against Browser Harness has a 95% CI that includes zero (other tool minus Browser Harness: agent-browser -4.0, CI -10.0 to +1.8; Playwright MCP -0.4, -6.6 to +5.7; Chrome DevTools MCP +0.6, -5.6 to +6.6).
Browser Harness had the lowest median input tokens (2.1M vs 3.3-6.7M) and the lowest median model cost ($0.042 vs $0.056-0.097). Model cost excludes browser, proxy and judge. It was slower than Playwright MCP and Chrome DevTools MCP (median 9.0 vs 8.3 and 8.7 min) and faster than agent-browser (11.2 min). These are medians, with no confidence intervals.
A first agent-browser run was discarded: a setup bug on our side let it launch its own local browser instead of the shared cloud browser. The row shows the corrected rerun.
Measured with Codex only. Claude Code, Cursor, Playwright CLI and Claude in Chrome were not measured. Method and per-task scores: coding-agent-browser-tools.json.
When to use something else
- Playwright (Test, MCP or CLI): isolated, repeatable CI tests of your own app, in a clean browser with no personal logins.
- Chrome DevTools MCP : performance traces and DevTools debugging (network, console, source-mapped stack traces).
- Claude in Chrome : you only use Claude and have a Pro, Max, Team or Enterprise plan.
- Cursor's built-in Browser : the agent doesn't need your logged-in Chrome. It runs in its own per-workspace profile.
OpenAI's Codex labels its browser feature "Browser use" in its settings. It is separate from Browser Use, the company behind this repo.
Scale with Browser Use Cloud
Use your local browser for logged-in, personal work. When you want many browsers in parallel, with live previews, proxies, stealth, CAPTCHA solving, and more, scale with Browser Use Cloud.
browser-harness-mcp exposes the browser control helpers as MCP tools over stdio, so any MCP client (Claude Code, Devin, Cursor, etc.) can drive the browser without writing a second CDP layer. See docs/MCP.md for setup and client configuration.
Add this to .cursor/mcp.json in your project, or to ~/.cursor/mcp.json for every project. It needs uv.
{
"mcpServers": {
"browser-harness": {
"type": "stdio",
"command": "uvx",
"args": ["--from", "browser-harness[mcp]", "browser-harness-mcp"]
}
}
}
Bug fixes, documentation improvements, and agent-generated domain skills are welcome. See CONTRIBUTING.md.
The Bitter Lesson of Agent Harnesses · Web Agents That Actually Learn

