mcpField
P
Puppeteer MCP

Puppeteer MCP

Local
github.com/iatsiukBrowser Automation0Updated 42w ago

About Puppeteer MCP

Puppeteer MCP is a browser automation MCP server for developers and coding agents. Its single `execute` tool runs custom JavaScript with access to the Puppeteer Browser API, including across persistent sessions.

Key features

  1. 01Run JavaScript through one `execute` tool
  2. 02Access the Puppeteer Browser API
  3. 03Reuse browser sessions across calls
  4. 04Configure headless mode and viewport
  5. 05Pass custom flags to Chrome

Use cases

  1. 01Automate multi-step browser workflows
  2. 02Scrape content from web pages
  3. 03Test web applications with Puppeteer

MCP support

It exposes an `execute` tool to MCP clients, running supplied JavaScript in a Node.js VM with a `browser` global. The VM is not a security sandbox; the project is intended for trusted local development.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"pptr": {
"command": "npx",
"args": [
"-y",
"pptr-mcp"
]
}
}
}
Run commandnpx -y pptr-mcp

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npmpptr-mcp

Tools

1

Saved tool list · updated 3w ago

ParameterTypeRequiredDescription
codestringYesJavaScript code to execute. Return JSON-serializable data
persistentbooleanNoReuse browser profile across calls; false creates isolated profile per call

Details

From the project README

pptr-mcp

MCP server for browser automation via Puppeteer. Unlike other browser MCPs that expose fixed tools (navigate, click, screenshot), this server executes arbitrary JavaScript code with direct access to the Puppeteer Browser instance.

Key Difference

Most browser MCP servers provide a limited set of predefined actions. This approach requires multiple round-trips for complex workflows and can't handle edge cases.

pptr-mcp takes a different approach: it exposes a single execute tool that runs your JavaScript code in a Node.js VM with a browser global. You write Puppeteer code directly, getting full API access in one call.

Traditional MCP (5 round-trips)         pptr-mcp (1 round-trip)
================================        ================================

  Agent           Server                  Agent           Server
    |                |                      |                |
    |-- navigate --->|                      |-- execute ---->|
    |<-- ok ---------|                      |                |
    |                |                      |   +------------------------+
    |-- waitFor ---->|                      |   | const page = await     |
    |<-- ok ---------|                      |   |   browser.newPage();   |
    |                |                      |   | await page.goto(url);  |
    |-- click ------>|                      |   | await page.click(s);   |
    |<-- ok ---------|                      |   | await page.type(i, t); |
    |                |                      |   | return await           |
    |-- type ------->|                      |   |   page.screenshot();   |
    |<-- ok ---------|                      |   +------------------------+
    |                |                      |                |
    |-- screenshot ->|                      |<-- result -----|
    |<-- image ------|                      |                |
    |                |                      |                |

Requirements

  • Node.js >= 20

Installation

npm install -g pptr-mcp

MCP Configuration

Add to your MCP client config (e.g., Claude Desktop):

{
  "mcpServers": {
    "puppeteer": {
      "command": "npx",
      "args": ["pptr-mcp"]
    }
  }
}

With CLI options:

{
  "mcpServers": {
    "puppeteer": {
      "command": "npx",
      "args": ["pptr-mcp", "--no-headless", "--viewport=1080p"]
    }
  }
}

With custom Chrome flags (after --):

{
  "mcpServers": {
    "puppeteer": {
      "command": "npx",
      "args": [
        "pptr-mcp",
        "--viewport=1280x720",
        "--",
        "--proxy-server=http://proxy:8080"
      ]
    }
  }
}

CLI Options

OptionDescription
--no-headlessRun with visible browser window
--viewport=VALUESet viewport size (e.g., 1920x1080 or 1080p)
--help, -hShow help
-- [args]Pass remaining args to Chrome

Unknown options before -- are also passed to Chrome.

Claude Code Plugin

Install as a Claude Code plugin:

/plugin marketplace add iatsiuk/pptr-mcp
/plugin install pptr-mcp@pptr-mcp

Environment Variables

VariableDescription
CHROME_PATHPath to Chrome executable
PUPPETEER_EXECUTABLE_PATHAlternative to CHROME_PATH
PUPPETEER_CACHE_DIRBrowser download cache directory
PPTR_MCP_TIMEOUTExecution timeout in ms (default: 30000)

Tool: execute

Executes JavaScript code with access to Puppeteer browser.

Parameters
NameTypeDefaultDescription
codestringrequiredJavaScript code to execute
persistentbooleantrueReuse browser session across calls

Recipes

Disable headless mode

Show browser window during execution:

{
  "mcpServers": {
    "puppeteer": {
      "command": "npx",
      "args": ["pptr-mcp", "--no-headless"]
    }
  }
}
Custom Chrome profile directory

Use your own Chrome profile with saved logins and cookies:

{
  "mcpServers": {
    "puppeteer": {
      "command": "npx",
      "args": ["pptr-mcp", "--", "--user-data-dir=/path/to/profile"]
    }
  }
}
Use system Chrome instead of downloaded

By default, pptr-mcp downloads Chrome for Testing - a version optimized and tested for the bundled Puppeteer. To use your system Chrome instead:

{
  "mcpServers": {
    "puppeteer": {
      "command": "npx",
      "args": ["pptr-mcp"],
      "env": {
        "CHROME_PATH": "/path/to/chrome"
      }
    }
  }
}

Security

This server is designed for trusted local development with LLM assistants (Claude Code, Cursor, etc.). The executing code comes from the LLM at your request.

What this means
  • Not a sandbox: The Node.js VM isolates code for convenience, not security. It is not designed to run untrusted code.
  • Full browser control: Executed code can navigate to any URL, read page content, take screenshots, and interact with web applications.
  • Chrome runs without sandbox: --no-sandbox flag is used for Docker/container compatibility.
  • Persistent sessions: With persistent: true (default), cookies and browser state are preserved across calls. Use persistent: false for isolation.
Not designed for
  • Multi-tenant or shared server deployments
  • Executing untrusted code from external sources
  • Building web services that accept arbitrary user input

License

WTFPL

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.