WO

webmcp-org/chrome-devtools-quickstart

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

41 stars 9 forks 质量 77 趋势 4MIT

使用 Chrome DevTools MCP 与 WebMCP 工具的快速演示——AI 驱动的浏览器自动化

概览

让AI代理直接访问你网站的功能——没有截图,没有DOM抓取,只有结构化的工具调用。 1. 你的网站加载 @mcp-b/global,增加了 navigator.modelContext 2.你使用 navigator.modelContext.registerTool() 注册工具 3.Chrome DevTools MCP 连接 Chrome,并暴露 list_webmcp_tools + call_webmcp_tool 4.AI 代理发现并调用你的工具 添加WebMCP文档服务器,让你的AI知道如何构建工具: 光标、Claude 桌面、风帆冲浪及其他客户端 - 编辑 ~/库/应用支持/Claude/claude_desktop_config.json(macOS): “导航到 http://localhost:5173, 列表可用的 WebMCP 工具,并将计数器设置为 42” AI将导航到你的页面,发现工具并加以实施: Chrome DevTools MCP 是一款 MCP 服务器,为 AI 代理提供完整的浏览器自动化功能——导航、点击、输入、截图、控制台访问、网络检查和性能分析。

概述(AI 翻译)

让AI代理直接访问你网站的功能——无需截图,无需DOM抓取,只有结构化的工具调用。

为什么这很重要

**与截图类工作流程相比,代币数量可少多达89%。

工作原理

  1. 你的网站加载 @mcp-b/global,这会增加 navigator.modelContext
  2. 你用navigator.modelContext.registerTool()注册工具
  3. Chrome DevTools MCP 连接 Chrome,并暴露 list_webmcp_tools + call_webmcp_tool
  4. 人工智能代理发现并调用你的工具

快速入门(3步)

1.克隆与逃亡

2.将MCP服务器添加到你的AI客户端

克劳德代码:

可选: 添加WebMCP文档服务器,让你的AI知道如何构建工具:

光标、Claude 桌面、风帆冲浪及其他客户端

光标 - 添加到.cursor/mcp.json:

Claude Desktop - 编辑 ~/Library/Application Support/Claude/claude_desktop_config.json(macOS):

风帆冲浪 - 添加到mcp_config.json:

3.测试一下

问问你的人工智能:

“导航到 http://localhost:5173, 列表可用的 WebMCP 工具,并将计数器设置为 42”

AI将导航到你的页面,发现工具并加以实施:


背景

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Chrome DevTools MCP Quickstart

Give AI agents direct access to your website’s functionality—no screenshots, no DOM scraping, just structured tool calls.

Why This Matters

Up to 89% fewer tokens compared to screenshot-based workflows.

How It Works

flowchart LR
    A[AI Client] --> B[Chrome DevTools MCP]
    B -->|CDP| C[Your Website]
    C -->|mcp-b/global| D[navigator.modelContext]

    B -.->|list_webmcp_tools| E[Discovers tools]
    B -.->|call_webmcp_tool| F[Executes tools]
  1. Your website loads @mcp-b/global which adds navigator.modelContext
  2. You register tools using navigator.modelContext.registerTool()
  3. Chrome DevTools MCP connects to Chrome and exposes list_webmcp_tools + call_webmcp_tool
  4. AI agents discover and call your tools

Quick Start (3 Steps)

1. Clone & Run

git clone https://github.com/WebMCP-org/chrome-devtools-quickstart.git
cd chrome-devtools-quickstart
npm install && npm run dev

2. Add MCP Server to Your AI Client

Claude Code:

claude mcp add chrome-devtools npx @mcp-b/chrome-devtools-mcp@latest

Optional: Add the WebMCP docs server so your AI knows how to build tools:

claude mcp add --transport http webmcp-docs https://docs.mcp-b.ai/mcp

3. Test It

Ask your AI:

“Navigate to http://localhost:5173, list available WebMCP tools, and set the counter to 42”

The AI will navigate to your page, discover the tools, and execute them:


Background

在 GitHub 查看完整 README

安装

npx @mcp-b/chrome-devtools-mcp@latest
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "chrome-devtools": { "command": "npx", "args": ["@mcp-b/chrome-devtools-mcp@latest"] }, "webmcp-docs": { "url": "https://docs.mcp-b.ai/mcp" } } }