When should you use it
Use the Playwright MCP server when you want an agent to:- Automate browser actions.
- Extract structured page context via snapshots, avoiding ambiguity of pixel-based methods.
- Test and verify UI elements, text, or values without vision models.
- Capture console logs, network requests, PDFs, or traces during automated workflows.
- Manage tabs, dialogs, and file uploads in real-time web automation.
Requirements
- Requirements:
- Node.js 18 or newer
- An MCP-compatible client (VS Code, Cursor, Windsurf, Claude Desktop, Goose, etc.)
- Installation:
Install the Playwright MCP server with your MCP client. - Optional capabilities (enabled via
--caps):visionโ coordinate-based mouse actionspdfโ save pages as PDFverifyโ element/text/value verificationtracingโ start/stop browser tracing
Tools
Core interaction
- browser_click โ Click (or double click) on an element.
- browser_hover โ Hover over an element.
- browser_type โ Type text into an editable element, with optional submit/slow typing.
- browser_fill_form โ Fill multiple form fields at once.
- browser_select_option โ Select one or more dropdown values.
- browser_press_key โ Press a keyboard key.
- browser_drag โ Perform drag-and-drop between elements.
- browser_file_upload โ Upload one or multiple files.
Navigation & tabs
- browser_navigate โ Navigate to a specific URL.
- browser_navigate_back โ Go back to the previous page.
- browser_tabs โ List, create, close, or select tabs.
- browser_close โ Close the current page.
Page context & capture
- browser_snapshot โ Capture structured accessibility snapshot (preferred for automation).
- browser_take_screenshot โ Take a screenshot of viewport, full page, or element.
- browser_pdf_save (opt-in via
--caps=pdf) โ Save page as PDF.
Evaluation & debugging
- browser_evaluate โ Run JavaScript in page context.
- browser_console_messages โ Return console messages.
- browser_network_requests โ Return all network requests since load.
- browser_resize โ Resize the browser window.
- browser_handle_dialog โ Accept/decline modal dialogs or prompts.
Verification (opt-in via --caps=verify)
- browser_verify_element_visible โ Verify an element is visible by role + accessible name.
- browser_verify_text_visible โ Verify a text string is visible.
- browser_verify_list_visible โ Verify a list with expected items is visible.
- browser_verify_value โ Verify element values (e.g., checkbox state, input value).
Coordinate-based (opt-in via --caps=vision)
- browser_mouse_click_xy โ Click at a coordinate.
- browser_mouse_drag_xy โ Drag mouse between coordinates.
- browser_mouse_move_xy โ Move mouse to a coordinate.
Tracing (opt-in via --caps=tracing)
- browser_start_tracing โ Start trace recording.
- browser_stop_tracing โ Stop trace recording.
Installation
- browser_install โ Install the required browser binaries if not already present.
Notes
- Prefer
browser_snapshotover screenshots for interactionโitโs structured, fast, and deterministic. - Many tools require both a human-readable element description and a ref from the snapshot for safety and determinism.
- Optional capabilities (
vision,pdf,verify,tracing) must be explicitly enabled when starting the server.

