🎭 Playwright MCP Server

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

⚠️ Authentication Required: All requests must include the x-api-key header with your API key.

🚀 Quick Start

Configuration for Claude Code

Add to your .mcp.json file:

Option 1: Direct API Key (Recommended)

{
  "mcpServers": {
    "playwright": {
      "type": "http",
      "url": "https://playwright.mcp.majewscy.tech/",
      "headers": {
        "x-api-key": "YOUR_API_KEY"
      }
    }
  }
}

Option 2: OAuth-style Authentication

{
  "mcpServers": {
    "playwright": {
      "type": "http",
      "url": "https://playwright.mcp.majewscy.tech/"
    }
  }
}

With OAuth-style, the server will use dynamic client registration.

🛠️ Available Tools

navigate_to

Navigate to a URL in the browser

Parameters:
Example:
{
  "url": "https://example.com",
  "waitUntil": "networkidle"
}

click

Click on an element

Parameters:
Example:
{
  "selector": "button[type='submit']",
  "button": "left",
  "clickCount": 1
}

type_text

Type text into an input field

Parameters:
Example:
{
  "selector": "input[name='username']",
  "text": "john.doe@example.com",
  "delay": 50
}

screenshot

Take a screenshot of the current page

Parameters:
Example:
{
  "fullPage": true
}

get_text

Extract text content from elements

Parameters:
Example:
{
  "selector": "h1, .content p"
}

wait_for_selector

Wait for an element to appear

Parameters:
Example:
{
  "selector": ".loading-complete",
  "state": "visible",
  "timeout": 30000
}

evaluate

Execute JavaScript in the page context

Parameters:
Example:
{
  "expression": "document.title"
}

new_page

Create a new browser page/tab

Parameters:
Example:
{
  "url": "https://example.com"
}

close_page

Close the current page

Parameters: None

๐Ÿงช Testing the Server

Test with curl:

curl -X POST https://playwright.mcp.majewscy.tech/ \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "jsonrpc": "2.0",
    "method": "list_tools",
    "params": {},
    "id": 1
  }'

โ— Common Errors

โœ… Server Status: Running and ready to accept requests