Back to MCP Catalog

Playwright Browser Automation MCP Server

Browser AutomationPython
Automate browser interactions with Playwright
Available Tools

playwright_navigate

Navigates to a specified URL. Creates a new session if none exists.

url

playwright_screenshot

Takes a screenshot of the current page or a specific element.

nameselector

playwright_click

Clicks an element on the page using a CSS selector.

selector

playwright_fill

Fills out an input field with specified value.

selectorvalue

playwright_evaluate

Executes JavaScript code in the browser console.

script

playwright_click_text

Clicks an element on the page by its text content.

text

playwright_get_text_content

Gets the text content of all visible elements.

playwright_get_html_content

Gets the HTML content of a specific element.

selector

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.

Overview

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.

Installation

Prerequisites

Before installing the Playwright Browser Automation MCP, ensure you have:

  • Python 3.8 or higher
  • uv package manager (recommended) or pip

Installation Steps

  1. Install the package using uv or pip:

    uv install playwright-server
    

    or

    pip install playwright-server
    
  2. Configure your AI assistant client to use the MCP server:

For Claude Desktop

  • On MacOS: Edit ~/Library/Application\ Support/Claude/claude_desktop_config.json
  • On Windows: Edit %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.

Usage

Once installed, you can use the Playwright Browser Automation tools in your conversations with the AI assistant. Here are some example commands:

  • "Navigate to example.com and take a screenshot"
  • "Fill out the login form on website.com with my username and password"
  • "Click the 'Submit' button on the current page"
  • "Extract all the text content from the current page"

The AI assistant will use the appropriate tools to perform these actions.

Debugging

Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, use the MCP Inspector:

  1. Install the MCP Inspector using npm:

    npx @modelcontextprotocol/inspector uv --directory PATH_TO_YOUR_PROJECT_DIRECTORY run playwright-server
    
  2. The Inspector will display a URL that you can access in your browser to begin debugging.

Notes

  • The server automatically creates a new browser session if one doesn't exist when you navigate to a URL.
  • Screenshots are saved with the name you specify in the command.
  • For security reasons, be cautious when using this tool with sensitive information or on websites requiring authentication.

Related MCPs

Playwright Browser Automation
Browser AutomationJavaScript

Automate browser interactions, take screenshots, and scrape web content

Playwright Browser Automation
Browser AutomationTypeScript

Browser automation capabilities using Playwright

Puppeteer Browser Automation
Browser AutomationTypeScript

Browser automation tool that enables web interaction, screenshots, and JavaScript execution

About Model Context Protocol

Model Context Protocol (MCP) allows AI models to access external tools and services, extending their capabilities beyond their training data.

Generate Cursor Documentation

Save time on coding by generating custom documentation and prompts for Cursor IDE.