Chrome MCP 服务器
模型上下文协议 (MCP) 服务器通过 Chrome DevTools 协议 (CDP) 提供对 Chrome 浏览器实例的细粒度控制。
先决条件
Bun (推荐)或 Node.js(v14 或更高版本)
启用远程调试的 Chrome 浏览器
设置
安装 Bun
安装 Bun(如果尚未安装):
启动 Chrome 并启用远程调试:
您可以使用附带的脚本自动检测您的操作系统并使用正确的命令启动 Chrome:
# Make the script executable chmod +x start-chrome.sh # Run the script ./start-chrome.sh或者手动启动 Chrome 进行远程调试:
# macOS /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 # Windows start chrome --remote-debugging-port=9222 # Linux google-chrome --remote-debugging-port=9222安装依赖项:
启动服务器:
对于使用热重载进行开发:
服务器默认在 3000 端口启动。您可以通过设置PORT
环境变量来更改此设置。
配置 Roo Code 以使用此 MCP 服务器
要将此 Chrome MCP 服务器与 Roo 代码一起使用:
打开 Roo 代码设置
导航至 MCP 设置配置文件:
macOS:
~/Library/Application Support/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
Windows:
%APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json
Linux:
~/.config/Code/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json
向
mcpServers
对象添加以下配置:
保存文件并重新启动 Roo Code 以应用更改。
您现在可以使用 Roo Code 中的 Chrome MCP 工具来控制浏览器。
可用工具
服务器提供以下浏览器控制工具:
导航
导航到特定的 URL。
参数:
url
(字符串):要导航到的 URL
点击
单击特定坐标。
参数:
x
(数字):X 坐标y
(数字):Y坐标
类型
在当前焦点处输入文本。
参数:
text
(字符串):要输入的文本
clickElement
单击页面信息中索引对应的元素。
参数:
selector
(字符串):元素索引(例如,“0”表示第一个元素)
获取文本
使用 CSS 选择器获取元素的文本内容。
参数:
selector
(字符串):用于查找元素的 CSS 选择器
获取页面信息
获取有关页面的语义信息,包括交互元素和文本节点。
获取页面状态
获取当前页面状态,包括 URL、标题、滚动位置和视口大小。
用法
服务器通过 SSE 传输实现模型上下文协议。请通过以下方式连接到服务器:
SSE 端点:
http://localhost:3000/sse-cursor
消息端点:
http://localhost:3000/message?sessionId=...
与 Roo Code 一起使用时,MCP 设置文件中的配置将自动处理连接。
发展
要使用热重载以开发模式运行服务器:
这使用 Bun 的内置监视模式在文件发生变化时自动重启服务器。
执照
麻省理工学院
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
模型上下文协议服务器,使 AI 助手能够通过 Chrome DevTools 协议控制 Chrome 浏览器,从而实现导航、点击、输入和提取页面信息。
Related MCP Servers
- -securityFlicense-qualityA Model Control Protocol server that enables AI assistants to control a browser through tools for web automation tasks like navigation, typing, clicking, and taking screenshots.Last updated -
- -securityFlicense-qualityA Model Control Protocol server that enables AI assistants to control a browser through tools for web automation tasks like navigation, typing, clicking, and taking screenshots.Last updated -
- -securityFlicense-qualityA Model Control Protocol server that enables AI assistants to control a browser, allowing them to perform web automation tasks like navigation, typing, clicking, and taking screenshots.Last updated -
- -securityAlicense-qualityA Chrome extension-based Model Context Protocol server that enables AI assistants to control your browser, leveraging your existing configurations and login states for complex automation, content analysis, and semantic search.Last updated -8,583MIT License