Puppeteer MCP server

Integrates Puppeteer-based browser automation for web scraping, testing, and AI model interaction with live web content.
Back to servers
Provider
J Waldor
Release date
Jan 07, 2025
Language
TypeScript
Stats
1 star

This MCP Puppeteer server enables browser automation capabilities for LLMs, allowing interaction with web pages, screenshot capture, and JavaScript execution in a real browser environment.

Installation

You can run the MCP Puppeteer server using either Docker or NPX. Each method has a different configuration approach.

Docker Installation

The Docker implementation uses headless Chromium:

{
  "mcpServers": {
    "puppeteer": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "--init", "-e", "DOCKER_CONTAINER=true", "mcp/puppeteer"]
    }
  }
}

NPX Installation

The NPX version will open a browser window:

{
  "mcpServers": {
    "puppeteer": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-puppeteer"]
    }
  }
}

Available Tools

The Puppeteer server provides several tools for browser automation:

Navigation and Interaction

  • puppeteer_navigate - Navigate to any URL

    // Example: Navigate to Google
    {
      "url": "https://www.google.com"
    }
    
  • puppeteer_click - Click elements on a page

    // Example: Click a button with id="submit"
    {
      "selector": "#submit"
    }
    
  • puppeteer_hover - Hover over elements

    // Example: Hover over a dropdown menu
    {
      "selector": ".dropdown-menu"
    }
    

Form Manipulation

  • puppeteer_fill - Fill input fields

    // Example: Fill a search box
    {
      "selector": "input[name='q']",
      "value": "search term"
    }
    
  • puppeteer_select - Select an option from a dropdown

    // Example: Select an option from a dropdown
    {
      "selector": "select#country",
      "value": "USA"
    }
    

Visual and Scripting

  • puppeteer_screenshot - Capture screenshots

    // Example: Capture full page screenshot
    {
      "name": "homepage",
      "width": 1280,
      "height": 800
    }
    
    // Example: Capture specific element
    {
      "name": "login-form",
      "selector": "#login-form"
    }
    
  • puppeteer_evaluate - Execute JavaScript code

    // Example: Extract page title
    {
      "script": "return document.title;"
    }
    

Accessing Resources

The server provides two types of resources:

Console Logs

Access browser console logs via the resource ID console://logs. This provides all console messages from the browser in text format.

Screenshots

Access captured screenshots via the resource ID screenshot://<name>, where <name> is the name specified during capture. These resources are PNG images.

Usage Examples

Complete Web Interaction Workflow

This example shows how to navigate to a website, fill out a form, and take a screenshot:

  1. Navigate to a website:

    // puppeteer_navigate
    {
      "url": "https://example.com/login"
    }
    
  2. Fill out username and password fields:

    // puppeteer_fill for username
    {
      "selector": "#username",
      "value": "testuser"
    }
    
    // puppeteer_fill for password
    {
      "selector": "#password",
      "value": "password123"
    }
    
  3. Click the login button:

    // puppeteer_click
    {
      "selector": "#login-button"
    }
    
  4. Take a screenshot of the logged-in page:

    // puppeteer_screenshot
    {
      "name": "logged-in-page",
      "width": 1280,
      "height": 800
    }
    
  5. Access the screenshot using resource ID screenshot://logged-in-page

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later