The Puppeteer MCP Server is a Python implementation of the Model Context Protocol that enables language models to interact with web browsers. This server provides browser automation capabilities through Playwright, allowing LLMs to navigate web pages, capture screenshots, fill forms, and execute JavaScript in a real browser environment.
pip install -r requirements.txt
playwright install
Run the server directly with the following command:
python puppeteer_server.py
To configure the server with Claude Desktop, add the following to your Claude configuration file:
{
"mcpServers": {
"puppeteer": {
"command": "python",
"args": ["path/to/puppeteer.py"]
}
}
}
Navigate to any URL using the puppeteer_navigate
tool:
{
"name": "puppeteer_navigate",
"arguments": {
"url": "https://example.com",
"timeout": 60000 // optional, defaults to 60000ms
}
}
Capture screenshots of the entire page or specific elements:
{
"name": "puppeteer_screenshot",
"arguments": {
"name": "my_screenshot",
"selector": "#specific-element", // optional
"width": 1280, // optional, default: 1280
"height": 720, // optional, default: 720
"timeout": 30000 // optional, defaults to 30000ms
}
}
Click on page elements using CSS selectors:
{
"name": "puppeteer_click",
"arguments": {
"selector": ".button-class",
"timeout": 30000 // optional, defaults to 30000ms
}
}
Fill out input fields with text:
{
"name": "puppeteer_fill",
"arguments": {
"selector": "#input-id",
"value": "text to fill",
"timeout": 30000 // optional, defaults to 30000ms
}
}
Run JavaScript code in the browser context:
{
"name": "puppeteer_evaluate",
"arguments": {
"script": "document.title",
"timeout": 30000 // optional, defaults to 30000ms
}
}
The server provides detailed error messages for common scenarios:
The server implements comprehensive logging with different levels:
Additional notes:
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.