chrome-devtools-browser
Skill0 starsChanged 4 months agoMITView on GitHub
在服务器容器中拉起本地 Chrome 浏览器并通过 chrome-devtools-mcp 为 Claude Agent 提供完整的浏览器操控能力(导航、截图、表单填写、JS 执行等)。可选启用 noVNC 远程桌面,让用户通过 Web 页面实时查看和操作浏览器。当用户提到"启动浏览器"、"拉起 Chrome"、"浏览器截图"、"noVNC"、"远程浏览器"、"chrome-devtools"时触发。
- Installs packages
1 other project uses a version of this.
Adopted by
Most recently taken up by
- Encod3d-Sec/TORCHtheir own version, first seen Aug 12, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- Encod3d-Sec/TORCH★ 329same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Files
chrome-devtools-browser
在服务器/容器环境中拉起本地 Chrome 浏览器,通过 chrome-devtools-mcp 为 Claude Agent 提供完整的浏览器操控能力,并可选通过 noVNC 提供 Web 远程桌面供用户交互。
核心设计:noVNC 启动时,MCP 和 noVNC 自动共享同一个 Chrome 实例——Agent 的操作会实时反映在 noVNC 画面上,用户在 noVNC 中的操作 Agent 也能感知。
Agent 执行流程
skill 被触发后,agent 按以下决策树执行:
1. 运行 status.sh 获取当前状态
│
├─ Chrome 未安装 → 运行 setup.sh(全自动安装 + 启动 noVNC + 配置 MCP)
│ → 提示用户重启 Claude Code 会话
│
├─ Chrome 已安装,MCP 工具可用
│ ├─ 用户需要浏览器操作(截图/导航/填表)→ 直接用 MCP 工具执行
│ ├─ 用户需要 noVNC(看画面/手动登录/扫码)
│ │ ├─ noVNC 已运行 → 告知访问地址
│ │ ├─ noVNC 未运行 → 运行 start-novnc.sh → 提示重启会话
│ │ └─ noVNC 依赖未安装 → 运行 setup.sh
│ └─ 用户要卸载 → 运行 uninstall.sh
│
└─ Chrome 已安装,MCP 工具不可用
├─ .mcp.json 未配置 → 运行 setup.sh
└─ .mcp.json 已配置 → 提示重启 Claude Code 会话关键原则:
- 先 status 再决策,不盲猜
- 每次改动
.mcp.json后都要提示用户重启会话 - noVNC 启动后 MCP 自动切为 browserUrl 模式,确保同一个浏览器
适用场景
- 需要 Agent 自动操作网页(导航、填表、点击、截图)
- 需要渲染 HTML 并截图(如视频渲染、页面预览)
- 需要在无 GUI 的服务器容器中使用浏览器
- 需要用户通过 Web 远程查看和操作浏览器(如手动登录、扫码认证)
为 Claude Agent 提供的能力
配置 chrome-devtools-mcp 后,Agent 可使用以下工具:
| 工具 | 说明 |
navigate_page | 导航到 URL、前进、后退、刷新 |
take_screenshot | 对页面或元素截图 |
take_snapshot | 获取页面 a11y 树结构(用于定位元素) |
click / hover | 点击或悬停元素 |
fill / fill_form | 填写表单输入框、选择框、复选框 |
evaluate_script | 在页面中执行 JavaScript |
press_key / type_text | 键盘输入 |
list_pages / new_page / select_page | 多标签页管理 |
list_network_requests / get_network_request | 网络请求监控 |
list_console_messages | 控制台日志查看 |
lighthouse_audit | Lighthouse 审计 |
performance_start_trace | 性能追踪 |
emulate | 设备模拟(视口、暗色模式、网络节流等) |
依赖清单
| 依赖 | 用途 | 必需 |
| Chrome/Chromium | 浏览器引擎 | 是 |
| Node.js >= 18 | 运行 chrome-devtools-mcp | 是 |
| chrome-devtools-mcp | MCP 服务端 | 是 |
| Xvfb | 虚拟显示 | noVNC 模式需要 |
| x11vnc | VNC 服务端 | noVNC 模式需要 |
| noVNC + websockify | Web VNC 客户端 | noVNC 模式需要 |
一键安装(推荐)
运行 setup.sh,无需任何交互,自动完成全部安装、启动 noVNC、配置 MCP:
bash {baseDir}/scripts/setup.sh脚本会自动:
- 安装 Chrome(通过 Playwright,已有则跳过)
- 安装 chrome-devtools-mcp
- 安装 noVNC 依赖(自动检测 apt/yum/dnf)
- 启动 noVNC 远程桌面(Chrome + Xvfb + x11vnc + websockify)
- 合并
~/.mcp.json中的chrome-devtools配置(不覆盖其他 MCP) - 检测并为已安装的 Codex、Qwen Code、QoderCLI 注入用户级 MCP 配置
- 输出访问地址
Agent 注入遵循以下规则:
- 仅当
codex、qwen、qodercli命令存在时才处理 - 已存在同名 MCP 时保留用户配置,不覆盖
- 本技能新增的配置会记录到安装清单,可随 noVNC/headless 模式切换并在卸载时删除
- Qwen/QoderCLI 优先使用原生
mcp add,CLI 因旧配置校验失败时回退到原子 JSON 合并
安装完成后:
- 重启 Claude Code 会话,Agent 即可使用浏览器 MCP 工具
- 在浏览器中打开 http://localhost:6080/vnc.html 查看和操作 Chrome
- Agent 的操作会实时反映在 noVNC 画面上
手动安装
1. 安装 Chrome
# 推荐:通过 Playwright 安装
npm exec --yes -- playwright install chromium
# 或手动安装:
# Debian/Ubuntu:
sudo apt-get update && sudo apt-get install -y chromium-browser
# CentOS/RHEL:
sudo yum install -y chromium
# Fedora:
sudo dnf install -y chromium2. 安装 chrome-devtools-mcp
npm install -g chrome-devtools-mcp3. 安装 noVNC 依赖
# Xvfb + x11vnc
# Debian/Ubuntu:
sudo apt-get install -y xvfb x11vnc
# CentOS/RHEL:
sudo yum install -y xorg-x11-server-Xvfb x11vnc
# Fedora:
sudo dnf install -y xorg-x11-server-Xvfb x11vnc
# websockify(--no-deps 跳过 numpy,大幅加速安装)
pip3 install --no-deps websockify
# noVNC Web 客户端
git clone --depth 1 https://github.com/novnc/noVNC.git ~/noVNC4. 启动 + 配置
# start-novnc.sh 会同时启动 noVNC 并配置 .mcp.json
bash {baseDir}/scripts/start-novnc.sh重启 Claude Code 会话后即可使用。
使用方式
启动 noVNC 远程桌面
bash {baseDir}/scripts/start-novnc.sh [DISPLAY_NUM] [NOVNC_PORT] [VNC_PORT] [TARGET_URL]
# 默认: bash {baseDir}/scripts/start-novnc.sh 99 6080 5999 about:blank
# CDP 9222 冲突时: CHROME_DEVTOOLS_BROWSER_CDP_PORT=19222 bash {baseDir}/scripts/start-novnc.sh启动后:
- 访问 **http://localhost:6080/vnc.html**,点击 Connect
- 重启 Claude Code 会话让 MCP 连接此浏览器
- Agent 操作和 noVNC 画面同步
如端口未自动转发,手动执行:
ssh -L 6080:localhost:6080 user@server
查看状态
bash {baseDir}/scripts/status.sh输出所有组件的安装和运行状态,包括 MCP 当前模式、Codex/Qwen/QoderCLI 注册状态、CDP 连通性和 noVNC 访问地址。
清理残留进程
bash {baseDir}/scripts/cleanup.sh
bash {baseDir}/scripts/cleanup.sh 99 6080 5999 --all-chrome默认只清理这个 skill 管理的进程:
- 带
remote-debugging-port=9222的 Chrome - noVNC / Xvfb / VNC / websockify 相关进程
- 模式切换或显式 cleanup 场景下的
chrome-devtools-mcp
--all-chrome 仅在你明确需要时使用,它会额外清理当前用户下的全部 Chrome / Chromium 进程。
停止 noVNC
bash {baseDir}/scripts/stop-novnc.sh停止后 .mcp.json 自动还原为 headless 模式,重启会话后 Agent 使用独立的 headless 浏览器。
MCP 两种模式切换
| 模式 | .mcp.json 配置 | 触发方式 | 说明 |
| noVNC 模式 | --browserUrl http://127.0.0.1:9222 | start-novnc.sh 自动切换 | Agent 和 noVNC 共享同一个浏览器 |
| Headless 模式 | --executablePath <Chrome路径> --headless | stop-novnc.sh 自动还原 | Agent 使用独立的 headless 浏览器 |
两种模式切换后都需要重启或重载 Agent 会话。模式切换时脚本会自动清理旧的 skill 管理进程,并同步本技能创建的 Codex/Qwen/QoderCLI MCP 配置。
运行日志存放在用户私有目录 ~/.cache/chrome-devtools-browser/runtime/,避免共享 /tmp 下同名日志被其他用户创建后导致权限错误。
卸载
只卸载 setup.sh 安装的组件,安装前已存在的不动:
bash {baseDir}/scripts/uninstall.sh强制卸载全部(无安装清单时):
bash {baseDir}/scripts/uninstall.sh --force卸载后重启 Claude Code 会话。
常见场景
内网页面需要 SSO 登录
- 运行
start-novnc.sh并重启 Claude Code 会话 - Agent 导航到目标页面 → 跳转到 SSO 登录页
- Agent 通过 MCP 填写账号密码,或将二维码截图给用户扫码
- 用户也可以直接在 noVNC 中手动完成登录
- 登录完成后 Agent 继续自动化操作
页面截图 / 渲染预览
Agent:
1. mcp__chrome-devtools__navigate_page → 导航
2. mcp__chrome-devtools__take_screenshot → 截图返回表单自动化填写
Agent:
1. mcp__chrome-devtools__take_snapshot → 获取页面元素
2. mcp__chrome-devtools__fill_form → 批量填写表单
3. mcp__chrome-devtools__click → 点击提交按钮故障排查
| 问题 | 解决方案 |
| Chrome 启动失败 | 检查 --no-sandbox 参数(容器中必需) |
| 页面白屏 | 添加 --disable-gpu --disable-software-rasterizer |
/dev/shm 空间不足 | 添加 --disable-dev-shm-usage |
| MCP 连接失败 | 重启 Claude Code 会话以加载新的 .mcp.json |
| noVNC 页面打不开 | 检查端口转发是否生效,确认 6080 端口已转发 |
| 9222/5999/6080 端口被占用 | 脚本会安全退出而不会误杀或误连其他进程;停止占用进程,或调整 noVNC/VNC 参数,CDP 可设置 CHROME_DEVTOOLS_BROWSER_CDP_PORT |
| noVNC 画面不同步 | MCP 和 noVNC 用了不同 Chrome,运行 start-novnc.sh 重新配置后重启会话 |
| Chrome 依赖缺失 | npm exec --yes -- playwright install-deps chromium |
| x11vnc 报错 "no display" | 确认 Xvfb 已启动且 DISPLAY=:99 |
| websockify 安装慢 | 用 pip3 install --no-deps websockify 跳过 numpy |
| MCP 工具无响应(list_pages 空) | glibc 2.17 系统降级到 Chrome 110,可能与 chrome-devtools-mcp 1.2.0 部分不兼容。Agent 可通过 CDP WebSocket 直接操作作为回退 |
| noVNC 黑屏/进度条转 | 清除浏览器缓存后强制刷新(Ctrl+Shift+R),旧版 JS 缓存会导致模块加载失败 |
| noVNC 安装时 git 卡住等输入 | 已通过 GIT_TERMINAL_PROMPT=0 修复,如仍遇到则手动下载 noVNC |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

