豆豆友情提示:这是一个非官方 GitHub 代理镜像,主要用于网络测试或访问加速。请勿在此进行登录、注册或处理任何敏感信息。进行这些操作请务必访问官方网站 github.com。 Raw 内容也通过此代理提供。
Skip to content

Latest commit

 

History

History
198 lines (155 loc) · 6.63 KB

File metadata and controls

198 lines (155 loc) · 6.63 KB

Chrome DevTools MCP

npm chrome-devtools-mcp package

chrome-devtools-mcp is a Model-Context-Protocol (MCP) server that brings the power of Chrome DevTools to coding agents. Using it, coding agents can live debug style, performance or networking issues directly in Chrome.

Key features

  • Get performance insights: Uses Chrome DevTools to record traces and extract performance insights.
  • Advanced browser debugging: Analyze network requests, take screenshots and check the browser console.
  • Reliable automation. Uses puppeteer to automate actions in Chrome and automatically wait for action results.

Disclaimers

chrome-devtools-mcp exposes content of the browser instance to the MCP clients allowing them to inspect, debug, and modify any data in the browser or DevTools. Avoid sharing sensitive or personal information that you don't want to share with MCP clients.

Requirements

Getting started

Add the following config to your MCP client:

{
  "mcpServers": {
    "chrome-devtools": {
      "command": "npx",
      "args": ["chrome-devtools-mcp@latest"]
    }
  }
}

Note

Using chrome-devtools-mcp@latest ensures that your MCP client will always use the latest version of the Chrome DevTools MCP server.

MCP Client specific configuration

Claude Code Use the Claude Code CLI to add the Chrome DevTools MCP server (guide):
claude mcp add chrome-devtools npx chrome-devtools-mcp@latest
Cline Follow https://docs.cline.bot/mcp/configuring-mcp-servers and use the config provided above.
Copilot / VS Code Follow the MCP install guide, with the standard config from above. You can also install the Chrome DevTools MCP server using the VS Code CLI:
code --add-mcp '{"name":"chrome-devtools","command":"npx","args":["chrome-devtools-mcp@latest"]}'
Cursor Follow https://docs.cursor.com/en/context/mcp#using-mcp-json and use the config provided above.
Gemini CLI Follow the MCP guide using the standard config from above.
Gemini Code Assist Follow the configure MCP guide using the standard config from above.

Tools

Configuration

The Chrome DevTools MCP server supports the following configuration option:

  • --browserUrl, -u Connect to a running Chrome instance using port forwarding. For more details see: https://developer.chrome.com/docs/devtools/remote-debugging/local-server.

    • Type: string
  • --headless Whether to run in headless (no UI) mode.

    • Type: boolean
    • Default: false
  • --executablePath, -e Path to custom Chrome executable.

    • Type: string
  • --isolated If specified, creates a temporary user-data-dir that is automatically cleaned up after the browser is closed.

    • Type: boolean
    • Default: false
  • --channel Specify a different Chrome channel that should be used.

    • Type: string
    • Choices: stable, canary, beta, dev
    • Default: stable

Pass them via the args property in the JSON configuration. For example:

{
  "mcpServers": {
    "chrome-devtools": {
      "command": "npx",
      "args": [
        "chrome-devtools-mcp@latest"
        "--channel=canary",
        "--headless=true",
        "--isolated=true",
      ]
    }
  }
}

You can also run npx chrome-devtools-mcp@latest --help to see all available configuration options.

Concepts

User data directory

chrome-devtools-mcp starts a Chrome's stable channel instance using the following user data directory:

  • Linux / MacOS: $HOME/.cache/chrome-devtools-mcp/chrome-profile-$CHANNEL
  • Window: %HOMEPATH%/.cache/chrome-devtools-mcp/chrome-profile-$CHANNEL

The user data directory is not cleared between runs and shared across all instances of chrome-devtools-mcp. Set the isolated option to true to use a temporary user data dir instead which will be cleared automatically after the browser is closed.