Playwright MCP
Microsoft's open-source MCP server that gives AI agents structured browser automation via Playwright's accessibility tree.
Playwright MCP is Microsoft's open-source MCP server that lets AI agents drive a real browser via Playwright. It acts on the accessibility tree rather than screenshots, so interactions are deterministic, token-efficient, and need no vision model — navigation, clicks, forms, tabs, and console/network inspection across Chromium, Firefox, and WebKit.
Playwright MCP is a Model Context Protocol server from Microsoft that lets an AI agent drive a real browser. It is not a standalone app — you register it with an MCP client like Claude Code, and the agent gains a set of tools for navigating pages, clicking, typing, filling forms, and reading results. Under the hood it uses Playwright, the same automation engine that powers Microsoft's end-to-end testing framework.
Its defining choice is to act on the page's accessibility tree rather than screenshots. Each action returns a structured snapshot of elements, their roles, and their text, so the model interacts with semantic targets instead of guessing pixel coordinates. That makes it fast, deterministic, and token-efficient, and means no vision model is required. It is aimed at developers who want an agent that can actually exercise a running web app — reproducing bugs, checking flows, scraping state, or driving QA — instead of only reasoning about source code.
Highlights
- Accessibility-tree based — operates on structured page snapshots (roles, names, text), not pixel screenshots, so interactions are deterministic and cheap on tokens.
- Modular
--capsopt-ins — stays lean by default (no vision model required) and exposes seven optional capability groups behind--caps:config,network,storage,devtools(tracing and video),vision(coordinate clicks),pdf, andtesting. - Full browser tool set & WebMCP — navigation, clicks, typing, form fills, drag-and-drop, tab management, file uploads, dialog handling, console/network inspection, and automatic collection of page-registered WebMCP tools (disable with
--no-webmcp). - Cross-browser — runs Chromium, Firefox, or WebKit (and named Chrome/Edge channels), headed or headless.
- Three session modes — workspace-scoped persistent profiles by default,
--isolatedfor ephemeral runs, or--extensionto attach to existing Chrome/Edge tabs with your logged-in sessions. - Flexible deployment & secret redaction — run locally over stdio (
npx @playwright/mcp@latest, Node.js 20+), as a standalone HTTP server (--port 8931→/mcp), or in Docker (mcr.microsoft.com/playwright/mcp), with--secretsand--redact-url-paramsto mask tokens in responses. - Microsoft-maintained, Apache-2.0 — published as
@playwright/mcp(v0.0.86, ~40k GitHub stars as of November 2026) in themicrosoft/playwright-mcprepo.
In an AI-assisted workflow
Because it is an MCP server, you add it once to your client and every session can reach for it. In Claude Code:
claude mcp add playwright npx @playwright/mcp@latestOr drop it into an MCP config block directly:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}From there the agent can verify its own work — start the dev server, navigate to the page it just changed, click through the flow, and read back the accessibility snapshot to confirm the result. A typical loop: ask the agent to reproduce a reported bug, let it drive the browser to the failing state, then have it write a Playwright test that locks the fix in place.
TIP
Pair it with a testing-focused agent (see test-engineer) so the model knows to write a regression test once it has reproduced an issue in the browser, not just confirm the page loads.
NOTE
The first run downloads the browser binaries via Playwright. If your environment blocks that, install browsers ahead of time with npx playwright install.
Good to know
Playwright MCP is free and open source under Apache-2.0 (v0.0.86, ~40k GitHub stars as of November 2026); you run it via Node.js 20+ (npx @playwright/mcp@latest), standalone HTTP (--port), or Docker, with no hosted SaaS tier or account. It works with any MCP-capable client — Claude Code, the Claude Desktop app, VS Code, Cursor, and others. For coding agents watching context overhead, Microsoft's README now also points to its companion microsoft/playwright-cli (CLI + Skills) as a lower-token option, keeping Playwright MCP for persistent, exploratory, and self-healing browser loops.
WARNING
A browser agent can navigate to and act on any site it is pointed at. Run it against your own apps and trusted URLs, pass --isolated to run untrusted pages in an ephemeral profile (the default profile is persistent and retains your login state), and use --allowed-origins / --blocked-origins to limit which origins it can request — note these are best-effort filters, not a hard security boundary, and do not affect redirects.
Configure it with Adding MCP Servers to Claude Code, check its prompt footprint in our MCP server token overhead benchmark, compare it with other browser automation servers in The Best MCP Servers in 2026, or browse Playwright MCP alternatives.
Frequently asked questions
- What is Playwright MCP?
- Playwright MCP is a Model Context Protocol server from Microsoft that gives an AI agent a full browser tool set — navigating, clicking, typing, filling forms, managing tabs, and reading console/network output. It's built on Playwright and operates on the page's accessibility tree, returning structured snapshots instead of screenshots, so no vision model is needed.
- How do I add Playwright MCP to Claude Code?
- Run claude mcp add playwright npx @playwright/mcp@latest, or add it to an mcpServers config block with command npx and the @playwright/mcp@latest argument. The first run downloads browser binaries via Playwright; if your environment blocks that, run npx playwright install ahead of time.
- Is Playwright MCP free?
- Yes — free and open source under Apache-2.0, published as @playwright/mcp on npm (Node.js 20+) and maintained by Microsoft in the microsoft/playwright-mcp repo. You run it locally via npx, in Docker, or as a standalone HTTP MCP server (--port); there's no hosted SaaS tier or account, and it works with any MCP-capable client.
- Is Playwright MCP safe to run?
- A browser agent can act on any site it's pointed at, so run it against your own apps and trusted URLs. Pass --isolated for an ephemeral profile (the default profile persists your logged-in state) and use --allowed-origins / --blocked-origins to limit reachable origins — best-effort filters, not a hard security boundary.
Filed under
mcp · browser · testing · automation
Related
- AgentTest EngineerUse this agent to write and improve automated tests — unit, integration, and edge cases. Examples — adding coverage to an untested module, writing regression tests for a bug, designing a test plan.
- ToolClaude CodeAnthropic's agentic coding tool for the terminal, IDE, desktop app and web.
- ToolChrome DevTools MCPGoogle's official MCP server that gives coding agents a live Chrome — Puppeteer automation plus DevTools network, console, and performance insights.
- GuideMCP Server Context-Token Overhead Benchmark (2026): 16 Servers MeasuredWe probed 16 real MCP servers over stdio and HTTP to measure exact tools/list context-window token overhead — from 172 tokens (Ref) to 7,143 tokens (Supabase).
- GuideThe Best MCP Servers in 2026The MCP servers actually worth connecting in 2026 — Context7, GitHub, Chrome DevTools, Playwright, Serena, Exa, Firecrawl, and official vendor servers.
- GuideBrowser Agents in 2026: Browser Use vs Stagehand vs Skyvern vs Playwright MCPSeven ways to give AI a browser — Browser Use, Stagehand, Skyvern, the MCP servers, Claude in Chrome, Browserbase and Firecrawl — compared with a verdict each.
- AgentBrowser Agent EngineerUse this agent to build, harden, or debug browser-automation agents — web tasks via Browser Use, Stagehand, Skyvern, or Playwright-based stacks. Examples: automate a portal workflow, make a flaky browser agent reliable, add verification and guardrails to web automation, choose between vision and DOM grounding.
- TermComputer UseComputer use is an AI agent operating software through its real interface — reading the screen, moving the cursor, clicking, and typing like a person would.