scalr Book a call
← Field notes

playwright mcp

Playwright MCP: Let Claude Code Drive a Browser

Playwright MCP is Microsoft's free MCP server that lets Claude Code open a browser, click, type and read pages through their accessibility tree. What it does, how to install it, and how it differs from Claude in Chrome.

A split cover: Playwright, Claude and Google Chrome logo tiles beside a screenshot of the Playwright MCP README, which says the server lets models work with web pages through accessibility snapshots instead of screenshots

Playwright MCP is a free, open-source MCP server from Microsoft that lets an AI agent like Claude Code drive a real browser. It opens pages, clicks, types and fills forms, and it reads each page as a structured accessibility snapshot rather than a screenshot. You add it to Claude Code with one command.

The short version: Playwright MCP gives Claude its own browser to work in, while Claude in Chrome lends Claude yours.

What is Playwright MCP?

Playwright is Microsoft's browser automation library. Developers use it to script tests that open Chromium, Firefox or WebKit and check that a website behaves. Playwright MCP wraps that engine as an MCP server, so instead of a developer writing the script, a model calls the steps as tools while it works.

If MCP itself is new to you, my plain guide to Claude MCP covers what a server is and how Claude uses one. In one line: an MCP server hands Claude a list of things it can do somewhere, and Claude calls them when your request needs them.

Two details from the project's README set it apart from most browser agents.

The top of the Playwright MCP README on GitHub: it describes an MCP server that lets models interact with web pages through structured accessibility snapshots instead of screenshots, compares Playwright MCP with the Playwright CLI for coding agents, and lists three key features: fast and lightweight, LLM-friendly, and deterministic tool application
Screenshot: github.com/microsoft/playwright-mcp, 18 November 2026.

It reads structure, not pixels. The README says the server works from Playwright's accessibility tree, "not pixel-based input", and that no vision model is needed. The accessibility tree is the version of a page that screen readers use: every button, link, heading and form field, with its label. Claude gets that list as text, picks the element it wants by reference, and Playwright acts on it. Screenshots are still available as a tool, and a coordinate-clicking mode can be switched on for pages that hide their controls from the tree.

It's a separate browser by default. Playwright launches its own browser with its own profile. Your everyday Chrome, with its tabs and logins, is untouched unless you deliberately connect it.

It's free under the Apache 2.0 licence and needs Node.js 20 or newer. The npm package stood at version 0.0.85 on 18 November 2026, so it's still pre-1.0 and its tools still change between releases.

How do you add Playwright MCP to Claude Code?

One command, from the README:

claude mcp add playwright npx @playwright/mcp@latest

Then start Claude Code, type /mcp to confirm the server shows as connected, and ask in plain words:

Open localhost:3000, sign up with a test email, and tell me what happens after the confirmation screen. Check the console for errors while you go.

Claude will call the navigate tool, take a snapshot, fill the form, click, and read the console messages. By default the browser is headed, meaning you see a window open and watch it work. Add --headless to the command to run it out of sight.

The options worth knowing, all from the README's configuration table:

OptionWhat it does
--headlessRuns the browser without a window (headed is the default)
--browserPicks chrome, firefox, webkit or msedge
--device "iPhone 15"Emulates a phone, so Claude checks your mobile layout
--isolatedKeeps the profile in memory, so nothing persists between sessions
--storage-stateLoads saved cookies into an isolated session, for a test login
--capsSwitches on extra tool sets: vision, pdf, devtools, network, storage, testing
--extensionConnects to your running Chrome or Edge through the Playwright extension

Where Claude Code stores the server (just this project, every project, or a shared .mcp.json the team gets through version control) is set with --scope, and the MCP guide has that table.

What can Claude do with Playwright MCP?

The core tool set covers what a person does in a browser: navigate, go back, click, hover, drag, type, fill a whole form, pick from a drop-down, press keys, upload a file, handle a pop-up dialog, manage tabs, and wait for text to appear. On top of that sit the developer tools: read console messages, list network requests, take a screenshot, and run JavaScript on the page.

That makes it a fit for jobs where Claude is building or checking something:

  • Testing what it just built. Claude writes the change, opens the page, runs the flow and reads the console, in one session.
  • Reproducing a bug. Describe the steps a user took, and Claude walks through them and reports where the page broke.
  • Checking a layout at phone size. With --device, the same page renders as a phone would show it.
  • Writing a test from a walk-through. The README lists a code generation option that defaults to TypeScript, so the steps Claude took can come back as a Playwright test script you keep.
  • Reading pages that need JavaScript to render, where a plain web fetch would come back empty.

How is Playwright MCP different from Claude in Chrome?

Both let Claude Code control a browser, and Claude Code supports both, but they're built for different work: Playwright MCP is for seeing how a page behaves for a fresh visitor, and Claude in Chrome is for getting things done inside the accounts you're already logged into.

Claude Code's documentation page titled Use Claude Code with Chrome, saying Claude Code integrates with the Claude in Chrome browser extension, shares the browser's login state so it can access sites you are signed into, runs actions in a visible Chrome window, and pauses for you at a login page or CAPTCHA
Screenshot: code.claude.com/docs/en/chrome, 18 November 2026.

Claude in Chrome is Anthropic's own browser extension. The Claude Code Chrome docs say that when you start Claude Code with claude --chrome, Claude opens new tabs in your Chrome, "shares your browser's login state", and runs every action in a visible window. When it reaches a login page or a CAPTCHA, it stops and asks you to handle it.

Side by side:

Playwright MCPClaude in Chrome (in Claude Code)
Made byMicrosoft, open sourceAnthropic
Which browserA browser Playwright launches, with its own profileYour own Chrome or Edge
Your loginsNone, unless you load saved cookies or connect the extensionEvery site you're already signed into
BrowsersChromium, Chrome, Edge, Firefox, WebKitChrome and Edge, also detected in Brave, Arc, Vivaldi and Opera
Runs headlessYes, and in DockerNo, actions run in a visible window
Plan neededNone. Any MCP client, any model, API key fineA paid Claude plan, signed in with /login
How it reads a pageAccessibility snapshots by defaultThe page's text and structure, read through the extension
Safety checksYou set them up. The README says it's "not a security boundary"Site permissions from the extension, plus Claude Code's permission prompts
Start it withclaude mcp add playwright ...claude --chrome, or /chrome

A few rows deserve a sentence each.

Logins are the real dividing line. Claude in Chrome is built for the logged-in web: the Claude Code docs list Google Docs, Gmail and Notion as apps it can work in "without API connectors". Playwright MCP starts every session as a stranger to those sites, which is a feature when you're testing your own sign-up flow and a nuisance when you want it to read your inbox.

Plan and sign-in. The Chrome docs say the integration needs a direct Anthropic plan (Pro, Max, Ultra, Team or Enterprise) and stays off if you authenticate Claude Code with an API key or a setup-token token, and it isn't offered through Amazon Bedrock or other third-party providers. Playwright MCP has none of those conditions, which is why it's the one that runs on a build server or in CI, the automated checks that run every time code changes.

Context cost. Each one spends some of Claude's context window. The Chrome docs warn that leaving Chrome enabled by default "increases context usage", because the browser tools load in every session. The Playwright README makes a similar point about itself: it recommends that coding agents look at the separate Playwright CLI with skills instead, because loading large tool schemas and accessibility trees costs tokens. The MCP server, it says, still suits longer loops where keeping the browser state is worth that cost.

The overlap. Playwright MCP has a --extension mode that attaches to your running Chrome or Edge, and a persistent profile that remembers a site once you've signed in through it. So it can reach logged-in pages too. It just wasn't designed around that, and it doesn't come with Anthropic's per-site permissions.

Which one should you use?

The job decides it, so here's how the common ones fall.

  • Testing or debugging a site you're building → Playwright MCP. Clean profile, repeatable, headless when you want it, and it can turn the walk-through into a test.
  • Checking pages in Firefox or Safari's engine → Playwright MCP. Claude in Chrome is Chromium only.
  • Anything on a server, in CI, or with an API key → Playwright MCP, because the Chrome integration needs a signed-in paid account and a desktop browser.
  • Work inside sites you're logged into (a dashboard, a CRM, a Google Doc) → Claude in Chrome. It uses your real session and asks before acting on a new site.
  • A recurring personal task across several logged-in sites → Claude in Chrome, and look at Cowork if no code is involved.
  • A site with an official connector, like Gmail or Google Drive → neither. The connector is cleaner than a browser.

You can run both in the same Claude Code setup, and naming the one you want in the request ("use Playwright to...") keeps Claude from picking the other.

A note from my own setup: every site I build gets checked by Playwright before anyone sees a link, but as a script rather than through the MCP server, as I described in the five tools I plug into Claude Code. A script that does the same check every time suits a fixed checklist. The MCP server suits the open-ended version, where you want Claude to explore a page and decide what to try next.

Is Playwright MCP safe to use?

How safe it is depends on which pages you send it to and which tools you leave switched on. The README is plain about it: "Playwright MCP is not a security boundary." Its --allowed-origins option, which limits which sites the browser may request, carries the same warning: it "does not serve as a security boundary and does not affect redirects".

The risk is the one every browsing agent shares. A page can carry hidden text written to steer the model reading it, which is called prompt injection. A Playwright browser holding no logins has less to lose when that happens, which is one argument for keeping it that way. Three habits keep it tight:

  1. Keep --isolated on for anything outside your own sites, so no cookies carry over.
  2. Leave the extra capabilities off unless the job needs them. storage, network and devtools each add tools that can read or change more.
  3. Keep Claude Code's permission prompts on for browser tools, and approve each click on a site you don't control.

On persistence: by default the server keeps a profile on disk per project, and the README says logged-in information is stored there. If you sign in to something through Playwright once, that session stays until you delete the profile or switch to --isolated.

Key takeaways

  • Playwright MCP is Microsoft's free, open-source MCP server that lets Claude drive a browser through the page's accessibility tree.
  • Add it with claude mcp add playwright npx @playwright/mcp@latest, and check it with /mcp.
  • It launches its own browser, so it suits testing, debugging and automated checks, across Chromium, Firefox and WebKit.
  • Claude in Chrome uses your own Chrome and logins, needs a paid Claude plan, and suits work inside sites you're signed into.
  • Neither is a security boundary. Isolated profiles, fewer tools and permission prompts do the protecting.

FAQ

Is Playwright MCP free?

Yes. Playwright MCP is open source under the Apache 2.0 licence and costs nothing to install or run. You need Node.js 20 or newer. The only cost is the model's tokens, since page snapshots and tool lists take up context in Claude Code.

How do I install Playwright MCP in Claude Code?

Run claude mcp add playwright npx @playwright/mcp@latest in your terminal, start Claude Code, and type /mcp to confirm the Playwright server is connected. Then ask Claude to open a page in plain words. Add --headless to the command if you don't want a browser window.

What's the difference between Playwright MCP and Claude in Chrome?

Playwright MCP is Microsoft's open-source server that launches its own browser with a clean profile, suited to testing and automation. Claude in Chrome is Anthropic's extension that lets Claude work in your own Chrome, using the sites you're already logged into. It needs a paid Claude plan.

Can Playwright MCP use my logged-in accounts?

Not by default. Playwright MCP launches a separate browser with its own profile. It can reach logged-in pages if you sign in through that browser, load saved cookies with --storage-state, or connect to your running Chrome or Edge with the --extension option and the Playwright extension.

Does Playwright MCP work with Firefox and Safari?

It works with Firefox and with WebKit, the engine behind Safari, as well as Chromium, Chrome and Edge. You pick one with the --browser option. Claude in Chrome, by comparison, only runs in Chromium-based browsers.

If you build websites, Playwright MCP is the one to add first, and Claude in Chrome earns its place later, once you want Claude working inside your own logged-in accounts.

Extra Resources

WhatsApp us