Public Browser — Claude Code MCP server: what it does, how to install
An MCP server that drives Chrome directly over CDP for Claude Code and Cursor. It gives agents browser control across nested iframes without Playwright.
claude mcp add public-browser -- npx -y public-browserWhat Public Browser does
The server links AI agents directly to Chrome through the Chrome DevTools Protocol. It bypasses Playwright dependencies and browser extension bridges. By grouping multiple actions inside run_plan, the tool reduces round-trips and overall token usage. Failures stay loud: ambiguous CSS selectors abort execution, while references from previously closed pages cannot trigger accidental clicks.
The engine traverses open or closed shadow DOM trees and clicks inside nested cross-origin iframes. Chrome launches in a visible window on its first tool invocation. Running the package requires Node 20 or higher. Note that profile logins on macOS do not carry over to the automated session.
What it helps with
- interact with elements inside nested cross-origin iframes
- run multi-step browser flows within a single tool call
- inspect and click controls inside closed shadow roots
- prevent accidental clicks on stale node references
Example prompts for the agent
- Open the sign-in form on the local test server and log in with mock credentials
- Navigate to the settings tab inside the iframe and toggle dark mode
- Fill in all required fields across the multi-step form and submit it
How to install Public Browser
Platform CLI
claude mcp add public-browser -- npx -y public-browserPlatform CLI
codex mcp add public-browser -- npx -y public-browserConfig file
{
"mcpServers": {
"public-browser": {
"command": "npx",
"args": [
"-y",
"public-browser"
]
}
}
}Config file
{
"servers": {
"public-browser": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"public-browser"
]
}
}
}Platform CLI
gemini mcp add public-browser npx -y public-browserStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Public Browser
How to install Public Browser in Claude Code?
Run claude mcp add public-browser -- npx -y public-browser. Then fully quit and restart Claude Code so that the client reloads the server configuration.
What does Public Browser do?
It allows coding agents to control Chrome directly through the Chrome DevTools Protocol without Playwright. The server automates clicks, form submissions, and interactions with nested iframes and shadow DOM.
What are the prerequisites for running Public Browser?
You need Node 20 or higher installed on your system. Chrome opens automatically in a standard visible window when the first browser tool is called.