leonpolak
MCP Serverleonpolakpublic

cursor puppeteer mcp

MCP server for Puppeteer visual testing and feedback

Repository Info

4
Stars
0
Forks
4
Watchers
0
Issues
JavaScript
Language
MIT License
License

About This Server

MCP server for Puppeteer visual testing and feedback

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

Cursor Puppeteer MCP

A Puppeteer-based MCP (Model-Control-Protocol) server for generating visual feedback to Cursor. This tool allows Cursor to:

  1. Visit a local development server URL
  2. Check for errors
  3. Take screenshots of the page or specific elements
  4. Perform actions like clicking on elements
  5. Compare screenshots with expected results

Installation

npm install

How It Works

The MCP server communicates with Cursor using a specific protocol:

  1. Cursor sends a URL and optional parameters to the MCP server
  2. The server launches Puppeteer to visit the URL
  3. Puppeteer performs any specified actions and takes screenshots
  4. The server returns results to Cursor, including screenshot paths
  5. Cursor can analyze the screenshots and delete them when they match the expected output

Usage

From Cursor

In your Cursor prompt, you can ask to use this tool at the end of code generation:

Generate a React counter component. After generating the code, use the Puppeteer tool to take a screenshot of the component.

From Command Line

You can also use the tool directly from the command line:

node src/cursor-integration.js http://localhost:3000 '{"waitTime": 1000}'

Options:

{
  // Wait time in milliseconds before taking screenshot
  "waitTime": 1000,

  // Perform an action before taking screenshot
  "action": {
    "element": { "id": "buttonId" }, // Can also use "class" or "selector"
    "action": "click" // click, hover, focus, type
  },

  // Take screenshot of specific element instead of full page
  "elementToCapture": { "id": "elementId" }
}

API

Taking Screenshots

import { takeScreenshot } from "./src/cursor-client.js";

// Take a full page screenshot
const result = await takeScreenshot("http://localhost:3000", {
  waitTime: 1000,
});

// Take a screenshot after clicking a button
const result = await takeScreenshot("http://localhost:3000", {
  action: {
    element: { id: "exampleButton" },
    action: "click",
  },
});

// Take a screenshot of a specific element
const result = await takeScreenshot("http://localhost:3000", {
  elementToCapture: { id: "content" },
});

Deleting Screenshots

import { deleteScreenshot } from "./src/cursor-client.js";

const deleteResult = await deleteScreenshot("/path/to/screenshot.png");

Integration with Cursor

This tool is designed to seamlessly integrate with Cursor:

  1. Cursor generates code for a project
  2. Cursor starts a local development server
  3. Cursor invokes this tool with the local server URL
  4. The tool visits the URL, performs actions, and takes screenshots
  5. Cursor analyzes the screenshots to check if they match the prompt
  6. Cursor can iteratively improve the code based on visual feedback

Examples

See the examples directory for usage examples.

Quick Start

1

Clone the repository

git clone https://github.com/leonpolak/cursor-puppeteer-mcp
2

Install dependencies

cd cursor-puppeteer-mcp
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerleonpolak
Repocursor-puppeteer-mcp
LanguageJavaScript
LicenseMIT License
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation