home / mcp / playwright mcp server

Playwright MCP Server

Playwrite wrapper for MCP

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "misanthropic-ai-playwrite-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/Users/shannon/Workspace/artivus/playwright-mcp",
        "run",
        "playwright-mcp"
      ]
    }
  }
}

You can run a Playwright-based MCP server that lets clients control a browser for automation tasks. This server exposes browser interaction capabilities, page analysis prompts, and built-in tools to navigate, interact, and extract content from web pages, all via MCP-compatible clients.

How to use

You interact with the Playwright MCP server through an MCP client that speaks the agreed MCP protocol. The server provides a prompt called interpret-page to analyze the current page and optionally focus on areas like forms, navigation, or text, returning both a text analysis and a screenshot. It also exposes a set of browser automation tools you can call to navigate to URLs, manage pages, click elements, type input, wait for elements, extract text, retrieve page HTML, and take screenshots. You can request screenshots as resources using a page-specific URI pattern and switch between multiple pages as needed. Use the available navigation, interaction, and content extraction tools to automate tasks end-to-end, from loading a page to validating results.

How to install

Install dependencies needed to run the MCP server and enable Playwright browser automation.

uv add playwright
playwright install chromium

Start the development server (local path shown as an example). Use the exact path that contains your Playwright MCP source when you run this locally.

uv --directory /Users/shannon/Workspace/artivus/playwright-mcp run playwright-mcp

If you prefer a published/production-style setup, you can run the server using the published command.

uvx playwright-mcp

Configuration and notes

The server is designed to be run as a stdio-based MCP server. It starts by invoking the runtime tool (uv) with the directory containing your server source and the target script, or by using the published runtime (uvx) with the server name. There are no HTTP endpoints or URLs required to start the server itself, but the server exposes HTTP-style idea endpoints for client interaction via MCP. Ensure you have Chromium installed for Playwright to launch browsers.

Prompts and resources are available for interpreting pages and taking screenshots. The interpret-page prompt analyzes the current page content and structure and can return a screenshot for reference. Screenshot resources are accessible via a page-specific URI like screenshot://{page_id} for any open page.

Tools and capabilities overview

The server provides a comprehensive set of browser automation tools that your MCP client can invoke to automate tasks.

Browser navigation: navigate to a URL, create new pages, switch pages, and list all pages.

Page interaction: click elements via CSS selectors, type text into inputs, and wait for elements to appear.

Content extraction: retrieve text from elements, get the entire page HTML, and take screenshots.

Available tools

navigate

Navigate the active browser page to a specified URL.

new_page

Open a new browser page and assign it a unique identifier.

switch_page

Switch the active context to a different browser page by ID.

get_pages

List all currently open browser pages and their IDs.

click

Click an element identified by a CSS selector on the active page.

type

Type text into a targeted input element.

wait_for_selector

Wait for a CSS selector to appear on the page before continuing.

get_text

Extract text content from a selected element.

get_page_content

Retrieve the full HTML content of the current page.

take_screenshot

Capture a screenshot of the current page or a specific element.

interpret-page

Analyze current page content and structure, returning text analysis and a page screenshot.