Skip to main content
Glama
by lxe

Chrome MCP 服务器

模型上下文协议 (MCP) 服务器通过 Chrome DevTools 协议 (CDP) 提供对 Chrome 浏览器实例的细粒度控制。

先决条件

  • Bun (推荐)或 Node.js(v14 或更高版本)

  • 启用远程调试的 Chrome 浏览器

设置

安装 Bun

  1. 安装 Bun(如果尚未安装):

# macOS, Linux, or WSL curl -fsSL https://bun.sh/install | bash # Windows (using PowerShell) powershell -c "irm bun.sh/install.ps1 | iex" # Alternatively, using npm npm install -g bun
  1. 启动 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
  2. 安装依赖项:

bun install
  1. 启动服务器:

bun start

对于使用热重载进行开发:

bun dev

服务器默认在 3000 端口启动。您可以通过设置PORT环境变量来更改此设置。

配置 Roo Code 以使用此 MCP 服务器

要将此 Chrome MCP 服务器与 Roo 代码一起使用:

  1. 打开 Roo 代码设置

  2. 导航至 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

  3. mcpServers对象添加以下配置:

{ "mcpServers": { "chrome-control": { "url": "http://localhost:3000/sse-cursor", "disabled": false, "alwaysAllow": [] } } }
  1. 保存文件并重新启动 Roo Code 以应用更改。

  2. 您现在可以使用 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 dev

这使用 Bun 的内置监视模式在文件发生变化时自动重启服务器。

执照

麻省理工学院

-
security - not tested
F
license - not found
-
quality - not tested

Related MCP Servers

  • -
    security
    F
    license
    -
    quality
    A 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 -
  • -
    security
    F
    license
    -
    quality
    A 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 -
  • -
    security
    F
    license
    -
    quality
    A 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 -
  • -
    security
    A
    license
    -
    quality
    A 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 -
    9,264
    MIT License
    • Linux
    • Apple

View all related MCP servers

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lxe/chrome-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server