|
1 | 1 | --- |
2 | 2 | name: chrome-devtools |
3 | | -description: Uses Chrome DevTools via MCP for efficient debugging, troubleshooting and browser automation. Use when debugging web pages, automating browser interactions, analyzing performance, or inspecting network requests. |
| 3 | +description: > |
| 4 | + Chrome DevTools MCP server for browser automation, debugging, |
| 5 | + network inspection, console analysis, and performance tracing. |
| 6 | + Controls Chrome via Puppeteer/CDP. v0.17.0. |
4 | 7 | --- |
5 | 8 |
|
6 | 9 | ## Core Concepts |
7 | 10 |
|
8 | | -**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`. |
| 11 | +**Browser lifecycle**: Browser starts on first tool call using a |
| 12 | +persistent Chrome profile. Configure via CLI args: |
| 13 | +`npx chrome-devtools-mcp@latest --help`. |
9 | 14 |
|
10 | | -**Page selection**: Tools operate on the currently selected page. Use `list_pages` to see available pages, then `select_page` to switch context. |
| 15 | +**Page selection**: Tools operate on the currently selected page. |
| 16 | +`list_pages` to see pages, `select_page` to switch context. |
11 | 17 |
|
12 | | -**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. |
| 18 | +**Element interaction**: `take_snapshot` returns an a11y tree with |
| 19 | +unique `uid` references. Use UIDs with `click`, `fill`, `drag`, etc. |
| 20 | +Always take a fresh snapshot if elements aren't found. |
13 | 21 |
|
14 | | -## Workflow Patterns |
15 | | - |
16 | | -### Before interacting with a page |
17 | | - |
18 | | -1. Navigate: `navigate_page` or `new_page` |
19 | | -2. Wait: `wait_for` to ensure content is loaded if you know what you look for. |
20 | | -3. Snapshot: `take_snapshot` to understand page structure |
21 | | -4. Interact: Use element `uid`s from snapshot for `click`, `fill`, etc. |
22 | | - |
23 | | -### Efficient data retrieval |
| 22 | +## Capabilities at a Glance |
24 | 23 |
|
25 | | -- Use `filePath` parameter for large outputs (screenshots, snapshots, traces) |
26 | | -- Use pagination (`pageIdx`, `pageSize`) and filtering (`types`) to minimize data |
27 | | -- Set `includeSnapshot: false` on input actions unless you need updated page state |
| 24 | +| Category | Tools | Key Use | |
| 25 | +|----------|-------|---------| |
| 26 | +| **Snapshots** | `take_snapshot`, `take_screenshot` | See page structure/visuals | |
| 27 | +| **Input** | `click`, `fill`, `fill_form`, `press_key`, `drag`, `hover`, `upload_file`, `handle_dialog` | Interact with elements | |
| 28 | +| **Navigation** | `navigate_page`, `new_page`, `close_page`, `list_pages`, `select_page`, `wait_for` | Control page lifecycle | |
| 29 | +| **Network** | `list_network_requests`, `get_network_request` | Inspect HTTP traffic | |
| 30 | +| **Console** | `list_console_messages`, `get_console_message` | Debug logs/errors | |
| 31 | +| **Performance** | `performance_start_trace`, `performance_stop_trace`, `performance_analyze_insight` | CWV scores, bottlenecks | |
| 32 | +| **Emulation** | `emulate`, `resize_page` | Device/network simulation | |
| 33 | +| **Script** | `evaluate_script` | Run JS in page context | |
| 34 | +| **Extensions** | `install_extension`, `uninstall_extension`, `list_extensions`, `reload_extension` | Manage Chrome extensions | |
28 | 35 |
|
29 | | -### Tool selection |
30 | | - |
31 | | -- **Automation/interaction**: `take_snapshot` (text-based, faster, better for automation) |
32 | | -- **Visual inspection**: `take_screenshot` (when user needs to see visual state) |
33 | | -- **Additional details**: `evaluate_script` for data not in accessibility tree |
34 | | - |
35 | | -### Parallel execution |
| 36 | +## Workflow Patterns |
36 | 37 |
|
37 | | -You can send multiple tool calls in parallel, but maintain correct order: navigate → wait → snapshot → interact. |
| 38 | +### Standard page interaction |
| 39 | +1. Navigate: `navigate_page` or `new_page` |
| 40 | +2. Wait: `wait_for` if you know expected content |
| 41 | +3. Snapshot: `take_snapshot` to get element UIDs |
| 42 | +4. Interact: `click`, `fill`, etc. using UIDs |
| 43 | + |
| 44 | +### Network-first scraping |
| 45 | +1. `navigate_page` to target URL |
| 46 | +2. `list_network_requests(resourceTypes: ["xhr", "fetch"])` to find APIs |
| 47 | +3. `get_network_request(reqid)` to inspect response bodies |
| 48 | +4. Or use `evaluate_script` with `fetch()` for reliable data retrieval |
| 49 | + |
| 50 | +### Console debugging |
| 51 | +1. Navigate to page (errors collected automatically) |
| 52 | +2. `list_console_messages(types: ["error"])` to find errors |
| 53 | +3. `get_console_message(msgid)` for full stack trace + cause chain |
| 54 | +4. Source-mapped locations show original file/line/column |
| 55 | + |
| 56 | +### Performance analysis |
| 57 | +1. `navigate_page` to target URL first |
| 58 | +2. `performance_start_trace(reload: true, autoStop: true)` |
| 59 | +3. Review CWV scores + insight sets in response |
| 60 | +4. `performance_analyze_insight(insightSetId, insightName)` for details |
| 61 | +5. CrUX field data included by default (disable: `--no-performance-crux`) |
| 62 | + |
| 63 | +## Key Features (v0.17.0) |
| 64 | + |
| 65 | +- **CrUX field data**: Real-user LCP, INP, CLS in performance traces |
| 66 | +- **Error.cause chains**: Full cause hierarchy for uncaught errors |
| 67 | +- **Error objects in console.log**: Message + stack when logging Errors |
| 68 | +- **Source-mapped stacks**: Original file/line/column (v0.16.0+) |
| 69 | +- **Ignored script filtering**: Internal frames hidden from traces |
| 70 | +- **Navigation scoping**: Data split per navigation, 3 preserved |
| 71 | +- **Lazy formatting**: Bodies/stacks resolved only when requested |
| 72 | + |
| 73 | +## Efficiency Tips |
| 74 | + |
| 75 | +- Use `filePath` for large outputs (screenshots, traces, snapshots) |
| 76 | +- Use pagination (`pageIdx`, `pageSize`) and type filters to limit data |
| 77 | +- Set `includeSnapshot: false` on input actions when snapshot not needed |
| 78 | +- Response bodies expire fast -- fetch promptly or use `evaluate_script` |
| 79 | +- Prefer `take_snapshot` over `take_screenshot` for automation |
| 80 | +- Parallel tool calls OK, but maintain order: navigate -> wait -> snap |
| 81 | + |
| 82 | +## CLI Quick Reference |
| 83 | + |
| 84 | +``` |
| 85 | +--browserUrl URL Connect via HTTP CDP endpoint |
| 86 | +--wsEndpoint URL Connect via WebSocket |
| 87 | +--autoConnect Auto-find running Chrome 144+ |
| 88 | +--executablePath PATH Launch specific Chrome binary |
| 89 | +--isolated Temp profile, auto-cleaned |
| 90 | +--headless No UI |
| 91 | +--viewport WxH Initial viewport size |
| 92 | +--no-usage-statistics Disable telemetry |
| 93 | +--no-performance-crux Disable CrUX in traces |
| 94 | +--no-category-network Disable network tools |
| 95 | +``` |
38 | 96 |
|
39 | 97 | ## Troubleshooting |
40 | 98 |
|
41 | | -If `chrome-devtools-mcp` is insufficient, guide users to use Chrome DevTools UI: |
42 | | - |
| 99 | +If chrome-devtools-mcp is insufficient, guide users to Chrome DevTools: |
43 | 100 | - https://developer.chrome.com/docs/devtools |
44 | 101 | - https://developer.chrome.com/docs/devtools/ai-assistance |
0 commit comments