Playwright MCP
Control a browser through structured accessibility snapshots rather than brittle CSS selectors or pixel-guessing. Every action starts by observing the accessibility tree (browser_snapshot or browser_find) and targeting elements by their snapshot target ref (or a unique selector).
Core Workflow
- Navigate: Call
browser_navigatewithurl, or open a separate tab/context withbrowser_tabs(action: "new", optionalisolatedContext). - Inspect via snapshot: Call
browser_snapshot(usedepthortargetto scope large pages, orbrowser_findwithtext/regexto locate a ref cheaply). - Act with
targetrefs: Pass the snapshottarget(plus human-readableelementwhen helpful) tobrowser_click,browser_type,browser_fill_form,browser_select_option,browser_hover,browser_drag,browser_drop, orbrowser_file_upload. - Wait & verify: Use
browser_wait_for(text,textGone, ortimeup to 30s) for async UI updates, then re-snapshot because DOM changes invalidate prior refs. - Debug & capture: Inspect
browser_console_messages,browser_network_requests→browser_network_request,browser_evaluate, orbrowser_take_screenshot.
Capability Groups
Core automation + tab management (25 browser_* tools) are enabled by default. Additional groups require server --caps opt-in (config, network, storage, devtools, vision, pdf, testing):
- Default (
core+ tab management): Navigation, accessibility snapshots/search, clicks, typing, forms, uploads/drops, dialogs, media emulation, JS evaluation, screenshots, console, and network inspection. --caps=vision: Coordinate-based mouse fallback (browser_mouse_click_xy,browser_mouse_move_xy,browser_mouse_drag_xy,browser_mouse_down,browser_mouse_up,browser_mouse_wheel) for canvas/non-ARIA UIs after a screenshot.--caps=pdf/network/storage/devtools/testing/config:browser_pdf_save, route mocking & offline simulation, cookie/WebStorage/storage-state tools, video/trace/action recording & annotations, Playwright locator/assertion helpers, andbrowser_get_config.
Guardrails
- Prefer
browser_snapshotandbrowser_findover screenshots unless visual layout inspection or--caps=visioncoordinates are required. - Avoid
browser_run_code_unsafeunless standardbrowser_*tools andbrowser_evaluatecannot express the action (it executes arbitrary JS in the MCP server process). - Re-snapshot after navigation, modal open/close, or form submission before reusing any
targetref. - Never assume opt-in capability tools (
browser_pdf_save,browser_route,browser_cookie_*,browser_mouse_*, etc.) are active unless enabled on the server.
References
- references/tools-reference.md: Complete 72-tool catalog by capability group with parameters, defaults, and read-only flags.
- references/setup-and-config.md: Transport modes (
stdioand standalone HTTP/mcp), DockerENTRYPOINT&--allowed-hostsgotchas,--caps, profiles, andPLAYWRIGHT_MCP_*environment variables.


