Playwright MCP — Browser Automation for AI Agents
by Microsoft
The MCP server that lets an agent drive a real browser from the accessibility tree instead of screenshots.
Overview
Playwright MCP is maintained by the Playwright team at Microsoft and distributed as the npm package @playwright/mcp; the repository README is its canonical documentation. Its central design decision is that the agent operates on Playwright's structured accessibility snapshot rather than on pixels, so a text-only model can identify and act on elements deterministically — the README states it bypasses the need for screenshots or visually-tuned models, which is what makes runs cheaper and more reproducible than vision-based browser agents. The documented tool surface is organised into capability groups. Core automation, roughly twenty-five tools, covers navigation, clicking, typing, form filling, option selection, hovering, drag-and-drop, keyboard input, file upload, waiting, accessibility snapshots, screenshots, console messages and in-page JavaScript evaluation. Tab tools create, list, select and close browser tabs. Network tools mock requests, monitor traffic and simulate offline mode. Storage tools read and write cookies, localStorage and sessionStorage. Three opt-in groups extend this: vision tools for XY-coordinate mouse interaction when the accessibility tree is not enough; PDF generation together with Playwright locator and assertion tools for test authoring; and a DevTools group for action recording, video capture, tracing, annotations and element highlighting. Installation is a single JSON stanza pointing at npx @playwright/mcp@latest, with one-click install buttons documented for VS Code, Cursor, Claude Desktop, Cline and more than fifteen other MCP-compatible clients, plus a Docker image. It requires Node.js 18 or newer, carries roughly 37,000 stars and 3,100 forks, and is actively developed. Simon Willison's write-up on using it with Claude Code adds a practical note the README does not: name "playwright mcp" explicitly in the prompt or the model tends to reach for bash instead, and a visible (non-headless) browser is the easiest way to handle logins, because you type the credentials yourself and the agent inherits the session cookies.
At a Glance
- Topic
- MCP
- Level
- Intermediate
- Format
- Documentation
- Cost
- Free
- Duration
- ~1-2 hours to install, wire into a client and work through the tool list; reference thereafter
- Provider
- Microsoft
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Give an agent a real Chromium browser through a single MCP server configuration
- ✓Drive pages from accessibility snapshots instead of screenshots, avoiding a vision model entirely
- ✓Use the tab, network and storage tool groups to mock requests and manage sessions
- ✓Handle interactive logins by authenticating yourself in the visible browser window
- ✓Enable opt-in capability groups for PDFs, coordinate clicks, tracing and test generation
- ✓Register the server with Claude Code, Cursor, VS Code and other MCP clients
- ✓Run the browser inside Docker to isolate untrusted pages from the host machine
Highlights
- •The accessibility-tree approach means a text-only model can automate the web — no screenshot pipeline, no vision-tuned model, no coordinate guessing
- •Maintained by Microsoft's Playwright team, so the browser layer is the same engine teams already use for production end-to-end testing
- •One of the highest-starred MCP servers on GitHub at roughly 37,000 stars and 3,100 forks, with one-click installs for 15+ clients
- •Capability groups are opt-in, so you can keep the exposed tool list — and therefore the context cost — small
- •Independent write-ups flag the real gotcha: say "playwright mcp" in the prompt or the agent falls back to shell commands
Who It’s For
Best For
- ✓Engineers building agents that must log in, fill forms or scrape JavaScript-rendered pages
- ✓QA and test engineers generating or repairing Playwright tests with a coding agent
- ✓Anyone evaluating browser automation for agents without paying for a vision model
Prerequisites
- •Node.js 18 or newer installed locally
- •An MCP-capable client such as Claude Code, Cursor or VS Code
- •Basic understanding of how MCP servers are registered and what a tool call is
FAQ
What is Playwright MCP — Browser Automation for AI Agents?
The official documentation and source for Playwright MCP, Microsoft's Model Context Protocol server that hands an LLM agent a real Chromium browser. It is for engineers building agents that must log in, fill forms, scrape a JavaScript-rendered page, or drive an end-to-end test. Unlike vision-based browser agents it exposes structured accessibility snapshots, so a text-only model can navigate deterministically with no screenshot pipeline. After working through it you can register the server with Claude Code, Cursor, VS Code or any MCP client and script multi-step web tasks.
Is Playwright MCP — Browser Automation for AI Agents free?
Playwright MCP — Browser Automation for AI Agents is free to access.
What level is Playwright MCP — Browser Automation for AI Agents for?
Playwright MCP — Browser Automation for AI Agents is aimed at a intermediate audience. Recommended background: Node.js 18 or newer installed locally, An MCP-capable client such as Claude Code, Cursor or VS Code, Basic understanding of how MCP servers are registered and what a tool call is.
How long does Playwright MCP — Browser Automation for AI Agents take?
Expect roughly ~1-2 hours to install, wire into a client and work through the tool list; reference thereafter. Most learners work through it at their own pace.
What will I learn from Playwright MCP — Browser Automation for AI Agents?
You'll learn: Give an agent a real Chromium browser through a single MCP server configuration; Drive pages from accessibility snapshots instead of screenshots, avoiding a vision model entirely; Use the tab, network and storage tool groups to mock requests and manage sessions; Handle interactive logins by authenticating yourself in the visible browser window; Enable opt-in capability groups for PDFs, coordinate clicks, tracing and test generation; Register the server with Claude Code, Cursor, VS Code and other MCP clients; Run the browser inside Docker to isolate untrusted pages from the host machine.
Topics
Sources
This page was written from 2 sources, 1 on domains other than github.com.