Playwright MCP Server

Microsoft's browser-automation MCP server, from the microsoft/playwright-mcp repository. Install commands, configuration options and the tools it exposes, read from the project README on 2 September 2026.

Interactive examples · No account is connected on this page

Updated

Playwright MCP is a Model Context Protocol server from Microsoft that gives an MCP client browser automation through Playwright. It exposes tools such as browser_navigate, browser_click and browser_snapshot, and it reads pages as structured accessibility snapshots rather than screenshots, so no vision model is needed. The README lists Node.js 18 or newer as the requirement, and most clients add it with one npx command.

Try a Playwright MCP task

Pick an example to see which Playwright MCP tools a task would call and what the result looks like. Examples are illustrative; nothing on this page connects to Playwright.

Playwright

Install Playwright MCP

Playwright MCP needs Node.js 18 or newer and nothing else. Claude Code and VS Code add it with a one-line command, and every other client takes the standard JSON block that runs npx @playwright/mcp@latest. Command-line flags choose the browser, headless mode and device emulation. Start it with --port when several clients must share one browser.

Check the one prerequisite

The server ships as the npm package @playwright/mcp, and the README names a single hard requirement: Node.js 18 or newer. Everything else comes from the MCP client you already use. The README names VS Code, Cursor, Windsurf, Claude Desktop, Goose, Grok and Junie as supported hosts, and says any other MCP client works the same way, because the wire format is the protocol rather than an integration.

node --version

Add it with your client's CLI

Two clients publish a one-line install command in the README. Claude Code registers the server by name and command; VS Code takes the same object as JSON on the command line.

claude mcp add playwright npx @playwright/mcp@latest

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

Or paste the standard JSON config

Every other client takes the standard configuration block. Windsurf and Claude Desktop are documented as using exactly this, with no client-specific fields.

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

Choose a browser and a mode

Command-line options go in the args array after the package name. --browser accepts chrome, firefox, webkit and msedge. --headless runs without a window; the README notes the server is headed by default. --device emulates a device such as an iPhone 15, and --config points at a configuration file.

npx @playwright/mcp@latest --browser msedge --headless --device "iPhone 15"

Run it over HTTP when one browser has to be shared

The README covers a case that trips people up: running a headed browser on a machine without a display, or from worker processes. The fix is to start the server where a DISPLAY exists and pass --port to enable the HTTP transport, then point clients at the URL instead of a command.

npx @playwright/mcp@latest --port 8931

{
  "mcpServers": {
    "playwright": {
      "url": "http://localhost:8931/mcp"
    }
  }
}

Official documentation: Read the README on GitHub.

Three documented ways to run the server

The README documents three ways to run Playwright MCP. npx over stdio is the default, started and stopped by the client. HTTP mode with --port runs a long-lived server that clients reach by URL, which fixes headed browsers on machines without a display. Docker runs the mcr.microsoft.com/playwright/mcp image for containerised setups.

What differsnpx (stdio)HTTP (--port)Docker
Commandnpx @playwright/mcp@latestnpx @playwright/mcp@latest --port 8931docker run -i --rm --init --pull=always mcr.microsoft.com/playwright/mcp
Client config keycommand + argsurl: http://localhost:8931/mcpcommand + args
Process lifetimeStarted and stopped by the MCP clientLong-lived; clients connect to the URLLong-lived when started with -d
Case the README gives for itThe default setup shown for every clientHeaded browser without a display, or worker processesContainerised runs; the sample passes --headless --browser chromium --no-sandbox
Image or package@playwright/mcp on npm@playwright/mcp on npmmcr.microsoft.com/playwright/mcp

Commands transcribed from the microsoft/playwright-mcp README, read 2026-09-02. Pin @playwright/mcp to a version instead of @latest if you need reproducible runs.

What the server exposes to the model

Playwright MCP gives a model a browser through structured accessibility snapshots instead of screenshots, so no vision model is needed. Its tools cover navigation and clicking, typing and form filling, drag, drop and file uploads. Extra capability groups for vision, PDF and devtools are opt-in through --caps, and profile flags control whether sessions persist.

Accessibility snapshots, not screenshots

The README describes the server as one that lets language models interact with web pages through structured accessibility snapshots, bypassing the need for screenshots or visually-tuned models. That is the design choice that separates it from screenshot-driven browser agents: the model receives a labelled element tree, so it can name a target instead of guessing at pixel coordinates.

Navigation and pointing

browser_navigate, browser_click and browser_hover cover moving between pages and pointing at elements found in the snapshot.

Typing and forms

browser_type, browser_fill_form, browser_select_option and browser_press_key handle text entry, whole-form fills, dropdowns and raw key input.

Drag, drop and uploads

browser_drag, browser_drop and browser_file_upload cover the interactions that plain clicking cannot express.

Optional capabilities behind --caps

The --caps flag turns on additional capability groups the README names as vision, pdf and devtools. They are off unless you ask for them.

Profile and session control

--isolated keeps the browser profile in memory instead of on disk, and --storage-state points at a storage state file so an isolated session can start already signed in.

What is Playwright MCP, and where does it sit in an agent stack?

Playwright MCP is Microsoft’s Model Context Protocol server for browser automation. It gives an MCP client a real browser through Playwright and describes pages as structured accessibility snapshots, so the model names elements instead of guessing at pixels. It needs Node.js 18 or newer and is usually added with one npx command.

Playwright MCP is one server among many in the MCP server directory, and it covers a narrow job: giving a model a real browser. Servers such as GitHub MCP hand the model an API, while this one hands it a rendered page, which is the only option when the site has no API. Clients differ in how they register it, which is why the Cursor MCP and Claude MCP setups are written up separately.

The protocol underneath is public. The current Model Context Protocol specification revision is 2026-07-28; it defines a JSON-RPC 2.0 message format with stateless, self-contained requests, three participants (hosts, clients and servers), and three server-side features — resources, prompts and tools. Playwright MCP is a tools server: everything it offers arrives as a callable tool rather than as a resource.

If you are choosing between a browser-driving server and a purpose-built extractor, the trade is throughput against generality. A browser renders anything but costs a page load per step, which is the ground covered on web scraping. For agents that need to plan across several of these servers, see AI agent builder.

How to connect Playwright MCP

  1. Check Node.js

    Playwright MCP needs Node.js 18 or newer.

  2. Add the server

    Use your client’s CLI (claude mcp add playwright npx @playwright/mcp@latest) or the standard JSON config.

  3. Try a read-only navigation

    Ask the agent to open a page and return a snapshot before letting it type or click.

See the full Playwright MCP setup

Playwright MCP use cases

Check a page that has no API

Navigate, snapshot and read the elements — the only option when a site offers no API for the data you need.

Smoke-test a form or checkout flow

Type, fill forms, select options and click through a flow in an isolated profile, stopping before irreversible steps.

Reuse a signed-in session safely

Start an isolated browser with --storage-state so the session begins signed in without writing a profile to disk.

Share one browser across clients

Run the server over HTTP with --port when several clients or agents need the same browser.

Playwright MCP questions

These answers cover what people ask before relying on Playwright MCP: whether Playwright needs a separate install, the exact Claude Code command, how to run headless on a server, how to keep a login between sessions, whether it is an official Microsoft project, and how it differs from the Playwright test runner.

Do I need to install Playwright separately?

The README lists Node.js 18 or newer as the requirement and the npx command fetches @playwright/mcp itself, so no separate install step is documented. The --browser flag selects the engine from chrome, firefox, webkit and msedge. The README's tool listing has a heading for browser installation, but that section is empty, so if your client reports a missing browser binary, install the Playwright browsers on that machine.

How do I add Playwright MCP to Claude Code?

Run claude mcp add playwright npx @playwright/mcp@latest. That is the exact command the README publishes for Claude Code. Claude Desktop is different: the README points at the general MCP install guide and says to use the standard JSON configuration block shown above. More client-specific notes are collected on the Claude MCP page.

Can Playwright MCP run headless on a server?

Yes. Pass --headless; the README notes the server runs headed by default, so headless is opt-in. For containers, the README's own long-lived Docker example runs /app/cli.js --headless --browser chromium --no-sandbox --port 8931 --host 0.0.0.0 from the mcr.microsoft.com/playwright/mcp image, which is the configuration to copy if you are deploying it as a service rather than launching it per session.

How do I keep a login between sessions?

Two flags govern this. --isolated keeps the browser profile in memory, so nothing persists after the run. --storage-state takes a path to a storage state file, which is how you start an isolated session already authenticated. Without --isolated, the browser profile persists on disk in the normal Playwright way.

Is Playwright MCP an official Microsoft project?

It is published in the microsoft/playwright-mcp GitHub repository, and the container image is served from Microsoft's own registry at mcr.microsoft.com/playwright/mcp. This page is a third-party write-up of that project; check the README before you rely on any flag here, since command-line options change between releases.

What is the difference between Playwright MCP and the Playwright test runner?

The test runner is driven by test files you write and assert against. Playwright MCP wraps the same browser automation library in a Model Context Protocol server so a model decides the next action at runtime, from an accessibility snapshot of the current page. They share the browser layer and nothing above it.

Browser steps are one part of a workflow

A browser server gets an agent onto a page. Getting the result into a spreadsheet, a CRM or a ticket is a separate problem, and that is what the automation side of this site covers: which step triggers the browser run, where its output lands, and what the workflow should do when a page layout changes.