What is the Playwright MCP server?
Playwright MCP is Microsoft's MCP server for browser automation. It exposes Playwright to an AI agent through accessibility snapshots instead of screenshots, so the agent can navigate, click, type and read pages without a vision model. You start it locally with npx @playwright/mcp@latest.
Playwright MCP is a Model Context Protocol server that gives an AI agent browser automation through Playwright. The README says it works from structured accessibility snapshots, so the agent reads the page as a tree of elements rather than guessing from pixels.
You run it locally with npx @playwright/mcp@latest. The agent can then open a URL, read the snapshot, click, type, fill forms and capture a screenshot to check the result. For a Chrome-only alternative, see Chrome DevTools MCP.
What it changes in your workflow
- The agent can open the page it just built, click through the flow and report what broke, instead of you checking by hand.
- It needs no vision model, because actions target element references from the accessibility snapshot.
- Console messages and network requests are available as tools, so a failing script or a blocked request shows up in the agent's reasoning.
- You can run it headless, in isolated sessions with no saved profile, or attach to a running Chrome or Edge through the Playwright Extension.
Local or remote
| Playwright MCP | |
|---|---|
| Where it runs | On your machine, started by the client with npx |
| Transport | stdio by default; pass --port to serve HTTP at /mcp |
| Browsers | Chrome, Firefox, WebKit and Edge through the --browser option |
| Requirements | Node.js 18 or newer and an MCP client |
| Account or key | None for the server itself |
Who it is for
Best for
- Developers who want an agent to test a page or a flow in a real browser while it codes.
- Exploratory automation and long agent loops that benefit from a persistent browser context.
- Teams that want one server across VS Code, Cursor, Windsurf, Claude Desktop, Codex, Gemini CLI and other listed clients.
Not for
- Token-tight coding sessions. The README itself points coding agents to Playwright CLI with skills, because CLI calls load fewer tokens than MCP tool schemas and snapshots.
- A security boundary. The README states plainly that Playwright MCP is not one.
- Pixel-level checks as a default. Screenshots exist, but the snapshot is the primary view; for layout diffs see Squint MCP.
Use it with UiChemy
Playwright MCP verifies pages in a browser. UiChemy produces them for WordPress: Composer writes HTML, CSS and JS inside Elementor or Gutenberg, and Figma to WordPress converts designs. Open the finished page with this server and have the agent click through it. Click Get Started on uichemy.com.
Connect Playwright MCP Server: Browser Automation for AI Coding Agents to your AI client
npx @playwright/mcp@latestAdd the standard config
Put the config above in your client's MCP settings. The README says this standard config works in most tools.
Or use a client command
For Claude Code the README gives
claude mcp add playwright npx @playwright/mcp@latest. For Codex it givescodex mcp add playwright npx "@playwright/mcp@latest".Choose browser options
Add flags to args, for example --headless, --browser firefox, --isolated or --device "iPhone 15". Every flag also has a PLAYWRIGHT_MCP_ environment variable.
Enable extra tool groups if needed
Pass --caps with vision, pdf or devtools to switch on coordinate tools, PDF export or DevTools tools. Test assertions and storage tools are opt-in too.
Try a prompt
Ask the agent to open your local site, take a snapshot and list the links it finds.
Client configuration
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}Endpoints and ports
npx @playwright/mcp@latestStarts the server over stdio. The client normally runs it.npx @playwright/mcp@latest --port 8931Then set the client url to http://localhost:8931/mcp.mcr.microsoft.com/playwright/mcpThe README says Docker supports headless Chromium only.What you can do with it
- Accessibility snapshotsThe agent reads the page as a structured tree, so actions target exact elements and do not depend on a vision model.
- Several browsersThe --browser option accepts chrome, firefox, webkit and msedge.
- Isolated sessionsThe --isolated flag keeps the profile in memory, and --storage-state loads saved cookies for a clean, repeatable start.
- Attach to your browserWith --extension and the Playwright Extension, it connects to a running Edge or Chrome instance.
- Device emulationThe --device and --mobile flags emulate a phone, and the README notes mobile pages are usually lighter, which saves tokens.
- Opt-in capabilitiesVision, PDF, DevTools, testing and storage tool groups stay off until you enable them with --caps.
- Network controlsAllowed and blocked origins, a proxy server, and request routing tools help you shape what the browser can reach.
- Test code generationThe --codegen option sets the language for generated test code: typescript, python, java, csharp or none.
Tools it exposes
browser_navigate
Opens a URL in the current tab.
browser_snapshot
Returns the accessibility snapshot of the page, the main way the agent reads it.
browser_click
Clicks an element by reference from the snapshot or a unique selector.
browser_type
Types text into an element.
browser_fill_form
Fills several form fields in one call.
browser_take_screenshot
Saves a screenshot of the page or an element.
browser_console_messages
Returns console messages, filtered by level.
browser_network_requests
Lists the network requests the page made.
browser_evaluate
Runs JavaScript on the page or an element.
browser_wait_for
Waits for text or a time to pass.
browser_tabs
Lists, creates, closes or selects tabs.
browser_file_upload
Uploads files through a file chooser.
browser_generate_locator
Creates a locator for an element to reuse in tests. Opt-in testing group.
browser_pdf_save
Saves the page as a PDF. Opt-in pdf group.
Frequently asked questions
What is the Playwright MCP server?
It is Microsoft's MCP server that lets an AI agent control a browser through Playwright. The agent reads accessibility snapshots, then navigates, clicks, types and takes screenshots through tool calls. It runs locally with npx @playwright/mcp@latest and needs Node.js 18 or newer.
How do I install Playwright MCP?
Add a server entry with command npx and args @playwright/mcp@latest to your client's MCP config, then restart the client. The README also gives one-line commands for Claude Code, Codex, Copilot CLI, Gemini CLI and others, plus one-click installs for VS Code and Cursor.
Does Playwright MCP need a vision model?
No. The README says it operates purely on structured data from the accessibility tree. Screenshots are available, and the vision capability adds coordinate-based mouse tools for elements the snapshot does not expose, but they are optional.
Should I use Playwright MCP or Playwright CLI?
The README suggests the CLI with skills for coding agents, because it is more token efficient. It keeps MCP for specialized loops such as exploratory automation, self-healing tests or long autonomous workflows where a persistent browser context matters more than token cost.
Is Playwright MCP safe to run?
The README says it is not a security boundary and links to MCP security guidance. By default file access is limited to the workspace roots, and you can set allowed or blocked origins, though the README notes the origin list is not a security boundary either.
Can Playwright MCP run headless?
Yes. Pass --headless, which the README says runs the browser without a window; the default is headed. The Docker image supports headless Chromium only. For machines without a display, you can also serve HTTP with the --port flag.
Which clients work with Playwright MCP?
The README lists VS Code, Cursor, Windsurf, Claude Desktop, Goose, Grok, Junie and any other MCP client, with setup notes for Amp, Cline, Codex, Copilot, Factory, Gemini CLI, Kiro and LM Studio among others.
How is Playwright MCP different from Chrome DevTools MCP?
Playwright MCP drives Chrome, Firefox, WebKit and Edge through Playwright and accessibility snapshots. Chrome DevTools MCP is a separate server built around Chrome. Pick by the browsers you must test and the tools you want.


