Setup Guides8 min read

Playwright MCP Server: Browser Automation with Claude and Cursor

Use the Playwright MCP server to give AI assistants full browser control. Automate web testing, scraping, and UI interactions directly from Claude Desktop or Cursor.

By MyMCPTools Team·

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 URL
  • browser_click — Click elements by selector or description
  • browser_type — Type text into inputs
  • browser_screenshot — Capture page screenshots
  • browser_get_text — Extract visible text from a page
  • browser_get_html — Get full page HTML
  • browser_scroll — Scroll the page
  • browser_wait_for — Wait for selectors or text to appear
  • browser_evaluate — Execute JavaScript in the page context
  • browser_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:

Recommended Tools

Better Stack

Free Plan

Get alerted when your APIs, browser tests, payment pipelines, or MCP server dependencies go down. Used by 100K+ developers.

Start monitoring free →

1Password

14-day Free Trial

Store and inject API keys, payment credentials, tokens, and file access secrets into your MCP server configs. Trusted by 150K+ developers.

Try 1Password free →

🔧 MCP Servers Mentioned in This Article

🌍

Playwright MCP Server (ExecuteAutomation)

ExecuteAutomation's Playwright MCP Server is a community-maintained browser automation server (5,500+ GitHub stars) distinct from Microsoft's official microsoft/playwright-mcp — it leans further into test generation and visual workflows rather than pure accessibility-tree navigation. Beyond standard navigate/click/fill/screenshot tools, it can generate Playwright test code from a live browsing session, scrape full page content and structured data, execute arbitrary JavaScript in the page context, and drive API testing (GET/POST/PUT/PATCH/DELETE requests) alongside the browser tools. A standout feature is 143 real device presets for responsive testing — a single call like playwright_resize({ device: "iPhone 13" }) swaps in the correct viewport, user-agent, touch support, and device pixel ratio, and natural-language prompts like "test on iPad landscape" work directly through Claude. Install via `npm install -g @executeautomation/playwright-mcp-server`, Smithery, mcp-get, or the one-line `claude mcp add --transport stdio playwright npx @executeautomation/playwright-mcp-server` for Claude Code; VS Code one-click installers are also published. No API keys are required — it launches and drives a local Chromium/Firefox/WebKit browser directly. Choose this over Microsoft's official server when you specifically need auto-generated Playwright test scripts, JS execution, or device-emulation testing; choose Microsoft's for pure lightweight accessibility-tree page navigation.

Local
🌍

Puppeteer

Browser automation and web scraping with Puppeteer.

Local
🌍

Browserbase

Automate browser interactions in the cloud (web navigation, data extraction, form filling, and more).

Local
🌍

Browserless MCP Server

The Browserless MCP Server is Browserless.io's official Model Context Protocol integration, exposing Browserless's smart-scraper and browser-automation API as tools any MCP-compatible AI assistant can call — Claude Desktop, Cursor, VS Code, and Windsurf among them. The fastest path is the hosted remote server at `https://mcp.browserless.io/mcp`, authenticated with a Browserless API token (a free tier is available), so most users never run anything locally. Core capabilities: a scraping tool that cascades through strategies (plain HTTP fetch, proxy, full headless-browser render, and CAPTCHA solving as needed) and returns content as markdown, HTML, screenshot, PDF, or extracted links; a web-search tool covering web/news/image search with geo-targeting and time-range filters, with optional per-result scraping; a raw Puppeteer-execution tool that runs custom JavaScript against a live page object on Browserless's cloud browsers for cases the built-in tools don't cover; and a stateful agent-loop mode that keeps a persistent browser session alive across multiple tool calls with snapshot/observe/act primitives, instead of forcing one-shot page loads for every step. This makes it a fit for AI research agents that need to click through paginated results, fill and submit forms, or verify a scrape against a live rendered page rather than a static fetch. The github.com/browserless/mcp-server URL sometimes cited for this project does not exist — the real official repo lives at browserless/browserless-mcp; a separate community implementation, Lizzard-Solutions/browserless-mcp, offers a comparable self-hosted alternative for teams that want to run the bridge themselves instead of the hosted endpoint.

Local

📚 More from the Blog