# Playwright MCP

> Playwright MCP is an open-source MCP server for browser automation. Browser automation server that lets AI clients drive Playwright pages via accessibility. It runs locally on your machine and is started by your AI client.

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

## About

The README describes an MCP server that gives language models control of a web browser through Playwright. Instead of sending screenshots, it exposes the page's accessibility tree so a model can pick elements by reference and act on them.

The server runs over stdio or HTTP and is set up by adding a command entry to an MCP client such as VS Code, Cursor, Claude Desktop or Claude Code. It can run with a persistent browser profile, in isolated sessions with optional storage state, or attach to an existing browser through an extension. Optional capabilities add coordinate-based mouse actions, PDF export, tracing and test assertions.

It suits developers who want an AI assistant to navigate sites, fill forms, or generate and check end-to-end test steps. The registry entry for the npm and Docker packages lists a required YOUR_API_KEY variable without explaining what it is used for, so check that before deploying.

## Features

- **Accessibility snapshot control:** Reads the page through Playwright's accessibility tree so models can act on elements without vision models.
- **Persistent or isolated profiles:** Runs with a saved browser profile that keeps logins, or with throwaway sessions that discard state on close.
- **Existing browser connection:** An optional extension lets the server work with tabs and sessions already open in Chrome or Edge.
- **Configurable startup state:** Accepts storage state files, init scripts and init pages to prepare cookies, permissions and page setup.
- **Optional capabilities:** Enable coordinate mouse actions, PDF saving, tracing or test assertion tools with flags.
- **Docker and HTTP transport:** Can run headless in a container or as a long-lived service on a chosen port for remote clients.

## Good for

- Letting an AI assistant navigate a web app and report what it finds
- Filling and submitting forms during automated browser workflows
- Generating locators and verifying visible elements for end-to-end tests
- Capturing page snapshots, console messages or network requests while debugging
- Running headless browser sessions inside a container for an MCP client

## Install

### Claude Code (Terminal)

```sh
claude mcp add playwright-mcp --env YOUR_API_KEY='<YOUR_API_KEY>' -- npx -y @dinesh-nalla-se/playwright-mcp
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "playwright-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@dinesh-nalla-se/playwright-mcp"
      ],
      "env": {
        "YOUR_API_KEY": "<YOUR_API_KEY>"
      }
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "playwright-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@dinesh-nalla-se/playwright-mcp"
      ],
      "env": {
        "YOUR_API_KEY": "<YOUR_API_KEY>"
      }
    }
  }
}
```

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

```json
{
  "servers": {
    "playwright-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@dinesh-nalla-se/playwright-mcp"
      ],
      "env": {
        "YOUR_API_KEY": "<YOUR_API_KEY>"
      }
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "playwright-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@dinesh-nalla-se/playwright-mcp"
      ],
      "env": {
        "YOUR_API_KEY": "<YOUR_API_KEY>"
      }
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "playwright-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@dinesh-nalla-se/playwright-mcp"
      ],
      "env": {
        "YOUR_API_KEY": "<YOUR_API_KEY>"
      }
    }
  }
}
```

## Tools

- `browser_click`: Perform click on a web page
- `browser_close`: Close the page
- `browser_console_messages`: Returns all console messages
- `browser_evaluate`: Evaluate JavaScript expression on page or element
- `browser_fill_form`: Fill multiple form fields
- `browser_navigate`: Navigate to a URL
- `browser_network_requests`: Returns all network requests since loading the page
- `browser_press_key`: Press a key on the keyboard
- `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
- `browser_tabs`: List, create, close, or select a browser tab

## FAQ

### Does it need a vision model?

No. The README says it operates on structured accessibility snapshots rather than screenshots, so no vision model is needed by default.

### Which Node.js version is required?

The README lists Node.js 18 or newer as a requirement.

### Can it run in Docker?

Yes. The README gives Docker run examples, but notes the Docker build only supports headless Chromium.

### Which browsers does it support?

The README lists chrome, firefox, webkit and msedge as browser options for the browser flag.

### 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 --env YOUR_API_KEY='<YOUR_API_KEY>' -- npx -y @dinesh-nalla-se/playwright-mcp

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

The closest alternatives to Playwright MCP are MCP Server Browser, MCP Server, Cdpilot, Chrome DevTools MCP and Turbo-Browser-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

- [MCP Server Browser](https://ai-powered.com/mcp/mcp-server-browser): MCP Server Browser is an open-source MCP server for browser automation.
- [MCP Server](https://ai-powered.com/mcp/mcp-server-mweo0sk4): MCP Server is an MCP server for developer tools.
- [Cdpilot](https://ai-powered.com/mcp/cdpilot): Cdpilot is an open-source MCP server for browser automation.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-4): Chrome DevTools MCP 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.
- [Screen Mouse Recorder MCP](https://ai-powered.com/mcp/screen-mouse-recorder-mcp): Screen Mouse Recorder MCP is an open-source MCP server for browser automation.
- [Agent Browser](https://ai-powered.com/mcp/agent-browser-3): Agent Browser is an open-source MCP server for browser automation.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-3): Chrome DevTools MCP is an open-source MCP server for browser automation.

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