Skip to main content

MCP server for RootBrowse browser automation

Project description

RootBrowse MCP

MCP Server for RootBrowse browser automation framework. 为 AI Agent 提供结构化的浏览器操控能力。

安装

pip install rootbrowse-mcp

Claude Code 配置

settings.json 中添加:

{
  "mcpServers": {
    "rootbrowse": {
      "command": "rootbrowse-mcp"
    }
  }
}

或指定路径:

{
  "mcpServers": {
    "rootbrowse": {
      "command": "D:\\path\\to\\.venv\\Scripts\\python.exe",
      "args": ["-m", "rootbrowse-mcp.server"]
    }
  }
}

Tools

页面扫描

  • get_page_regions() — 获取页面所有语义区域
  • get_region_summary(region_xpath) — 获取区域统计摘要
  • match_element(region_xpath, tag, role, text_contains, query, limit) — 按条件筛选元素

浏览器

  • init_browser(headless) — 初始化浏览器(必选,headless 默认 True)
  • get_page(url, timeout) — 打开 URL
  • take_screenshot(path) — 页面截图
  • close_browser() — 关闭浏览器
  • run_js(code, args) — 在浏览器端执行 JavaScript

注意: 使用其他工具前必须先调用 init_browser() 初始化浏览器。

标签页

  • new_tab(url) — 打开新标签页
  • close_tab() — 关闭当前标签页
  • switch_tab(index) — 切换标签页
  • get_tabs_count() — 获取标签页数量

状态

  • save_state(path) — 保存浏览器状态
  • load_state(path) — 恢复浏览器状态

run_js 万能接口

所有元素操作(点击、输入、获取元素信息)都通过 run_js 完成,不单独封装。

数据类型

Region(区域)

{xpath, label}

Element(元素)

{tag, role, text, xpath, attrs}

ElementPreview(元素摘要)

{xpath, text, attrs_preview}

run_js 特殊用法

绕过 DOM 传输限制获取长文本:

run_js("return document.body.innerText.substring(0, 2000)")
run_js("return document.body.innerText.substring(2000, 5000)")

依赖

  • Python >= 3.10
  • rootbrowse >= 0.5.0
  • mcp >= 1.0.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rootbrowse_mcp-0.4.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rootbrowse_mcp-0.4.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file rootbrowse_mcp-0.4.0.tar.gz.

File metadata

  • Download URL: rootbrowse_mcp-0.4.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for rootbrowse_mcp-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7a29d3043f823d3deee9ee5a3314ee6c9e87e94a049b17de6ac1604921cba880
MD5 d57e8e211ce5541db637a4344e097b87
BLAKE2b-256 37e235e4e3e3dedb55f1f9f801b8b19209ff0b1e4ef4244134fb333de22f06ff

See more details on using hashes here.

File details

Details for the file rootbrowse_mcp-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: rootbrowse_mcp-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for rootbrowse_mcp-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7587453aa2a71db93147974288f54b042973e90be01d82fe91bdbd55cb103081
MD5 5d7ff2e2529e011c830df363dddb2464
BLAKE2b-256 220e6ec12424512850304b1aed8fedb5881d0d91cecfb62f8454afdbfa5e0f56

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page