Skip to main content

Playwright MCP Server Python

logo 512px

A Python Model Context Protocol (MCP) server that provides browser automation capabilities using Playwright. This server exposes a set of tools for navigating, interacting with, and extracting data from web pages.

Note: This is an independent, community-maintained Python implementation. It is not affiliated with, endorsed by, or derived from Microsoft's official Playwright MCP server (which is a Node.js/TypeScript project using accessibility snapshots). This project uses Playwright's standard Python API directly.

Features

  • Navigation: Navigate to URLs, go back/forward, reload pages
  • Interaction: Click elements, type text, wait for selectors
  • Extraction: Get text content, page HTML, page title, URL
  • Screenshots: Take full-page or element screenshots (base64 PNG via MCP resources)
  • Multi-page: Create and switch between multiple browser pages
  • JavaScript Evaluation: Execute arbitrary JS in page context

Installation

Obtain development version from https://github.com/themanyone/playwright-mcp-server-python.git

git clone https://github.com/themanyone/playwright-mcp-server-python.git
cd playwright-mcp-server-python

# From source
pip install -e .

# Or install with dev dependencies
pip install -e ".[dev]"

# Install Playwright browsers
playwright install chromium

Usage

As an MCP Server (stdio)

# Run with default settings (headless chromium)
playwright-mcp

# Run with custom options
playwright-mcp --headed --browser firefox --timeout 60000

# With additional browser args
playwright-mcp --browser-arg "--disable-web-security" --browser-arg "--no-sandbox"

As a Library

from playwright_mcp import create_server, ServerConfig, BrowserConfig

# Custom configuration
config = ServerConfig(
    browser=BrowserConfig(
        headless=True,
        browser_type="chromium",
    ),
    default_timeout=30000,
)

server = create_server(config)
await server.run_stdio()

Available Tools

Tool Description
navigate Navigate to a URL
click Click on an element by selector
type Type text into an input element
get_text Get text content from an element
get_page_content Get the current page HTML content
take_screenshot Take a screenshot of page or element
new_page Create a new browser page
switch_page Switch to a different browser page
get_pages List all available browser pages
wait_for_selector Wait for an element to be visible
evaluate Evaluate JavaScript in page context
get_title Get the page title
get_url Get the current page URL
go_back Navigate back in history
go_forward Navigate forward in history
reload Reload the current page

Resources

The server exposes screenshot resources at URIs like screenshot://{page_id}.

Configuration

BrowserConfig

Option Type Default Description
headless bool True Run browser in headless mode
browser_type str "chromium" Browser engine (chromium, firefox, webkit)
args tuple[str] () Additional browser launch arguments
slow_mo float 0.0 Slow down operations by ms
devtools bool False Open DevTools on launch

ServerConfig

Option Type Default Description
name str "playwright-mcp" Server name
version str "0.2.0" Server version
browser BrowserConfig BrowserConfig() Browser configuration
default_timeout float 30000.0 Default timeout in ms

Development

# Run tests
pytest

# Type checking
mypy playwright_mcp

# Linting
ruff check playwright_mcp

# Format
ruff format playwright_mcp

Architecture

playwright_mcp/
├── config.py       # Configuration dataclasses
├── browser.py      # Browser lifecycle management
├── tools.py        # Tool definitions (MCP schema)
├── executor.py     # Tool execution logic
├── handlers.py     # MCP request handlers
├── server.py       # Main server class
├── cli.py          # Command-line interface
└── __main__.py     # Entry point

Relationship to Other Projects

Project Language Approach MCP Transport
This project Python Direct Playwright API stdio
microsoft/playwright-mcp Node.js/TypeScript Accessibility snapshots stdio / SSE
microsoft/playwright-cli Node.js CLI + Skills N/A (CLI)

License

Playwright® is a trademark of Microsoft Corporation. This project is an independent implementation using the Playwright Python library under its Apache 2.0 license.

This project includes the Playwright library (also Apache 2.0 licensed by Microsoft Corporation). See NOTICE for attribution details.

Blame

Mostly vibe-coded "from scratch" with crush agent using NVIDIA: Nemotron 3 Ultra. And without consulting the original Node.js/TypeScript that had no Fedora package at the time, and could not be fixed to work with crush. Some bits contributed by themanyone. Examine source code before running. Use at your own risk.

Thanks for trying out Playwright MCP Server Python!

Metadata

Release files for playwright-mcp-server-hellork 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for playwright-mcp-server-hellork 0.2.1
File Size Uploaded Provenance Actions
playwright_mcp_server_hellork-0.2.1.tar.gz 18.6 kB Without provenance Details for playwright_mcp_server_hellork-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for playwright-mcp-server-hellork 0.2.1
File Interpreter ABI Platform Actions
playwright_mcp_server_hellork-0.2.1-py3-none-any.whl Python 3 none any Details for playwright_mcp_server_hellork-0.2.1-py3-none-any.whl

Total release size: 64.5 kB

Release files / playwright_mcp_server_hellork-0.2.1.tar.gz

Download URL playwright_mcp_server_hellork-0.2.1.tar.gz
Size 18.6 kB
Tags Source
SHA-256 checksum
How to use checksums
005f19bc3e0f46ba7eb705bdb3d43b307180a6082b0230c30e1bd157897402f2
BLAKE2b-256 checksum
How to use checksums
b3050b4a387ecac93e2b142d44291515c95d81804cf3d4b95ec5f93abd4c2a98
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / playwright_mcp_server_hellork-0.2.1-py3-none-any.whl

Download URL playwright_mcp_server_hellork-0.2.1-py3-none-any.whl
Size 45.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
038d8739b1b81fcd97d57507b63e5816aa1382776877c74cd19936696eddbaba
BLAKE2b-256 checksum
How to use checksums
6f3cedbf2616ab6bf4262b1562b0ce5c4cf3e7fc5d0e8fc82bf20ed09eb634ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for playwright-mcp-server-hellork 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page