Puppeteer MCP Server

Puppeteer MCP Server

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.

twolven

Browser Automation
Local
Python
Visit Server

README

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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Excel MCP Server

Excel MCP Server

A Model Context Protocol server that enables AI assistants to read from and write to Microsoft Excel files, supporting formats like xlsx, xlsm, xltx, and xltm.

Featured
Local
Go
Playwright MCP Server

Playwright MCP Server

Provides a server utilizing Model Context Protocol to enable human-like browser automation with Playwright, allowing control over browser actions such as navigation, element interaction, and scrolling.

Featured
Local
TypeScript
@kazuph/mcp-fetch

@kazuph/mcp-fetch

Model Context Protocol server for fetching web content and processing images. This allows Claude Desktop (or any MCP client) to fetch web content and handle images appropriately.

Featured
Local
JavaScript
Claude Code MCP

Claude Code MCP

An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.

Featured
Local
JavaScript
Apple MCP Server

Apple MCP Server

Enables interaction with Apple apps like Messages, Notes, and Contacts through the MCP protocol to send messages, search, and open app content using natural language.

Featured
Local
TypeScript
DuckDuckGo MCP Server

DuckDuckGo MCP Server

A Model Context Protocol (MCP) server that provides web search capabilities through DuckDuckGo, with additional features for content fetching and parsing.

Featured
Python
YouTube Transcript MCP Server

YouTube Transcript MCP Server

This server retrieves transcripts for given YouTube video URLs, enabling integration with Goose CLI or Goose Desktop for transcript extraction and processing.

Featured
Python
serper-search-scrape-mcp-server

serper-search-scrape-mcp-server

This Serper MCP Server supports search and webpage scraping, and all the most recent parameters introduced by the Serper API, like location.

Featured
TypeScript