Playwright MCP

Microsoft's Playwright server for driving Chrome, Firefox, WebKit or Edge from an MCP client

Official · Microsoft TypeScript Local · stdio Browser automationTesting

129 popularity score ★ 39k ↓ 11M/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add playwright -- npx @playwright/mcp@latest
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "playwright": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.playwright]
command = "npx"
args = ["@playwright/mcp@latest"]
Gemini CLITerminal
gemini mcp add --scope user playwright npx -- @playwright/mcp@latest
Local (container)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add playwright -- docker run -i --rm --init --pull=always mcr.microsoft.com/playwright/mcp
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "playwright": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--init",
        "--pull=always",
        "mcr.microsoft.com/playwright/mcp"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "playwright": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--init",
        "--pull=always",
        "mcr.microsoft.com/playwright/mcp"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "playwright": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "--init",
        "--pull=always",
        "mcr.microsoft.com/playwright/mcp"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.playwright]
command = "docker"
args = ["run", "-i", "--rm", "--init", "--pull=always", "mcr.microsoft.com/playwright/mcp"]
Gemini CLITerminal
gemini mcp add --scope user playwright docker -- run -i --rm --init --pull=always mcr.microsoft.com/playwright/mcp

Settings 12

PLAYWRIGHT_MCP_BROWSER Optional: Browser or channel to use: chrome, firefox, webkit or msedge (same as --browser). Default chrome.
PLAYWRIGHT_MCP_HEADLESS Optional: Run without a window (same as --headless). When unset it is headed, except on Linux with no DISPLAY, where it runs headless.
PLAYWRIGHT_MCP_CAPS Optional: Comma-separated tool groups to add: network, storage, devtools, vision, pdf, testing, config (same as --caps).
PLAYWRIGHT_MCP_ISOLATED Optional: Keep the browser profile in memory instead of on disk (same as --isolated). Cannot be combined with a user data directory.
PLAYWRIGHT_MCP_USER_DATA_DIR Optional: Folder for the persistent browser profile (same as --user-data-dir).
PLAYWRIGHT_MCP_ALLOWED_ORIGINS Optional: Semicolon-separated origins the browser may request. All are allowed when unset, and redirects are not covered.
PLAYWRIGHT_MCP_ALLOW_UNRESTRICTED_FILE_ACCESS Optional: Allow files outside the workspace roots and any file:// URL (same as --allow-unrestricted-file-access).
PLAYWRIGHT_MCP_IGNORE_ROOTS Optional: Skip asking the client for workspace roots and use the working directory as the root (same as --ignore-roots).
PLAYWRIGHT_MCP_REDACT_URL_PARAMS Optional: Comma-separated query or fragment parameter names, such as access_token, whose values are shown as <redacted> in tool output.
PLAYWRIGHT_MCP_CONFIG Optional: Path to a JSON configuration file (same as --config).
Set together: http
PLAYWRIGHT_MCP_PORT Optional: Port for serving over HTTP instead of stdio (same as --port).
PLAYWRIGHT_MCP_ALLOWED_HOSTS Optional: Comma-separated hosts the HTTP server answers for. Defaults to localhost, loopback addresses and the --host value; * turns the check off.

In a container, a setting goes in with -e NAME=value after docker run.

What it does

Playwright MCP is Microsoft's browser automation server built on Playwright. The model works from accessibility snapshots of the page rather than pixels, so it can click, type, fill forms, answer dialogs, switch tabs and read console output or network traffic with no vision model involved. Screenshots are still there when you want to look at a page.

More tools come in through --caps. With network you get request mocking and an offline switch. Storage adds cookies, localStorage, sessionStorage and saved storage state, and devtools brings tracing, video, highlights and recording a person's clicks as Playwright code. Then there are coordinate mouse control (vision), PDF export (pdf), locator and assertion helpers for tests (testing), and a tool that prints the resolved settings (config). Counting every opt-in group it has 72 tools, and 25 of them are on without any --caps.

It runs on your machine under Node.js 18 or later. With no browser named it opens the installed Google Chrome channel, and it keeps a persistent profile so logins survive between sessions. Use --isolated for an in-memory profile, or --extension to attach to a Chrome or Edge you already have open. The README calls it headed by default, but the config code turns headless on when it runs on Linux with no DISPLAY set. Actions time out after 5 seconds and navigations after 60 unless you change the timeout settings. Passing --port starts it as an HTTP server, and there is a Docker image that runs headless Chromium only.

The maintainers point coding agents toward the separate Playwright CLI with skills, which costs fewer tokens. They keep this server for longer agent loops that hold on to browser state.

What it needs

RuntimeNode.js 18+
Runs onmacOS, Windows, Linux
Also
  • Google Chrome installed for the default chrome channel, or another browser picked with --browser
  • Playwright Extension in Chrome or Edge, only for --extension

Limits

  • Limit Most tools beyond the 25 core ones only appear when their group is named in --caps (network, storage, devtools, vision, pdf, testing, config).
  • Platform The Docker image runs headless Chromium only.
  • Limit File access stays inside the client's workspace roots, or the working directory when there are none, unless --allow-unrestricted-file-access is set.
  • Not covered --allowed-origins and --blocked-origins filter browser requests but do not cover redirects, and the README says they are not a security boundary.
  • Limit Headed runs need a display. On a machine without one, start it with --port from a session that has DISPLAY, or run headless.
  • Limit Some clients advertise workspace roots but cannot answer the request for them. --ignore-roots makes it use the working directory instead.

Who it suits

A good fit for an agent that has to work through real web pages step by step: testing a flow, filling forms, checking what a page shows, or capturing a trace or video of a run. It comes from the Playwright team, runs locally and needs no account. Since it can click and submit as you on any site the browser can open, the persistent profile matters. Use --isolated or a separate user data directory when the agent should not carry your logins. Coding agents that only need quick browser checks may spend fewer tokens with Playwright CLI and skills, which the README recommends for that case.

Tools 60 of 72

16 only read, 39 change things, 5 can delete or overwrite.

browser_click changes
Clicks an element picked from the page snapshot
browser_close changes
Closes the current page
browser_console_messages
Returns the console messages the page has logged
browser_drag changes
Drags one element onto another
browser_drop changes
Drops files or typed data onto an element as if dragged in from outside the page
browser_emulate_media changes
Overrides CSS media features such as light or dark colour scheme
browser_evaluate changes
Runs a JavaScript expression in the page or against one element
browser_file_upload changes
Uploads one or more files to a file chooser
browser_fill_form changes
Fills several form fields in one call
browser_find
Searches the page snapshot for text or a regex and returns matching nodes with context
browser_handle_dialog changes
Accepts or dismisses an alert, confirm or prompt dialog
browser_hover changes
Moves the pointer over an element
browser_navigate changes
Opens a URL in the current tab
browser_navigate_back changes
Goes back one step in the tab's history
browser_network_request
Shows headers and body of one numbered request from the request list
browser_network_requests
Lists the requests made since the page loaded, numbered
browser_press_key changes
Presses a single keyboard key
browser_resize changes
Changes the browser window size
browser_run_code_unsafe changes
Runs a Playwright code snippet inside the server process, with full code execution rights
browser_select_option changes
Picks one or more options in a dropdown
browser_snapshot
Returns the accessibility snapshot of the page that other tools use to target elements
browser_take_screenshot
Captures an image of the page or an element, for viewing only
browser_type changes
Types text into an editable element
browser_wait_for
Waits for text to show up or go away, or for a set time
browser_tabs changes
Lists, opens, closes or switches tabs
browser_network_state_set changes
Puts the browser offline or back online (network cap)
browser_route changes
Mocks responses for requests that match a URL pattern (network cap)
browser_route_list
Shows the mock routes in force (network cap)
browser_unroute changes
Removes mock routes by pattern, or all of them (network cap)
browser_cookie_clear deletes
Deletes every cookie in the browser context (storage cap)
browser_cookie_delete deletes
Deletes one cookie (storage cap)
browser_cookie_get
Reads one cookie by name (storage cap)
browser_cookie_list
Lists cookies, optionally for one domain or path (storage cap)
browser_cookie_set changes
Sets a cookie with its domain, path, expiry and flags (storage cap)
browser_localstorage_list
Lists localStorage keys and values (storage cap)
browser_localstorage_get
Reads one localStorage item (storage cap)
browser_localstorage_set changes
Writes a localStorage item (storage cap)
browser_localstorage_delete deletes
Removes one localStorage item (storage cap)
browser_localstorage_clear deletes
Empties localStorage (storage cap)
browser_set_storage_state deletes
Replaces cookies and localStorage with a saved state file, wiping what was there (storage cap)
browser_storage_state changes
Saves cookies and localStorage to a file for reuse (storage cap)
browser_annotate
Opens the Playwright Dashboard so a person can mark up the page, then returns the marks with a screenshot and snapshot (devtools cap)
browser_highlight changes
Draws a lasting highlight around an element (devtools cap)
browser_resume changes
Continues a paused script, optionally one step at a time (devtools cap)
browser_start_recording changes
Starts turning what a person does in the browser into Playwright code (devtools cap)
browser_stop_recording
Ends the recording and returns the generated Playwright code (devtools cap)
browser_start_tracing changes
Starts a Playwright trace (devtools cap)
browser_stop_tracing changes
Stops the trace and saves it (devtools cap)
browser_start_video changes
Starts recording video of the page (devtools cap)
browser_stop_video changes
Stops the video and saves it (devtools cap)
browser_video_chapter changes
Adds a chapter card to the video being recorded (devtools cap)
browser_mouse_click_xy changes
Clicks at x and y coordinates (vision cap)
browser_mouse_down changes
Presses a mouse button down (vision cap)
browser_mouse_drag_xy changes
Drags with the left button to a coordinate (vision cap)
browser_mouse_move_xy changes
Moves the mouse to a coordinate (vision cap)
browser_mouse_up changes
Releases a mouse button (vision cap)
browser_mouse_wheel changes
Scrolls with the mouse wheel (vision cap)
browser_pdf_save changes
Saves the page as a PDF file (pdf cap)
browser_generate_locator
Produces a Playwright locator for an element, for use in tests (testing cap)
browser_verify_element_visible
Checks that an element is visible (testing cap)

Similar servers