Skip to main content

Better Playwright MCP

Project description

Better Playwright MCP Server

A comprehensive Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright. This server enables AI assistants to interact with web pages through actions like navigation, element interaction, form filling, and page analysis.

Features

  • Browser lifecycle management with Chrome DevTools Protocol (CDP) connection support
  • Element interaction - click, type, extract text/links from web elements
  • Navigation and history management - go to URLs, back/forward, refresh
  • Form input handling with multiple selector types (ID, class, text, placeholder, label)
  • Page snapshots - accessibility tree analysis and visual screenshots
  • Automatic browser cleanup and comprehensive error handling

Installation

Install the package using uv:

uv tool install mudae

Usage

Run the MCP server:

uvx mudae

The server will start and be available for MCP client connections.

Browser Connection

By default, the server attempts to connect to an existing browser instance via Chrome DevTools Protocol (CDP). You can control this behavior with the LOCAL_CDP_URL environment variable:

# Connect to browser running on custom port
LOCAL_CDP_URL=http://localhost:9223 uvx mudae

# Connect to default CDP endpoint (localhost:9222)
uvx mudae

If no existing browser is found at the CDP URL, the server will automatically launch a new browser instance at localhost:9222 by default

Starting a Browser with CDP

To start Chrome/Chromium with CDP enabled for persistent browser sessions:

# Chrome
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug

# Chromium
chromium --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug

Available Tools

The MCP server provides these tools for browser automation:

Navigation

  • navigate - Go to URLs, navigate browser history (back/forward), refresh pages

Element Interaction

  • getElement - Find and interact with page elements (click, get text, extract links, type text)
  • fillInput - Fill form input fields with proper event handling

Page Analysis

  • getSnapshot - Capture page state as accessibility trees or visual screenshots
  • exploreByRole - Explore page sections by ARIA landmark roles

When to Use

This MCP server is ideal when you need an AI assistant to:

  • Automate web workflows - Fill forms, click buttons, navigate between pages
  • Extract web content - Get text, links, and structured data from websites
  • Test web applications - Verify page content and functionality
  • Analyze page accessibility - Understand page structure and interactive elements
  • Take visual snapshots - Capture screenshots for documentation or verification

The server is particularly useful for tasks requiring persistent browser sessions, complex web interactions, or detailed page analysis that goes beyond simple HTTP requests.

Environment Variables

  • LOCAL_CDP_URL - Chrome DevTools Protocol endpoint (default: http://localhost:9222)

Requirements

  • Python 3.8+
  • Playwright (automatically installed with dependencies)

The server handles Playwright browser installation automatically on first run.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mudae-0.1.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mudae-0.1.2-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file mudae-0.1.2.tar.gz.

File metadata

  • Download URL: mudae-0.1.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mudae-0.1.2.tar.gz
Algorithm Hash digest
SHA256 4e3586d41d437874c1352a4ed6c567d22c4d31449b2d4d079c8386f6ceb47fe4
MD5 feb05d2c054ce5ae0a876984871dcb80
BLAKE2b-256 c0c1d48067a30ccb69a8a57370d154596086429f9625cdb177c98c96da4c22d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for mudae-0.1.2.tar.gz:

Publisher: publish.yml on ivanleomk/mudae

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mudae-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mudae-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for mudae-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 81ec2d778929030b94659dd6b719e5bca0a3205d75e6d4724ac029092acffb86
MD5 f7d75ab302d824354a5fb07fd09a39d5
BLAKE2b-256 25b951ecd553c0a96f9c7e8996a7b16ed0f7e8b07931597423f6369ab175471b

See more details on using hashes here.

Provenance

The following attestation bundles were made for mudae-0.1.2-py3-none-any.whl:

Publisher: publish.yml on ivanleomk/mudae

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page