Playwright MCP
Microsoft's official MCP server for browser automation. Lets Claude, Cursor, and other AI agents control web browsers using accessibility snapshots — structured element trees — rather than screenshots or a vision model. Supports Chromium, Firefox, and WebKit. Free and open source.
31,138
Stars
v0.0.70
Version
Apache 2.0
License
Microsoft
Maintained by
How It Works: Accessibility Snapshots, Not Screenshots
Most browser automation tools send screenshots to the model and rely on vision capabilities. Playwright MCP takes a fundamentally different approach: it gives the AI an accessibility tree — a structured, token-efficient representation of the page where every interactive element has a role, label, and reference ID.
When Claude wants to click a button, it references the element by its accessibility ID (e.g., e42), not by pixel coordinates or CSS selectors. This means the model reads what the page means, not what it looks like — making interactions more reliable and dramatically cheaper in token cost.
Installation
Add Playwright MCP to your MCP client's configuration file. The server installs on first use via npx — no separate install step needed.
Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}Cursor
Go to Cursor Settings → MCP → Add new MCP Server:
Name: playwright | Type: command
npx @playwright/mcp@latestVS Code
code --add-mcp '{"name":"playwright","command":"npx","args":["@playwright/mcp@latest"]}'Claude Code (CLI)
claude mcp add playwright npx @playwright/mcp@latestConfiguration Options
Headless mode (no browser window)
"args": ["@playwright/mcp@latest", "--headless"]Firefox instead of Chromium
"args": ["@playwright/mcp@latest", "--browser=firefox"]Isolated sessions (fresh context)
"args": ["@playwright/mcp@latest", "--isolated"]Persistent login (storage state)
"args": ["@playwright/mcp@latest", "--storage-state=/path/auth.json"]For remote or headless Linux environments, run the server in HTTP mode:
Start server (terminal 1)
npx @playwright/mcp@latest --port 8931Configure client (claude_desktop_config.json)
{
"mcpServers": {
"playwright": {
"url": "http://localhost:8931/mcp"
}
}
}What You Can Do With It
Playwright MCP exposes 34 browser control tools. Here are the most useful ones:
Navigation
Navigate to URL, go back/forward, reload page, wait for load
Interaction
Click, type, fill forms, select dropdowns, check/uncheck, press keys, hover
Page inspection
Get accessibility snapshot, take screenshot, get full page content
Tabs & windows
Open new tab, switch tabs, close tab
Network & storage
Mock API routes, get/set cookies, save/restore session state
Code execution
Run arbitrary Playwright script via browser_run_code
Real-world use cases
- ✓ Self-QA during development — point Claude at localhost:3000 to verify UI flows work
- ✓ Automated form filling — e-commerce checkout, sign-up flows, data entry
- ✓ Web scraping — extract structured data using accessibility tree, no CSS selectors needed
- ✓ Test generation — navigate to a page, explore interactions, generate Playwright test code
- ✓ Authenticated workflows — save session state once, reuse across agent runs
- ✓ Cross-browser verification — check behaviour in Chromium, Firefox, and WebKit
Playwright MCP vs. Alternatives
| Playwright MCP | Puppeteer MCP | Browserbase MCP | |
|---|---|---|---|
| Element targeting | Accessibility tree | CSS selectors | Natural language |
| Browsers | Chromium, Firefox, WebKit | Chromium only | Cloud-managed |
| Cost | Free (local) | Free (local) | $20–99+/month |
| Status | ✅ Actively maintained | ⚠️ Deprecated 2026 | ✅ Active |
| Best for | Most projects | Legacy code | Production scale |
Anthropic's Puppeteer MCP server was officially deprecated in early 2026. Playwright MCP is the recommended default for new projects.
Common Issues & Fixes
Browser won't launch after install
Playwright browsers need a separate install: run npx playwright install chromium (or firefox/webkit). This downloads the browser binaries.
Connection refused / server not found
Ensure the server is running before the client connects. For HTTP mode, start the server first. For Claude Desktop, check that the command path resolves correctly outside your shell.
Headless mode fails on Linux
Most Linux servers lack a display. Use --port mode instead of stdio: start the server with npx @playwright/mcp@latest --port 8931 and configure the client with the URL.
Accessibility snapshot is empty or too large
Wait for full page load before snapshotting. For pages with huge DOM trees, use the --snapshot-timeout option or snapshot a specific element by reference.
Works locally but fails in CI
Add --headless to the args array. For GitHub Actions, also add --no-sandbox to launchOptions in a config file, as sandboxing requires extra privileges in containers.
Frequently Asked Questions
What is Playwright MCP?+
Playwright MCP is Microsoft's official MCP server that lets AI agents like Claude control web browsers using Playwright. Unlike screenshot-based approaches, it uses accessibility snapshots — structured representations of page elements — so Claude reads element roles and labels rather than pixels. It supports Chromium, Firefox, and WebKit.
How do I install Playwright MCP in Claude Desktop?+
Add this to your claude_desktop_config.json file (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json): { "mcpServers": { "playwright": { "command": "npx", "args": ["@playwright/mcp@latest"] } } }. Restart Claude Desktop after saving.
Is Playwright MCP free?+
Yes. Playwright MCP is open source (Apache 2.0) and runs locally on your machine at no cost. You only pay for the AI model API calls (Claude, GPT-4, etc.) you use to interact with it.
What is the difference between Playwright MCP and Puppeteer MCP?+
Playwright MCP is Microsoft's actively maintained server supporting Chromium, Firefox, and WebKit. The Anthropic Puppeteer MCP server was deprecated in early 2026. Playwright MCP is now the recommended default for browser automation in MCP-based AI agents.
Related MCP servers
Need Playwright MCP in production?
Altor deploys browser automation AI systems for B2B teams.
We wire Playwright MCP into production agent workflows — QA automation, web scraping pipelines, form-filling agents — and deploy them in 3 weeks. Not demo. Connected to your real systems from day one.
Talk to Altor about browser automation →