MCP server

playwright MCP

MCP server published on npm as @playwright/mcp. Transports: stdio. Maintained in microsoft/playwright-mcp.

Checked 2026-10-31

Install

Claude Code
claude mcp add playwright -- npx -y @playwright/mcp

Commands come from the project's own docs or registry entry. Check them against the source before you run them.

Loading poll...

Playwright MCP is Microsoft's server that lets an AI agent drive a real browser through the Model Context Protocol: it opens pages, clicks, fills forms and reads the result as structured text. In Claude Code you install it with claude mcp add playwright npx @playwright/mcp@latest. It is Apache-2.0, free, and needs Node.js 18 or newer. We checked the README and repo on 31 October 2026.

Quick facts

Maintainer

Microsoft (microsoft/playwright-mcp)

License

Apache-2.0

Requires

Node.js 18 or newer

Latest release we saw

v0.0.83, published 28 Sep 2026

Last push we saw

30 Oct 2026

Package

@playwright/mcp on npm

Transport

stdio by default; HTTP endpoint with --port

Default browser mode

Headed (a visible window); --headless to hide it

How it sees the page

Accessibility tree snapshots, no vision model needed

Price

Free

Docker image

mcr.microsoft.com/playwright/mcp (headless Chromium only)

The release number is the one GitHub lists as "latest". The version string starts with 0.0, so treat the tool names and options as able to change between releases. Pin a version if you share a config with a team.

What it lets an agent do

A coding agent that edits front-end code cannot see the result. It can read the diff and guess. With Playwright MCP it can open the page, look at it, click through the flow and tell you what actually happened.

The server does this through accessibility snapshots. Instead of sending a screenshot to the model, it sends a text tree of the page: roles, names, states, and a reference for each element. The README lists three reasons for this design: it is fast and light, it needs no vision model, and it is deterministic because the agent points at a named element rather than at pixels.

In practice that covers jobs like these:

  • Reproduce a bug from a URL and a set of steps.
  • Walk a signup, checkout or settings flow and report where it breaks.
  • Check a page at a phone width, then again in dark mode.
  • Read the console and network log after a failed action.
  • Upload a file, handle a dialog, drag an item across a list.
  • Generate a Playwright locator or a test assertion for something it just verified.

Install it in each agent

The standard config works in most clients. It runs the package with npx, so there is nothing to install first.

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp@latest"]
    }
  }
}

Claude Code

The README gives this line:

claude mcp add playwright npx @playwright/mcp@latest

Claude Code's own docs describe the general form as claude mcp add [options] <name> -- <command> [args...], where the double dash separates Claude's options from the server's. If you want to pass options to Playwright MCP, use that form:

claude mcp add --transport stdio playwright -- npx @playwright/mcp@latest --headless

Claude Code has three scopes. Local is the default and stays private to you in ~/.claude.json. Project scope writes a .mcp.json at the project root so teammates get the same server from version control, and Claude Code asks each person to approve it. User scope loads the server in every project. Add --scope project or --scope user to choose. Check what is connected with /mcp inside a session.

Cursor

The README offers an install button, or you can add it by hand under Cursor Settings, MCP, Add new MCP Server, using the command npx @playwright/mcp@latest. Cursor reads mcp.json, in .cursor/mcp.json for one project or ~/.cursor/mcp.json for all of them, and the entry has the same shape as the standard config above.

Codex

The README gives a CLI line and a config file alternative:

codex mcp add playwright npx "@playwright/mcp@latest"
[mcp_servers.playwright]
command = "npx"
args = ["@playwright/mcp@latest"]

That goes in ~/.codex/config.toml, or in .codex/config.toml to scope it to one project, per the Codex docs. Run codex mcp list to see what is configured, or /mcp inside the TUI.

Gemini CLI

The README says to use the standard config in your Gemini CLI settings.json under mcpServers. Gemini CLI also has gemini mcp add, which takes a name and a command, and supports a trust flag per server. Leave trust at false. When it is true, Gemini CLI skips the confirmation prompt for that server's tool calls, which you do not want on a browser.

VS Code

The README shows an install button and a command line version:

code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'

VS Code's docs give a slightly different example that includes "type":"stdio". Use that one if the first form is rejected. Be careful with file formats: VS Code's .vscode/mcp.json uses a top-level servers key, while the portable file format uses mcpServers. Copying one into the other is a common reason a server does not appear.

Other clients

The README also covers Amp, Antigravity, Cline, Copilot CLI, Factory, Warp and Windsurf, mostly by pointing at the standard config.

Compatibility at a glance

Agent

How you add it

Config file

Notes

Claude Code

claude mcp add playwright npx @playwright/mcp@latest

~/.claude.json or .mcp.json

Three scopes; project servers need approval

Cursor

Install button or Settings, MCP

.cursor/mcp.json or ~/.cursor/mcp.json

mcpServers key

Codex

codex mcp add playwright npx "@playwright/mcp@latest"

~/.codex/config.toml

TOML, [mcp_servers.playwright]

Gemini CLI

Standard config in settings.json

settings.json

Keep trust false

VS Code with Copilot

code --add-mcp '{...}'

.vscode/mcp.json

VS Code format uses servers

The tools it exposes

The README groups tools by capability. The default set is core automation, tab management and browser installation. Everything else is opt-in.

Core automation (on by default):

Tool

What it does

Read-only

browser_navigate, browser_navigate_back

Go to a URL, go back

No

browser_snapshot

Return the accessibility snapshot of the page

Yes (per README table)

browser_click, browser_hover, browser_drag, browser_drop

Pointer actions on a referenced element

No

browser_type, browser_press_key, browser_fill_form, browser_select_option

Keyboard and form input

No

browser_file_upload, browser_handle_dialog

Upload files, accept or dismiss dialogs

No

browser_take_screenshot

Take a screenshot

See README

browser_find

Search the snapshot for text or a regular expression

Yes

browser_console_messages

Return console messages at a chosen level

Yes

browser_network_requests, browser_network_request

List requests, then show one in detail

Yes

browser_resize, browser_emulate_media

Change the window size; switch dark mode or reduced motion

No

browser_wait_for

Wait for text or time

See README

browser_evaluate

Run a JavaScript expression on the page or an element

No

browser_run_code_unsafe

Run a Playwright snippet in the server process

No

browser_close

Close the page

No

The README describes browser_run_code_unsafe as running arbitrary JavaScript in the Playwright server process and being "RCE-equivalent". That is the README's wording, and it is a good reason to read tool calls before approving them.

Tab management: browser_tabs lists, opens, closes and selects tabs.

Opt-in groups. The README headings name them as config, network, storage, devtools, vision, pdf and testing. The --caps option row lists vision, pdf and devtools as its values, so check the README for the exact flag if you need network routing or storage tools. [VERIFY: whether --caps accepts config, network, storage and testing]

  • Network: browser_route, browser_route_list, browser_unroute, browser_network_state_set.
  • Storage: cookie, localStorage and sessionStorage get, set, list, delete and clear tools, plus browser_storage_state and browser_set_storage_state.
  • DevTools: highlight and annotate, tracing, video and recording tools.
  • Vision: coordinate-based mouse tools such as browser_mouse_click_xy.
  • PDF: browser_pdf_save.
  • Testing: browser_generate_locator and verify tools for visible element, visible list, visible text and value.

Every tool you expose costs context, because the schema is loaded into the model's window. Leave groups off until a task needs them.

Options worth knowing

You pass these as extra args in the config, or as PLAYWRIGHT_MCP_* environment variables. The README lists dozens; these are the ones we would reach for first.

Option

What it does

--headless

No visible window

--isolated

Keep the profile in memory only; nothing saved to disk

--browser <name>

chrome, firefox, webkit or msedge

--user-data-dir <path>

Use a persistent profile at a path you choose

--storage-state <path>

Start an isolated session from saved cookies and local storage

--device "iPhone 15"

Emulate a device

--mobile

Emulate a generic phone; the README notes mobile pages are lighter, which saves tokens

--viewport-size 1280x720

Set the viewport

--allowed-origins, --blocked-origins

Origin lists; the README says these are not a security boundary

--output-dir <path>

Where automatically named files such as screenshots go

--snapshot-mode none

Skip snapshots in responses to cut tokens

--port 8931

Serve over HTTP instead of stdio

--extension

Connect to a running Chrome or Edge through the Playwright extension

--config <path>

Load a JSON config file

Profiles, sessions and logins

This is where most setups go wrong, so it gets its own section.

By default the server uses a persistent profile. On macOS that is ~/Library/Caches/ms-playwright/mcp-{channel}-{workspace-hash}, and the hash comes from the workspace root, so each project gets its own. Anything you log into stays there between sessions. That is handy for an internal site and risky for everything else.

Only one browser can use a persistent profile at a time. If two MCP clients share a workspace, they conflict. The README's fix is --isolated for the extra clients or a distinct --user-data-dir.

In isolated mode the profile lives in memory and the state is lost when the browser closes. You can seed it from a saved file with --storage-state, which loads cookies and local storage into the fresh context. That is the clean way to test a logged-in page without leaving a real session on disk.

The third route is the browser extension: --extension connects to a Chrome or Edge you already have open, with your logged-in tabs. It is convenient and it hands the agent your real sessions. Use it only on trusted pages.

Real tasks with copy-ready prompts

These prompts are starting points. Adjust the URL and the flow.

Check a change after an edit

I just changed the pricing page. Open http://localhost:4321/pricing,
take a snapshot, and tell me whether the three plan cards and the
FAQ render. Then resize to 390 by 844 and tell me if anything overflows.

Reproduce a bug

Open https://staging.example.com/login. Sign in with the test account
I will paste next. Go to Settings, change the display name, save, and
report the exact error text and any console errors or failed network
requests. Do not retry more than twice.

Dark mode and reduced motion

Open the homepage, emulate dark color scheme and reduced motion, take
a screenshot for each, and list any element whose text looks low
contrast in the snapshot.

Turn a manual check into a test

Walk through adding an item to the cart on /shop. Once it works, write
a Playwright test in TypeScript that repeats those steps, using
getByRole locators where you can.

Find what a page loads

Load /dashboard, then list the network requests that returned 4xx or
5xx and show the response body for the first one.

For a fuller recipe that wires this into a review loop, see the browser QA recipe.

Security and permissions

Read this part before you point the server at anything you care about.

It is not a sandbox. The README says so in one line: Playwright MCP is not a security boundary. It points to the MCP security best practices page.

The browser carries your sessions. With the default persistent profile or the extension, every site you are logged into is reachable by the agent. A page the agent visits can contain instructions aimed at the model, which is called prompt injection. Claude Code's MCP docs warn that servers which fetch external content can expose you to this, and a browser is the clearest example.

File access is limited by default. The README says file system access is restricted to workspace roots, and navigation to file:// URLs is blocked. The flag --allow-unrestricted-file-access turns that off. Leave it off.

Origin filters are a convenience. --allowed-origins and --blocked-origins are described as not a security boundary, and they do not affect redirects. Do not rely on them to keep an agent off a site.

Binding. The HTTP mode binds to localhost by default. The README notes --host 0.0.0.0 binds to all interfaces. Do not do that on a shared network without a proxy and authentication in front.

A sensible baseline:

  1. Use --isolated for anything public or untrusted.
  2. Keep logged-in profiles for trusted internal sites only.
  3. Do not set a Gemini trust flag or an auto-approve mode for this server.
  4. Read browser_evaluate and browser_run_code_unsafe calls before you approve them.
  5. Never paste real production credentials into a prompt. The --secrets option reads a dotenv file instead.

Limits and known issues

  • Token cost. Snapshots and tool schemas take context. The README itself says coding agents often do better with the Playwright CLI plus skills, because CLI calls avoid loading large schemas and long accessibility trees. It keeps MCP for exploratory automation, self-healing tests and long-running loops. That is a fair steer from the maintainers.
  • Docker is narrower. The README notes the Docker image supports headless Chromium only.
  • One profile, one browser. Parallel clients need --isolated or separate data directories.
  • Open reports. At the time we checked, the issue list held items such as a request to bound settle waits on pages whose timers cannot run (#43752 and a fix proposal in #43767), a report that the snapshot includes off-screen elements (#39955), and a Docker image request about a certificate update (#1808). Check the tracker for your version before you rely on a behavior.
  • Pre-1.0 versioning. The latest tag is v0.0.83, so options can be renamed. The README mentions flags such as --mobile and --no-webmcp that are newer than many blog posts you will find.

Alternatives

Option

Choose it when

Chrome DevTools MCP

You want performance traces and DevTools data from a Chrome you control

Puppeteer MCP

You already use Puppeteer and want a smaller surface

Browserbase MCP

You want a hosted browser instead of one on your machine

Playwright CLI with skills

You use a coding agent and care most about tokens

Fetch MCP

You only need page text, not clicks

Pair it with Context7 MCP for current framework docs, or with GitHub MCP to file the bug you just reproduced. The full MCP servers hub lists the rest.

Which agents it works best with

Any client that speaks MCP can run it. The practical difference is how each one handles approval and context.

  • Claude Code is the easiest fit for a front-end loop: edit, open the page, check, edit again. Project scope lets a team share one config.
  • Cursor and VS Code suit people who want the browser result next to the editor. Mind the different JSON keys.
  • Codex takes a TOML entry, and its docs describe a per-server tool allow list, which helps you leave the risky tools out.
  • Gemini CLI works with the standard config and has includeTools and excludeTools filters for the same purpose.

Our take

We did not run a benchmark for this page, so this is a read of the documentation, not a test result.

The design choice that matters is the accessibility snapshot. It makes the server cheap to reason about for the model and easy to audit for you, because a tool call names an element rather than a coordinate. For checking front-end work it is the most direct way we know of to give an agent eyes.

The honest caveat comes from the README itself. The maintainers say coding agents often get more value from the CLI with skills, and that MCP earns its place when the loop is long and needs state. If your agent mostly does short checks, try the CLI first. If it explores a site, or you want a human-readable record of each step, the MCP server is the better pick.

Treat the profile as the real decision. Isolated for the public web, persistent for internal tools you trust, and the extension only when you must reuse a live login. Most of the risk in this server comes from that choice, not from the code.

A short setup checklist

  1. Confirm node --version prints 18 or newer.
  2. Add the server with the line for your agent above.
  3. Start a fresh session and list tools (/mcp in Claude Code and Codex).
  4. Ask for a snapshot of a local page before anything else.
  5. Add --headless and --isolated once the first run works.
  6. Turn on one opt-in group at a time, only when a task needs it.
  7. Pin the package version if the config is shared.

Frequently asked questions

What does Playwright MCP need to run? Node.js 18 or newer, per the README. After that any MCP client can launch it with npx.

Does it read screenshots or the page structure? The default is the accessibility tree. Screenshots are available as a tool, and coordinate-based mouse tools are opt-in.

Can I run it without a visible window? Yes, pass --headless. The browser is headed by default.

Is it a security boundary? No. The README states that directly. Run it isolated for untrusted sites.

Should a coding agent use the MCP server or the Playwright CLI? The README steers coding agents toward the CLI with skills for token efficiency, and keeps MCP for persistent, exploratory loops.

*Product names are used descriptively. We are not affiliated with Microsoft or Playwright.*

Works with

Tried it with one of these? Vote below: works for me, or not.

Questions

What does Playwright MCP need to run?

Node.js 18 or newer, per the README. Any MCP client can use it, including Claude Code, Cursor, Codex, Gemini CLI and VS Code.

Does it read screenshots or the page structure?

By default it works from the page's accessibility tree, so no vision model is needed. Coordinate-based tools exist but are opt-in.

Can I run it without a visible window?

Yes. Pass --headless. The README says the browser is headed by default.

Is it a security boundary?

No. The README says Playwright MCP is not a security boundary, so treat the browser as having the same reach as you do.

Should a coding agent use the MCP server or the Playwright CLI?

The README points coding agents to the Playwright CLI with skills for token efficiency, and keeps MCP for long-running loops that need persistent state.

Loading poll...

Reviews

Loading reviews…

Write a review

Your rating

Up to 1000 characters. Stars alone are enough.

Sources

  1. github.com/microsoft/playwright-mcp
  2. raw.githubusercontent.com/microsoft/playwright-mcp/main/README.md
  3. code.claude.com/docs/en/mcp
  4. developers.openai.com/codex/mcp
  5. code.visualstudio.com/docs/copilot/reference/mcp-configuration
  6. cursor.com/docs/context/mcp
  7. github.com/google-gemini/gemini-cli/blob/main/docs/tools/mcp-server.md

Similar

  • browser-use MCP

    Browser Use is an open-source Python library for AI browser agents, and our entry covers its MCP route.

    • MCP server
    • Official

    browser-use · 119,597 stars

  • Scrapling MCP Server

    Scrapling is a Python web scraping framework from D4Vinci, described on GitHub as handling everything from a single request to a full-scale crawl, and this entry is its MCP server.

    • MCP server

    D4Vinci · 90,477 stars

  • Netdata MCP

    Netdata is an observability platform, and this entry is its hosted MCP endpoint at app.netdata.cloud, reached over streamable HTTP.

    • MCP server

    netdata · 81,227 stars

  • claude-flow MCP

    Claude Flow is published on npm as claude-flow, and its repository now sits at ruvnet/ruflo, which the GitHub description calls the original agent harness for deploying multi-agent swarms and coordinating autonomous workflows.

    • MCP server

    ruvnet · 80,298 stars

  • Context7 MCP

    Context7 is an MCP server from Upstash that serves up-to-date library documentation to coding agents, so the model reads current docs instead of guessing from training data.

    • MCP server

    upstash · 63,974 stars

  • Chrome DevTools MCP

    MCP server published on npm as chrome-devtools-mcp. Transports: stdio. Maintained in ChromeDevTools/chrome-devtools-mcp.

    • MCP server

    ChromeDevTools · 54,503 stars

Part of the Wbcom Designs family

The all-in-one WordPress community stack

Also ours: wbcomdesigns.comvapvarun.combrndle.com