Chrome DevTools Protocol
STDIOMCP server for interacting with Chrome through DevTools Protocol.
MCP server for interacting with Chrome through DevTools Protocol.
An MCP server that provides tools for interacting with Chrome through its DevTools Protocol. This server enables remote control of Chrome tabs, including executing JavaScript, capturing screenshots, monitoring network traffic, and more.
This type of MCP Server is useful When you need to manually configure your browser to be in a certain state before you let an AI tool like Cline poke at it. You can also use this tool to listen to and pull network events into its context.
npm install @nicholmikey/chrome-tools
The server can be configured through environment variables in your MCP settings:
{ "chrome-tools": { "command": "node", "args": ["path/to/chrome-tools/dist/index.js"], "env": { "CHROME_DEBUG_URL": "http://localhost:9222", "CHROME_CONNECTION_TYPE": "direct", "CHROME_ERROR_HELP": "custom error message" } } }
CHROME_DEBUG_URL
: The URL where Chrome's remote debugging interface is available (default: http://localhost:9222)CHROME_CONNECTION_TYPE
: Connection type identifier for logging (e.g., "direct", "ssh-tunnel", "docker")CHROME_ERROR_HELP
: Custom error message shown when connection failsLaunch Chrome with remote debugging enabled:
# Windows "C:\Program Files\Google\Chrome\Application\chrome.exe" --remote-debugging-port=9222 # Mac /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 # Linux google-chrome --remote-debugging-port=9222
Configure MCP settings:
{ "env": { "CHROME_DEBUG_URL": "http://localhost:9222", "CHROME_CONNECTION_TYPE": "direct" } }
When running in WSL, you'll need to set up an SSH tunnel to connect to Chrome running on Windows:
ssh -N -L 9222:localhost:9222 windowsuser@host
{ "env": { "CHROME_DEBUG_URL": "http://localhost:9222", "CHROME_CONNECTION_TYPE": "ssh-tunnel", "CHROME_ERROR_HELP": "Make sure the SSH tunnel is running: ssh -N -L 9222:localhost:9222 windowsuser@host" } }
When running Chrome in Docker:
Launch Chrome container:
docker run -d --name chrome -p 9222:9222 chromedp/headless-shell
Configure MCP settings:
{ "env": { "CHROME_DEBUG_URL": "http://localhost:9222", "CHROME_CONNECTION_TYPE": "docker" } }
Lists all available Chrome tabs.
Executes JavaScript code in a specified tab. Parameters:
tabId
: ID of the Chrome tabscript
: JavaScript code to executeCaptures a screenshot of a specified tab, automatically optimizing it for AI model consumption. Parameters:
tabId
: ID of the Chrome tabformat
: Image format (jpeg/png) - Note: This is only for initial capture. Final output uses WebP with PNG fallbackquality
: JPEG quality (1-100) - Note: For initial capture onlyfullPage
: Capture full scrollable pageImage Processing:
Monitors and captures network events from a specified tab. Parameters:
tabId
: ID of the Chrome tabduration
: Duration in seconds to capturefilters
: Optional type and URL pattern filtersNavigates a tab to a specified URL. Parameters:
tabId
: ID of the Chrome taburl
: URL to loadQueries and retrieves detailed information about DOM elements matching a CSS selector. Parameters:
tabId
: ID of the Chrome tabselector
: CSS selector to find elements
Returns:nodeId
: Unique identifier for the nodetagName
: HTML tag nametextContent
: Text content of the elementattributes
: Object containing all element attributesboundingBox
: Position and dimensions of the elementisVisible
: Whether the element is visibleariaAttributes
: ARIA attributes for accessibilityClicks on a DOM element and captures any console output triggered by the click. Parameters:
tabId
: ID of the Chrome tabselector
: CSS selector to find the element to click
Returns:message
: Success/failure messageconsoleOutput
: Array of console messages triggered by the clickMIT