Playwright MCP: what it does for agent QA

Playwright MCP gives an AI agent a real browser through accessibility snapshots. Setup, the tools QA uses, MCP vs CLI, and where bug evidence comes from.

A clear glass tree rises from a flat slab into three rounded nodes, with the larger right node glowing orange.

Playwright MCP gives an AI agent a real browser and reads each page back as an accessibility tree, so the agent clicks named elements instead of guessing at pixels. That makes it good at reproducing and exploring bugs. It cannot tell the agent what a real user’s browser did when the bug happened.

What Playwright MCP is

Playwright MCP is a Model Context Protocol server published by Microsoft that exposes Playwright’s browser automation as tools a language model can call. The agent sends browser_navigate with a URL, and the server answers with an accessibility snapshot of the page: headings, textboxes, buttons and links as a tree, each with a reference such as e5. The agent then passes that reference as the target of browser_click or browser_type.

That is the difference from screenshot-driven agents. The official introduction describes the server as snapshot based, operating on the accessibility tree rather than pixels, with no vision model required, and lists Chrome, Firefox, WebKit and Edge as supported browsers. It counts more than 70 tools across navigation, forms, network mocking, storage, tracing and video.

Three defaults matter for QA work, all from the README as read on 2026-11-17:

  • The browser is headed. It opens a visible window unless you pass --headless, so a person can watch the run.
  • The profile is persistent. Logins and cookies survive between sessions in a user data directory. Pass --isolated to keep the profile in memory and start clean each time, which is what a test session usually wants.
  • The accessibility tree is the interface. An element with no accessible name is as hard for the agent to target as it is for a screen reader user to find. A page that fails one tends to fail the other.

The npm package @playwright/mcp was at version 0.0.85 on 2026-11-17, a pre-1.0 number that is worth remembering when a tool name in an older tutorial no longer exists.

How to set it up

Every client takes the same server definition: a command, npx, with the argument @playwright/mcp@latest. The installation guide gives the JSON form, and the README gives one-line commands per client. In Claude Code it is claude mcp add playwright npx @playwright/mcp@latest; in Codex it is codex mcp add playwright npx "@playwright/mcp@latest".

The options worth knowing for testing are flags on that same command. These are the ones a QA setup reaches for, quoted from the README’s configuration table:

FlagWhat it doesWhy a tester cares
--isolatedKeeps the browser profile in memory, never on diskEach run starts with no cookies or logged-in state
--headlessRuns without a visible window (headed is the default)Needed in CI or on a server
--browserPicks chrome, firefox, webkit or msedgeReproduces a bug in the engine it was reported in
--deviceEmulates a device, for example "iPhone 15"Checks a mobile report without a phone
--viewport-sizeSets the viewport, for example "1280x720"Matches the viewport recorded with a bug report
--capsTurns on extra tool groups such as vision, pdf or devtoolsAdds coordinate clicks, PDF export, tracing and video
--console-levelSets which console messages come back: error, warning, info or debugKeeps the agent’s context free of debug noise
--storage-stateLoads cookies and local storage from a file into an isolated contextStarts a test already signed in as a test user
--snapshot-modefull or none for snapshots in responsesCuts tokens when the agent does not need the tree every step

A persistent profile can only be used by one browser at a time, the README notes, so two agents sharing a workspace will collide. Start the second one with --isolated or a separate --user-data-dir.

The tools a QA agent actually uses

The core tools are always on. The rest arrive in groups behind --caps. For testing, these are the ones that do the work, grouped as the project README groups them:

GroupToolsUsed for
Corebrowser_navigate, browser_snapshot, browser_click, browser_type, browser_fill_form, browser_select_option, browser_press_keyWalking a flow the way a user would
Corebrowser_console_messages, browser_network_requests, browser_network_requestReading the console and the requests of the agent’s own session
Corebrowser_take_screenshot, browser_resize, browser_tabs, browser_handle_dialogCapturing state, checking breakpoints, handling popups
Testing (--caps=testing)browser_generate_locator, browser_verify_element_visible, browser_verify_text_visible, browser_verify_valueTurning a found path into assertions for a real test
Network (--caps=network)browser_route, browser_unroute, browser_network_state_setMocking a failing API, going offline
Storage (--caps=storage)cookie, localStorage and sessionStorage tools, browser_storage_stateReproducing a bug that depends on saved state
DevTools (--caps=devtools)browser_start_tracing, browser_start_video, browser_start_recordingRecording the agent’s run as a trace, a video or code

The testing group is the bridge to a lasting suite. An agent that finds a path through a form can call browser_generate_locator for each element it touched and hand back locators a person can paste into a Playwright test file. That matters because an MCP session is not a test: nothing reruns it on the next build. A regression check that should run every time belongs in a script, which is the subject of regression testing tools, and the agent’s run is how the script gets written faster.

Two cautions from the same README. First, browser_run_code_unsafe executes arbitrary Playwright code and is named that way on purpose. Second, Playwright MCP “is not a security boundary”: the allowed and blocked origin options do not stop redirects and are not protection. Keep real customer credentials out of the profile, and let the MCP client’s permission prompts decide what the agent may do.

Playwright MCP, the Playwright CLI and plain test scripts

Playwright now ships two ways to give an agent a browser, and its own documentation says which to pick. The introduction page compares them in a table, and the README adds the reasoning.

Playwright MCPPlaywright CLIPlaywright Test
Who drivesThe model, one tool call at a timeThe agent, through shell commandsThe test runner, from a file
Best forExploratory automation, self-healing tests, long agent loopsCoding agents working in a large codebaseRegression checks on every build
Token costHigher: tool schemas and snapshots sit in contextLower: short command outputNone at run time
Default modeHeadedHeadlessHeadless in CI
RepeatableNo, each run is a new conversationNoYes

The README puts it directly: coding agents increasingly favour the CLI because it avoids loading large tool schemas and verbose accessibility trees into the model’s context, while MCP “remains relevant” for loops that benefit from a persistent browser and reasoning over page structure. For a QA team the split is practical. Use MCP when the job is to poke at a page until a bug shows itself, or to reproduce a report step by step while a person watches. Use the CLI when an agent is editing code and only needs to check a page. Use test files for anything that must pass on every release.

None of the three replaces a person on the page. An agent reading an accessibility tree notices a missing label quickly and a misaligned button never, which is why visual checks such as inspecting an element still sit with a human.

Where the evidence for the bug comes from

Here is the gap every Playwright MCP tutorial skips. The agent’s browser is new. browser_console_messages returns the console of the session the agent opened, not of the session where a customer hit the bug last Tuesday. If the fault depended on that user’s browser version, their saved cart, a slow third-party script or a request that failed once, the agent will load the page, see it working, and report that it cannot reproduce the problem. That is the agent version of works on my machine.

The missing half is the record of the original session, and a reporting tool with its own MCP server can hand it over. Notarus exposes every panel action as an MCP tool, documented on the developers page. An agent with both servers connected can run the loop end to end:

  1. get_ticket on the report returns the reporter’s description, the page URL, the browser, the operating system and the viewport.
  2. get_session returns that session’s log timeline, and search_logs filters it for errors or network failures; get_recording says whether a replay exists.
  3. Playwright MCP starts with --browser and --viewport-size set to what the ticket recorded, and the agent walks the steps to reproduce.
  4. If the fault appears, browser_console_messages and browser_network_requests confirm it matches the recorded console error. If it does not, the agent knows which recorded condition it failed to recreate.
  5. comment_ticket writes the result back on the ticket and move_ticket moves it to the next stage, so the person who reported it can see progress.

The same gap applies to the browser built into GitHub’s own agent: GitHub Copilot browser use, in public preview since November 17, 2026, drives the developer’s signed-in Chrome or Edge, not the reporter’s.

Playwright MCP is the hands; the recorded session is the memory. Neither is enough alone. The agent without the record tests a guess, and the record without a browser cannot confirm a fix. The limits on our side are stated on why we built Notarus MCP-native: it captures what happens on a live web page, with no mobile SDK, so a native app bug needs a different source of evidence.

Common questions

What is Playwright MCP?

Playwright MCP is Microsoft's Model Context Protocol server for Playwright. It lets an AI agent drive a real browser by calling tools such as browser_navigate, browser_click and browser_snapshot. The agent reads the page as an accessibility snapshot, where each element carries a reference, so it acts on named elements rather than on screen coordinates.

How do you install Playwright MCP?

Add a server entry to your MCP client that runs npx @playwright/mcp@latest. In Claude Code the one-line form is claude mcp add playwright npx @playwright/mcp@latest, and Codex, VS Code and Cursor have their own commands in the project README. The browser opens headed by default, so you can watch what the agent does.

Is Playwright MCP the same as Playwright test?

No. Playwright Test runs test files that a person or an agent wrote, the same way on every build. Playwright MCP hands the browser to a language model one tool call at a time, which suits exploration and reproduction. The testing capability can generate locators and assertions that you then move into a real test file.

Should I use Playwright MCP or the Playwright CLI?

Playwright's own documentation recommends the CLI for coding agents working in a large codebase, because shell output is shorter and costs fewer tokens than tool schemas and snapshots. It keeps MCP for agent loops that need a persistent browser and repeated reasoning over page structure, such as exploratory testing or long autonomous runs.

Is Playwright MCP safe to point at any website?

Its README states plainly that Playwright MCP is not a security boundary, and that its allowed and blocked origin options are conveniences rather than protection. Run it with an isolated profile for testing, keep real credentials out of the persistent profile, and rely on your MCP client's permissions to control what the agent may do.

Can Playwright MCP see what a real user saw when a bug happened?

No. It drives a fresh browser session that the agent controls, so it can only show what happens now, in its own environment. The user's console errors, failed requests and replay from the moment of the report have to come from the session that was recorded, which is where a bug reporting tool's own MCP server comes in.

The Notarus team

The people who build Notarus. We write up the decisions behind the product when the reasoning is worth more than the changelog line.

Keep reading

Reports with the evidence attached.

Start free, one script tag.

<script src="…/widget.js" data-key="pb_pub_…">