Playwright MCP: Browser Automation with AI (Complete Setup Guide)
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.)
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
Required to run the MCP server
Chromium, Firefox, WebKit (installed in Step 1)
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:
- npm:
@playwright/mcp(npmjs.com/package/@playwright/mcp) - GitHub: github.com/microsoft/playwright-mcp
- Docs: playwright.dev/agents, Browser Automation
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 StudioRelated Content
Frequently Asked Questions
How do I get a hosted Playwright MCP server without installing anything?
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?
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?
Why accessibility snapshots instead of screenshots?
Written by Nikhil Tiwari
15+ years in product development. AI enthusiast building developer tools that make complex technologies accessible to everyone.
Free MCP Tools (no install)
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