Labsco
code-craka logo

Puppeteer

β˜… 4

from code-craka

Browser automation using Puppeteer, with support for local, Docker, and Cloudflare Workers deployments.

πŸ”₯πŸ”₯πŸ”₯πŸ”₯βœ“ VerifiedFreeAdvanced setup

Puppeteer MCP Server

A comprehensive Model Context Protocol (MCP) server that provides browser automation capabilities using Puppeteer. This server enables Large Language Models (LLMs) to interact with web pages, take screenshots, and execute JavaScript in both local and cloud environments.

License: MIT TypeScript Node.js Docker Cloudflare Workers

πŸš€ Features

Core Capabilities

  • Browser Automation: Navigate, click, fill forms, and interact with web pages
  • Screenshot Capture: Take full-page or element-specific screenshots
  • JavaScript Execution: Run custom scripts in browser context
  • Console Monitoring: Capture and access browser console logs
  • Resource Management: Store and retrieve screenshots and logs
  • Security Controls: Configurable dangerous argument filtering

Deployment Options

  • Local Development: Direct Puppeteer integration with Chromium
  • Docker Container: Containerized deployment with ARM64 support
  • Cloudflare Workers: Cloud deployment using external browser services

πŸ› οΈ Available Tools

Navigation & Interaction

  • puppeteer_navigate - Navigate to URLs with optional launch options
  • puppeteer_click - Click elements using CSS selectors
  • puppeteer_hover - Hover over elements
  • puppeteer_fill - Fill input fields and forms
  • puppeteer_select - Select dropdown options

Content & Automation

  • puppeteer_screenshot - Capture page or element screenshots
  • puppeteer_evaluate - Execute JavaScript in browser context

Resources

  • console://logs - Access browser console output
  • screenshot://<name> - Retrieve captured screenshots

πŸ—οΈ Development

Local Development

# Clone the repository
git clone https://github.com/code-craka/puppeteer-mcp.git
cd puppeteer-mcp

# Install dependencies
npm install

# Development with watch mode
npm run watch

# Build for production
npm run build

Docker Development

# Build Docker image
docker build -t puppeteer-mcp .

# Run with environment variables
docker run -i --rm --init \
  -e DOCKER_CONTAINER=true \
  -e PUPPETEER_LAUNCH_OPTIONS='{"headless":true}' \
  puppeteer-mcp

πŸ” Security

Default Security Measures

  • Dangerous browser arguments are filtered by default
  • Configurable security levels via environment variables
  • Headless mode in Docker containers
  • Scoped permissions for different deployment environments
  • Latest Updates: All dependencies updated, 0 security vulnerabilities
  • Secure Build: esbuild v0.25.0+ and Wrangler v4.22.0 with latest patches

Dangerous Arguments (Filtered by Default)

  • --no-sandbox
  • --disable-setuid-sandbox
  • --single-process
  • --disable-web-security
  • --ignore-certificate-errors

Override with ALLOW_DANGEROUS=true environment variable.

πŸ“‹ Examples

Basic Screenshot

{
  "name": "puppeteer_screenshot",
  "arguments": {
    "name": "example-page",
    "width": 1280,
    "height": 720
  }
}

Navigate and Interact

{
  "name": "puppeteer_navigate",
  "arguments": {
    "url": "https://example.com",
    "launchOptions": {
      "headless": false
    }
  }
}

Execute JavaScript

{
  "name": "puppeteer_evaluate",
  "arguments": {
    "script": "return document.title;"
  }
}

πŸ“Š Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   MCP Client    β”‚    β”‚  Puppeteer MCP   β”‚    β”‚   Browser       β”‚
β”‚  (Claude, etc.) │◄──►│     Server       │◄──►│  (Chromium)     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                β”‚
                                β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚  Cloud Services  β”‚
                       β”‚ (Browserless.io) β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit your changes: git commit -m 'Add amazing feature'
  4. Push to the branch: git push origin feature/amazing-feature
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ”— Related Projects

πŸ“ž Support

🏷️ Version History

  • v1.0.0 - Initial release with local Puppeteer support
  • v1.1.0 - Added Docker support and ARM64 compatibility
  • v1.2.0 - Cloudflare Workers adaptation with external browser services
  • v1.3.0 - βœ… Live Production Deployment - Successfully deployed on Cloudflare Workers with Browserless.io integration, tested and confirmed working
  • v1.4.0 - πŸ”’ Security & Performance Update - Updated Wrangler to v4.22.0, fixed esbuild vulnerabilities, added observability logs, resolved all npm audit issues (0 vulnerabilities)

Author: Sayem Abdullah Rihan
License: MIT
Repository: github.com/code-craka/puppeteer-mcp