Playwright MCP Server: Let an Assistant Drive a Real Browser

Playwright MCP is Microsoft's open-source MCP server that gives an AI assistant a real browser to click, type, fill forms and read pages. Instead of looking at screenshots, it reads the page's accessibility tree, a structured list of buttons, links and text. It needs Node.js 18 or newer and installs with one npx line.

Playwright MCP at a glance
ItemValue
npm package@playwright/mcp
RequirementNode.js 18 or newer
How it sees pagesAccessibility snapshots, not pixels
Browserschrome, firefox, webkit, msedge
Default windowHeaded (visible); add --headless to hide it

Updated

If you run a website or store, Playwright MCP is a practical way to have an assistant walk through your own pages like a customer would: open the menu, add something to the cart, submit the contact form, and report what broke. It is built on Playwright, a widely used browser testing library. Pick your options below and copy a config, then read the safety notes before pointing it at anything logged in.

Playwright MCP config builder

Choose options and copy the JSON. This page only writes text; it does not start a browser.

Config JSON

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

Options worth knowing

Each option also has an environment variable form, listed in the README.

Selected Playwright MCP options
OptionWhat it does
--browser <browser>chrome, firefox, webkit or msedge
--headlessRuns without a visible window; headed is the default
--isolatedKeeps the browser profile in memory, not on disk
--storage-state <path>Loads cookies and local storage into an isolated session
--device <device>Emulates a device, for example "iPhone 15"
--viewport-size <size>Sets the viewport in pixels, for example "1280x720"
--caps <caps>Turns on extra tool groups, such as pdf or vision
--allowed-origins / --blocked-originsAllow or block request origins; not a security boundary
--timeout-action / --timeout-navigationDefaults 5000 ms and 60000 ms
--port <port>Serves over HTTP so a client can connect by URL

Core tools

Core Playwright MCP tools
ToolPurposeRead-only
browser_navigateOpen a URLNo
browser_snapshotCapture the accessibility snapshot of the pageYes
browser_clickClick an elementNo
browser_typeType into a fieldNo
browser_fill_formFill several fields at onceNo
browser_take_screenshotSave a screenshotYes
browser_console_messagesRead console messagesYes
browser_network_requestsList network requestsYes
browser_resizeResize the windowNo
browser_run_code_unsafeRun Playwright codeNo

Config examples

Standard config

The minimal setup the README gives for most MCP apps.

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

Run as an HTTP server and connect by URL

Useful when the app cannot open a window itself. The client then points at http://localhost:8931/mcp.

npx @playwright/mcp@latest --port 8931

Persistent, isolated or your own browser

Playwright MCP can run in three ways. The default persistent profile keeps cookies and logins in a folder per project. Isolated mode keeps everything in memory, which suits repeatable tests. The browser extension mode connects to a Chrome or Edge window you already have open, which is convenient but means the assistant acts with your real logins.

Only one browser can use a persistent profile at a time. If you run two assistant sessions on the same project, start the second with --isolated or a different --user-data-dir.

Good jobs for it on your own site

Checking that every link in the main menu opens a page that loads. Filling the contact form with test details and confirming the thank-you message appears. Reading the console messages on a page that seems slow. Resizing to a phone width and listing anything that overflows.

Write the results down as a checklist you can repeat after each change, so the assistant's run becomes your regression test.

How it works

  1. Choose a browser and whether the window should be visible or headless.
  2. Turn on isolated mode if you want every session to start clean, with nothing saved to disk.
  3. Add any extra capability groups you need, such as PDF saving or test assertions.
  4. Copy the JSON into your MCP app's config and restart it. The first run downloads the package.

Tips

Frequently asked questions

What is an accessibility snapshot?

Browsers keep an accessibility tree, the same structured view screen readers use: each button, link, heading and field with its name and role. Playwright MCP hands the assistant that tree, so it can say "click the Add to cart button" without guessing from an image.

Is Playwright MCP a security boundary?

No, and its README says so in bold. Options like --allowed-origins and --blocked-origins are described as not a security boundary either. Treat it as a tool you supervise, and run it where a mistake cannot reach real customer data.

Does it remember logins between sessions?

By default it uses a persistent profile, so logins are stored on disk like a normal browser. With --isolated the profile lives in memory and is lost when the browser closes. You can preload cookies into an isolated session with --storage-state.

Can it take screenshots or save PDFs?

browser_take_screenshot is a core tool. PDF saving (browser_pdf_save) is opt-in with --caps=pdf, and click-by-coordinates tools need --caps=vision.

Should I use Playwright MCP or the Playwright CLI?

The README suggests coding agents may do better with the separate Playwright CLI, which uses fewer tokens. It keeps MCP for longer exploratory sessions where holding the browser state open is worth that cost.

Related: What is an MCP server?, Filesystem MCP server, How to build an MCP server, AI agent test checklist, Connect MCP in We.Inc.

Start for free or see all free tools. We.Inc is free to start, with no card needed. AI building is on paid plans from $20 a month.

More in Guides

We.Inc is an AI-powered website builder you can resell under your own brand. Launch a branded client dashboard, bill on Stripe Connect, and deliver AI-generated websites in minutes. White-label plans start at $99 a month for 25 client sites, with a 7-day free trial and no per-site fees.

Product

Who It's For

Features

Resources

Company

View Sitemap