PuppeteerMCP Server is a powerful tool that implements the Model Context Protocol (MCP) to enable AI assistants to interact with web pages. Through this server, AI agents can navigate to URLs, capture screenshots at different viewport sizes, retrieve console logs, detect JavaScript errors, and perform various page interactions like clicking, typing, and scrolling.
# Clone the repository
git clone <repository-url>
cd PuppeteerMCP
# Install dependencies
npm install
# Build the server
npm run build
# Test with MCP inspector
npx @modelcontextprotocol/inspector build/index.js
To use this MCP server with Cursor:
npm run build
Add the MCP server to your Cursor configuration. The exact location depends on your OS:
{
"mcpServers": {
"puppeteer": {
"command": "node",
"args": ["/absolute/path/to/PuppeteerMCP/build/index.js"]
}
}
}
Important: Use the absolute path to your built JavaScript file.
Restart Cursor to load the MCP server. You should see the screenshot tool available in Cursor's AI interface.
In Cursor, you can request screenshots with commands like:
If no breakpoints are specified, the tool uses these standard responsive breakpoints:
The screenshot tool supports executing a sequence of page interactions before capturing screenshots:
{
"url": "https://example.com/login",
"actions": [
{
"type": "type",
"selector": "#username",
"text": "[email protected]"
},
{
"type": "type",
"selector": "#password",
"text": "password123"
},
{
"type": "click",
"selector": "#login-button"
},
{
"type": "waitForElement",
"selector": ".dashboard",
"timeout": 5000
}
]
}
The screenshot tool captures and reports page activity:
Server not appearing in Cursor:
Tool calls failing:
Browser launch failures:
To ensure screenshots work well with Cursor's chat interface:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.