chrome-devtools-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@chrome-devtools-mcpDiagnose why the sticky header is not staying fixed"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
chrome-devtools-mcp
让 AI 通过 MCP 协议直接调用 Chrome DevTools Protocol(CDP),获取浏览器运行时 DOM 结构、计算样式、控制台日志、网络请求等信息,彻底解决 AI 只能读源码、无法获取真实运行时上下文的问题。
前置条件
Node.js 18+
Chrome 浏览器
Related MCP server: Chrome DevTools MCP
安装
npm install
npm run build启动 Chrome(调试模式)
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--remote-debugging-port=9222 \
--user-data-dir=/tmp/chrome-debug-profile推荐添加 alias 到 ~/.zshrc,之后直接用 chrome-debug 启动:
alias chrome-debug='/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug-profile'OpenCode 集成
在 ~/.config/opencode/opencode.json 中添加:
{
"mcp": {
"chrome-devtools": {
"type": "local",
"command": ["node", "/path/to/chrome-devtools-mcp/dist/index.js"],
"env": {
"CHROME_DEBUGGING_PORT": "9222"
},
"enabled": true
}
}
}注意:
command必须是数组格式,不能是字符串。
查看实时日志
MCP server 的所有 CDP 调用日志写入 ~/chrome-devtools-mcp.log,在任意终端运行以下命令实时查看:
tail -f ~/chrome-devtools-mcp.log工具清单(11 个)
DOM 工具
工具 | 说明 |
| 列出所有可调试的 Tab(type=page) |
| 按 CSS 选择器查找元素,返回 tagName/id/classList |
| 获取 DOM 子树, |
| 获取元素完整祖先链(含指定样式 + 自动诊断),sticky/overflow/z-index 问题根因定位专用 |
CSS 工具
工具 | 说明 |
| 获取元素计算样式,返回 |
| 获取元素匹配的 CSS 规则列表(含来源文件、行号) |
| 获取元素盒模型尺寸(width/height/margin/padding/border/content) |
Runtime 工具
工具 | 说明 |
| 获取页面视口/内容尺寸(viewportWidth/viewportHeight/contentWidth/contentHeight) |
| 在页面上下文执行 JS 表达式,自动拦截 cookie/localStorage/fetch 等敏感 API |
| 获取控制台日志,支持按 level 过滤(log/info/warn/error/debug) |
Network 工具
工具 | 说明 |
| 获取网络请求记录,支持 |
注意:
get_console_logs和get_network_requests只收集 MCP 连接后的事件,连接前的记录无法追溯。
智能诊断(Phase 3)
get_ancestors 会自动在返回结果里附带 diagnosis 字段,无需 AI 额外推理即可定位根因:
{
"ancestors": [...],
"diagnosis": {
"hints": [
{
"depth": 2,
"tagName": "section",
"classList": ["arco-layout"],
"issue": "position:sticky 失效 — 祖先节点 overflow 非 visible/unset 会阻断 sticky",
"property": "overflow",
"value": "hidden",
"impact": "blocking"
}
],
"summary": "发现 1 个阻断性问题。第2层 <section> overflow:hidden"
}
}impact 三级:blocking(直接阻断)/ likely(大概率影响)/ possible(可能有影响)
检测覆盖:
overflow: hidden/scroll/auto/clip→ sticky 失效transform非 none → fixed/sticky 失效will-change: transform/opacity/filter→ 层叠上下文异常contain: layout/paint/strict/content→ fixed 失效filter/backdrop-filter→ 层叠上下文异常
典型用法
诊断 sticky 失效
1. 调用 get_computed_styles(".sticky-header")
→ summary.position: sticky(确认已设置)
2. 调用 get_ancestors(".sticky-header")
→ diagnosis.summary: "发现 1 个阻断性问题。第3层 <div.el-scrollbar__wrap> overflow:hidden"
→ 根因定位完成,无需进一步推理排查 JS 错误
1. 调用 get_console_logs(level="error")
→ 获取页面 error 级别日志
2. 调用 evaluate_js("document.querySelector('.btn').disabled")
→ 获取按钮当前的 disabled 状态排查接口问题
1. 调用 get_network_requests(url_filter="/api/cooperation")
→ 查看合作相关接口的请求状态和响应时间安全说明
调试端口绑定
127.0.0.1,禁止公网暴露evaluate_js自动拦截document.cookie、localStorage、sessionStorage、fetch、XMLHttpRequestMCP Server 仅本地运行,数据不出 localhost
仅供开发环境使用,勿集成到生产流程
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityAmaintenanceEnables AI coding assistants to control and inspect a live Chrome browser through Chrome DevTools. Provides browser automation, performance analysis, debugging capabilities, and network request monitoring.Last updated1,563,37948,685Apache 2.0
- AlicenseAqualityDmaintenanceEnables AI coding assistants to control and inspect a live Chrome browser for automation, debugging, performance analysis, and screenshot capture through Chrome DevTools.Last updated261,563,3793Apache 2.0
- Alicense-qualityDmaintenanceEnables AI coding assistants to control and inspect a live Chrome browser for automation, debugging, performance analysis, network monitoring, and DOM interaction through Chrome DevTools Protocol.Last updated1,563,379Apache 2.0
- -license-quality-maintenanceEnables AI coding assistants to control and inspect a live Chrome browser for automated debugging, performance analysis, and web interaction. It leverages Puppeteer and Chrome DevTools to provide capabilities like network monitoring, console logging, and automated browser actions.Last updated
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,
Provides cloud browser automation capabilities using Stagehand and Browserbase, enabling LLMs to i…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Himangguo/chrome-devtools-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server