The Puppeteer MCP server provides browser automation capabilities that allow large language models to interact with web pages, take screenshots, and execute JavaScript in a real browser environment. It enables AI assistants to navigate websites, fill forms, and capture visual content from the web.
You can run the Puppeteer MCP server using either Docker or NPX. Each method has slightly different characteristics.
The Docker implementation uses headless Chromium:
{
"mcpServers": {
"puppeteer": {
"command": "docker",
"args": ["run", "-i", "--rm", "--init", "-e", "DOCKER_CONTAINER=true", "mcp/puppeteer"]
}
}
}
To build the Docker image yourself:
docker build -t mcp/puppeteer -f src/puppeteer/Dockerfile .
The NPX version opens a visible browser window:
{
"mcpServers": {
"puppeteer": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
}
}
}
The Puppeteer MCP server provides several tools for browser automation:
{
"url": "https://example.com",
"launchOptions": {
"headless": false,
"defaultViewport": {"width": 1280, "height": 720}
},
"allowDangerous": false
}
url
: The webpage to navigate to (required)launchOptions
: Optional Puppeteer configuration settingsallowDangerous
: When false, blocks security-reducing options like --no-sandbox
{
"name": "homepage",
"selector": "#main-content",
"width": 1024,
"height": 768
}
name
: Identifier for the screenshot (required)selector
: CSS selector for a specific element (optional)width
and height
: Dimensions of the screenshot (optional){
"selector": ".submit-button"
}
{
"selector": ".dropdown-menu"
}
{
"selector": "#username",
"value": "testuser"
}
{
"selector": "#country",
"value": "Canada"
}
{
"script": "document.querySelector('.dark-mode-toggle').click(); return document.title;"
}
You can customize the Puppeteer launch options in two ways:
Set PUPPETEER_LAUNCH_OPTIONS
with a JSON-encoded string:
{
"mcpServers": {
"mcp-puppeteer": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-puppeteer"],
"env": {
"PUPPETEER_LAUNCH_OPTIONS": "{ \"headless\": false, \"executablePath\": \"C:/Program Files/Google/Chrome/Application/chrome.exe\", \"args\": [] }",
"ALLOW_DANGEROUS": "true"
}
}
}
}
Pass options directly to the navigation tool:
{
"url": "https://example.com",
"launchOptions": {
"headless": false,
"defaultViewport": {"width": 1280, "height": 720}
},
"allowDangerous": true
}
The server provides two types of resources:
Access browser console output at console://logs
- this includes all console messages from the browser session.
Access captured screenshots at screenshot://<name>
where <name>
is the identifier specified during capture. These are PNG images.
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.