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.
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 uids. 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.
Using a local fork (Codex CLI)
If you are developing a local version of the MCP server, point Codex to your local entry file instead of npx ...@latest.
- •Build once (and rebuild after changes):
npm run build - •Configure Codex to launch your local server (stdio):
- •
codex mcp remove chrome-devtools(if it already exists) - •
codex mcp add chrome-devtools -- node /absolute/path/to/build/src/index.js
- •
- •Add server flags by appending them to the command, for example:
- •
codex mcp add chrome-devtools -- node /absolute/path/to/build/src/index.js --headless - •
codex mcp add chrome-devtools -- node /absolute/path/to/build/src/index.js --browser-url=http://127.0.0.1:9222
- •
Workflow Patterns
Before interacting with a page
- •Navigate:
navigate_pageornew_page - •Wait:
wait_forto ensure content is loaded if you know what you look for. - •Snapshot:
take_snapshotto understand page structure - •Interact: Use element
uids from snapshot forclick,fill, etc.
Debugging: breakpoints and “hooks”
Use the debugger_* tools to set breakpoints/logpoints and to step through code. A practical flow:
- •Ensure the right tab is active:
list_pages→select_page - •Enable debugging:
debugger_enable - •Find target script(s):
- •
list_scripts(then narrow down) - •
search_scriptsto locate filenames/URLs by keyword - •If bundled/minified:
pretty_print_script, then usesearch_pretty_script
- •
- •Set a breakpoint/logpoint:
- •By URL:
debugger_set_breakpoint_by_url - •By script id:
debugger_set_breakpoint_by_script_id - •By pretty location (after pretty print):
debugger_set_breakpoint_by_pretty_location - •Logpoint variants:
debugger_set_logpoint_by_*
- •By URL:
- •Trigger the code path (use
click/fill/press_keyorevaluate_script) - •Wait for pause + inspect:
- •
debugger_wait_for_paused/debugger_get_paused_state - •Evaluate in the paused frame:
debugger_evaluate_on_call_frame - •Inspect objects:
runtime_get_properties
- •
- •Step/continue:
debugger_step_over/debugger_step_into/debugger_step_out/debugger_resume
“Hook” style breakpoints (useful when you don’t know the exact line yet):
- •DOM mutation points:
debugger_set_dom_breakpoint(and manage viadebugger_list_dom_breakpoints/debugger_remove_dom_breakpoint) - •Event listener hooks:
debugger_set_event_listener_breakpoint(list/remove available) - •XHR/fetch hooks:
debugger_set_xhr_breakpoint - •Instrumentation hooks:
debugger_set_instrumentation_breakpoint - •Exceptions:
debugger_set_pause_on_exceptions
Housekeeping:
- •Update conditions:
debugger_update_breakpoint_condition - •List/remove breakpoints:
debugger_list_breakpoints/debugger_remove_breakpoint - •Reset state:
debugger_clear_breakpoints(anddebugger_clear_dom_breakpoints) - •If you pretty-print, map positions:
debugger_map_pretty_location_to_original
Efficient data retrieval
- •Use
filePathparameter for large outputs (screenshots, snapshots, traces) - •Use pagination (
pageIdx,pageSize) and filtering (types) to minimize data - •Set
includeSnapshot: falseon 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_scriptfor data not in accessibility tree
Network and console triage
- •Network:
- •List:
list_network_requests(useresourceTypes, pagination) - •Inspect one:
get_network_request(save bodies to files when large)
- •List:
- •Console:
- •List:
list_console_messages(usetypes, pagination) - •Inspect one:
get_console_message
- •List:
Performance workflow
- •Navigate to the target:
navigate_page/new_page - •Start trace:
performance_start_trace(optionally reload) - •Reproduce interaction (click/scroll/type)
- •Stop trace:
performance_stop_trace - •Analyze:
performance_analyze_insight
Inputs, dialogs, and uploads
- •Keyboard:
press_key(shortcuts, submit, navigation) - •Hover/drag:
hover,drag - •Forms:
fill_form(batch fill) - •Dialogs (alert/confirm/prompt):
handle_dialog - •File upload:
upload_file(use the file input elementuid)
Emulation and viewport
- •Device/viewport simulation:
emulate - •Resize:
resize_page
Parallel execution
You can send multiple tool calls in parallel, but maintain correct order: navigate → wait → snapshot → interact.
Troubleshooting
If chrome-devtools-mcp is insufficient, guide users to use Chrome DevTools UI: