Puppeteer MCP — Headless Chrome Server for AI Agents
MCP server wrapping Google Puppeteer for headless Chrome automation. Navigate pages, screenshot, generate PDFs, scrape SPAs, and test web apps through AI agent commands. 2,000+ stars.
What it is
Puppeteer MCP is a Model Context Protocol server that wraps Google's Puppeteer library for headless Chrome automation. It gives AI agents the ability to navigate web pages, take screenshots, generate PDFs, scrape single-page applications, and run web tests through natural language commands. The agent controls a real Chrome browser instance programmatically.
The server targets developers who want their AI coding assistant to interact with web pages during development. Use cases include visual regression testing, data extraction from SPAs, PDF generation, and automated form testing.
How it saves time or tokens
Puppeteer MCP removes the need to write Puppeteer scripts for one-off browser tasks. Instead of coding navigation sequences, element selectors, and screenshot logic, you describe the task to your AI agent. The agent translates your request into Puppeteer API calls, executes them, and returns the results. For visual QA and scraping tasks, this reduces a 20-line script to a single sentence.
How to use
- Add the Puppeteer MCP server to your
.mcp.json:
{
"mcpServers": {
"puppeteer": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-puppeteer"]
}
}
}
- Restart Claude Code to load the server.
- Ask the agent to perform browser tasks: 'Take a screenshot of https://tokrepo.com and describe the layout.'
Example
Common automation tasks with Puppeteer MCP:
# Screenshot a page
'Take a full-page screenshot of https://example.com'
# Generate a PDF
'Generate a PDF of the pricing page at https://example.com/pricing'
# Scrape dynamic content
'Extract all product names and prices from https://store.example.com'
# Test a form
'Fill out the contact form at https://example.com/contact with test data and submit'
# Visual comparison
'Take screenshots of the homepage on mobile and desktop viewports'
The agent manages the browser lifecycle, element selection, and data extraction automatically.
Related on TokRepo
- MCP Chrome Integration — Chrome DevTools Protocol MCP server for browser debugging
- AI Tools for Browser Automation — Browser automation tools for testing and scraping
Common pitfalls
- Headless Chrome requires Chromium to be installed. The npx command downloads it automatically, but this adds a significant first-run delay.
- SPAs with lazy loading need explicit scroll or wait commands before content extraction. Tell the agent to 'scroll to the bottom and wait for all content to load.'
- Some websites block headless browsers with bot detection. Puppeteer's headless mode can be detected by sophisticated anti-bot systems.
- Always check the official documentation for the latest version-specific changes and migration guides before upgrading in production environments.
Frequently Asked Questions
Puppeteer MCP uses Google's Puppeteer library and is Chromium-only. Playwright MCP uses Microsoft's Playwright and supports Chromium, Firefox, and WebKit. Puppeteer is lighter weight; Playwright provides better cross-browser coverage.
Yes. The server can generate PDFs from any web page. This is useful for creating PDF exports of dashboards, reports, or documentation pages rendered in the browser.
Yes. You can ask the agent to emulate specific device viewports for responsive testing. This lets you take screenshots at mobile, tablet, and desktop sizes from a single command.
Yes. Puppeteer runs a real Chrome browser, so it executes JavaScript fully. This makes it effective for scraping SPAs, dynamic content, and pages that require JavaScript for rendering.
By default, Puppeteer runs in headless mode (no visible browser window). This is suitable for server environments and CI/CD. Headed mode can be configured for debugging if you need to see the browser.
Citations (3)
- Puppeteer MCP GitHub— Puppeteer MCP server for AI agent browser automation
- Puppeteer Documentation— Google Puppeteer headless Chrome library
- MCP Documentation— Model Context Protocol for tool integration