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
--isolatedto 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:
| Flag | What it does | Why a tester cares |
|---|---|---|
--isolated | Keeps the browser profile in memory, never on disk | Each run starts with no cookies or logged-in state |
--headless | Runs without a visible window (headed is the default) | Needed in CI or on a server |
--browser | Picks chrome, firefox, webkit or msedge | Reproduces a bug in the engine it was reported in |
--device | Emulates a device, for example "iPhone 15" | Checks a mobile report without a phone |
--viewport-size | Sets the viewport, for example "1280x720" | Matches the viewport recorded with a bug report |
--caps | Turns on extra tool groups such as vision, pdf or devtools | Adds coordinate clicks, PDF export, tracing and video |
--console-level | Sets which console messages come back: error, warning, info or debug | Keeps the agent’s context free of debug noise |
--storage-state | Loads cookies and local storage from a file into an isolated context | Starts a test already signed in as a test user |
--snapshot-mode | full or none for snapshots in responses | Cuts 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:
| Group | Tools | Used for |
|---|---|---|
| Core | browser_navigate, browser_snapshot, browser_click, browser_type, browser_fill_form, browser_select_option, browser_press_key | Walking a flow the way a user would |
| Core | browser_console_messages, browser_network_requests, browser_network_request | Reading the console and the requests of the agent’s own session |
| Core | browser_take_screenshot, browser_resize, browser_tabs, browser_handle_dialog | Capturing state, checking breakpoints, handling popups |
Testing (--caps=testing) | browser_generate_locator, browser_verify_element_visible, browser_verify_text_visible, browser_verify_value | Turning a found path into assertions for a real test |
Network (--caps=network) | browser_route, browser_unroute, browser_network_state_set | Mocking a failing API, going offline |
Storage (--caps=storage) | cookie, localStorage and sessionStorage tools, browser_storage_state | Reproducing a bug that depends on saved state |
DevTools (--caps=devtools) | browser_start_tracing, browser_start_video, browser_start_recording | Recording 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 MCP | Playwright CLI | Playwright Test | |
|---|---|---|---|
| Who drives | The model, one tool call at a time | The agent, through shell commands | The test runner, from a file |
| Best for | Exploratory automation, self-healing tests, long agent loops | Coding agents working in a large codebase | Regression checks on every build |
| Token cost | Higher: tool schemas and snapshots sit in context | Lower: short command output | None at run time |
| Default mode | Headed | Headless | Headless in CI |
| Repeatable | No, each run is a new conversation | No | Yes |
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:
get_ticketon the report returns the reporter’s description, the page URL, the browser, the operating system and the viewport.get_sessionreturns that session’s log timeline, andsearch_logsfilters it for errors or network failures;get_recordingsays whether a replay exists.- Playwright MCP starts with
--browserand--viewport-sizeset to what the ticket recorded, and the agent walks the steps to reproduce. - If the fault appears,
browser_console_messagesandbrowser_network_requestsconfirm it matches the recorded console error. If it does not, the agent knows which recorded condition it failed to recreate. comment_ticketwrites the result back on the ticket andmove_ticketmoves 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.