Home / MCP / Playwright MCP Server

Playwright MCP Server

Provides browser automation via Playwright for MCP clients, enabling page interactions, screenshots, test code generation, web scraping, and in-page JavaScript execution.

typescript
Installation
Add the following to your MCP client configuration file.

Configuration

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

Playwright MCP Server lets you control a real Playwright browser from your MCP client, enabling web page interactions, screenshots, test code generation, page scraping, and in-page JavaScript execution. It is designed to be used by large language model agents to automate browser tasks in a secure, disposable environment.

How to use

You connect your MCP client to the Playwright MCP Server using a configured server entry. Once connected, you can instruct the agent to interact with web pages, capture screenshots, generate test code, scrape page content, and run JavaScript in a real browser context. Use clear prompts to specify the target URL, actions to perform, and any data you want returned from the page.

Common usage patterns include: navigating to a page and extracting specific elements, taking screenshots for visual validation, generating test code based on observed UI interactions, and running JavaScript to query dynamic behavior. Keep prompts concise and rely on the server to execute actions in the Playwright environment.

How to install

Prerequisites: you need Node.js and npm installed on your system. You will also use a package or tool to run the MCP server via command line.

Step 1: Install the Playwright MCP Server globally using npm or a convenience installer.

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

Step 2: Alternatively, install via MCP-get to fetch the server package.

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

Step 3: If you prefer Smithery for installation, run the Smithery command to install the server for Claude Desktop.

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

Step 4: For VS Code users, install the Playwright MCP server through the VS Code extension workflow. You can add the MCP via the command line interface as shown here.

# For VS Code
code --add-mcp '{"name":"playwright","command":"npx","args":["-y", "@executeautomation/playwright-mcp-server"]}'
```

```
# For VS Code Insiders
code-insiders --add-mcp '{"name":"playwright","command":"npx","args":["-y", "@executeautomation/playwright-mcp-server"]}'

Configuration to use Playwright Server

Configure your MCP client to reference the Playwright MCP server with a straightforward stdio setup. The server uses npx to launch the package and passes the server package as an argument.

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

Available tools

interactWithPage

Interact with a web page by performing actions such as clicking, typing, navigating, and waiting for selectors within a real Playwright browser context.

takeScreenshot

Capture screenshots of pages or specific elements to assist visual validation and testing.

generateTestCode

Generate test code templates based on observed interactions and page structure to accelerate test creation.

webScrape

Scrape page content, extract data, and return structured results from the loaded page.

executeJavaScript

Run arbitrary JavaScript in the context of the loaded page to inspect state or trigger behaviors.