Microsoft's MCP server that gives agents a real browser — driven by the accessibility tree, not screenshots.

Install

$ npx -y @playwright/mcp

What is Playwright MCP?

Playwright MCP is Microsoft's official bridge between LLM agents and a real browser, built on the Playwright automation engine. Its defining design choice is representing pages as structured accessibility-tree snapshots instead of screenshots: the agent reads a text description of every interactive element and acts on elements by reference, which is dramatically more token-efficient and more deterministic than vision-based browsing.

The tool surface is broad — navigation, clicking, typing, form filling, file uploads, tab management, network inspection and mocking, cookie/storage control, plus opt-in extras like coordinate-based vision mode, PDF export, tracing, and test-style assertions. It runs over stdio by default, or as a standalone HTTP server with a --port flag for headless and remote setups. You need Node 18+ and Playwright-managed browsers.

In practice it has become the default answer to "my agent needs to see a web page": debugging a frontend the agent just changed, filling out forms, scraping behind JavaScript, or exploratory QA. The README is blunt that it is not a security boundary — the agent can do anything your browser session can do, so treat the sites you point it at accordingly.

Key capabilities

  • Accessibility-tree snapshots instead of screenshots — deterministic element targeting, far fewer tokens per page
  • Full browser control: navigation, forms, uploads, tabs, dialogs, network mocking, cookies and storage
  • Opt-in capability flags for vision mode, PDF export, tracing/video, and test assertions
  • Runs over stdio for local clients or as a standalone HTTP server for headless/remote deployments
  • Backed by the Playwright team at Microsoft — same engine, browsers, and selector semantics as Playwright tests

When to use it

Reach for Playwright MCP when the agent needs to interact with live web pages — verifying UI changes it just made, automating a form-heavy workflow, or investigating a bug that only reproduces in a browser. It is the safest default among browser MCP servers because Microsoft maintains it against the real Playwright engine. Do not pick it for writing conventional Playwright test suites (write those directly — an MCP round-trip per action is slow), for high-volume scraping (use Playwright scripts), or for anything where a misbehaving agent in your browser session would be costly: it is explicitly not a security boundary.

Alternatives

Frequently asked questions

How do I add Playwright MCP to Claude Code?

Run `claude mcp add playwright -- npx @playwright/mcp@latest`. You need Node 18 or newer; on first use Playwright will prompt to install its browsers if they are missing. After that the agent can open pages, take accessibility snapshots, and interact with elements directly. Add flags like `--headless` or a config file to control browser choice, viewport, and allowed origins.

Does Playwright MCP use screenshots or the accessibility tree?

The accessibility tree, by default. Each snapshot is a structured text description of the page with element references the agent can act on — no vision model needed, and far cheaper in tokens than images. A coordinate-based vision mode exists as an opt-in flag for pages where the accessibility tree falls short, such as canvas-heavy UIs.

Is Playwright MCP safe to run against any website?

Treat it with the same caution as handing someone your browser. The project states plainly that it is not a security boundary: the agent can click, submit, and download anything the session can reach. Mitigations include allowed/blocked origin lists, running headless in an isolated profile, and avoiding sessions logged into sensitive accounts.

Star count updated 2026-07-02 · refreshed weekly from the GitHub API · browse all tools →