# Playwright MCP

> Playwright MCP is an open-source MCP server for browser automation. MCP server giving AI assistants browser automation through Playwright accessibility. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, vscode, self-hosted, Linux, macOS, Windows
- **Repository:** https://github.com/microsoft/playwright-mcp
- **MCP Registry name:** io.github.microsoft/playwright-mcp
- **Categories:** [browser automation](https://ai-powered.com/categories/browser-automation)
- **Listing updated:** 2026-11-18

## About

The README describes Playwright MCP as a Model Context Protocol server that lets language models drive web pages through Playwright. Instead of relying on screenshots, it reads the browser's accessibility tree, so the model works with structured page data.

It runs as a local stdio process started with npx, or as an HTTP server via a --port flag or a Docker image. Browser state can be a persistent profile, an isolated in-memory session, or an existing browser attached through the Playwright extension. Options cover viewport, headless mode, proxies, storage state, output directories and more.

The README positions it for exploratory automation, self-healing tests and long-running agent loops that need persistent browser context. It also notes that the project is not a security boundary and points to the separate Playwright CLI for coding agents that are constrained by token budget.

## Features

- **Accessibility snapshot control:** Pages are read as an accessibility tree, so models can act on elements by reference without a vision model.
- **Broad tool set:** Tools cover navigation, clicking, typing, form filling, dialogs, network inspection, screenshots and waiting.
- **Flexible browser sessions:** Choose a persistent profile, an isolated session, or attach to an existing Chrome or Edge browser via the extension.
- **Multiple transports:** Runs over stdio for desktop clients or over HTTP with a port flag or a Docker container.
- **Configurable safety limits:** Options restrict allowed hosts and origins, file system access, and redact URL parameters in responses.
- **Code generation option:** Can generate TypeScript, Python, Java or C# code for the actions it performs, according to the codegen setting.

## Good for

- Letting an AI assistant navigate and test a web application during development
- Running exploratory checks or self-healing test workflows driven by an agent
- Filling forms and extracting page information in a logged-in browser session
- Inspecting console messages and network requests while debugging a page
- Capturing screenshots or PDFs of pages as part of an automated task

## Install

### Claude Code (Terminal)

```sh
claude mcp add playwright-mcp -- npx -y @playwright/mcp
```

### Claude Desktop (claude_desktop_config.json)

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

### Cursor (~/.cursor/mcp.json)

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

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "playwright-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@playwright/mcp"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

### Other clients (your client's MCP settings (most use this shape))

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

## Tools

- `browser_click`: Perform click on a web page
- `browser_close`: Close the browser and all open tabs.
- `browser_console_messages`: Returns all console messages
- `browser_drag`: Perform drag and drop between two elements
- `browser_drop`: Drop files or MIME-typed data onto an element
- `browser_emulate_media`: Emulate CSS media features for the page
- `browser_evaluate`: Evaluate JavaScript expression on page or element
- `browser_file_upload`: Upload one or multiple files
- `browser_fill_form`: Fill multiple form fields
- `browser_find`: Search the accessibility snapshot of the current page for text or a regular expression
- `browser_handle_dialog`: Handle a dialog
- `browser_hover`: Hover over element on page
- `browser_navigate`: Navigate to a URL
- `browser_navigate_back`: Go back to the previous page in the history
- `browser_network_request`: Returns full details of a single network request
- `browser_network_requests`: Returns a numbered list of network requests since loading the page
- `browser_press_key`: Press a key on the keyboard
- `browser_resize`: Resize the browser window
- `browser_run_code_unsafe`: Run a Playwright code snippet
- `browser_select_option`: Select an option in a dropdown
- `browser_snapshot`: Capture accessibility snapshot of the current page
- `browser_take_screenshot`: Take a screenshot of the current page
- `browser_type`: Type text into editable element
- `browser_wait_for`: Wait for text to appear or disappear or a specified time to pass

## FAQ

### Which clients can use it?

The README lists VS Code, Cursor, Windsurf, Claude Desktop, Claude Code, Codex, Gemini CLI, Goose, Grok, Junie, Kiro, LM Studio and others, and says it works with any MCP client.

### What does it require to run?

Node.js 20 or newer. The Docker image is also available.

### Is it a security boundary?

No. The README states Playwright MCP is not a security boundary and points to MCP security best practices.

### When should the CLI be used instead?

The README suggests the Playwright CLI with SKILLs for coding agents that need token-efficient browser commands.

### Is Playwright MCP free?

Yes. Playwright MCP is open source, so you can use and self-host it for free.

### How do I add Playwright MCP to Claude Code?

Run this command in your terminal: claude mcp add playwright-mcp -- npx -y @playwright/mcp

### What are the best alternatives to Playwright MCP?

The closest alternatives to Playwright MCP are Browser Use, Scrapling MCP Server, Chrome DevTools MCP, Oya Browser and playwright_mcp.

## Where this comes from

- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [Browser Use](https://ai-powered.com/mcp/browser-use): Browser Use is a freemium MCP server for browser automation.
- [Scrapling MCP Server](https://ai-powered.com/mcp/scrapling-mcp-server): Scrapling MCP Server is an open-source MCP server for web search and scraping.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-2): Chrome DevTools MCP is an open-source MCP server for browser automation.
- [Oya Browser](https://ai-powered.com/mcp/oya-browser): Oya Browser is a freemium MCP server for browser automation.
- [playwright_mcp](https://ai-powered.com/mcp/playwright-mcp-3): playwright_mcp is an open-source MCP server for browser automation.
- [browsentic](https://ai-powered.com/mcp/browsentic-2): browsentic is an open-source MCP server for browser automation.
- [Turbo-Browser-MCP](https://ai-powered.com/mcp/turbo-browser-mcp): Turbo-Browser-MCP is an open-source MCP server for browser automation.
- [Mantis](https://ai-powered.com/mcp/mantis-2): Mantis is an open-source MCP server for browser automation.

---
Source: https://ai-powered.com/mcp/playwright-mcp-2
