This guide shows how to use Playwright MCP with Claude Code so the assistant can open your web app in a real browser, click through it, and report what it actually sees. That matters because most coding assistants only imagine the running page. They read your code, guess at the layout, and wait for you to describe what broke.
Playwright MCP changes that loop. Claude Code can navigate to a page, press buttons, fill forms, read console errors, inspect network output, and take screenshots. Instead of typing a long description of a broken checkout flow, you watch the assistant reproduce the problem itself. Then it can edit the code and reload the page to check the fix.
You stay in charge throughout. Run the browser where you can see it, give Claude a narrow job, and review the evidence before you accept any change. The setup is simple, but the supervision habits are what make the tool useful rather than messy.
What Playwright MCP Gives Claude Code
Playwright is Microsoft’s browser automation framework. Its MCP server exposes browser controls to AI clients such as Claude Code. Once the server is connected, Claude gains tools for navigation, clicking, typing, waiting for elements, taking screenshots, and checking console and network activity.
The important detail is how Claude reads a page. Playwright MCP usually works from the accessibility tree, which is a structured snapshot of elements, roles, and names. A button appears as a button with a label, not as a random set of pixels. That makes actions more reliable and easier for you to follow.
Screenshots still matter. The accessibility snapshot describes structure well, but it cannot tell you whether a heading overlaps a banner or whether a modal looks cramped. Ask for a screenshot whenever appearance is part of the task. Pair the screenshot with console output and you get both the visual symptom and the technical cause.

Without a browser, front-end debugging often runs in circles. Claude writes code. You run the app. You describe the result. Claude guesses again. With Playwright MCP, Claude can run the app, see the error state, check the console, make an edit, and reload to verify. You supervise in the same way you would watch a colleague share a screen.
Before You Install Anything
Check the basics first. You need Node.js installed because the Playwright MCP package runs through npx. You also need a project you can run locally, or a staging site you are allowed to test. A local development server is the safest place to learn.
Prepare a test account for your own app if login is part of the flow. Store those local test details in your project notes so each session starts with the same information. Never use production credentials for browser exploration. A test account can be reset. A real customer account cannot.
Plan for the first download. The first run may fetch browser binaries, and that can take a few minutes and a few hundred megabytes. Do that before you are in the middle of an urgent bug hunt. A slow first run is normal. A missing browser during a deadline is avoidable.
Installing Playwright MCP in Claude Code
Installation is usually one registration command. Claude Code can add the server with claude mcp add, pointing at the Playwright MCP package. Copy the exact current command from Microsoft’s Playwright MCP documentation, because package names and flags can change over time.
- Install Node.js and confirm that
npxis available in your terminal. - Copy the current Playwright MCP registration command from Microsoft’s documentation.
- Run the
claude mcp addcommand for the Playwright MCP server. - Start Claude Code in your project directory.
- Run
/mcpand confirm the Playwright server is connected and its tools are listed. - Allow the first run to finish downloading any browser binaries it needs.
If the server does not appear, stop and fix the connection before you start testing. Check that you are in the right project, that Node.js is installed, and that the command you copied matches the current documentation. Small setup mistakes look like tool failures later, so clear them early.

Keep the browser visible at first. Headed mode lets you watch Claude navigate, hesitate, recover, and finish. That teaches you what it handles well and where it needs a hint. Headless mode can come later, once a task is repetitive and trusted, such as a routine regression check.
If you are still learning how MCP servers fit into Claude, our guide on connecting Claude to other apps using MCP gives useful background. The pattern is the same here: register the server, confirm the tools, then give the assistant a clear job.
Your First Supervised Session
Start your app’s development server the way you normally would. Then give Claude a small mission with a clear finish line. Vague requests create wandering sessions. Concrete requests create evidence you can review.
Good first tasks are short and observable. Ask Claude to open the local site, go to the pricing page, and report what a visitor sees. Or ask it to reproduce the bug where the checkout button does nothing and collect the console errors. Both tasks have a visible result and a clear stopping point.
- Start the local development server and note the local URL.
- Tell Claude the exact page or flow to open.
- State the result you want, such as a screenshot, a console report, or a reproduced bug.
- Watch the browser while Claude snapshots the page and chooses elements.
- Interrupt if it heads into the wrong flow or tries an action you did not ask for.
- Review the screenshot, summary, and console evidence before asking for a code change.
Claude narrates its tool calls as it works. You should see it read the page, pick an element by role and name, click, then read the page again after the state changes. That narration is part of the value. If the reasoning looks wrong, you can correct it before the session drifts.
Ask for screenshots whenever the task is visual. A page can be structurally correct and still look broken. Screenshots show spacing, overlap, cropped text, and awkward empty areas that a text snapshot may miss. They also give you a record you can compare after a fix.
If Claude gets stuck, give the hint you would give a person. Say the button sits inside a modal. Say it must log in first with the local test account. Say the error only appears after the form is submitted twice. A short human hint often saves several confused tool calls.
Using Playwright MCP for Bug Reproduction
Bug reproduction is the strongest everyday use. Describe the bug report in plain language and let Claude attempt the exact steps. It can capture the failing state, read console messages, and check network activity before it touches code.
That order matters. Fixing before reproducing invites guesswork. Reproducing first gives Claude a target and gives you proof that the problem exists. After the edit, Claude can repeat the same steps and show whether the error has gone.
Keep the report specific. Name the page, the account type, the button, and the expected result. Mention what actually happened. If the bug depends on screen size, say so and ask for a screenshot at that size. The clearer the mission, the cleaner the evidence.

Checking Golden Paths After a Change
The second strong workflow is a golden-path walkthrough. After a change, ask Claude to move through the routes your users rely on most. For many apps that means signup, the core action, settings, and logout. Add checkout, search, or password reset if those flows matter to your product.
Ask Claude to flag anything broken or visually wrong and attach screenshots to the report. This catches the embarrassing breakage that unit tests can miss: a button hidden behind a banner, a form that submits to nowhere, a success message that never appears. It is not a replacement for a real test suite, but it is a fast safety net.
Keep the walkthrough bounded. A whole-app wander consumes context and produces a vague summary. A named route produces a checklist. Work one flow at a time, fix what appears, then move to the next flow in a fresh pass if the session grows long.
Teams that already use other MCP tools can combine habits here. For example, our guide on using the GitHub MCP server with Claude Code covers a different part of the workflow, while Playwright MCP handles the browser side. Keep each tool focused on the job it does best.
Turning a Browser Session Into a Permanent Test
Playwright MCP is also a bridge to lasting tests. Once Claude has completed a flow manually, ask it to write that flow as a proper Playwright test in your test suite. The same steps and assertions can then run again without you watching a browser.
- Let Claude complete the flow once in a supervised browser session.
- Confirm the steps match how a real user would complete the task.
- Ask Claude to write the flow as a Playwright test with clear assertions.
- Review the generated test like any other code.
- Run the test locally, then in CI if your project uses it.
This is where the value compounds. A one-off browser check helps today. A permanent test helps every week after. Review the test carefully, though. Generated tests can be brittle if they depend on fragile text or timing. Prefer stable selectors and assertions that describe user-visible outcomes.
If you use custom Claude Code workflows, a repeatable prompt can help. Our guide on creating custom slash commands in Claude Code shows how to turn a repeated instruction into a shortcut. A short command for a golden-path check can save typing and keep sessions consistent.
Limits, Safety, and Supervision Habits
A browser-driving assistant can click real buttons, so choose the playground with care. Local and staging environments are the right defaults. Production sites deserve read-only caution, if you use them at all, and tasks that cannot submit forms, place orders, or send messages.
Third-party sites need the same care. Automated browsing can breach terms of service or trip bot defences. Scraping at scale is exactly the kind of activity those defences exist to stop. Keep Playwright MCP aimed at your own app and your own testing work.
Performance is the other limit. Every page snapshot consumes context. Long wandering sessions get slower, cost more, and may lose the thread on complex pages. Keep missions focused, start fresh sessions for new tasks, and ask for a specific page or flow rather than the whole application.
Review the evidence yourself. Read the summary, open the screenshots, and check the console output before you accept a conclusion. Claude can misread a page or stop one step too early. Your review turns a helpful session into a trustworthy one.
Desktop users who also work in Claude’s desktop app may find the setup pattern familiar. Our guide on adding an MCP server to Claude Desktop covers that side of the ecosystem. The safety rule stays the same in both places: local test accounts only, never production logins.
A Simple Routine That Works
Use the same rhythm each time and the tool becomes predictable. Start the local server. Confirm the MCP connection with /mcp. Give one mission. Watch the browser. Review screenshots and console evidence. Approve a small fix. Repeat the same steps to verify.
Playwright MCP gives Claude Code eyes and hands in a real browser. Used with focused missions and local test data, it shortens the distance between a bug report and a verified fix. That is the real gain: less describing, more seeing, and a debugging loop you can trust because you watched it happen.
Frequently Asked Questions
Do I need to know Playwright to use Playwright MCP?
No. Claude handles the browser interactions and you direct it in plain language. Knowing Playwright helps when you convert a session into a permanent automated test, but it is not required for debugging or exploration.
Which browsers can Playwright MCP control?
Playwright supports Chromium, Firefox, and WebKit engines. Most people start with the default Chromium-based setup, then add other browsers when cross-browser checks matter for their project.
Can Claude log in to my app with Playwright MCP?
Yes, if you provide a local or staging test account or a saved authentication state for testing. Never give it production credentials, and treat test accounts like any other project secret.
Is Playwright MCP the same as writing Playwright tests?
Not quite. MCP sessions are interactive and exploratory, with Claude driving a browser live. Playwright tests are code you keep and run repeatedly. A common pattern is to explore with MCP first, then turn the successful flow into a test.
Should I use headed or headless mode first?
Start in headed mode so you can watch every action and learn how Claude handles your app. Move to headless mode later for trusted, repetitive checks where speed matters more than supervision.

