Playwright MCP

by @microsoft

Playwright MCP Server

Playwright MCP lets AI assistants operate browsers using structured accessibility data. It suits agents that need persistent page context, interactive exploration, and browser inspection without a vision model.

Browser Automation38,311nodeApache-2.0

Server facts

Playwright MCP

GitHub stars

38,311

Last commit

Oct 16, 2026

Runtime

node

License

Apache-2.0

Tech

Runtime
node
Transports
stdio
Remote access
No

Activity

GitHub stars
38,311
Last commit
Data as of

Tags

  • Accessibility
  • Browser Automation
  • Playwright
  • Web Testing

Overview

Playwright MCP exposes browser automation to AI clients through Playwright. Instead of requiring a model to interpret page pixels, it supplies structured accessibility information that an agent can inspect before choosing an action. The available controls cover navigation, clicks, keyboard input, forms, dropdowns, tabs, uploads, and drag operations. Inspection tools expose console output and network traffic, while screenshots provide a separate visual record. This combination supports exploratory browsing and testing workflows in which an assistant repeatedly examines a page and acts on its current structure. The README positions persistent browser context as a reason to choose the MCP interface for longer agent loops.

Setup uses an npx command in an MCP client's configuration and requires Node.js 18 or later. The README includes configuration examples for numerous editors, terminal agents, and desktop clients. Options select browser engines, headless execution, emulated devices, saved profiles, connection endpoints, and additional capabilities. File access is limited to workspace roots by default, and file URL navigation starts blocked. Origin allowlists and blocklists are explicitly not security boundaries. For coding agents with tight context budgets, the project also points to a separate CLI and skills approach, noting that MCP's larger tool schemas and accessibility trees can consume more tokens.

Install & configure

Requirements

  • Node.js 18 or later
  • An MCP-compatible client
Documented launch / install command
npx @playwright/mcp@latest

Add the command to your client's MCP configuration. Browser selection, headless operation, and connection settings are configurable through documented arguments.

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Desktop configuration
{
  "mcpServers": {
    "playwright-mcp": {
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ],
      "env": {}
    }
  }
}

Read the Claude Desktop setup guide

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.

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

Read the Cursor setup guide

Config file · Workspace: .vscode/mcp.json

For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.

VS Code configuration
{
  "servers": {
    "playwright-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ],
      "env": {}
    }
  }
}

Read the VS Code setup guide

Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.

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

Read the Windsurf setup guide

Config file · Project scope: .mcp.json at the repository root

The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Code configuration
{
  "mcpServers": {
    "playwright-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "@playwright/mcp@latest"
      ],
      "env": {}
    }
  }
}

Read the Claude Code setup guide

Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.

Tools

Source: repository tool metadata. Tool descriptions are a documented snapshot, not a live capability check.

ToolWhat it does
browser_closeShut the active page.
browser_resizeChange the browser window dimensions.
browser_console_messagesRead messages emitted to the browser console.
browser_handle_dialogRespond to a browser dialog.
browser_emulate_mediaOverride CSS media settings such as the page color scheme.
browser_evaluateEvaluate JavaScript against a page or element.
browser_file_uploadSupply files to an upload control.
browser_dropDrop local files or MIME data onto a page element.
browser_findFind text or regex matches within the page accessibility snapshot.
browser_fill_formPopulate several form fields together.
browser_press_keySend a keyboard key press.
browser_typeEnter text in an editable page element.
browser_navigateOpen a specified web address.
browser_navigate_backReturn to the preceding page in browser history.
browser_network_requestsList captured network requests with reference numbers.
browser_network_requestInspect headers or body data for a numbered network request.
browser_run_code_unsafeExecute a Playwright snippet in the server process; this permits arbitrary JavaScript execution.
browser_take_screenshotCapture a page image; use an accessibility snapshot to guide actions.
browser_snapshotRead the current page as an accessibility tree.
browser_clickClick a page element.
browser_dragDrag from one page element to another.
browser_hoverPosition the pointer over an element.
browser_select_optionChoose an entry from a dropdown control.
browser_tabsInspect, open, switch, or close tabs.
browser_wait_forPause for matching text, its disappearance, or an elapsed interval.

Use cases

  • Explore a website through accessibility snapshots and iterative actions.
  • Fill forms and exercise interactive browser flows.
  • Inspect console errors and individual network requests.
  • Keep browser state across a long-running agent workflow.

Strengths

  • Structured page access does not require a vision model.
  • Combines browser controls with console and network inspection.
  • Documents configuration for many MCP clients.

Limitations

  • Requires Node.js 18 or later.
  • Tool schemas and accessibility trees can use more context than the separate CLI workflow.
  • Origin filters are not a security boundary.

Playwright MCP setup notes

  • Playwright MCP's stdio example needs a client that launches local processes.

Frequently asked questions

No. Page interaction uses structured accessibility data rather than requiring screenshot interpretation.

Related MCP servers