The Playwright MCP server gives your AI assistant a real web browser it can control programmatically. That means filling forms, clicking buttons, taking screenshots, scraping dynamic pages, and running end-to-end tests — all from a single conversation with Claude or Cursor.
This guide covers what the Playwright MCP server can do, how to install it, and real-world workflows you'll use every day.
What is the Playwright MCP Server?
Playwright is Microsoft's battle-tested browser automation library, trusted by engineering teams worldwide for end-to-end testing. The Playwright MCP server wraps Playwright in a Model Context Protocol interface, giving AI assistants direct browser control.
Unlike simpler scraping tools, Playwright handles:
- JavaScript-heavy pages — SPAs, React/Vue apps, dynamic content
- Authentication flows — login forms, OAuth, cookie management
- Screenshots and PDFs — capture pages as images or documents
- Network interception — inspect and mock API responses
- Multi-browser support — Chromium, Firefox, and WebKit
Installation
Install the Playwright MCP server package:
npm install -g @playwright/mcp
Or use it via npx (no global install needed):
npx @playwright/mcp@latest
If you're using npx, Playwright will auto-download browser binaries on first run.
Configuration: Claude Desktop
Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%Claudeclaude_desktop_config.json (Windows):
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"]
}
}
}
For headless mode (no visible browser window):
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest", "--headless"]
}
}
}
Configuration: Cursor
In ~/.cursor/mcp.json:
{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest", "--headless"]
}
}
}
Available Tools
The Playwright MCP server exposes a rich set of browser interaction tools:
browser_navigate— Navigate to any URLbrowser_click— Click elements by selector or descriptionbrowser_type— Type text into inputsbrowser_screenshot— Capture page screenshotsbrowser_get_text— Extract visible text from a pagebrowser_get_html— Get full page HTMLbrowser_scroll— Scroll the pagebrowser_wait_for— Wait for selectors or text to appearbrowser_evaluate— Execute JavaScript in the page contextbrowser_pdf— Generate a PDF from the current page
Real-World Use Cases
Web Scraping Dynamic Pages
Many sites require JavaScript execution before content appears. Ask Claude: "Go to hacker news, scrape the top 10 post titles and vote counts, and give me a summary."
End-to-End Testing
Ask: "Navigate to localhost:3000, log in with test@example.com / password123, verify the dashboard loads with 5 dashboard cards, and take a screenshot."
Competitor Research
Ask: "Visit our three main competitor pricing pages, take screenshots of their pricing tables, and compare their plans."
Form Automation
Ask: "Go to the contact form at example.com/contact, fill in the details for our partnership inquiry, review what you've filled in, and take a screenshot before submitting."
Visual Regression Detection
Ask: "Screenshot the homepage at 1280px width and 375px width (mobile). Are there any layout issues visible?"
Playwright vs Puppeteer MCP: Which to Use?
Both offer browser automation via MCP. The key differences:
- Playwright MCP supports Chromium, Firefox, and WebKit. Better cross-browser coverage. More reliable element selection.
- Puppeteer MCP is Chromium-only. Lighter weight. Good if you only need Chrome and want a smaller dependency footprint.
For most production use cases, Playwright is the better choice. For quick local automation, either works fine.
Headless vs Headed Mode
By default, Playwright opens a visible browser window (headed mode). This is useful for debugging — you can see exactly what the AI is doing. For automated tasks, use --headless to run without a visible window.
Related guides: