playwright-mcp
This server gives an AI assistant a live, Playwright-controlled browser to inspect and interact with web pages, so it can write context-aware Playwright tests.
Open a browser and navigate to a URL (
init-browser)Run custom Playwright JavaScript against the current page, returning results, console logs, and errors (
execute-code)Capture screenshots of the current page (
get-screenshot)Get an interactive snapshot of buttons, links, and inputs, with an annotated screenshot for UI automation (
get-interactive-snapshot)Get a full page snapshot of all visible content — text, images, forms — for complete context (
get-full-snapshot)Extract all text content such as headings, paragraphs, and lists (
get-text-snapshot)Retrieve the raw HTML DOM (
get-full-dom, deprecated in favor of the snapshot tools)
Provides keyboard shortcuts support for macOS users to access the Cursor AI window with Cmd + I.
Utilized as a runtime for running the playwright-mcp server, which enables browser automation and DOM interaction.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@playwright-mcp take a screenshot of the login form on the current page"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
How to Use playwright-mcp?
Introduction
Ever tried using Cursor or Claude to write Playwright tests? Yeah, it's kind of a mess.
Why? Because your AI assistant has no clue what's on your web page. It's like trying to describe a painting to someone who's blindfolded. The result?
Flaky tests → The AI is guessing selectors, and it gets them wrong.
Broken scripts → You spend more time fixing tests than writing them.
Debugging nightmares → The AI can't "see" what's happening, so you end up doing all the heavy lifting.
Wouldn't it be nice if your AI could actually understand your web page instead of just making educated guesses?
Enter playwright-mcp !
playwright-mcp gives your AI assistant superpowers by making the browser fully visible to it. Instead of working in the dark, your AI assistant now has real-time access to the page DOM, elements, and interactions.
How playwright-mcp Works (AKA How We Fix This Mess)
Once installed, playwright-mcp spins up a Playwright-controlled browser and gives your AI assistant full access to it. This unlocks:
Recording interactions → Click, type, scroll—let playwright-mcp turn your actions into fully functional Playwright test cases.
Taking screenshots → Capture elements or full pages so your AI gets actual visual context (no more guessing).
Extracting the DOM → Grab the entire HTML structure so the AI can generate rock-solid selectors.
Executing JavaScript → Run custom JS inside the browser for debugging, automation, or just for fun.
Why You'll Love playwright-mcp
🚀 AI-generated tests that actually work → No more flaky selectors, broken tests, or guesswork.
⏳ Massive time savings → Write and debug Playwright tests 5x faster.
🛠️ Fewer headaches → Your AI assistant gets live page context, so it can generate real test cases.
🔌 Works out of the box → Plug it into Cursor, Claude, WindSurf, or whatever you use—it just works.
Give Your AI the Context It Deserves
Tired of fixing AI-generated tests? Stop debugging AI's bad guesses—start writing flawless Playwright tests. Use the guide below to install playwright-mcp and let your AI assistant actually help you for once.
Installation: Get Up and Running in No Time
Prerequisites (a.k.a. What You Need Before You Start)
Before you install playwright-mcp, make sure you have:
✅ Node.js installed on your system (because, well… it's an npm package)
✅ Playwright and its Chromium browser installed
✅ An IDE that supports MCP, like Cursor
✅ A brain that's ready to automate Playwright tests like a pro
Setting Up playwright-mcp (It's Easy, I Promise)
Connect It to Your IDE (Cursor Setup)
If you're using Cursor, follow these steps to connect playwright-mcp like a boss:
Open Cursor IDE
Navigate to Settings (⚙️)
Select Cursor Settings → Go to the MCP tab
Click "Add new MCP server"
Fill in the following details:

Name →
playwright-mcpCommand →
npx -y playwright-mcp
Click "Add", and boom—you're connected! 🚀
Note: If clicking on "Add new MCP server", opens a file(.cursor/mcp.json), Paste the following code and save:
{
"mcpServers": {
"playwright-mcp": {
"command": "npx",
"args": [
"-y",
"playwright-mcp"
]
}
}
}Now Cursor actually understands your web pages. No more random test suggestions based on zero context! Head to the Claude tutorial or Cursor tutorial to understand it in details.
Connect It to Claude desktop
Wait… Does It Work with Other AI Assistants? Yes! While playwright-mcp is a match made in heaven for IDEs, you can use it with Claude desktop to write tests as well.
Install
playwright-mcp(The Easy Part)First things first, fire up your terminal and run:
npm install -g playwright-mcp
Hook It Up to Claude Desktop
Find the Configuration File
On windows
%APPDATA%\Claude\claude_desktop_config.json
On macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Update the config file
{ "mcpServers": { "playwright": { "command": "npx", "args": ["-y", "playwright-mcp"] } } }Restart Claude Desktop (Because It's a New Day)
Close and reopen Claude Desktop to apply the changes.
Verify That It's Working
Once everything is set up, let's test if Claude can actually talk to Playwright now.
Open Claude and ask: "List all available MCP tools."
If
playwright-mcpis installed correctly, it should list tools like:init-browser→ Initialize browser and navigate to a URLget-interactive-snapshot→ Get focused snapshot of interactive elements (buttons, links, inputs) with annotated screenshotget-full-snapshot→ Get complete page snapshot including all visible content for full context understandingget-text-snapshot→ Extract all text content from the page for reading and content analysisget-screenshot→ Take a simple screenshot of the current pageget-full-dom→ Get raw HTML DOM (deprecated - use snapshot tools instead)execute-code→ Run custom Playwright JavaScript code against the page
Ask Claude to init browser and a browser should open up after your approval!
Now that the Calude has access to the web pages. You can ask it write highly contextual tests! Head to the Claude tutorial or Cursor tutorial to understand it in details.
Related MCP server: browser-devtools-mcp
Telemetry
Why we collect it: we are researching how AI browsing agents are used: which tools they call, on what kinds of pages, and from which MCP clients. The data also guides improvements to playwright-mcp. A one-line notice is printed to stderr the first time the server runs, and you can opt out at any time (see below).
What is sent: one event per tool call, named after the tool (init_browser, execute_code, get_screenshot, get_full_dom, get_interactive_snapshot, get_full_snapshot, get_text_snapshot), plus prompt_used (with the prompt's name) when you use one of the server's prompts, and server_start when an MCP client connects. Every event carries:
the server version, and the name and version of the MCP client (for example Claude Code or Cursor)
a random install ID, created on first run, that groups calls from one install
a random session ID, new each time the server starts, and the call's position in that session (
seq)
Each tool event also carries:
ok: whether the call succeeded, and if not,error_kind: one ofno_browser,timeout,navigation,selector,syntax,other. The error message itself is never sent.duration_ms: how long the call tookresult_charsandresult_images: how much text and how many images the tool returned to the agenta description of the page:
page_kind: one ofpublic,local,private_ip,ip_literal,file,browser_internal,unparsedpage_domain: for public web pages only, the registrable domain (for exampleexample.comoracme.vercel.app), never the full address, subdomain, path or querypage_is_dev_host: whether the host name contains a label such asdev,staging,qaortest
init_browser also sends reinit (whether a browser was already open). execute_code also sends the length of the code run (codeLength), how many times it calls each common Playwright method (for example { "click": 2, "fill": 1 }, from a fixed list of method names), and how many console logs and console errors it produced. The code itself is never sent. server_start sends the operating system type (darwin, linux or win32) and the Node.js major version.
Pages on localhost, private IPs, intranet host names or local files send only their type, not an address.
What is anonymised, and what is not: nothing sent identifies you by name, username, hostname, email or IP address. Two fields are not fully anonymous:
The install ID and session ID are random and not derived from you or your machine, but they link events from one install, and from one session, together.
page_domainnames the public website your agent visited. For a company's own site (for examplestaging.acme.combecomesacme.com), that can show which organisation's site was being worked on.
How it is used: only for research and to improve playwright-mcp. As part of the research, we classify page domains by organisation size, sector and country to understand what kinds of organisations use browsing agents, and report only aggregate counts. It is not used for sales or marketing, and we never contact organisations based on it. Research results are published only in aggregate, with no organisation or install named.
What is never sent: page contents, screenshots, the code your agent runs, error messages, full URLs, your IP address (discarded on receipt, GeoIP disabled), or your username or hostname.
Retention: raw events are kept for 2 years, then deleted. Aggregate reports derived from them, which contain no install IDs or per-install records, may be kept indefinitely.
Deletion requests: email himanshusaleria [at] gmail [dot] com with your install ID, from ~/.config/playwright-mcp/install-id ($XDG_CONFIG_HOME/playwright-mcp/install-id if set, %APPDATA%\playwright-mcp\install-id on Windows).
Opt out: set DO_NOT_TRACK=1 or PLAYWRIGHT_MCP_TELEMETRY=0, or pass --no-telemetry (for example npx -y playwright-mcp --no-telemetry). When opted out, the server creates no telemetry client and sends nothing.
Available Tools
7 toolsexecute-codeA
Execute custom Playwright JS code against the current page
Inputs: code (required).
get-full-domA
Get the full DOM of the current page. (Deprecated, use get-context instead)
Inputs: no named parameters.
get-full-snapshotB
Get a complete snapshot of the page including all visible content (text, images, forms, etc.) for understanding the full context
Inputs: no named parameters.
get-interactive-snapshotB
Get a snapshot focused on interactive elements (buttons, links, inputs) with annotated screenshot for UI automation
Inputs: no named parameters.
get-screenshotB
Get a screenshot of the current page
Inputs: no named parameters.
get-text-snapshotB
Get all text content from the page (headings, paragraphs, lists) for reading and content extraction
Inputs: no named parameters.
init-browserC
Initialize a browser with a URL
Inputs: url (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
The three snapshot tools overlap somewhat in purpose, though their descriptions distinguish interactive, full, and text use cases. The deprecated get-full-dom tool references a missing get-context tool and also overlaps with the full snapshot, increasing misselection risk.
All tool names use consistent kebab-case with clear verb-first patterns such as get-*, execute-code, and init-browser. There are no mixed casing or naming conventions.
Seven tools is a well-scoped count for a Playwright browser automation server. Each tool broadly earns its place, with only the deprecated get-full-dom being questionable.
The server covers initialization, page inspection, screenshots, and arbitrary automation via execute-code, but lacks direct navigation, click, type, wait, and cleanup tools. The deprecated get-full-dom reference to a nonexistent get-context is a notable dead end.
Maintenance
Related MCP Connectors
Run, debug, and triage tests from your IDE using natural language, no dashboard switching, no manual data transfers. The TestMu AI (formerly LambdaTest) MCP Server is a single remote server exposing four tool suites: HyperExecute — analyze your project, generate YAML configs and test runner commands, then monitor jobs and sessions. Automation — pull a TestID's details plus command, network, and console logs into one chat for instant root-cause analysis. Includes mobile app upload. SmartUI — explain pixel, layout, DOM, and perceptual changes in a visual regression run, with context-aware React/HTML/CSS fixes. Accessibility — audit any public URL or a local React app against WCAG and get ready-to-apply remediation steps. Connects over https://mcp.lambdatest.com/mcp using OAuth 2.1 — no API keys in your config. One-click install in Cursor; works with Claude, GitHub Copilot, Cline, and any MCP client. Tests execute on the TestMu AI cloud: 3,000+ browsers and 10,000+ real devices.
Approved test intent, reviewed Playwright automation and run evidence, inside your editor.
Live browser debugging for AI assistants — DOM, console, network via MCP.
MCP server for Mint — AI-powered QA that runs your app in a real browser on every PR.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI-powered browser automation, web scraping, and testing using Playwright across Chromium, Firefox, and WebKit. It allows users to perform actions like navigation, clicking, typing, and taking screenshots through natural language interfaces.MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides AI coding assistants with comprehensive browser automation and debugging capabilities using Playwright, including visual inspection, DOM debugging, and execution monitoring.MIT
- AlicenseNot gradedqualityCmaintenancePlaywright-powered browser automation and debugging for VS Code and Cursor via the Model Context Protocol (MCP).52MIT
- AlicenseCqualityCmaintenanceAn MCP server that enables AI agents to autonomously test, debug, and analyze web interfaces visually using Playwright, with 30 tools for screenshots, workflows, performance, and visual comparison.3020 npm85ISC