Playwright MCP server

OfficialMicrosoft33,295Config last verified Jun 1, 2026

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

~/.claude.json
json
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}
Or via CLI
bash
claude mcp add playwright -- npx @playwright/mcp@latest

Available tools

ToolDescription
browser_navigateNavigates the browser to a URL.
browser_navigate_backGoes back to the previous page in the history.
browser_snapshotCaptures an accessibility snapshot of the current page, which is better than a screenshot for taking actions.
browser_clickPerforms a click on a web page element.
browser_hoverHovers over an element on the page.
browser_typeTypes text into an editable element.
browser_press_keyPresses a key on the keyboard.
browser_fill_formFills multiple form fields in one call.
browser_select_optionSelects an option in a dropdown.
browser_file_uploadUploads one or multiple files.
browser_dragPerforms drag and drop between two elements.
browser_dropDrops files or MIME-typed data onto an element, as if dragged from outside the page.
browser_handle_dialogHandles a browser dialog such as an alert, confirm, or prompt.
browser_wait_forWaits for text to appear or disappear, or for a specified time to pass.
browser_evaluateEvaluates a JavaScript expression on the page or an element.
browser_run_code_unsafeRuns an arbitrary Playwright code snippet in the server process (RCE-equivalent).
browser_resizeResizes the browser window.
browser_take_screenshotTakes a screenshot of the current page; use browser_snapshot for taking actions.
browser_console_messagesReturns all console messages from the page.
browser_network_requestsReturns a numbered list of network requests since the page loaded.
browser_network_requestReturns the full headers and body of a single network request by index.
browser_closeCloses the current page.
browser_tabsLists, creates, closes, or selects a browser tab.
browser_pdf_saveSaves the current page as a PDF (opt-in via --caps=pdf).
browser_get_configGets the resolved config after merging CLI options, env vars, and config file (opt-in via --caps=config).
browser_network_state_setSets the browser network state to online or offline (opt-in via --caps=network).
browser_routeSets up a route to mock network requests matching a URL pattern (opt-in via --caps=network).
browser_route_listLists all active network routes (opt-in via --caps=network).
browser_unrouteRemoves network routes matching a pattern, or all routes (opt-in via --caps=network).
browser_cookie_setSets a cookie with optional flags (opt-in via --caps=storage).
browser_cookie_getGets a specific cookie by name (opt-in via --caps=storage).
browser_cookie_listLists all cookies, optionally filtered by domain or path (opt-in via --caps=storage).
browser_cookie_deleteDeletes a specific cookie (opt-in via --caps=storage).
browser_cookie_clearClears all cookies (opt-in via --caps=storage).
browser_localstorage_setSets a localStorage item (opt-in via --caps=storage).
browser_localstorage_getGets a localStorage item by key (opt-in via --caps=storage).
browser_localstorage_listLists all localStorage key-value pairs (opt-in via --caps=storage).
browser_localstorage_deleteDeletes a localStorage item (opt-in via --caps=storage).
browser_localstorage_clearClears all localStorage (opt-in via --caps=storage).
browser_sessionstorage_setSets a sessionStorage item (opt-in via --caps=storage).
browser_sessionstorage_getGets a sessionStorage item by key (opt-in via --caps=storage).
browser_sessionstorage_listLists all sessionStorage key-value pairs (opt-in via --caps=storage).
browser_sessionstorage_deleteDeletes a sessionStorage item (opt-in via --caps=storage).
browser_sessionstorage_clearClears all sessionStorage (opt-in via --caps=storage).
browser_storage_stateSaves storage state (cookies and local storage) to a file for later reuse (opt-in via --caps=storage).
browser_set_storage_stateRestores storage state from a file, clearing existing cookies and local storage first (opt-in via --caps=storage).
browser_generate_locatorGenerates a locator for an element to use in tests (opt-in via --caps=devtools).
browser_verify_element_visibleVerifies an element is visible on the page (opt-in via --caps=verify).
browser_verify_text_visibleVerifies text is visible on the page (opt-in via --caps=verify).
browser_verify_list_visibleVerifies a list is visible on the page (opt-in via --caps=verify).
browser_verify_valueVerifies the value of an element (opt-in via --caps=verify).
browser_mouse_click_xyClicks the mouse at a given coordinate (opt-in via --caps=vision).
browser_mouse_move_xyMoves the mouse to a given coordinate (opt-in via --caps=vision).
browser_mouse_drag_xyDrags with the left mouse button to a given coordinate (opt-in via --caps=vision).
browser_mouse_downPresses the mouse button down (opt-in via --caps=vision).
browser_mouse_upReleases the mouse button (opt-in via --caps=vision).
browser_mouse_wheelScrolls 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.
← Browse all browser-automation servers