playwright-mcp-server

rcrumpto14/playwright-mcp-server

3.2

If you are the rightful owner of playwright-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Playwright MCP Server is a Model Context Protocol server that offers browser automation capabilities using the Playwright library.

Tools
9
Resources
0
Prompts
0

Playwright MCP Server

A Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright.

Features

  • Browser management (launch, close)
  • Page navigation
  • Element interaction (click, type, get text)
  • Wait for elements
  • Screenshot capture
  • PDF generation
  • Headless and headed browser modes

Installation

npm install
npm run build

Usage

As an MCP Server

Add to your MCP configuration file (e.g., ~/.cursor/mcp.json):

{
  "servers": {
    "playwright": {
      "command": "node",
      "args": ["path/to/playwright-mcp-server/dist/index.js"]
    }
  }
}

Or if published to npm:

{
  "servers": {
    "playwright": {
      "command": "npx",
      "args": ["playwright-mcp-server"]
    }
  }
}

Development

npm run dev

Available Tools

browser_launch

Launch a new browser instance.

  • headless (boolean, optional): Run in headless mode (default: true)

navigate

Navigate to a URL.

  • url (string, required): URL to navigate to

click

Click on an element.

  • selector (string, required): CSS selector for the element

type

Type text into an input field.

  • selector (string, required): CSS selector for the input field
  • text (string, required): Text to type

get_text

Get text content from an element.

  • selector (string, required): CSS selector for the element

screenshot

Take a screenshot of the current page.

  • path (string, required): File path to save the screenshot
  • fullPage (boolean, optional): Capture full page (default: false)

generate_pdf

Generate a PDF of the current page.

  • path (string, required): File path to save the PDF
  • format (string, optional): Paper format (default: A4)

wait_for_selector

Wait for an element to appear.

  • selector (string, required): CSS selector to wait for
  • timeout (number, optional): Timeout in milliseconds (default: 30000)

browser_close

Close the browser instance.

Example Usage

  1. Launch browser: browser_launch
  2. Navigate to a page: navigate with URL
  3. Interact with elements: click, type, get_text
  4. Capture content: screenshot or generate_pdf
  5. Close browser: browser_close

License

MIT