Puppeteer MCP Server
Provides a ChatGPT-compliant MCP endpoint with restricted search and retrieve tools for approved domains.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Puppeteer MCP Server
A headless Chrome automation server built with Next.js and Puppeteer, designed to run on Vercel with multiple cloud browser options. This project provides RESTful API endpoints for web scraping, screenshot capture, PDF generation, and performance monitoring.
š GitHub Repository: https://github.com/axo-mvo/puppeteer-mcp-server
š Live Demo: https://puppeteer-mcp-server.vercel.app
š® Interactive Demo: https://puppeteer-mcp-server.vercel.app/demo
Quick Test
Try the live API right now:
# Take a screenshot
curl "https://puppeteer-mcp-server.vercel.app/api/screenshot-chromium?url=https://example.com" -o screenshot.png
# Extract text content
curl -X POST "https://puppeteer-mcp-server.vercel.app/api/scrape" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com","action":"text"}'Related MCP server: Screenshot API
Project Structure
puppeteer-vercel/
āāā app/
ā āāā api/
ā ā āāā screenshot-browserless/ # Browserless.io API endpoint
ā ā ā āāā route.ts
ā ā āāā screenshot-chromium/ # @sparticuz/chromium API endpoint
ā ā ā āāā route.ts
ā ā āāā scrape/ # Advanced scraping API endpoint
ā ā ā āāā route.ts
ā ā āāā mcp/ # Model Context Protocol endpoint
ā ā āāā route.ts
ā āāā demo/ # Interactive demo page
ā ā āāā page.tsx
ā āāā page.tsx # Main landing page
ā āāā layout.tsx # Root layout
ā āāā globals.css # Global styles
āāā package.json # Dependencies and scripts
āāā next.config.ts # Next.js configuration
āāā tailwind.config.ts # Tailwind CSS configuration
āāā README.md # Project documentationArchitectural Decisions
Browser Execution Options
The project implements two approaches for running headless Chrome in serverless environments:
@sparticuz/chromium (
/api/screenshot-chromium)Self-contained Chromium binary packaged with the function
No external dependencies required
Larger bundle size but more reliable
Works within Vercel's function size limits
Browserless.io (
/api/screenshot-browserless)Connects to managed headless Chrome instances in the cloud
Requires
BLESS_TOKENenvironment variableSmaller function size
Better for high-volume usage
API Design
RESTful endpoints for different functionality
TypeScript interfaces for request/response validation
Comprehensive error handling with proper HTTP status codes
Caching headers for improved performance
Flexible options for customization
Setup Instructions
Prerequisites
Node.js 18+
npm, yarn, or pnpm
Local Development
Clone and install dependencies:
git clone https://github.com/axo-mvo/puppeteer-mcp-server.git cd puppeteer-mcp-server npm installSet up environment variables (for Browserless.io): Create
.env.localfile:BLESS_TOKEN=your_browserless_api_token_hereRun the development server:
npm run devAccess the application:
Main page: http://localhost:3000
Demo page: http://localhost:3000/demo
Deployment to Vercel
Push to GitHub:
git init git add . git commit -m "Initial commit" git remote add origin <your-github-repo-url> git push -u origin mainDeploy to Vercel:
Import your GitHub repository in Vercel dashboard
Add environment variables if using Browserless.io:
BLESS_TOKEN: Your Browserless.io API token
Configure function timeout (optional): Add to
vercel.json:{ "functions": { "app/api/**/route.ts": { "maxDuration": 30 } } }
MCP (Model Context Protocol) Support
This server now supports the Model Context Protocol (MCP), allowing it to be used as a tool server in AI assistants like Cursor, Claude Desktop, and other MCP-compatible clients.
MCP Endpoints
URL: /api/mcp (Full-featured for Cursor, Claude Desktop, etc.)
URL: /api/mcp-compliant (ChatGPT-compliant version with restrictions)
The MCP endpoint provides the following tools:
Tool Name | Description | Parameters |
| Take a screenshot of a web page |
|
| Generate a PDF from a web page |
|
| Extract text content from a web page |
|
| Extract HTML content from a web page |
|
| Get performance metrics for a web page |
|
Adding to AI Assistants
For Cursor/Claude Desktop (Full Version)
Add to your ~/.cursor/mcp.json:
{
"mcpServers": {
"puppeteer-mcp": {
"url": "https://puppeteer-mcp-server.vercel.app/api/mcp",
"transport": "sse"
}
}
}For ChatGPT (Compliant Version)
Use the compliant endpoint with restricted functionality:
Go to ChatGPT Settings ā Connectors ā Create
Add MCP Server URL:
https://puppeteer-mcp-server.vercel.app/api/mcp-compliantOnly tools named
searchandretrieveare available (OpenAI requirement)Access is limited to approved domains for security
Using MCP Tools
Once configured, you can use natural language commands in Cursor:
"Take a screenshot of example.com"
"Generate a PDF of the homepage"
"Extract the title text from this website"
"Get performance metrics for this URL"
API Endpoints
Screenshot APIs
GET /api/screenshot-chromium
Takes screenshots using @sparticuz/chromium.
Parameters:
url(required): URL to capture
Example:
curl "https://your-app.vercel.app/api/screenshot-chromium?url=https://example.com"GET /api/screenshot-browserless
Takes screenshots using Browserless.io.
Parameters:
url(required): URL to capture
Requires: BLESS_TOKEN environment variable
Example:
curl "https://your-app.vercel.app/api/screenshot-browserless?url=https://example.com"Advanced Scraping API
POST /api/scrape
Comprehensive scraping endpoint with multiple actions.
Request Body:
{
url: string;
action: 'screenshot' | 'pdf' | 'text' | 'html' | 'performance';
options?: {
fullPage?: boolean;
selector?: string;
format?: 'A4' | 'Letter';
landscape?: boolean;
waitFor?: number;
viewport?: {
width: number;
height: number;
};
};
}Examples:
Screenshot with custom viewport:
curl -X POST "https://your-app.vercel.app/api/scrape" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"action": "screenshot",
"options": {
"fullPage": true,
"viewport": {"width": 1200, "height": 800}
}
}'Generate PDF:
curl -X POST "https://your-app.vercel.app/api/scrape" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"action": "pdf",
"options": {
"format": "A4",
"landscape": false
}
}'Extract text content:
curl -X POST "https://your-app.vercel.app/api/scrape" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"action": "text",
"options": {
"selector": "h1"
}
}'Environment Variables
Variable | Required | Description |
| No* | Browserless.io API token (*required for browserless endpoints) |
Features
ā Screenshot capture (full page or viewport)
ā PDF generation from web pages
ā Text and HTML content extraction
ā Performance metrics collection
ā Custom viewport and wait options
ā RESTful API endpoints
ā MCP (Model Context Protocol) support
ā TypeScript support
ā Interactive demo interface
ā Multiple browser execution options
ā Comprehensive error handling
ā AI assistant integration (Cursor, Claude Desktop)
Limitations
Function timeout: Vercel free tier has 10-second timeout
Function size: @sparticuz/chromium adds ~50MB to function
Memory usage: Chrome requires significant memory allocation
Concurrent executions: Consider rate limiting for production use
Troubleshooting
Common Issues
Function timeout errors (FUNCTION_INVOCATION_TIMEOUT):
Fixed in latest version: Optimized Chrome args and faster page loading
Uses
domcontentloadedinstead ofnetworkidle0for faster loadingIncreased function timeout to 60 seconds in
vercel.jsonAdded proper browser cleanup to prevent memory leaks
Memory errors:
Close browser instances properly (handled automatically)
Avoid concurrent requests to same function
Function memory set to 1024MB in configuration
Browserless.io connection errors:
Verify
BLESS_TOKENis correctly setCheck Browserless.io service status
Performance Optimizations
The latest version includes several Vercel-specific optimizations:
Faster Chrome startup with optimized arguments
Reduced page load time using
domcontentloadedBetter error handling with automatic browser cleanup
Increased timeouts for complex pages (60s function timeout)
Memory optimization with single-process Chrome mode
Contributing
Fork the repository
Create a feature branch
Make changes and test locally
Submit a pull request
Change Log
2025-06-05: Initial project setup with Next.js 15 and Puppeteer integration
2025-06-05: Added @sparticuz/chromium support for self-contained browser execution
2025-06-05: Implemented Browserless.io integration for cloud browser instances
2025-06-05: Created comprehensive scraping API with multiple action types
2025-06-05: Built interactive demo interface with real-time testing
2025-06-05: Added TypeScript interfaces and comprehensive error handling
2025-06-05: Updated main landing page with feature overview and setup instructions
2025-06-05: Fixed Vercel timeout issues with optimized Chrome args and faster loading
2025-06-05: Increased function timeout to 60s and improved error handling
2025-06-05: Added production URL storage and comprehensive testing suite
2025-06-05: Fixed file download issue - PDFs and images now download with proper extensions (.pdf, .png) instead of generic .file extension
2025-06-05: Added Model Context Protocol (MCP) support with comprehensive tool definitions for AI assistant integration
2025-06-05: Created ChatGPT-compliant MCP endpoint with security restrictions and approved domain whitelist
Testing
Production Testing
Run the comprehensive test suite:
./test-production.shOr test individual endpoints:
# Health check
npm run test:prod
# Screenshot test
npm run test:screenshot
# Open demo page
npm run test:demoManual Testing
Live Endpoints:
Main Site: https://puppeteer-mcp-server.vercel.app/
Demo Page: https://puppeteer-mcp-server.vercel.app/demo
Screenshot API:
https://puppeteer-mcp-server.vercel.app/api/screenshot-chromium?url=https://example.comAdvanced Scraping:
POST https://puppeteer-mcp-server.vercel.app/api/scrape
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
This server cannot be deployed
Maintenance
Related MCP Connectors
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
Capture websites as PNG, JPEG, WebP or PDF, extract their content, or analyse them with AI.
Screenshot, diff, audit and sitemap-capture any web page ā 5 MCP tools for AI agents.
Screenshot, PDF, OG-image, and page extraction (markdown/JSON) over MCP. Bearer key or x402.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to capture screenshots, run visual diffs, accessibility audits, and batch sweep plans for web pages via MCP tools.11 npm2MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to capture any public URL as PNG, JPEG, or PDF via REST API or MCP tools, including screenshot capture, page description, and PDF rendering.12 npmMIT
- AlicenseAqualityCmaintenanceEnables browser automation and web data extraction through MCP tools, including Markdown reading, screenshots, structured data extraction, page inspection, and allowlisted site crawling.1051 npmMIT
- AlicenseAqualityCmaintenanceEnables MCP clients to capture web pages or render HTML as images or PDFs, with screenshots returned inline to the assistant.343 npmMIT