Playwright MCP server
Microsoft's official browser-automation server that drives pages via the accessibility tree, not pixels.
Playwright MCP is Microsoft's official Model Context Protocol server built on the Playwright automation library. Its defining choice is that it exposes the page to the model as a structured accessibility snapshot rather than a screenshot, so the agent reasons over labelled, addressable elements instead of guessing coordinates from an image. That makes interactions deterministic and far cheaper in tokens, and it works across Chromium, Firefox, and WebKit.
The server runs locally over stdio via npx and can also be launched as a standalone HTTP endpoint with a --port flag for shared or containerized use. Beyond clicking, typing, and navigating it covers tab management, form filling, dialog handling, file uploads, network inspection, console messages, screenshots, and opt-in capabilities like PDF generation, cookie and storage control, request mocking, tracing, and coordinate-based (vision) input. For agents that need to test web apps, scrape rendered content, or walk a real login flow, it is the most actively maintained option in the ecosystem.
Quick install
Copy-paste configs are provided for all 8 supported clients. Pick your client below.
Add to ~/.claude.json
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}
}
}claude mcp add playwright -- npx @playwright/mcp@latestAvailable tools
| Tool | Description |
|---|---|
| browser_navigate | Navigates the browser to a URL. |
| browser_navigate_back | Goes back to the previous page in the history. |
| browser_snapshot | Captures an accessibility snapshot of the current page, which is better than a screenshot for taking actions. |
| browser_click | Performs a click on a web page element. |
| browser_hover | Hovers over an element on the page. |
| browser_type | Types text into an editable element. |
| browser_press_key | Presses a key on the keyboard. |
| browser_fill_form | Fills multiple form fields in one call. |
| browser_select_option | Selects an option in a dropdown. |
| browser_file_upload | Uploads one or multiple files. |
| browser_drag | Performs drag and drop between two elements. |
| browser_drop | Drops files or MIME-typed data onto an element, as if dragged from outside the page. |
| browser_handle_dialog | Handles a browser dialog such as an alert, confirm, or prompt. |
| browser_wait_for | Waits for text to appear or disappear, or for a specified time to pass. |
| browser_evaluate | Evaluates a JavaScript expression on the page or an element. |
| browser_run_code_unsafe | Runs an arbitrary Playwright code snippet in the server process (RCE-equivalent). |
| browser_resize | Resizes the browser window. |
| browser_take_screenshot | Takes a screenshot of the current page; use browser_snapshot for taking actions. |
| browser_console_messages | Returns all console messages from the page. |
| browser_network_requests | Returns a numbered list of network requests since the page loaded. |
| browser_network_request | Returns the full headers and body of a single network request by index. |
| browser_close | Closes the current page. |
| browser_tabs | Lists, creates, closes, or selects a browser tab. |
| browser_pdf_save | Saves the current page as a PDF (opt-in via --caps=pdf). |
| browser_get_config | Gets the resolved config after merging CLI options, env vars, and config file (opt-in via --caps=config). |
| browser_network_state_set | Sets the browser network state to online or offline (opt-in via --caps=network). |
| browser_route | Sets up a route to mock network requests matching a URL pattern (opt-in via --caps=network). |
| browser_route_list | Lists all active network routes (opt-in via --caps=network). |
| browser_unroute | Removes network routes matching a pattern, or all routes (opt-in via --caps=network). |
| browser_cookie_set | Sets a cookie with optional flags (opt-in via --caps=storage). |
| browser_cookie_get | Gets a specific cookie by name (opt-in via --caps=storage). |
| browser_cookie_list | Lists all cookies, optionally filtered by domain or path (opt-in via --caps=storage). |
| browser_cookie_delete | Deletes a specific cookie (opt-in via --caps=storage). |
| browser_cookie_clear | Clears all cookies (opt-in via --caps=storage). |
| browser_localstorage_set | Sets a localStorage item (opt-in via --caps=storage). |
| browser_localstorage_get | Gets a localStorage item by key (opt-in via --caps=storage). |
| browser_localstorage_list | Lists all localStorage key-value pairs (opt-in via --caps=storage). |
| browser_localstorage_delete | Deletes a localStorage item (opt-in via --caps=storage). |
| browser_localstorage_clear | Clears all localStorage (opt-in via --caps=storage). |
| browser_sessionstorage_set | Sets a sessionStorage item (opt-in via --caps=storage). |
| browser_sessionstorage_get | Gets a sessionStorage item by key (opt-in via --caps=storage). |
| browser_sessionstorage_list | Lists all sessionStorage key-value pairs (opt-in via --caps=storage). |
| browser_sessionstorage_delete | Deletes a sessionStorage item (opt-in via --caps=storage). |
| browser_sessionstorage_clear | Clears all sessionStorage (opt-in via --caps=storage). |
| browser_storage_state | Saves storage state (cookies and local storage) to a file for later reuse (opt-in via --caps=storage). |
| browser_set_storage_state | Restores storage state from a file, clearing existing cookies and local storage first (opt-in via --caps=storage). |
| browser_generate_locator | Generates a locator for an element to use in tests (opt-in via --caps=devtools). |
| browser_verify_element_visible | Verifies an element is visible on the page (opt-in via --caps=verify). |
| browser_verify_text_visible | Verifies text is visible on the page (opt-in via --caps=verify). |
| browser_verify_list_visible | Verifies a list is visible on the page (opt-in via --caps=verify). |
| browser_verify_value | Verifies the value of an element (opt-in via --caps=verify). |
| browser_mouse_click_xy | Clicks the mouse at a given coordinate (opt-in via --caps=vision). |
| browser_mouse_move_xy | Moves the mouse to a given coordinate (opt-in via --caps=vision). |
| browser_mouse_drag_xy | Drags with the left mouse button to a given coordinate (opt-in via --caps=vision). |
| browser_mouse_down | Presses the mouse button down (opt-in via --caps=vision). |
| browser_mouse_up | Releases the mouse button (opt-in via --caps=vision). |
| browser_mouse_wheel | Scrolls the mouse wheel (opt-in via --caps=vision). |
What you can do with it
End-to-end test a web app
An agent walks a real user flow, asserts on accessible elements, and reports failures with the snapshot that produced them.
Scrape rendered, JS-heavy pages
Pages that only render content after client-side JavaScript become readable because the agent drives a real browser, not a raw HTTP fetch.
FAQ
- Is it free?
- Yes. It is open source under Microsoft and free to run; you only pay for any browser infrastructure you host yourself.
- Does it support remote/OAuth?
- It can run as a standalone HTTP server via the --port flag, but it has no built-in OAuth; the default and most common mode is local stdio.