开发工具
- 作者仓库星标 42,728
- 作者仓库 chrome-devtools-mcp
- 领域
- 人工智能
- 作者声明的智能体
- 未找到明确声明;不据此推断已兼容或已测试
- 静态检查
- 88 / 100 · 启发式扫描,不代表运行安全
- 运行环境证据
- 未执行;当前没有隔离运行测试证据
- 作者 / 版本 / 许可证
- @ChromeDevTools · 未声明许可证
- 上下文用量评级
- 低消耗
- 接入复杂程度
- 需简单配置
- 是否需要外部接口密钥
- 不需要
- 兼容的系统
- macOS · Linux · Windows
- 运行环境要求
- 未检出明确要求
- 检测到的文件与系统行为
-
- 只读
- 命令执行
- 网络行为
- 仅限本地
- 安装命令数
- 无(仅作为资料)
需要注意: 未声明工具权限范围;实际权限由运行环境决定。
## Core Concepts
**Browser lifecycle**: Browser starts automatically on first tool call using a persistent Chrome profile. Configure via CLI args in the MCP server configuration: `npx chrome-devtools-mcp@latest --help`.
Addional tooling can be enabled by providing the following flags:
- For extension tooling, use the `--categoryExtensions` flag.
- For memory tooling, use the `--memoryDebugging` flag.
**Page selection**: Tools operate on the currently selected page. Use `list_pages` to see available pages, then `select_page` to switch context.
**Element interaction**: Use `take_snapshot` to get page structure with element `uid`s. Each element has a unique `uid` for interaction. If an element isn't found, take a fresh snapshot - the element may have been removed or the page changed.
## Workflow Patterns
### Before interacting with a page
1. Navigate: `navigate_page` or `new_page`
2. Wait: `wait_for` to ensure content is loaded if you know what you look for.
3. Snapshot: `take_snapshot` to understand page structure
4. Interact: Use element `uid`s from snapshot for `click`, `fill`, etc.
### Efficient data retrieval
- Use `filePath` parameter for large outputs (screenshots, snapshots, traces)
- Use pagination (`pageIdx`, `pageSize`) and filtering (`types`) to minimize data
- Set `includeSnapshot: false` on input actions unless you need updated page state
### Tool selection
- **Automation/interaction**: `take_snapshot` (text-based, faster, better for automation)
- **Visual inspection**: `take_screenshot` (when user needs to see visual state)
- **Additional details**: `evaluate_script` for data not in accessibility tree
### Parallel execution
You can send multiple tool calls in parallel, but maintain correct order: navigate → wait → snapshot → interact.
### Testing an extension
1. **Install**: Use `install_extension` with the path to the unpacked extension.
2. **Identify**: Get the extension ID from the response or by calling `list_extensions`.
3. **Trigger Action**: Use `trigger_extension_action` to open the popup or side panel if applicable.
4. **Verify Service Worker**: Use `evaluate_script` with `serviceWorkerId` to check extension state or trigger background actions.
5. **Verify Page Behavior**: Navigate to a page where the extension operates and use `take_snapshot` to check if content scripts injected elements or modified the page correctly.
## Troubleshooting
If `chrome-devtools-mcp` is insufficient, guide users to use Chrome DevTools UI:
- https://developer.chrome.com/docs/devtools
- https://developer.chrome.com/docs/devtools/ai-assistance
If there are errors launching `chrome-devtools-mcp` or Chrome, refer to https://github.com/ChromeDevTools/chrome-devtools-mcp/blob/main/docs/troubleshooting.md.
章节与文件索引
按说明文件中的顺序排列。
核心概念
与页面交互之前
高效的数据检索
工具选择
并行执行
文件/命令 -> npx chrome-devtools-mcp@latest --help · --categoryExtensions · --memoryDebugging · list_pages · select_page · take_snapshot · uid · navigate_page
内容校验值 -> 4595ad35cb98
当前原文的自动摘译,尚未人工审校。
核心概念
浏览器生命周期:浏览器在第一次工具调用时使用持久的 Chrome 配置文件自动启动。通过 MCP 服务器配置中的 CLI 参数进行配置:
npx chrome-devtools-mcp@latest --help。可以通过提供以下标志来启用其他工具: 对于扩展工具,请使用--categoryExtensions标志。对于内存工具,请使用--memoryDebugging标志。页面选择:工具在当前选定的页面上操作。使用list_pages查看可用页面,然后使用select_page切换上下文。与页面交互之前
导航:
navigate_page或new_page等待:wait_for以确保在您知道要查找的内容时加载内容。快照:take_snapshot了解页面结构交互:使用快照中的元素uid来表示click、fill等。高效的数据检索
使用
filePath参数进行大型输出(屏幕截图、快照、跟踪) 使用分页(pageIdx、pageSize)和过滤(types)以最小化输入操作上的数据集includeSnapshot: false,除非您需要更新页面状态工具选择
自动化/交互:
take_snapshot(基于文本,更快,更适合自动化)目视检查:take_screenshot(当用户需要查看视觉状态时)其他详细信息:evaluate_script适用于不在可访问性树中的数据并行执行
您可以并行发送多个工具调用,但保持正确的顺序:导航→等待→快照→交互。