Playwright MCP: let agents use a browser via accessibility snapshots instead of screenshots
TL;DR
Playwright MCP exposes browser tools driven by the accessibility tree: faster, cheaper in tokens and more reliable than screenshot-based control. Add it to Claude Code with claude mcp add playwright npx @playwright/mcp@latest. Great for E2E tests, bug reproduction and responsive checks.
Useful flags
| Flag | Effect |
|---|---|
--headless | Run without a window (headed by default) |
--isolated | In-memory profile, nothing saved — run several clients in parallel |
--caps vision,pdf,devtools | Extra capabilities: coordinate clicks, PDF export, devtools |
--snapshot-mode none | Skip snapshots on every response to save tokens |
Sample QA prompt
Open http://localhost:3000, sign up with the test account in fixtures/users.json,
add 2 products to the cart, verify the total. If it's wrong, take a screenshot
and write repro steps to bug-report.md.Notes
- Use dev/staging environments and test accounts; never give the agent real passwords.
- Once the agent finds the right flow, have it write a fixed Playwright test for CI.
- A persistent profile works for one browser at a time — add
--isolatedfor parallel runs.
Repo: microsoft/playwright-mcp