October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk3 min

Playwright MCP in Claude Code: Setup, Browser Control, and State

Register Playwright MCP with one Claude Code command, then use accessibility snapshots and element references to navigate, fill, click, and verify a browser flow.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To let Claude Code open a browser and interact with a website, register Playwright MCP with one terminal command, then restart Claude Code. The server can navigate to a page, return an accessibility snapshot, and let the agent act on identified elements before checking the updated page. You need Node.js 20 or newer for the current Playwright MCP installation instructions.

Set up Playwright MCP in Claude Code

  1. Check your Node.js version. Playwright’s current MCP installation guide requires Node.js 20 or newer. The browser downloads automatically the first time the server is used. Playwright MCP installation guide.
  2. Register the server. In a terminal where the Claude Code command is available, run:
    claude mcp add playwright npx @playwright/mcp@latest

    This is the command documented in the Playwright MCP README and Claude Code client instructions.

  3. Start a new Claude Code session. The server becomes available in the next session, so restart Claude Code if it was already open.
  4. Try a harmless demo flow. Ask Claude Code to navigate to https://demo.playwright.dev/todomvc, add a todo item such as “Check Playwright MCP,” and report what changed. This follows the example flow in the installation guide.

How Claude Code inspects and clicks through a page

Playwright MCP is a server that exposes browser navigation and interaction tools through MCP. Its typical loop is inspect, act, then inspect again: the agent navigates to the page, receives a structured accessibility snapshot, uses references in that snapshot to identify controls, and then clicks, types, or fills a field. It can request another snapshot to see the resulting state. The Playwright MCP introduction describes this interaction model and the available tools.

As an Amazon Associate I earn from qualifying purchases.

  1. Navigate: Open the TodoMVC demo URL.
  2. Inspect: Read the accessibility snapshot and identify the todo textbox from its role and label.
  3. Act: Use the textbox reference to enter an item and submit it, for example by pressing Enter.
  4. Verify: Inspect the updated page state and report whether the new todo appears.

This approach does not require the agent to rely on screenshots for the basic interaction. A page’s structure, authentication requirements, or behavior can still affect whether a particular flow works as expected.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose whether the browser is visible and where it runs

By default, Playwright MCP launches a headed browser, so you can watch the session. To run without a visible browser window, add --headless to the server arguments. The configuration options also support selecting Chrome, Firefox, WebKit, or Microsoft Edge. See Playwright MCP configuration options for the exact arguments.

The basic command uses a local browser. For an advanced setup, Playwright MCP can connect to a remote browser using a Playwright endpoint or a CDP endpoint; this is not needed for the local demo flow. Endpoint details and options are in the configuration documentation.

Decide how browser state should be saved

Playwright MCP uses a persistent browser profile by default, which preserves cookies and login state between sessions. Choose this behavior deliberately, especially on a shared machine or when working with sensitive accounts.

  • Persistent profile: Useful when a workflow needs a login to remain available between sessions.
  • Isolated mode: Starts a fresh session and does not save browser state to disk. You can provide storage state when an isolated session needs preloaded authentication.

These profile and storage-state options are documented in the Playwright MCP configuration guide. Treat saved authentication state as sensitive: avoid sharing it, and use the mode that matches the task.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

When to choose MCP instead of Playwright CLI

Playwright positions MCP for specialized agentic loops that benefit from persistent state and iterative reasoning about page structure. It positions Playwright CLI as a more token-efficient command workflow for coding agents working with large codebases. This is the project’s qualitative guidance, not a quantified performance comparison. See the Playwright MCP introduction.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Outdated Drivers Are Slowing You DownFree scan - exact matches

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.