做什么
使用 Chrome DevTools MCP 来控制 Chrome,调试网络应用,分析性能,并通过 MCP 工具实现浏览器任务自动化
技能库 智客分类:Agent 工作流 chrome-devtools-mcp-automation
使用 Chrome DevTools MCP 来控制 Chrome,调试网络应用,分析性能,并通过 MCP 工具实现浏览器任务自动化
官方网址:skills.sh
先看中文介绍;官方 description 原文单独保留,不改写 SKILL.md。
使用 Chrome DevTools MCP 来控制 Chrome,调试网络应用,分析性能,并通过 MCP 工具实现浏览器任务自动化
官方 description 未单独写出 Use when。按规范,代理会在用户任务与这段 description 的关键词匹配时激活本技能。
按 Agent Skills 渐进披露:启动时只加载 name 与 description(约 100 token);任务匹配后才读入整份 SKILL.md 正文;scripts/、references/、assets/ 仅在需要时再读。 本文件正文结构:Chrome DevTools MCP Automation、Installation、MCP Client Configuration、CLI Usage (Without MCP)、Install globally、Run CLI。
文件分析:这是一份仅含 SKILL.md 的指令型技能,代理激活后整份正文进入上下文。 正文约 548 行,超过规范建议的 500 行,激活时仍会整份载入。
Use Chrome DevTools MCP to control Chrome, debug web apps, analyze performance, and automate browser tasks via MCP tools
Chrome DevTools MCP AutomationInstallationMCP Client ConfigurationCLI Usage (Without MCP)Install globallyRun CLIRequirementsKey MCP ToolsBrowser ControlPerformance AnalysisDebugging & InspectionCommon Automation Patterns
来源分类:skills.sh agent-skill
namechrome-devtools-mcp-automationdescription具体调用语法与可用工具以目标 Agent 客户端为准。 查看调用机制说明 ↗
先选择目标 Agent 和安装范围,保留技能包的附属文件,安装后检查客户端能否发现该技能。
复制安装指令给支持 Agent Skills 的代理,确认其中的目标目录与客户端匹配。
把 Agent Skill「chrome-devtools-mcp-automation」安装到我的项目:SKILL.md 原文与官方 description 见 https://zicq.com/zh/skills/skl-389ad6add14b605e-Chrome-Devtools-Mcp-%E8%87%AA%E5%8A%A8%E5%8C%96.html 请存为 .cursor/skills/chrome-devtools-mcp-automation/SKILL.md 或 .claude/skills/chrome-devtools-mcp-automation/SKILL.md,frontmatter 的 name 与 description 保持原样,不要改写。
需要 Node.js 与 npx。先查看仓库技能列表,确认实际名称。
npx skills add 'https://github.com/reason-machines/devtools-skills' --list
npx skills add 'https://github.com/reason-machines/devtools-skills' --skill 'chrome-devtools-mcp-automation'
CLI 会交互选择目标 Agent,默认安装到项目;用户级安装使用 -g。先通过查看命令核对仓库内容,再用 npx skills list 检查已安装技能。
name: chrome-devtools-mcp-automation description: Use Chrome DevTools MCP to control Chrome, debug web apps, analyze performance, and automate browser tasks via MCP tools triggers:
Skill by ara.so — Devtools Skills collection.
Chrome DevTools MCP (chrome-devtools-mcp) is an MCP server that gives AI coding agents full control over Chrome browser automation, debugging, and performance analysis. It exposes Chrome DevTools Protocol and Puppeteer capabilities through MCP tools, enabling reliable browser automation, performance profiling, network inspection, and advanced debugging.
Add to your MCP client configuration (e.g., Claude Desktop, Cursor, VS Code):
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["-y", "chrome-devtools-mcp@latest"]
}
}
}
Slim mode (basic browser tasks only):
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["-y", "chrome-devtools-mcp@latest", "--slim", "--headless"]
}
}
}
Disable usage statistics and update checks:
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["-y", "chrome-devtools-mcp@latest", "--no-usage-statistics"],
"env": {
"CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS": "1"
}
}
}
}
# Install globally
npm install -g chrome-devtools-mcp
# Run CLI
chrome-devtools-mcp --help
Once the MCP server is running, your AI agent has access to these tools:
browser_navigate - Navigate to a URL
// Navigate to a page
await use_mcp_tool("chrome-devtools", "browser_navigate", {
url: "https://example.com"
});
browser_click - Click an element
// Click by selector
await use_mcp_tool("chrome-devtools", "browser_click", {
selector: "button.submit"
});
// Click with custom wait
await use_mcp_tool("chrome-devtools", "browser_click", {
selector: "#login-btn",
waitUntil: "networkidle2"
});
browser_type - Type text into an input
// Type into a field
await use_mcp_tool("chrome-devtools", "browser_type", {
selector: "input[name='email']",
text: "[email protected]"
});
// Type with delay between keystrokes
await use_mcp_tool("chrome-devtools", "browser_type", {
selector: "#search",
text: "search query",
delay: 100
});
browser_screenshot - Capture screenshot
// Full page screenshot
await use_mcp_tool("chrome-devtools", "browser_screenshot", {
fullPage: true
});
// Element screenshot
await use_mcp_tool("chrome-devtools", "browser_screenshot", {
selector: ".main-content",
fullPage: false
});
browser_evaluate - Execute JavaScript in browser
// Get page data
await use_mcp_tool("chrome-devtools", "browser_evaluate", {
script: "document.title"
});
// Interact with page
await use_mcp_tool("chrome-devtools", "browser_evaluate", {
script: `
const items = Array.from(document.querySelectorAll('.item'));
return items.map(el => ({
text: el.textContent,
href: el.querySelector('a')?.href
}));
`
});
performance_record - Record performance trace
// Record a page load
await use_mcp_tool("chrome-devtools", "performance_record", {
url: "https://example.com",
duration: 10000, // 10 seconds
throttling: "4g" // Simulate 4G network
});
performance_analyze - Analyze performance metrics
// Get performance insights
await use_mcp_tool("chrome-devtools", "performance_analyze", {
traceUrl: "trace-data-url",
includeFieldData: true // Include CrUX data
});
browser_console - Get console messages
// Fetch console logs
await use_mcp_tool("chrome-devtools", "browser_console", {});
browser_network - Inspect network requests
// Get network activity
await use_mcp_tool("chrome-devtools", "browser_network", {});
// Filter by resource type
await use_mcp_tool("chrome-devtools", "browser_network", {
resourceType: "xhr"
});
browser_cookies - Manage cookies
// Get all cookies
await use_mcp_tool("chrome-devtools", "browser_cookies", {
action: "get"
});
// Set a cookie
await use_mcp_tool("chrome-devtools", "browser_cookies", {
action: "set",
name: "session_id",
value: "abc123",
domain: "example.com"
});
// Delete cookies
await use_mcp_tool("chrome-devtools", "browser_cookies", {
action: "delete",
name: "session_id"
});
// Navigate to login page
await use_mcp_tool("chrome-devtools", "browser_navigate", {
url: "https://app.example.com/login"
});
// Fill in credentials
await use_mcp_tool("chrome-devtools", "browser_type", {
selector: "input[name='email']",
text: "[email protected]"
});
await use_mcp_tool("chrome-devtools", "browser_type", {
selector: "input[name='password']",
text: process.env.TEST_PASSWORD
});
// Submit form
await use_mcp_tool("chrome-devtools", "browser_click", {
selector: "button[type='submit']",
waitUntil: "networkidle0"
});
// Verify success
const result = await use_mcp_tool("chrome-devtools", "browser_evaluate", {
script: "document.querySelector('.success-message')?.textContent"
});
// Navigate to page
await use_mcp_tool("chrome-devtools", "browser_navigate", {
url: "https://news.example.com"
});
// Extract data
const articles = await use_mcp_tool("chrome-devtools", "browser_evaluate", {
script: `
Array.from(document.querySelectorAll('article')).map(article => ({
title: article.querySelector('h2')?.textContent?.trim(),
link: article.querySelector('a')?.href,
date: article.querySelector('time')?.getAttribute('datetime'),
summary: article.querySelector('p')?.textContent?.trim()
}))
`
});
// Record trace with throttling
const trace = await use_mcp_tool("chrome-devtools", "performance_record", {
url: "https://example.com",
duration: 15000,
throttling: "3g",
deviceEmulation: "mobile"
});
// Analyze metrics
const analysis = await use_mcp_tool("chrome-devtools", "performance_analyze", {
traceUrl: trace.url,
includeFieldData: true
});
// Check Core Web Vitals
console.log(`LCP: ${analysis.lcp}ms`);
console.log(`FID: ${analysis.fid}ms`);
console.log(`CLS: ${analysis.cls}`);
// Navigate and monitor network
await use_mcp_tool("chrome-devtools", "browser_navigate", {
url: "https://api.example.com/dashboard"
});
// Get network requests
const requests = await use_mcp_tool("chrome-devtools", "browser_network", {});
// Filter failed requests
const failed = requests.filter(r => r.status >= 400);
// Find slow requests
const slow = requests.filter(r => r.time > 1000);
// Baseline screenshot
await use_mcp_tool("chrome-devtools", "browser_navigate", {
url: "https://example.com"
});
const baseline = await use_mcp_tool("chrome-devtools", "browser_screenshot", {
fullPage: true
});
// Make changes via evaluate
await use_mcp_tool("chrome-devtools", "browser_evaluate", {
script: "document.body.classList.add('dark-mode')"
});
// Comparison screenshot
const comparison = await use_mcp_tool("chrome-devtools", "browser_screenshot", {
fullPage: true
});
// Navigate to page
await use_mcp_tool("chrome-devtools", "browser_navigate", {
url: "https://app.example.com"
});
// Check console for errors
const console = await use_mcp_tool("chrome-devtools", "browser_console", {});
// Filter errors with source maps
const errors = console.filter(msg =>
msg.type === 'error' && msg.stackTrace
);
// Log error details
errors.forEach(error => {
console.log(`Error: ${error.text}`);
console.log(`Source: ${error.stackTrace?.[0]?.url}`);
console.log(`Line: ${error.stackTrace?.[0]?.lineNumber}`);
});
# Run in headless mode
npx chrome-devtools-mcp@latest --headless
# Slim mode (basic tools only)
npx chrome-devtools-mcp@latest --slim
# Disable performance CrUX data
npx chrome-devtools-mcp@latest --no-performance-crux
# Disable usage statistics
npx chrome-devtools-mcp@latest --no-usage-statistics
# Connect to existing browser
npx chrome-devtools-mcp@latest --browser-url=http://127.0.0.1:9222
# Custom Chrome path
npx chrome-devtools-mcp@latest --chrome-path=/path/to/chrome
# Disable usage statistics
export CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS=1
# Disable update checks
export CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS=1
# CI mode (disables stats collection)
export CI=true
Headless with custom timeout:
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": ["-y", "chrome-devtools-mcp@latest", "--headless"],
"env": {
"CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS": "1"
}
}
}
}
Connect to existing browser (Antigravity):
{
"mcpServers": {
"chrome-devtools": {
"command": "npx",
"args": [
"-y",
"chrome-devtools-mcp@latest",
"--browser-url=http://127.0.0.1:9222"
]
}
}
}
Windows configuration:
{
"mcpServers": {
"chrome-devtools": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"chrome-devtools-mcp@latest"
],
"env": {
"SystemRoot": "C:\\Windows",
"PROGRAMFILES": "C:\\Program Files"
}
}
}
}
Issue: Chrome fails to launch
Solution:
chrome --version or google-chrome --versionnode --version (must be 20.19+){
"args": ["-y", "chrome-devtools-mcp@latest", "--chrome-path=/usr/bin/google-chrome"]
}
Issue: MCP server fails to connect to browser
Solution:
{
"startup_timeout_ms": 20000
}
pkill chrome (Linux/Mac)Issue: browser_click or browser_type fails to find element
Solution:
await use_mcp_tool("chrome-devtools", "browser_evaluate", {
script: `
await new Promise(resolve => {
const check = setInterval(() => {
if (document.querySelector('#my-element')) {
clearInterval(check);
resolve();
}
}, 100);
});
`
});
Issue: performance_record returns incomplete trace
Solution:
duration: 30000throttling parameterIssue: Console errors don't show source-mapped stack traces
Solution:
Issue: Chrome consumes excessive memory
Solution:
--headless mode--slim mode if you don't need performance toolsperformance_recordIssue: Performance analysis fails with rate limit error
Solution:
--no-performance-crux--headless flagwaitUntil: "networkidle0" for SPAsthrottling: "4g"Agent 工作流
创造有效技能指南。 当用户想创造出新的技能(或更新现有的技能),以专业知识,工作流程,或工具集成来扩展克洛德的能力时,应该使用这种技能.
Agent 工作流
使用ClawdHub CLI搜索,安装,更新并发布从taladhub.com的代理技能. 需要获取苍蝇上的新技能时使用,将安装的技能同步到最新版本或特定版本,或者发布 npm-instainddhub CLI 的新/更新的技能文件夹.
Agent 工作流
管弦乐团多代理团队,任务设定周期,交接协议,审查工作流程. 使用时间: (1)建立2+特派员队伍,具有不同专业,(2)确定任务路线和生命周期(收录框_ spec_建设_审查_完成),(3)在特派员之间制定交接协议,(4)建立审查和质量关口,(5)管理特派员之间的交流和文物共享.
Agent 工作流
Spec-first,TDD,子代理驱动的软件开发工作流程. 当:(1)构建任何新功能或应用——触发脑暴_计划_子代理执行回路,(2)调试出一个bug或测试失败——触发系统性的根起过程,(3)用户说"让我们构建","帮助我计划","我想添加X",或"这个被打破",(4)完成一个功…