QQ Browser Skill
Browser automation CLI for AI agents — 通过 WebSocket 控制 QQ 浏览器,实现网页自动化操作。
安装
从 PyPI 安装(推荐)
pip install qqbrowser-skill
安装 QQ 浏览器
安装 Python 包后,还需安装 QQ 浏览器本体:
qqbrowser-skill install # 安装 QQ 浏览器
qqbrowser-skill install --force # 强制重新安装
快速开始
1. 启动守护进程
执行任何浏览器操作前,必须先启动守护进程服务:
qqbrowser-skill serve --daemon # 后台模式启动
qqbrowser-skill status # 检查守护进程状态
qqbrowser-skill stop # 停止守护进程
2. 基本使用流程
# 导航到目标页面
qqbrowser-skill browser_go_to_url --url https://example.com
# 获取页面快照(包含元素索引)
qqbrowser-skill browser_snapshot
# 使用元素索引进行交互
qqbrowser-skill browser_click_element --index 1
qqbrowser-skill browser_input_text --index 2 --text "hello"
# 截图
qqbrowser-skill browser_screenshot
3. 查看所有可用命令
qqbrowser-skill list # 列出所有可用技能
qqbrowser-skill <skill_name> --help # 查看特定技能的帮助
开发指南
环境准备
本项目使用 uv 作为包管理和构建工具,使用 hatchling 作为构建后端。
# 安装 uv(如未安装)
curl -LsSf https://astral.sh/uv/install.sh | sh
# 克隆项目
git clone <repo-url>
cd X5UseLinuxMcp
# 安装依赖
uv sync
项目结构
X5UseLinuxMcp/
├── pyproject.toml # 项目配置与依赖
├── publish.sh # 构建 & 发布脚本
├── SKILL.md # 技能使用说明(供 AI Agent 参考)
├── uv.lock # 锁定的依赖版本
├── src/x5use/
│ ├── __init__.py
│ ├── server.py # CLI 入口 & 主服务
│ ├── daemon_server.py # 守护进程服务
│ ├── skill_registry.py # 技能注册表
│ ├── websocket_manager.py# WebSocket 管理
│ ├── rpc_client.py # RPC 客户端
│ ├── installer.py # 安装器入口
│ ├── installer_linux.py # Linux 安装逻辑
│ ├── installer_mac.py # macOS 安装逻辑
│ ├── installer_win.py # Windows 安装逻辑
│ ├── installer_common.py # 安装通用逻辑
│ ├── upgrader.py # 升级模块
│ ├── constants.py # 常量定义
│ ├── debug_collector.py # 调试信息收集
│ ├── vnc_proxy.py # VNC 代理
│ └── vnc_util.py # VNC 工具
└── build_whl/ # 预构建的 whl 包
本地开发运行
# 使用 uv 直接运行
uv run qqbrowser-skill <command>
# 或者先安装到虚拟环境再运行
uv pip install -e .
qqbrowser-skill <command>
构建
使用 uv build 构建 sdist 和 wheel 包:
uv build
构建产物输出到 dist/ 目录。
发布到 PyPI
项目提供了 publish.sh 脚本来自动化构建和上传流程。
前置条件
-
pip install twine # 或 uv pip install twine
-
配置 PyPI API Token(任选其一):
- 设置环境变量:
export TWINE_PASSWORD="pypi-你的Token" - 配置
~/.pypirc文件 - 运行时传入:
TWINE_PASSWORD="pypi-xxx" bash publish.sh
- 设置环境变量:
发布命令
# 发布到正式 PyPI
bash publish.sh
# 发布到 TestPyPI(用于测试)
bash publish.sh --test
发布脚本会自动执行以下步骤:
- 清理旧的构建产物
- 执行
uv build构建包 - 使用
twine check检查包合法性 - 使用
twine upload上传到 PyPI
版本管理
修改 pyproject.toml 中的 version 字段来更新版本号:
[project]
version = "1.0.10"
升级
qqbrowser-skill upgrade # 检查并升级 qqbrowser-skill 和 QQ 浏览器
qqbrowser-skill upgrade --check-only # 仅检查更新,不执行升级
qqbrowser-skill upgrade --skip-browser # 仅升级 Python 包,跳过浏览器更新
调试
qqbrowser-skill debug # 收集调试信息和日志
qqbrowser-skill debug --output /tmp/debug.tar.gz # 指定输出路径
依赖
- Python >= 3.10
- websockets >= 12.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mybrowser_skill-1.0.15.tar.gz
(41.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mybrowser_skill-1.0.15.tar.gz.
File metadata
- Download URL: mybrowser_skill-1.0.15.tar.gz
- Upload date:
- Size: 41.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5c0121056c4f96417871f526cc3edb192c8ffbcaa18f72b269bc50750369a63
|
|
| MD5 |
426063bf26aead508f1904c3bf4a181b
|
|
| BLAKE2b-256 |
6550645058698c8668fe725a0b8c6713109168a61bc94c6c9bc7a230e1c714d3
|
File details
Details for the file mybrowser_skill-1.0.15-py3-none-any.whl.
File metadata
- Download URL: mybrowser_skill-1.0.15-py3-none-any.whl
- Upload date:
- Size: 52.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
807d5ab3a7f73037723887f3984ba552ce8f3f61f9ab0c65096c9e6074ae8354
|
|
| MD5 |
5530cce30de9756067b9967b354b1556
|
|
| BLAKE2b-256 |
8f940a8eb15147714f2aa36420bf6ddf454ab2205dbec5e672f7fbc2328405a9
|