Let your agent click through your app with Playwright MCP
Added Updated Copyable prompt below
Published Last verified Released
Our verdict
Giving your coding agent a real browser is the cheapest way to catch 'it compiles but the button doesn't work' before you do. Playwright MCP is Microsoft's official server for this: the agent reads the page as an accessibility snapshot instead of screenshots, clicks and types, and can then turn the flow into a Playwright test. Microsoft now suggests its Playwright CLI with skills for coding agents that have a shell, because it uses fewer tokens; keep MCP for long exploratory sessions and clients without a shell.
- Who it's for
- Builders using coding agents on web UIs
- Leverage
- Agent verifies UI changes itself
- Effort
- Low
- Date added
What Playwright MCP does
Playwright MCP (@playwright/mcp, Apache-2.0, v0.0.86 released 18 Nov 2026) is an MCP server that lets an A.I. agent drive Chrome, Edge, Firefox or WebKit through Playwright. The default tools navigate, click, type, fill forms, upload files, handle dialogs, read console messages and network requests, and take screenshots; browser_snapshot returns the page's accessibility tree with element references the agent acts on. More tool groups are opt-in with --caps, including testing (assert that text, elements, lists or values are visible and generate locators), vision (coordinate clicks), pdf, storage, network and devtools (tracing and video). It runs with a persistent profile by default, in memory with --isolated, or in your logged-in Chrome or Edge through the Playwright extension.
How builders use Playwright MCP
- Add it in one line: claude mcp add playwright npx @playwright/mcp@latest (Codex: codex mcp add playwright npx "@playwright/mcp@latest"). It needs Node.js 20 or newer.
- After a UI change, have the agent start the dev server, open localhost, walk the flow and report what broke, then fix it and check again.
- Start the server with --caps=testing so the agent can assert what's on screen and generate locators, then ask it to write a Playwright test for the flow it just checked.
- Use --isolated with --storage-state and a saved login for repeatable sessions, instead of your everyday browser profile.
- Check mobile layouts with --device "iPhone 15" or --mobile.
- If your agent has a shell, try Microsoft's playwright-cli with its skills (playwright-cli install --skills) to save tokens.
Playwright MCP or Playwright CLI (checked 25 Nov 2026)
Both are Microsoft projects. This is how their READMEs split the job.
| Question | Playwright MCP | Playwright CLI |
|---|---|---|
| Setup | An MCP server in your agent's config | npm install -g @playwright/cli@latest, then playwright-cli install --skills |
| How the agent sees the page | Accessibility snapshots returned with tool results | Short commands; page data isn't pushed into the model unless it asks |
| Microsoft recommends it for | Long-running, exploratory or self-healing loops that keep browser state | Coding agents, because it avoids large tool schemas and accessibility trees |
| Needs a shell | No, any MCP client works | Yes, the agent runs commands |
Flags worth knowing
- --caps=testing adds browser_verify_text_visible, browser_verify_element_visible, browser_verify_list_visible, browser_verify_value and browser_generate_locator.
- --isolated keeps the profile in memory; add --storage-state to start logged in.
- --headless runs without a window (headed is the default).
- --snapshot-mode none stops attaching a full snapshot to every response, so the agent asks for one with browser_snapshot when it needs it.
- --extension drives your running Chrome or Edge, with its logins, through the Playwright extension.
- --allowed-origins and --blocked-origins limit where the browser goes. The README notes they are not a security boundary and don't cover redirects.
Playwright MCP: limits and gotchas
- It is not a security boundary, and the README says so. Anything the browser can reach, the agent can reach, so keep privileged profiles and admin pages out of its sessions.
- browser_run_code_unsafe runs arbitrary JavaScript in the Playwright server process, which the README calls RCE-equivalent. Keep it out of auto-approve lists.
- Snapshots of complex pages are large and use up context. Use browser_find, a snapshot depth limit or the CLI on heavy pages.
- A persistent profile works for one browser at a time. Parallel agents need --isolated or a separate --user-data-dir each.
- A manual click-through isn't a test suite. Ask for a real Playwright test file and run it in CI.
- It's still version 0.0.x, and options and tool names change between releases, so pin the version in shared configs.
Playwright MCP compared with other tools here
- Chrome DevTools MCP: the Chrome team's server for debugging: console messages with source-mapped stack traces, network requests and performance traces. Pick it to find out why a page is slow or failing, and Playwright MCP to click through flows and write tests.
- browser-use: a Python library for agents that complete web tasks. It's for building an agent, not for checking your own app while you code.
- Stagehand: Browserbase's framework that mixes A.I. actions with code, aimed at production automations rather than testing your dev build.
- Workflow Record: teaches Hermes Agent a browser chore you demonstrate once; with Playwright MCP the agent works out each step itself.
When to pick Playwright MCP
- Pick Playwright MCP if your agent edits a web UI and you want it to open the page and prove the flow works.
- Pick Playwright CLI with skills if your agent has a shell and token use matters.
- Pick Chrome DevTools MCP when the question is why a page is slow or throwing errors.
Copy this: Verify prompt
Start the dev server, then use the browser tool to open http://localhost:3000.
Walk through: sign up → create a <thing> → see it in the list.
Report anything broken, fix it, and re-check.
Finally, write a Playwright test that covers this flow.Playwright MCP questions
Does Playwright MCP need a vision model?
No. It works from accessibility snapshots, which are structured text. Coordinate-based clicking is an opt-in extra (--caps=vision) for elements the snapshot doesn't expose.
Can it use my logged-in browser?
Yes, with --extension and the Playwright extension installed in Chrome or Edge. For tests, a saved --storage-state in an isolated session is the safer choice.
Which browsers does it support?
Chrome, Microsoft Edge, Firefox and WebKit, chosen with --browser.
Can it write Playwright tests?
It drives the browser, and with --caps=testing it can also assert what's visible and generate locators. Ask the agent to write a test file from the flow it checked, then run it with Playwright's test runner.
Related discoveries
See the newest picks →- ToolCoding & Shipping Agents
Chrome DevTools MCP: let your coding agent debug in real Chrome
The Chrome DevTools team's official MCP server and CLI (Apache-2.0). It lets Claude Code, Cursor, Codex, Copilot, Gemini CLI or Antigravity open and control a live Chrome, read console messages with source-mapped stack traces, inspect network requests, take screenshots and record performance traces.
NewEffort: LowPrompt#Plugin / extension#MCP
- ToolSmall Tools, Repos & Plugins
agent-device: verify mobile apps from your coding agent
CLI, MCP server and Node API that let coding agents inspect, control and verify iOS, Android and other apps with accessibility snapshots and evidence.
NewEffort: MediumPrompt#Plugin / extension#MCP
Get the best new A.I. picks in your inbox
The best new agent workflows and tools we’ve vetted, with a clear verdict on each. Short, occasional, useful.