Dev Tools·
advanced
·11 min read·Apr 4, 2026How 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-puppeteerConfiguration
json
{
"mcpServers": {
"puppeteer": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
}
}
}Available Tools
| Tool | Description |
|---|---|
code | Navigate to a URL |
code | Capture page screenshot |
code | Click an element |
code | Fill form fields |
code | Select dropdown options |
code | Hover over elements |
code | 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_evaluatejavascript
// Extract all product prices from a page
const prices = document.querySelectorAll('.price');
return Array.from(prices).map(p => p.textContent);Best Practices
- ▸Respect robots.txt: Don't scrape sites that prohibit it
- ▸Rate limiting: Add delays between requests to be polite
- ▸Error handling: Pages may load differently each time
- ▸Resource management: Close the browser when done
Troubleshooting
- ▸Chrome not found: Set the environment variablecode
PUPPETEER_EXECUTABLE_PATH - ▸Timeout errors: Increase navigation timeout for slow pages
- ▸Memory issues: Run in headless mode (default) to reduce memory usage