Back to Blog
RecipeFeb 1, 2026Updated May 1814 min read

Playwright MCP: Browser Automation with AI (Complete Setup Guide)

NT

Nikhil Tiwari

MCP Playground

Updated: May 18, 2026 β€” added the hosted Playwright MCP option (one-click cloud deploy, live URL + bearer token).

🍳 MCP Recipe

  • What you'll get: AI-controlled browser automation using the official Playwright MCP server (Microsoft)
  • MCP server: @playwright/mcp (npm), GitHub: microsoft/playwright-mcp
  • Fast path: Deploy hosted Playwright MCP β€” live HTTPS URL + token in ~30 seconds, no install
  • Local path: 15–25 minutes (Node.js, Playwright browsers, MCP client config)
  • Difficulty: Beginner to intermediate

⚑ Skip the install β€” spin up a hosted Playwright MCP server in seconds

If you just want to drive a real Chrome browser from Claude, Cursor or any MCP-compatible agent without installing Node, Playwright or 300MB of browser binaries β€” use the hosted Playwright MCP server on MCP Playground.

  • Live HTTPS URL + bearer token in ~30 seconds β€” no Docker, no infra, no local dependencies
  • Runs headless Chrome in an isolated cloud sandbox β€” paste the URL into Claude Desktop, Cursor, MCP Agent Studio or your own code
  • Free tier: 1 active server, 10 min/month β€” enough for a real test drive
  • Same official Playwright tool surface (browser_navigate, browser_click, browser_snapshot, etc.)
Deploy hosted Playwright MCP β†’

What is Playwright MCP? Playwright MCP is an official Model Context Protocol server from Microsoft that lets AI assistants (Claude, Cursor, GitHub Copilot, etc.) control a real browser. Instead of sending screenshots to a vision model, it uses accessibility snapshotsβ€”a structured representation of the page (roles, names, states)β€”so the AI can navigate, click, type, and extract data reliably and without expensive image APIs.

This guide covers both paths: the hosted route (~30 seconds, no install) for anyone who wants to get started immediately, and the local STDIO route for teams that need full control or want to run on their own hardware.

Why Playwright MCP?

Feature Detail
Accessibility-based Uses the page's accessibility tree (roles, names, states), not pixels. Deterministic and less brittle than screenshot-based automation.
LLM-friendly Structured text output that language models can parse and reason about without vision capabilities.
Official & maintained Maintained by Microsoft; part of the Playwright ecosystem. Documented at playwright.dev/agents.

What You Can Do With Playwright MCP

  • Generate Playwright tests: Ask the AI to explore a URL and produce test code (e.g. "Generate a Playwright test that logs in and checks the dashboard").
  • Automate tasks: Fill forms, click through flows, download files, or extract data from pages.
  • Web scraping & summarization: Navigate to a page, take a snapshot or screenshot, and have the AI summarize or extract structured data.
  • Explore site structure: "List all links on this page" or "What forms are on this site?" using the accessibility snapshot.

Prerequisites

Node.js 18+

Required to run the MCP server

Playwright browsers

Chromium, Firefox, WebKit (installed in Step 1)

MCP client

Claude Desktop, Cursor, or VS Code with MCP

Step 1: Install Playwright Browsers

The Playwright MCP server drives real browsers. Install them once (if you haven't already):

npx playwright install

This installs Chromium, Firefox, and WebKit. You can also install only Chromium with npx playwright install chromium to save disk space.

Step 2: Add Playwright MCP to Your Client

The official npm package is @playwright/mcp. Add it to your MCP client config.

Claude Desktop

Edit your Claude Desktop config (e.g. ~/Library/Application Support/Claude/claude_desktop_config.json on macOS) and add:

{
 "mcpServers": {
 "playwright": {
 "command": "npx",
 "args": ["-y", "@playwright/mcp@latest"]
 }
 }
}

Cursor

In Cursor: Settings β†’ Tools & MCP β†’ Add MCP server. Use:

Field Value
Name playwright
Type stdio
Command npx
Args -y @playwright/mcp@latest

Restart Claude Desktop or Cursor after changing the config.

Step 3: Verify It Works

In your AI chat, try:

  • "What Playwright tools do you have?" β€” You should see tools like browser_navigate, browser_snapshot, browser_click, browser_take_screenshot, browser_fill_form, browser_type.
  • "Open https://example.com and give me a snapshot of the page." β€” The AI will use the MCP server to navigate and return the accessibility snapshot.

Example Prompts

  • "Go to https://example.com, take a snapshot, and list all the headings and links."
  • "Generate a Playwright test script that navigates to [URL], clicks the login button, and fills the email and password fields."
  • "Open [product page URL], extract the product name and price, and return them as JSON."

Important Notes

Local Playwright MCP uses STDIO

The local install above communicates over STDIO, so it works in clients that spawn child processes (Claude Desktop, Cursor, Claude Code) but not in browser-based tools that need an HTTP endpoint. If you want a remote HTTPS URL you can paste anywhere β€” including MCP Agent Studio β€” deploy the hosted Playwright MCP instead (one click, ~30 seconds, live URL + bearer token).

Package and repo references:

Skip the install β€” get a hosted Playwright MCP in 30 seconds

Live HTTPS URL + bearer token, headless Chrome in an isolated cloud sandbox. Works with Claude Desktop, Cursor, MCP Agent Studio and any MCP-compatible agent. Free tier available.

Deploy hosted Playwright MCP β†’ Open Agent Studio

Related Content

Frequently Asked Questions

How do I get a hosted Playwright MCP server without installing anything?
Open /mcp-hosted, pick Playwright, click Deploy. You get a live HTTPS URL and a bearer token in ~30 seconds β€” headless Chrome running in an isolated cloud sandbox. Paste the URL into Claude Desktop's mcp.json, Cursor, or MCP Agent Studio. The free tier gives you one active server and 10 minutes per month.
Hosted vs local Playwright MCP β€” which should I use?
Use hosted for everything except CI on private networks. It avoids 300MB of browser binaries, works in browser-only clients (Agent Studio, web agents), and runs in an isolated sandbox so a crashed page can't take down your machine. Use local STDIO when you need to drive a browser on a private network, want fully offline test generation, or are integrating with a CI runner that already has Playwright installed.
What is the difference between @playwright/mcp and @playwright/mcp-server?
@playwright/mcp is the official Microsoft/Playwright MCP server (microsoft/playwright-mcp). @playwright/mcp-server is a different, community package. This guide uses the official @playwright/mcp.
Can I use Playwright MCP with Claude Code / Cursor for test generation?
Yes. Once the server is configured (hosted URL or local STDIO), you can ask the AI to "generate a Playwright test that does X" and it will use the browser tools to explore the page and produce test code. Works in Cursor, Claude Desktop, Claude Code, and other MCP-enabled clients.
Why accessibility snapshots instead of screenshots?
Accessibility snapshots are structured (roles, names, states) and deterministic. The model can reason about "click the button named Submit" without interpreting pixels. That reduces cost (no vision API) and improves reliability across different screen sizes and themes.
NT

Written by Nikhil Tiwari

15+ years in product development. AI enthusiast building developer tools that make complex technologies accessible to everyone.

Build, compare & ship MCP agents β€” free

Connect any MCP server, compare 40+ models side-by-side, deploy hosted servers, and save reusable agents you can export as an API β€” all in your browser.

✦ Free credits on sign-up · no credit card needed

Try for Free β†’
Playwright MCP: Browser Automation with AI (Complete Setup Guide)