home / mcp / playwright mcp server

Playwright MCP Server

Provides browser automation via Playwright using MCP, enabling LLMs to control pages through structured accessibility snapshots.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "microsoft-playwright-mcp": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}

Playwright MCP is an MCP server that enables browser automation through Playwright by exposing a structured accessibility tree for interaction. This approach lets you drive web pages with exact, data-driven commands and page-state insights, avoiding reliance on screenshots or vision models. It is useful for persistent agent loops, exploratory automation, and long-running workflows where maintaining browser context is advantageous.

How to use

You connect an MCP client to the Playwright MCP server to perform browser automation using structured data from the page. Start the server, point your MCP client to its endpoint, and invoke tool endpoints to navigate, interact, and extract information from web pages. The server operates purely on accessible, non-visual data, enabling you to automate tasks with predictable, debuggable commands.

How to install

Prerequisites: You need Node.js 18 or newer installed on your system.

Install the Playwright MCP server via MCP configuration in your client. Use the standard configuration snippet below. This config declares a local MCP server that uses npx to run the Playwright MCP package.

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ]
    }
  }
}

Standalone MCP server

If you run the MCP server as a standalone process, start it with a port for HTTP transport and connect your client to that URL.

npx @playwright/mcp@latest --port 8931
```
```json
{
  "mcpServers": {
    "playwright": {
      "url": "http://localhost:8931/mcp"
    }
  }
}