Back to Codex
Dev Tools·
advanced
·11 min read·Apr 4, 2026

How to Use the Puppeteer MCP Server for Web Scraping & Automation

Automate web browsers using the Puppeteer MCP server. Navigate websites, take screenshots, extract data, and automate web interactions through AI.

Puppeteerweb scrapingbrowser automationscreenshotstesting

Use the Puppeteer MCP Server for Web Automation

The Puppeteer MCP server allows AI agents to control a web browser, enabling web scraping, screenshots, form filling, and complex web automation tasks.

Prerequisites

  • Node.js 18+
  • Chrome/Chromium browser
  • Sufficient system memory (Puppeteer can be resource-intensive)

Installation

bash
npm install -g @modelcontextprotocol/server-puppeteer

Configuration

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

Available Tools

ToolDescription
code
puppeteer_navigate
Navigate to a URL
code
puppeteer_screenshot
Capture page screenshot
code
puppeteer_click
Click an element
code
puppeteer_fill
Fill form fields
code
puppeteer_select
Select dropdown options
code
puppeteer_hover
Hover over elements
code
puppeteer_evaluate
Execute JavaScript on page

Example Workflows

Screenshot Capture

code
"Navigate to example.com and take a full-page screenshot"

Data Extraction

code
"Go to the pricing page of competitor.com and extract all plan details into a comparison table"

Form Automation

code
"Fill out the contact form on my-site.com with test data and submit it"

Visual Testing

code
"Take screenshots of my website at mobile, tablet, and desktop widths"

Advanced: JavaScript Evaluation

The

code
puppeteer_evaluate
tool lets you run arbitrary JavaScript in the browser context:

javascript
// Extract all product prices from a page
const prices = document.querySelectorAll('.price');
return Array.from(prices).map(p => p.textContent);

Best Practices

  1. Respect robots.txt: Don't scrape sites that prohibit it
  2. Rate limiting: Add delays between requests to be polite
  3. Error handling: Pages may load differently each time
  4. Resource management: Close the browser when done

Troubleshooting

  • Chrome not found: Set the
    code
    PUPPETEER_EXECUTABLE_PATH
    environment variable
  • Timeout errors: Increase navigation timeout for slow pages
  • Memory issues: Run in headless mode (default) to reduce memory usage