Playwright MCP for testers

Key takeaways
- Playwright MCP is Microsoft's free, open-source Model Context Protocol server. It lets AI coding agents like Claude Code, Cursor and Codex drive a real browser using the page's accessibility tree.
- It's useful for exploring an app, reproducing bugs and letting an agent check its own work as it builds. Microsoft points teams to the Playwright CLI, not MCP, for running test suites in CI.
- Playwright MCP isn't a test harness. It runs in one warm, logged-in session, it "looks" at the page instead of asserting, it forgets everything between runs, and it spends model tokens on every step.
- Other ways to give an agent a browser, like Vercel's agent-browser and Claude in Chrome, have the same gap.
- An agent can't be the check on its own work. Put an independent verification layer between the coding agent and production.
Playwright MCP is a popular way to give your coding agent access to a browser. A coding agent with Playwright MCP is effective in the same way a developer with a browser is effective - checking one’s own work is a good first step in a layered quality strategy.
Most people building with a coding agent have already wired a browser into it — Playwright MCP, Vercel's agent-browser, Claude in Chrome, etc. The agent opens your app, clicks through the change it just made, and tells you it looks right. On a side project that's fine.
It's not fine when a change has to hold across hundreds of end-to-end paths every release, or when an auditor asks for evidence of how you verified the change. “Claude clicked around and it looked good,” is not a result you can reproduce, review, or defend.
Here, we’ll cover what Playwright MCP is, where it fits next to the alternatives, and the specific places where an agent driving a browser quietly fails as a test.
What is Playwright MCP?
Playwright MCP is Microsoft's open-source server that lets an AI coding agent drive a real browser — navigate, click, type, read the page — through the Model Context Protocol. In plain terms, it's one way an agent like Claude Code, Cursor, or Copilot gets to actually open a browser and interact with your app instead of just writing code about it.
By default it reads the page through Playwright's accessibility tree and hands the agent a structured, text-based view (elements by role and name) — fast, token-cheap (~120 tokens vs ~1,500 for a screenshot), and more stable than pixel-matching. Vision mode (--caps=vision) adds coordinate-based mouse control for cases the tree can't express.
It's built by the Playwright team at Microsoft that also maintains the Playwright framework.
Giving an agent a browser: the alternatives
Playwright MCP is one way to give a coding agent a browser, not the only one. Here are a few examples:
Vercel's agent-browser is the closest — a Rust browser-automation CLI for AI agents. Same core loop as Playwright MCP (accessibility-tree snapshot → ref → act → re-snapshot), but it drives Chrome over the DevTools Protocol directly rather than Playwright, and runs either as a CLI or a MCP server (agent-browser mcp). Its headline is token efficiency: Vercel reports roughly 90% fewer tokens than Playwright MCP (some write-ups cite higher; an independent benchmark put it ~5.7×). Two honest wins over Playwright MCP: each --session is isolated by default (not a warm profile), and it's scriptable outside an agent. Still not a test harness — no assertions, no corpus, no cross-run memory, no managed execution, no verdict.
Anthropic's Claude in Chrome is the other end — it drives your real, logged-in Chrome profile directly. General task automation (calendars, email, expense reports), with "testing new website features" named as one use among many; positioned as an assistant acting as you, not a test tool. Guidance: trusted sites only, nothing financial/legal/medical; its own red-team measured a prompt-injection attack success rate of 23.6% unmitigated / 11.2% mitigated.
OpenAI's Codex for Chrome sits at the same end. It's an extension that lets Codex work in your real, signed-in Chrome, in a tab group per task, with DevTools access. Unlike Claude in Chrome, it names testing web apps as a headline use. It asks before touching a new site, and the guidance is to treat page content as untrusted. For hermetic, reproducible runs, guides still point you to Playwright or Puppeteer with controlled profiles. Same shape as Claude in Chrome: your session, not an isolated one, and you have to be there.
Cognition's Devin computer use goes further than a browser: Devin gets a full desktop (Linux by default, Windows and macOS too) with Chrome, native and Electron apps. It decides on its own when to start the app and click through flows like login and checkout, including after it opens a PR, and it can record its screen with key moments annotated for you to review. That video is the closest any of these gets to evidence. It's still the author checking its own work: the agent that wrote the change picks what to test and narrates whether it passed.
All four are good at what they do. For a tester, the two at the edges make the argument easier to see. Claude in Chrome runs your own logged-in session, so there's no isolation to speak of and "auth" just means you're signed in — which is also why it can't run unattended for long. agent-browser is cheaper per step than Playwright MCP, which sounds like it fixes the token problem and doesn't: a cheaper step still runs the model on every step of every run. Whichever one you reach for, the same thing is missing.
| Playwright MCP | agent-browser (Vercel) | Claude in Chrome | mabl | |
|---|---|---|---|---|
| Who drives it | Coding agent, via Playwright | Coding agent, via CDP (CLI or MCP) | Claude, as you, in real Chrome | The platform, as a system |
| Isolation | Warm shared profile by default | Isolated per --session by default | Your human session — not on offer | Built in |
| Unattended / CI | Possible, not optimized | Possible; still agentic per step | No — needs you logged in | Yes |
| Token model | Per step | Per step, ~90%+ cheaper (vendor/community) | Per step | Agentic tokens only where judgment is needed |
| A test harness? | No — MS points to the CLI for CI | No — general automation, no assertions | No — general task automation | Yes — purpose-built for verification |
These are similar approaches in the end. Whichever way you hand an agent a browser, you still want an independent tester on the other side of the change. We’ll focus on Playwright MCP.
How to set up Playwright MCP in Claude Code
Setup takes a minute. Register it:
claude mcp add playwright npx @playwright/mcp@latest
Then install the browsers, and name "Playwright MCP" in your first prompt or the agent may reach for shell Playwright instead. After that the agent finds elements by role and name from the snapshot — "click the Sign in button," not coordinates — and you watch it work.
Where it pays off is when you're away from the keyboard: a long-running loop where you want the agent to check the UX along the way as a checkpoint in development just as a software engineer would.
For day-to-day feature work where I’m at the keyboard, I usually find it faster and more effective to just click through the app myself. By the time I've written the prompt, waited for the agent to snapshot and reason through each step, and read back what it did, I could have checked it by hand. The loop is useful, but it isn't free; every step is a round-trip, and for a quick look that overhead costs more than it saves.
For full regression suites, running the same checks over and over at scale is a different problem, and neither clicking through it myself nor an agent in the loop is the answer there.
It’s worth noting that MCP uses more context per call than the CLI, which writes results to files; pin a version instead of @latest; it is not a security boundary, and browser_run_code and browser_evaluate run arbitrary JavaScript in the page; page content goes to the model API, so keep it on dev and test environments with test data.
Where Playwright MCP falls short as a test
None of what follows matters much on a side project. It starts to matter when a bug ships to real users, when the suite has to catch regressions across hundreds of paths, or when someone asks you to show how a release was verified. Six places where an agent driving a browser falls short of that, and why each one is structural rather than a prompt you can fix.
The agent runs in one warm, logged-in session
Exploring, it keeps a single profile and lets state pile up. That's the wrong default for a test: a check against a user who's already logged in and already carrying data never exercises login or empty-state paths, and passes or fails depending on run order. Playwright and mabl can isolate properly — fresh context, a clean fixture per test. An agent driving interactively won't, and nothing pushes it to.
"It looked fine" is not a check you can run again
Looking is not asserting. What you get back is an impression formed inside the agent's run, different next time, with nothing to reproduce or hand a reviewer. A real check is pass/fail against fixed criteria, run the same way every time. It keeps the evidence. The accessibility tree will confirm a "Submit" button that's present and labeled while it's invisible or under an overlay — the exact "did I break the page?" case — and nothing makes an exploring agent run the check that catches it.
A coding agent has no memory across runs, and that's where root cause lives
Each session is a fresh browser scoped to the task in front of it. It can tell you how the page looks now, not what changed since last release or whether a failure is a real regression. "When did this start failing?" and "what's different in the network calls since the last green run?" need history it doesn't have. That's architectural: something that exists only in the current run can't reason about change over time.
Playwright MCP is not a regression suite, and doesn't try to be
Microsoft frames it for exploration and points to the Playwright CLI for CI. The framework, not MCP, is a real regression solution, and a small team with a straightforward app can roll their own. Where that runs out is the corpus: test data in the right state, teardown between runs, shared flow logic, helpers that compute expected values. An agent improvising through MCP re-derives flows every session and leaves nothing to maintain. Generating a test is easy. The work is owning the corpus, and at enterprise scale, keeping it alive every release becomes a standing team.
Put the agent in the execution loop and you pay model tokens on every step of every run
Each step pulls the page into context, reasons, acts, and re-snapshots, with the context growing the whole way; cost compounds as the run gets longer. Vercel's agent-browser is far cheaper per step, but you still run the model on every step. A maintained corpus doesn't: execution is cheap deterministic replay, and you spend model tokens only where judgment is needed, like authoring, healing when the app changed, or analyzing a failure. One change can mean re-verifying thousands of paths every cycle; replaying those cheaply keeps the bill predictable.
Auth is a nuisance while you're there and a real problem when you're not
By hand it's easy: sign in once, save the storage state, reload it, or stay in the persistent profile — because you're there to re-auth when it lapses. A saved session is a short-lived, scoped credential; apps rotate it, and anything with MFA won't hand you a reusable refresh token, so you're back to logging in. The moment tests run unattended, something has to re-authenticate reliably, every run, across environments, with no human and no long-lived credentials where the agent and the model API can read them. That's a piece of infrastructure to build and run.
You want a tester, not a browser
The six points above are the same point. A coding agent with Playwright MCP gets a browser — hands to click with. What you want on the other side of a change is a tester: something whose job is to find out whether the work is good, not to get the change shipped.
That's the conflict. The agent that wrote the code is trying to finish the change; a green check is success for it. Ask it to verify its own work and you've asked the author to grade its own homework. It reuses the warm session, glances instead of asserting, has no memory of last week, skips the corpus, and leaves unattended auth to you. The agent isn't careless; verifying its own work just runs against what it's optimizing for. The author cannot be the verifier.
An independent tester doesn't share the author's incentive. It holds to what the change is supposed to do for a user, not to how the agent built it, and it keeps its own context and its own evidence. That's the gap mabl fills.
mabl is the independent verification layer for agentic development, and the difference from a coding agent with a browser is the machinery underneath it. It runs on a testing harness that owns the whole job end to end: authoring tests, running them in isolation across browsers, healing them when the app changes, and analyzing failures. It carries deep quality context, an accumulated model of how your application actually works and what good looks like in it, so a check means something beyond "the button was there." And it runs as an enterprise platform, with the execution infrastructure, the pipeline integrations, and the history across releases already in place, instead of a stack your team stands up and keeps alive. The result is a verdict you can put in front of a reviewer or an auditor.
So use Playwright MCP, or agent-browser, or Claude in Chrome, for what they're good at: letting an agent explore, reproduce, and build in a real browser. Then put an independent test between that agent and production, because an agent can't be the check on its own work.
See how mabl verifies what your coding agents ship. Start a free trial.
Frequently Asked Questions
What's the difference between Playwright (the framework) and Playwright MCP (the server)?
They're two different things from the same team, and people mix them up constantly. Playwright the framework is a test runner: you write test files in code, check them into your repo, and run them in CI. It's a real regression solution. Playwright MCP is a server that hands a coding agent a set of browser tools (navigate, click, type, read the page) so it can drive a live browser while you work. The framework runs tests you've written; MCP lets an agent operate a browser in the moment. Most of what people call "testing with Playwright" — CI runs, the HTML reporter, trace viewer, --only-changed — is the framework, not MCP. MCP is for exploring and drafting; the framework is for running a suite.
Is Playwright MCP free, and what do I need to run it?
Yes. It's open-source (Apache-2.0) from Microsoft. You need Node.js 18 or newer, and you run it with npx @playwright/mcp@latest. It can drive Chrome, Firefox, WebKit, or Microsoft Edge via the --browser flag. There's also a Docker image, but it only supports headless Chromium for now.
How do I add Playwright MCP to Claude Code or another coding agent?
In Claude Code, run claude mcp add playwright npx @playwright/mcp@latest, then name Playwright MCP in your first prompt. Microsoft documents setup for 20 clients: Amp, Antigravity, Claude Code, Claude Desktop, Cline, Codex, Copilot, Cursor, Factory, Gemini CLI, Goose, Grok, Junie, Kiro, LM Studio, opencode, Qodo Gen, VS Code, Warp, and Windsurf. Any client that speaks MCP can connect even if it's not on that list.
Can I use Playwright MCP in CI?
You can, but it's built for something else. MCP gives an AI agent live, interactive control of a browser, which suits exploration and bug repro. It costs more context per call and holds a live session. The Playwright CLI runs version-controlled test files, which suits repeatable CI. Microsoft's own guidance is to explore with MCP and run suites with the CLI.
How is Playwright MCP different from agent-browser and Claude in Chrome?
All three give an agent a browser. Playwright MCP drives it through Playwright and runs as an MCP server. agent-browser drives Chrome over the DevTools Protocol, runs as a CLI or an MCP server, isolates each session by default, and is reported to use far fewer tokens per step. Claude in Chrome drives your real, logged-in Chrome to do general tasks on your behalf. None of the three is a test harness.
Is Playwright MCP safe to point at production?
Microsoft states it is not a security boundary. It can run arbitrary JavaScript in the page and sends page content to the model API. Use dev or test environments with test data.
Can a coding agent test its own code?
It can check its own work as it builds, and that's a useful first step. It can't be the independent check. The agent that wrote the change is trying to finish it, so it picks what to test and decides whether it passed. Durable, isolated, maintained tests with a result you can show a reviewer need a separate verification layer between the agent and production.
Quality Engineering Resources

Your best engineers shouldn’t have to become managers to matter
AI coding agents raised the floor for every engineer. Learn why mabl is building a technical leadership path that matters as much as management.
Learn More
The agentic SDLC: from code generation to independent verification
See how the agentic SDLC changes planning, coding, review, testing, and release, and why independent verification keeps AI-generated code safe to ship.
Learn More
Beyond Friday the 13th headlines: Building trust in the enterprise
The Outlook, FAA, and Chase outages weren’t blamed on AI, but coding agents are multiplying change. Why software factories need independent verification.
Learn More