Playwright MCP
Microsoft's official MCP server for driving a browser with Playwright through the accessibility tree, no screenshots needed
Install
claude mcp add playwright npx @playwright/mcp@latestThis is third-party code. Review the repository files before installing.
What it does
The server launches a browser through Playwright and gives the agent tools to navigate, click, type and read pages. Pages reach the model as structured accessibility tree snapshots, so no vision model is needed. You can pick Chrome, Firefox, WebKit or Edge, emulate a mobile device, run headless, or attach to an open browser through an extension. Extra vision, pdf and devtools capabilities can be switched on.
Who it is for. For developers and QA engineers who need their agent to work with live web pages.
Good fit when
- The agent must walk through a site flow: log in, fill a form, check the result
- You need exploratory automation or self-healing tests with a persistent browser context
- You need data from a page that renders on the client
Not a fit when
- A coding agent in a large project needs to save context: the README recommends Playwright CLI with skills
- A plain HTTP request without a browser is enough
Example request
Open our staging site, register a test user and check that the confirmation email notice appearsLimitations
Requires Node.js 18 or newer. Page snapshots and tool schemas use many tokens. A persistent browser profile can serve only one client at a time; parallel clients need --isolated or a separate --user-data-dir. Allowed and blocked origin lists are not a security boundary.
How to disable. Remove the playwright server from your client's MCP config, in Claude Code with claude mcp remove playwright.
MCP
- Transport
- stdio
- Authentication
- API key
| Environment variables | |
|---|---|
| PLAYWRIGHT_MCP_BROWSER | Browser or Chrome channel: chrome, firefox, webkit, msedge |
| PLAYWRIGHT_MCP_HEADLESS | Run the browser headless |
| PLAYWRIGHT_MCP_CAPS | Extra capabilities: vision, pdf, devtools |
| PLAYWRIGHT_MCP_SECRETS_FILE secret | Path to a dotenv file with secrets |
Security check
- The agent opens arbitrary sites and can submit forms
- The persistent profile keeps cookies and sessions
README in short
The README first compares MCP with Playwright CLI and explains when to choose each. It then gives a standard JSON snippet and install commands for VS Code, Cursor, Claude Code, Codex, Goose, Windsurf and other clients. A large section lists launch arguments with matching environment variables, plus notes on user profiles, initial state and the config file. Apache-2.0 licensed.
FAQ
How does MCP differ from Playwright CLI?
The README recommends the CLI with skills for coding agents because it uses fewer tokens. MCP fits cases that need a persistent browser and rich page introspection.
Can I keep logins?
Yes, a persistent profile is used by default. For isolated sessions pass a storage state file with --storage-state.
Related
CLI, skill and Python library for browser control: the agent clicks, fills forms and reads pages over CDP
A skill that gathers the last 30 days of discussion on a topic from Reddit, X, YouTube, HN, Polymarket and GitHub into one brief
The Chrome DevTools team's official MCP server: the agent drives a live Chrome, reads network and console, and records performance traces
A fast Rust CLI for agent browser automation: accessibility snapshots with element refs, an MCP server and skills