mcp playwright

Local 2025-08-31 23:21:35 0

A Model Context Protocol server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.


smithery badge

A Model Context Protocol server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages, take screenshots, generate test code, web scraps the page and execute JavaScript in a real browser environment.

mcp-playwright MCP server

Screenshot

Playwright + Claude

Documentation | API reference

Installation

You can install the package using either npm, mcp-get, or Smithery:

Using npm:

npm install -g @executeautomation/playwright-mcp-server

Using mcp-get:

npx @michaellatman/mcp-get@latest install @executeautomation/playwright-mcp-server
Using Smithery

To install Playwright MCP for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @executeautomation/playwright-mcp-server --client claude

Configuration to use Playwright Server

Here's the Claude Desktop configuration to use the Playwright server:

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["-y", "@executeautomation/playwright-mcp-server"]
    }
  }
}

Testing

This project uses Jest for testing. The tests are located in the src/__tests__ directory.

Running Tests

You can run the tests using one of the following commands:

# Run tests using the custom script (with coverage)
node run-tests.cjs

# Run tests using npm scripts
npm test           # Run tests without coverage
npm run test:coverage  # Run tests with coverage
npm run test:custom    # Run tests with custom script (same as node run-tests.cjs)

The test coverage report will be generated in the coverage directory.

Star History

Star History Chart

[
  {
    "description": "Navigate to a URL",
    "inputSchema": {
      "properties": {
        "height": {
          "description": "Viewport height in pixels (default: 720)",
          "type": "number"
        },
        "timeout": {
          "description": "Navigation timeout in milliseconds",
          "type": "number"
        },
        "url": {
          "type": "string"
        },
        "waitUntil": {
          "description": "Navigation wait condition",
          "type": "string"
        },
        "width": {
          "description": "Viewport width in pixels (default: 1280)",
          "type": "number"
        }
      },
      "required": [
        "url"
      ],
      "type": "object"
    },
    "name": "playwright_navigate"
  },
  {
    "description": "Take a screenshot of the current page or a specific element",
    "inputSchema": {
      "properties": {
        "downloadsDir": {
          "description": "Custom downloads directory path (default: user's Downloads folder)",
          "type": "string"
        },
        "fullPage": {
          "description": "Store screenshot of the entire page (default: false)",
          "type": "boolean"
        },
        "height": {
          "description": "Height in pixels (default: 600)",
          "type": "number"
        },
        "name": {
          "description": "Name for the screenshot",
          "type": "string"
        },
        "savePng": {
          "description": "Save screenshot as PNG file (default: false)",
          "type": "boolean"
        },
        "selector": {
          "description": "CSS selector for element to screenshot",
          "type": "string"
        },
        "storeBase64": {
          "description": "Store screenshot in base64 format (default: true)",
          "type": "boolean"
        },
        "width": {
          "description": "Width in pixels (default: 800)",
          "type": "number"
        }
      },
      "required": [
        "name"
      ],
      "type": "object"
    },
    "name": "playwright_screenshot"
  },
  {
    "description": "Click an element on the page",
    "inputSchema": {
      "properties": {
        "selector": {
          "description": "CSS selector for the element to click",
          "type": "string"
        }
      },
      "required": [
        "selector"
      ],
      "type": "object"
    },
    "name": "playwright_click"
  },
  {
    "description": "Click an element in an iframe on the page",
    "inputSchema": {
      "properties": {
        "iframeSelector": {
          "description": "CSS selector for the iframe containing the element to click",
          "type": "string"
        },
        "selector": {
          "description": "CSS selector for the element to click",
          "type": "string"
        }
      },
      "required": [
        "iframeSelector",
        "selector"
      ],
      "type": "object"
    },
    "name": "playwright_iframe_click"
  },
  {
    "description": "fill out an input field",
    "inputSchema": {
      "properties": {
        "selector": {
          "description": "CSS selector for input field",
          "type": "string"
        },
        "value": {
          "description": "Value to fill",
          "type": "string"
        }
      },
      "required": [
        "selector",
        "value"
      ],
      "type": "object"
    },
    "name": "playwright_fill"
  },
  {
    "description": "Select an element on the page with Select tag",
    "inputSchema": {
      "properties": {
        "selector": {
          "description": "CSS selector for element to select",
          "type": "string"
        },
        "value": {
          "description": "Value to select",
          "type": "string"
        }
      },
      "required": [
        "selector",
        "value"
      ],
      "type": "object"
    },
    "name": "playwright_select"
  },
  {
    "description": "Hover an element on the page",
    "inputSchema": {
      "properties": {
        "selector": {
          "description": "CSS selector for element to hover",
          "type": "string"
        }
      },
      "required": [
        "selector"
      ],
      "type": "object"
    },
    "name": "playwright_hover"
  },
  {
    "description": "Execute JavaScript in the browser console",
    "inputSchema": {
      "properties": {
        "script": {
          "description": "JavaScript code to execute",
          "type": "string"
        }
      },
      "required": [
        "script"
      ],
      "type": "object"
    },
    "name": "playwright_evaluate"
  },
  {
    "description": "Perform an HTTP GET request",
    "inputSchema": {
      "properties": {
        "url": {
          "description": "URL to perform GET operation",
          "type": "string"
        }
      },
      "required": [
        "url"
      ],
      "type": "object"
    },
    "name": "playwright_get"
  },
  {
    "description": "Perform an HTTP POST request",
    "inputSchema": {
      "properties": {
        "url": {
          "description": "URL to perform POST operation",
          "type": "string"
        },
        "value": {
          "description": "Data to post in the body",
          "type": "string"
        }
      },
      "required": [
        "url",
        "value"
      ],
      "type": "object"
    },
    "name": "playwright_post"
  },
  {
    "description": "Perform an HTTP PUT request",
    "inputSchema": {
      "properties": {
        "url": {
          "description": "URL to perform PUT operation",
          "type": "string"
        },
        "value": {
          "description": "Data to PUT in the body",
          "type": "string"
        }
      },
      "required": [
        "url",
        "value"
      ],
      "type": "object"
    },
    "name": "playwright_put"
  },
  {
    "description": "Perform an HTTP PATCH request",
    "inputSchema": {
      "properties": {
        "url": {
          "description": "URL to perform PUT operation",
          "type": "string"
        },
        "value": {
          "description": "Data to PATCH in the body",
          "type": "string"
        }
      },
      "required": [
        "url",
        "value"
      ],
      "type": "object"
    },
    "name": "playwright_patch"
  },
  {
    "description": "Perform an HTTP DELETE request",
    "inputSchema": {
      "properties": {
        "url": {
          "description": "URL to perform DELETE operation",
          "type": "string"
        }
      },
      "required": [
        "url"
      ],
      "type": "object"
    },
    "name": "playwright_delete"
  }
]