home / mcp / playwright mcp server
Playwright Model Context Protocol Server - Tool to automate Browsers and APIs in Claude Desktop, Cline, Cursor IDE and More π
Configuration
View docs{
"mcpServers": {
"aakashh242-mcp-playwright": {
"command": "npx",
"args": [
"-y",
"@executeautomation/playwright-mcp-server"
],
"env": {
"YOUR_ENV": "PLACEHOLDER"
}
}
}
}Playwright MCP Server is a Model Context Protocol server that enables LLMs to automate and interact with web pages through a real Playwright-driven browser. It supports actions like navigation, taking screenshots, generating tests, and extracting page data, all within a scalable MCP HTTP/gateway workflow.
You run the Playwright MCP Server as a local or HTTP-enabled service and connect your MCP client to it. Use the stdio configuration for a local, in-process server, or enable the HTTP transport to run behind gateways and share artifacts across sessions. The server exposes a set of tools to automate browser actions, capture outputs, and generate tests.
Prerequisites: Node.js and npm (or an alternative package manager that supports npm packages). You will install the MCP server package and run it with a standard command.
# Install globally via npm
npm install -g @executeautomation/playwright-mcp-server
```
```
# Or install and start with npx (no global install required)
npx @executeautomation/playwright-mcp-server
```
```
# Alternative: install via Smithery (if you use Smithery workflow)
npx @smithery/cli install @executeautomation/playwright-mcp-server --client claude
````}]} ,{{
"mcpServers": {
"playwright": {
"command": "npx",
"args": ["-y", "@executeautomation/playwright-mcp-server"]
}
}
}
```
This configuration defines a local, stdio-based server named playwright that you can reference from your MCP client. Use the provided command and arguments exactly as shown to start the server in your environment.You can run the Playwright MCP Server in HTTP mode to work behind gateways and share session artifacts through resource links.
Start in HTTP mode (port and path defaults apply):
npx @executeautomation/playwright-mcp-server --http
```
Override port and path if needed:
```
npx @executeautomation/playwright-mcp-server --http --port 3000 --path /custom-mcpGenerated artifacts (screenshots, PDFs, console logs, and generated tests) are stored under /data/<session>/<resourceId>.<ext> on the server. Each session has isolated resources, and links expire after the configured TTL. Tools return resourceLinks that point to download URLs like http://host:port/path/resources/session/resourceId/filename.
In HTTP mode, you upload files for input elements by first obtaining a session-scoped upload URL, then calling the upload tool with the returned URI.
First, call construct_upload_url to get an upload endpoint, then post the file with multipart/form-data under the field file. After a successful upload, you receive a session-scoped resourceUri, and you pass that to playwright_upload_file to attach the file to your page.
Configure your MCP client (Claude Desktop, VS Code, or other) to point at the server using the mcpServers section you defined above. The command and URL in the example are what you will use to connect.
Use the following flags when running the server to tailor transport, host, and resource settings.
A starter agent prompt is available to guide you in building and testing workflows. Use it as a template and customize for your environment.
Follow standard contribution practices, ensure tooling like pre-commit hooks and lint/tests run cleanly locally, and update documentation when you add or change MCP capabilities.
The Playwright MCP Server can run in a Docker container with browsers and dependencies included. You can pull the image and run in standard Docker or compose for production HTTP usage.
Tests use Jest and cover the serverβs toolset and API. Run tests with the provided scripts to verify behavior and generate coverage reports.
This server exposes tools for browser automation, navigation, interaction, and data extraction. See the tool list in your client to discover all supported commands such as navigate, click, fill, get text, take screenshots, and generate tests.
Open a URL with optional viewport/headless/browser type; browser launches if needed.
Capture a screenshot of the page or a specific element; in HTTP mode, a resource link is returned.
Save the current page as a PDF and obtain a downloadable resource in HTTP mode.
Retrieve browser console logs with optional filters for debugging.
Set a file into an <input type="file"> element; in HTTP mode, upload first via a session-scoped URL.
Return a session-scoped upload URL for HTTP mode to attach uploaded files.
Click on an element with optional selectors and wait strategies.
Fill an input field with a value; supports selectors for targeting elements.
Select an option from a dropdown by value or visible text.
Hover over an element to reveal menus or tooltips.
Drag and drop or drag to a target element.
Press a keyboard key or combination on the active element.
Interact with elements inside an iframe.
Fill inputs inside an iframe context.
Extract visible text content from the page.
Retrieve cleaned visible HTML content.
Override the User-Agent string for browser contexts.
Navigate back in the browser history.
Navigate forward in the browser history.
Close the current page or the browser context.
Execute JavaScript in the page context and return results.
Wait for and validate a network response.
Assert properties of a network response during a test.
HTTP GET helper for API interactions.
HTTP POST helper for API interactions.
HTTP PUT helper for API interactions.
HTTP PATCH helper for API interactions.
HTTP DELETE helper for API interactions.
Begin a code generation session to record Playwright interactions.
End a code generation session and produce reusable tests.