Navigates to a specified URL. Creates a new session if none exists.
Takes a screenshot of the current page or a specific element.
Clicks an element on the page using a CSS selector.
Fills out an input field with specified value.
Executes JavaScript code in the browser console.
Clicks an element on the page by its text content.
Gets the text content of all visible elements.
Gets the HTML content of a specific element.
Playwright Browser Automation provides a comprehensive set of tools for automating web browser interactions. It allows you to navigate websites, take screenshots, interact with elements, and execute JavaScript directly from your AI assistant. This MCP server leverages the power of Playwright to enable sophisticated web automation tasks without requiring you to write code. Whether you need to fill forms, click buttons, extract content, or capture visual information from websites, this tool provides the necessary functionality in an accessible interface.
Playwright Browser Automation is a Model Context Protocol (MCP) server that enables AI assistants to interact with web browsers. It provides a set of tools for navigating websites, capturing screenshots, interacting with page elements, and executing JavaScript.
Before installing the Playwright Browser Automation MCP, ensure you have:
uv
package manager (recommended) or pipInstall the package using uv or pip:
uv install playwright-server
or
pip install playwright-server
Configure your AI assistant client to use the MCP server:
~/Library/Application\ Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
Add the following configuration:
"mcpServers": {
"playwright-server": {
"command": "uvx",
"args": [
"playwright-server"
]
}
}
For development or unpublished servers, use:
"mcpServers": {
"playwright-server": {
"command": "uv",
"args": [
"--directory",
"PATH_TO_YOUR_PROJECT_DIRECTORY",
"run",
"playwright-server"
]
}
}
Replace PATH_TO_YOUR_PROJECT_DIRECTORY
with the actual path to the directory containing the project.
Once installed, you can use the Playwright Browser Automation tools in your conversations with the AI assistant. Here are some example commands:
The AI assistant will use the appropriate tools to perform these actions.
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, use the MCP Inspector:
Install the MCP Inspector using npm:
npx @modelcontextprotocol/inspector uv --directory PATH_TO_YOUR_PROJECT_DIRECTORY run playwright-server
The Inspector will display a URL that you can access in your browser to begin debugging.