Skip to content
Mia Automation
NLEN Sign in Put Mia to workGet started

Playwright MCP Server: Let an AI Agent Use a Real Browser, Tested on Windows

Playwright MCP is Microsoft's MCP server that lets an AI app drive a real browser: open pages, click, type, read the page structure and take screenshots. You add it with one line, such as claude mcp add playwright npx @playwright/mcp@latest in Claude Code, and it runs on Node.js 18 or newer. We ran it on a Windows 10 PC through MCP Inspector, the official test tool. It listed 25 tools and loaded a page in 724 ms. On one of our guides it wrote a 31 KB snapshot to a file and answered in 442 characters, so the page structure only reaches the model when it asks for it.

AI agents and agentic workUpdated 7 min read

Tested by us on 11 November 2026.

What it does

The server sits between the AI app and a browser. The model asks for an action, such as go to this URL or click that button. The server performs it with Playwright and reports back what the page looks like as structured text: the accessibility tree, with a short reference for every link and button. The model doesn't need to read pixels, so a text-only model can still click the right thing.

Animated diagram of one tool call: the AI app calls browser_navigate, the Playwright MCP server runs page.goto, Chrome loads the page, a 477-line snapshot file is written and a 442-character answer goes back to the AI app.
One browser_navigate call in our test, from request to reply.

What you need

  • Node.js 18 or newer (we tested with Node 22 on Windows 10).
  • Chrome or another browser Playwright supports. By default it uses Chrome; our PC already had it, so nothing was downloaded.
  • An MCP host: Claude Code, Claude Desktop, VS Code, Cursor, Codex or another app that supports MCP.
  • No account and no fee for the server itself. The model calls cost whatever your AI app costs.

Set it up in Claude Code and other apps

  1. Add the server

    In Claude Code, one command. The project's README lists the equivalent for VS Code, Cursor, Codex and others.

    bash
    claude mcp add playwright npx @playwright/mcp@latest
  2. Choose headless or visible

    By default the browser window is visible, which is useful while you watch what the agent does. For scheduled or background work add --headless, and --isolated to keep the profile in memory so no cookies or logins stay behind.

    json
    {
      "mcpServers": {
        "playwright": {
          "command": "npx",
          "args": ["@playwright/mcp@latest", "--headless", "--isolated"]
        }
      }
    }
  3. Check the tools

    Run claude mcp list to see that it connected, or open it in MCP Inspector. You should see 25 tools, from browser_click to browser_wait_for.

    bash
    npx -y @modelcontextprotocol/inspector npx -y @playwright/mcp@latest --headless --isolated
  4. Ask for a task

    In plain language: "Open our pricing page and check whether the monthly price on it matches the one in our docs." The model picks browser_navigate, then browser_snapshot or browser_find, and answers.

Our test run, step by step

We started the server from MCP Inspector on a Windows 10 PC and called three tools by hand: browser_navigate on one of our own guides, browser_take_screenshot, and in a second session browser_click on a menu link. We didn't test typing or forms; the tool list further down shows which tools need care.

MCP Inspector with the Playwright server: browser_navigate selected, the result shows the Playwright code it ran, the page URL and title, and a link to the snapshot file; the protocol log shows the call took 724 ms. (opens at full size)
browser_navigate on our English install guide: 724 ms, and the reply points to a snapshot file instead of including it.

Inspector labels browser_navigate as destructive and open-world: those are the tool's own annotations, telling a host that it changes state and reaches the internet. 18 of the 25 tools carry the destructive label; 7 are read-only. And right after the call, the server asked the client for its roots (the folders it may use) and announced that its tool list had changed.

MCP Inspector showing the result of browser_take_screenshot: the Playwright code that saved a PNG and a preview of the captured page, How to install Claude Code on Windows. (opens at full size)
browser_take_screenshot in the same session: 72 ms, saved as a PNG next to the server and shown as a preview.

Clicking works on the references in the snapshot. In the snapshot of our Dutch guide, the pricing link in the menu was listed as link "Prijzen" [ref=e10]. We passed e10 as the target to browser_click. The server turned that into a role-based Playwright locator, clicked it in 712 ms and reported the new page: the pricing page, with a fresh snapshot file.

MCP Inspector showing the browser_click result: Playwright code that clicks the link named Prijzen inside the navigation named Menu, the new page URL mia-automation.com/prijzen and its title, and a protocol entry of 712 ms. (opens at full size)
browser_click with target e10: the server located the link by its role and name, not by screen position.

What it costs per run

The server is free; what you pay for is what the model reads. Our snapshot of one guide was 477 lines and 31 KB. In version 0.0.85 the reply to browser_navigate only pointed to that file. By the common rule of thumb of four characters per token, reading that snapshot would add roughly 8,000 tokens to the model's input; not reading it costs almost nothing. Other pages give other sizes, so measure your own heaviest page before you schedule an agent on it. The project's own README is frank about the trade-off: for coding agents it recommends its CLI with skills when token use matters, and MCP when an agent needs to keep a browser open across many steps.

Where a person signs off

The server labels its own tools, and that gives you a ready-made split. These 7 are read-only and safe to allow without asking: browser_snapshot, browser_find, browser_take_screenshot, browser_console_messages, browser_network_requests, browser_network_request and browser_wait_for. The other 18, from browser_click to browser_run_code_unsafe, can change something and keep asking for approval.

bash
claude --allowedTools "mcp__playwright__browser_snapshot,mcp__playwright__browser_find,mcp__playwright__browser_take_screenshot,mcp__playwright__browser_console_messages,mcp__playwright__browser_wait_for"

Claude Code: allow the read-only Playwright tools without a prompt, keep the rest on approval.

  • Logins and payments. Don't let the agent type passwords or card details. Log in yourself in a visible browser, or keep those flows out of reach.
  • Submitting forms. Filling in is fine; the click on send or buy should come back to you, unless it's a test environment.
  • Downloads and uploads. browser_file_upload can send files from your computer to a website. Keep it off unless you need it.

If it goes wrong

What you seeWhat to do
Two agents fight over one browser profileA persistent profile works for one browser at a time. Start extra clients with --isolated or their own --user-data-dir.
Headless Chrome keeps running after you stop the clientWe had this on Windows: stopping the inspector left a headless Chrome behind. Look for chrome.exe processes whose command line contains playwright_chromiumdev_profile and end them; the matching folders in %TEMP% can go too.
Snapshot files pile up in your project folderThe server writes to .playwright-mcp in its working folder. Add it to .gitignore or start the server from a scratch folder.

Related guides

Building a server of your own? Our MCP server build guide walks through one in Python and Node, tested the same way. New to MCP itself? Start with what an MCP server is.

Questions

What is the Playwright MCP server?

An MCP server from Microsoft that lets AI apps control a browser through Playwright: navigate, click, type, read the page structure and take screenshots.

How do I use Playwright MCP with Claude Code?

Run claude mcp add playwright npx @playwright/mcp@latest, then ask in plain language for a browser task. Add --headless and --isolated for background work.

Does Playwright MCP need screenshots or a vision model?

No. It works from the page's accessibility tree, so any model that reads text can use it. Screenshots are available as a separate tool.

Is Playwright MCP free?

Yes, the server is open source and free. You pay only for the model calls of the AI app that uses it.

Sources