Puppeteer MCP Server Web Automation Guide
Control headless Chromium with the official Puppeteer MCP server. Capture screenshots, automate forms, and scrape dynamic single-page web applications.
claude_desktop_config.json{
"mcpServers": {
"puppeteer": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-puppeteer"
]
}
}
}Generate & Test Puppeteer MCP Server Config
One-click export with environment variables & path locators for Claude Desktop, Cursor, Windsurf, and OpenAI Codex CLI.
Puppeteer MCP Server Web Automation Guide
While standard HTTP fetchers work effectively for static documentation and straightforward REST APIs, modern web platforms increasingly rely on complex client-side rendering engines. Single Page Applications (SPAs) built on React, Angular, and Vue emit empty HTML shells on initial load, hydrating their visual elements through asynchronous JavaScript bundles. When autonomous artificial intelligence agents encounter these platforms, simple HTTP GET requests return empty root containers or impenetrable anti-bot security challenges.
The Puppeteer Model Context Protocol (MCP) server solves this architectural roadblock by bridging local frontier LLMs with a dedicated headless Chromium browser instance. By translating model reasoning loops into real-time DevTools Protocol commands, the Puppeteer server empowers AI agents to execute client-side JavaScript, interact with dynamic DOM trees, capture full-page visual screenshots, and automate multi-step browser workflows.
1. Problem Statement and Architecture
Autonomous browser control requires handling complex asynchronous event loops, DOM state mutation, and heavy process management:
- ▸Hydration and Dynamic Rendering: Modern dashboards and SPAs load content dynamically via WebSocket channels and GraphQL requests. An agent inspecting static markup cannot evaluate the rendered state.
- ▸Visual Verification: Debugging UI regressions, checking responsive design viewports, or inspecting charts requires computer vision or raster image verification that textual HTML alone cannot communicate.
- ▸Complex Form Automation: Interacting with enterprise portals requires synthesizing genuine mouse clicks, focus events, keystroke latencies, and dropdown option selections without triggering bot defenses.
+-----------------------------------------------------------------------------------+
| Client Architecture |
| |
| +--------------------+ JSON-RPC 2.0 (stdio) +-------------------+ |
| | Claude / Cursor | <================================> | server-puppeteer | |
| +--------------------+ +---------+---------+ |
+----------------------------------------------------------------------|------------+
| Chrome DevTools
| Protocol (CDP)
v
+-------------------+
| Headless Chromium |
| (Rendered DOM) |
+-------------------+The @modelcontextprotocol/server-puppeteer daemon launches an isolated Chromium sub-process managed over stdio. When an AI client transmits a JSON-RPC 2.0 tool invocation, the server maps the instruction to corresponding Puppeteer API actions (page.goto(), page.screenshot(), page.click(), page.evaluate()), waits for network idle conditions, and returns structured data or base64-encoded visual buffers to the agent.
2. Prerequisites and Environment Matrix
Running headless Chromium requires adequate system memory, Node.js 18 or later, and the appropriate operating system shared libraries.
| Component | Minimum Version | Recommended | Notes |
|---|---|---|---|
| Node.js | 18.18.0+ | 20.x LTS or 22.x | Required for modern Puppeteer execution |
| Chromium | Bundled | 120.0+ | Downloaded automatically by Puppeteer |
| Memory | 2 GB free | 4 GB+ free | Heavy DOM rendering can consume 1-2 GB RAM |
| Claude Desktop | 0.7.0+ | Latest | Native MCP host with vision support |
| Cursor IDE | 0.42.0+ | Latest | Supports MCP tools in agent composer mode |
| OpenAI Codex CLI | 0.1.0+ | Latest | Command-line tool orchestration runner |
On Debian or Ubuntu Linux environments, install necessary X11 and NSS graphics dependencies:
sudo apt-get update && sudo apt-get install -y \
libnss3 libatk1.0-0 libatk-bridge2.0-0 libcups2 \
libdrm2 libxkbcommon0 libxcomposite1 libxdamage1 \
libxfixes3 libxrandr2 libgbm1 libasound23. Multi-Host Configuration Snippets
The server executes via npx using standard input/output. Below are verified configuration blocks for leading developer hosts.
Claude Desktop
Edit your claude_desktop_config.json (located in ~/Library/Application Support/Claude/ on macOS or %APPDATA%\Claude\ on Windows):
{
"mcpServers": {
"puppeteer": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
}
}
}Cursor IDE
Add the server definition inside .cursor/mcp.json or your global user settings:
{
"mcpServers": {
"puppeteer": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
}
}
}OpenAI Codex CLI
In ~/.codex/config.toml, configure the server entry:
[mcp_servers.puppeteer]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-puppeteer@2025.5.12"]4. Step-by-Step Tool Discovery and Invocation
During MCP protocol initialization, the Puppeteer server exposes a suite of browser manipulation tools:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"tools": [
{
"name": "puppeteer_navigate",
"description": "Navigate to any URL in the browser",
"inputSchema": {
"type": "object",
"properties": {
"url": { "type": "string", "description": "The URL to navigate to" }
},
"required": ["url"]
}
},
{
"name": "puppeteer_screenshot",
"description": "Capture a screenshot of the entire page or a specific selector",
"inputSchema": {
"type": "object",
"properties": {
"name": { "type": "string", "description": "Screenshot identifier name" },
"selector": { "type": "string", "description": "Optional CSS selector to capture" },
"width": { "type": "integer", "default": 1280 },
"height": { "type": "integer", "default": 800 }
},
"required": ["name"]
}
},
{
"name": "puppeteer_click",
"description": "Click an element matching the given CSS selector",
"inputSchema": {
"type": "object",
"properties": {
"selector": { "type": "string", "description": "CSS selector to click" }
},
"required": ["selector"]
}
},
{
"name": "puppeteer_fill",
"description": "Fill out an input field with text value",
"inputSchema": {
"type": "object",
"properties": {
"selector": { "type": "string", "description": "CSS selector to fill" },
"value": { "type": "string", "description": "Value to input" }
},
"required": ["selector", "value"]
}
},
{
"name": "puppeteer_evaluate",
"description": "Execute JavaScript code in the browser context",
"inputSchema": {
"type": "object",
"properties": {
"script": { "type": "string", "description": "JavaScript snippet to execute" }
},
"required": ["script"]
}
}
]
}
}Tool Invocation Wire Frame
When you prompt your agent: "Take a screenshot of the user dashboard at /dashboard", the host initiates:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "puppeteer_screenshot",
"arguments": {
"name": "dashboard-overview",
"width": 1440,
"height": 900
}
}
}The server rasterizes the viewport and responds with an image content block:
{
"jsonrpc": "2.0",
"id": 2,
"result": {
"content": [
{
"type": "image",
"data": "iVBORw0KGgoAAAANSUhEUgAABYAA...",
"mimeType": "image/png"
}
],
"isError": false
}
}5. Common Errors and Production Troubleshooting
1. Error: Could not find Chrome (Missing Browser Revision)
- ▸Symptom: Spawning Puppeteer fails with
Could not find Chrome (sys: ...)immediately on server launch. - ▸Root Cause: When invoked via
npx -yin temporary directories, Puppeteer's postinstall script may not have finished caching the Chromium binaries into~/.cache/puppeteer. - ▸Solution: Explicitly set the
PUPPETEER_EXECUTABLE_PATHenvironment variable in your client configuration to point to an existing system installation of Google Chrome or Brave Browser:
{
"mcpServers": {
"puppeteer": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"],
"env": {
"PUPPETEER_EXECUTABLE_PATH": "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe"
}
}
}
}2. Zombie Chromium Processes Exhausting Host Memory
- ▸Symptom: Host workstation fans spin up and system RAM steadily depletes across multiple coding sessions.
- ▸Root Cause: Abruptly closing the terminal host without graceful termination leaves orphaned
chromeorchromiumprocesses running in the background. - ▸Solution: Periodically verify and clean orphaned browser daemons:
# macOS / Linux
pkill -f "Chromium --headless"
# Windows PowerShell
Get-Process chrome | Where-Object { $_.CommandLine -like "*headless*" } | Stop-Process3. Navigation Timeouts on Dynamic Assets
- ▸Symptom:
puppeteer_navigatethrowsTimeoutError: Navigation timeout of 30000 ms exceeded. - ▸Root Cause: Heavy third-party advertising trackers or infinite network polling prevent the
networkidle0state from completing. - ▸Solution: Utilize
puppeteer_evaluateto navigate viawindow.location.hrefor wait for specific high-priority DOM selectors rather than holding on full network idle.
6. External Citations and Security Guardrails
Running an autonomous headless browser inside your development environment carries inherent security considerations:
- ▸Localhost Isolation: Do not grant unsupervised agents permission to navigate to unauthenticated internal microservices or router management consoles (
192.168.1.1). - ▸Credential Hygiene: Prevent agents from filling stored production passwords or session cookies into public forms.
- ▸Execution Sandboxing: Run Puppeteer in headless mode with sandboxing enabled (
--no-sandboxshould only be used in hardened containerized CI environments).
Weekly Protocol Diffs & Verified Drops
New server guides, benchmarks, and security audits. No spam. Unsubscribe anytime.
Zero marketing spam. 1-click unsubscribe anytime.
Build your full agent toolstack in the Visual Generator
Combine Puppeteer with databases, search APIs, and memory graphs in a single configuration file.
Did this setup guide work with your AI host?
Help test this configuration across Claude, Cursor, and Codex CLI. Be the first to report:
Puppeteer MCP Server Web Automation Guide FAQ
What is the Puppeteer MCP Server Web Automation Guide?
Control headless Chromium with the official Puppeteer MCP server. Capture screenshots, automate forms, and scrape dynamic single-page web applications.
How do I configure Puppeteer MCP Server Web Automation Guide in Claude Desktop or Cursor?
You can copy the configuration JSON from our guide or launch the interactive MCP Codex Config Generator at https://mcp-codex.com/generator to export valid configs in 1 click.
Can I use Puppeteer MCP Server Web Automation Guide with the OpenAI Codex CLI?
Yes, OpenAI Codex CLI supports Model Context Protocol. You can add it directly to ~/.codex/config.toml or pass arguments to codex mcp add.
Specializing in Model Context Protocol (MCP) integrations, autonomous AI agent orchestration, and distributed developer toolchains. Researches and benchmarks production MCP client-server architectures across OpenAI Codex, Claude, and Cursor.
Related Guides
OpenCode Free AI Agent Guide
Guide to running OpenCode coding agent completely free without API keys using Zen free tier, local LLMs, and OAuth accounts.
Dev ToolsSelf-Correcting Verification Loops in Agents
Build robust self-correcting /loop verification harnesses for AI agents using Test-Driven Agent Development, dual-agent critics, and MCP test sandboxes.
Dev ToolsAutomated Doc Verification Loops with Claude CLI
Build automated documentation verification loops with Claude CLI and MCP. Validate code snippets, test tool schemas, and sync SDK docs in CI/CD. Verified.