Skip to main content
Glama

Puppeteer MCP Server

Puppeteer MCP Server (Python Implementation)

A Model Context Protocol server that provides browser automation capabilities using Playwright (Python's equivalent to Puppeteer). This server enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.

Overview

This Python implementation provides a stable alternative to the TypeScript version, offering the same capabilities with improved error handling and logging. It uses Playwright, which is the Python equivalent to Puppeteer, providing robust browser automation capabilities.

Key Features

  • Full browser automation
  • Page navigation
  • Screenshot capture (full page or elements)
  • Form interaction (clicking and filling)
  • JavaScript execution
  • Console log monitoring
  • Configurable timeouts
  • Detailed error handling
  • Comprehensive logging

Prerequisites

  • Python 3.8+
  • pip (Python package installer)

Installation

  1. Install the required packages:
pip install -r requirements.txt
  1. Install Playwright browsers:
playwright install

Usage

Starting the Server

Run the server directly:

python puppeteer_server.py

Claude Desktop Configuration

Add this to your Claude configuration file:

{ "mcpServers": { "puppeteer": { "command": "python", "args": ["path/to/puppeteer.py"] } } }

Available Tools

puppeteer_navigate

Navigate to any URL in the browser.

{ "name": "puppeteer_navigate", "arguments": { "url": "https://example.com", "timeout": 60000 // optional, defaults to 60000ms } }

puppeteer_screenshot

Capture screenshots of the entire page or specific elements.

{ "name": "puppeteer_screenshot", "arguments": { "name": "my_screenshot", "selector": "#specific-element", // optional "width": 1280, // optional, default: 1280 "height": 720, // optional, default: 720 "timeout": 30000 // optional, defaults to 30000ms } }

puppeteer_click

Click elements on the page.

{ "name": "puppeteer_click", "arguments": { "selector": ".button-class", "timeout": 30000 // optional, defaults to 30000ms } }

puppeteer_fill

Fill out input fields.

{ "name": "puppeteer_fill", "arguments": { "selector": "#input-id", "value": "text to fill", "timeout": 30000 // optional, defaults to 30000ms } }

puppeteer_evaluate

Execute JavaScript in the browser console.

{ "name": "puppeteer_evaluate", "arguments": { "script": "document.title", "timeout": 30000 // optional, defaults to 30000ms } }

Error Handling

The server provides detailed error messages for common scenarios:

  • Navigation failures
  • Element not found
  • Timeout errors
  • JavaScript execution errors
  • Screenshot failures

Logging

Comprehensive logging is implemented with different levels:

  • INFO: Standard operations
  • ERROR: Operation failures
  • DEBUG: Detailed execution information

Notes

  • Browser launches in non-headless mode for better debugging
  • Default viewport size is 1280x720
  • All timeouts are configurable
  • Console logs are captured and stored
  • Screenshots are stored in memory with base64 encoding

Contributing

Contributions are welcome! Please read the repository's contributing guidelines before submitting pull requests.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.

  1. Overview
    1. Key Features
      1. Prerequisites
        1. Installation
          1. Usage
            1. Starting the Server
            2. Claude Desktop Configuration
          2. Available Tools
            1. puppeteer_navigate
            2. puppeteer_screenshot
            3. puppeteer_click
            4. puppeteer_fill
            5. puppeteer_evaluate
          3. Error Handling
            1. Logging
              1. Notes
                1. Contributing
                  1. License

                    Related MCP Servers

                    • A
                      security
                      A
                      license
                      A
                      quality
                      A Model Context Protocol server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.
                      Last updated a month ago
                      13
                      10,475
                      4,396
                      TypeScript
                      MIT License
                      • Linux
                      • Apple
                    • A
                      security
                      A
                      license
                      A
                      quality
                      A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages, take screenshots, generate test code, scrape web content, and execute JavaScript in real browser environments.
                      Last updated 2 months ago
                      31
                      10,475
                      TypeScript
                      MIT License
                      • Linux
                      • Apple
                    • -
                      security
                      A
                      license
                      -
                      quality
                      A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages through structured accessibility snapshots without needing screenshots or visually-tuned models.
                      Last updated 2 months ago
                      275,350
                      TypeScript
                      Apache 2.0
                      • Apple
                      • Linux
                    • A
                      security
                      F
                      license
                      A
                      quality
                      A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages through structured accessibility snapshots without requiring screenshots or visually-tuned models.
                      Last updated a month ago
                      25
                      275,350
                      • Apple
                      • Linux

                    View all related MCP servers

                    MCP directory API

                    We provide all the information about MCP servers via our MCP API.

                    curl -X GET 'https://glama.ai/api/mcp/v1/servers/twolven/mcp-server-puppeteer-py'

                    If you have feedback or need assistance with the MCP directory API, please join our Discord server