Home / MCP / 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.
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.
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.
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-serverStep 2: Alternatively, install via MCP-get to fetch the server package.
npx @michaellatman/mcp-get@latest install @executeautomation/playwright-mcp-serverStep 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 claudeStep 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"]}'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"]
}
}
}Interact with a web page by performing actions such as clicking, typing, navigating, and waiting for selectors within a real Playwright browser context.
Capture screenshots of pages or specific elements to assist visual validation and testing.
Generate test code templates based on observed interactions and page structure to accelerate test creation.
Scrape page content, extract data, and return structured results from the loaded page.
Run arbitrary JavaScript in the context of the loaded page to inspect state or trigger behaviors.