Skip to main content

云文档监控助手

自动监控云厂商(阿里云、百度云)官网文档更新,检测变更并使用AI生成摘要通知。

功能特性

  • 🕷️ 多云支持: 支持阿里云、百度云文档爬取
  • ?? 变更检测: 智能识别文档的新增、修改和删除
  • 🤖 AI摘要: 使用通义千问生成中文变更摘要
  • 📢 多渠道通知: 支持 aiflow、如流机器人、文件输出
  • 💾 历史记录: 完整的文档版本历史和变更记录
  • 🔧 MCP集成: 可作为MCP服务器,供AI助手调用
  • ⏰ 定时执行: 支持 crontab 定时自动检查

快速开始

1. 安装依赖

pip install -r requirements.txt

2. 配置环境变量

创建 .env 文件:

# 通义千问 API Key(必需)
DASHSCOPE_API_KEY=your_api_key

# aiflow Webhook 地址(可选)
AIFLOW_WEBHOOK_URL=https://aiflow.baidu-int.com/server/webhook/xxx

# 监控产品列表,逗号分隔(可选,覆盖 config.yaml)
MONITOR_PRODUCTS=/vpc,/dns,/vpn

3. 运行

# 手动执行一次检查
python -m src.main --check-now

# 启动定时任务服务
python -m src.main

项目结构

cloud-doc-monitor/
├── src/
│   ├── main.py            # 主入口(定时任务)
│   ├── mcp_server.py      # MCP 服务器
│   ├── crawler.py         # 阿里云文档爬虫
│   ├── baidu_crawler.py   # 百度云文档爬虫
│   ├── detector.py        # 变更检测
│   ├── summarizer.py      # AI 摘要生成
│   ├── notifier.py        # 通知发送
│   ├── storage.py         # 数据存储
│   ├── scheduler.py       # 任务调度
│   ├── config.py          # 配置管理
│   ├── models.py          # 数据模型
│   └── utils.py           # 工具函数
├── bin/
│   └── run_check.sh       # 定时任务脚本
├── config.yaml            # 配置文件
├── requirements.txt       # Python 依赖
└── .env                   # 环境变量(需自行创建)

配置说明

编辑 config.yaml:

# 监控产品列表(阿里云文档 alias)
monitor_products:
  - "/vpc"      # 专有网络
  - "/dns"      # 云解析
  - "/vpn"      # VPN网关

# 调度配置
scheduler:
  cron: "15 11 * * *"  # 每天 11:15 执行
  timezone: "Asia/Shanghai"

# 通知配置
notifications:
  - type: "aiflow"
    enabled: true
    webhook_url: "${AIFLOW_WEBHOOK_URL}"
  - type: "file"
    enabled: true
    output_dir: "./notifications"

MCP 集成

启动 MCP 服务器

python -m src.mcp_server

配置 MCP 客户端

在 .kiro/settings/mcp.json 中:

{
  "mcpServers": {
    "cloud-doc-monitor": {
      "command": "/path/to/venv/bin/python",
      "args": ["-m", "src.mcp_server"],
      "cwd": "/path/to/project",
      "env": {
        "DASHSCOPE_API_KEY": "your_key",
        "AIFLOW_WEBHOOK_URL": "your_webhook_url",
        "MONITOR_PRODUCTS": "/vpc,/dns,/vpn"
      }
    }
  }
}

可用 MCP 工具

工具名 功能
get_doc 获取单篇文档内容(支持关键词搜索)
list_product_docs 列出产品下所有文档
check_doc_changes 检查指定文档的变更
check_product_changes 检查单个产品的文档变更
monitor_products 主入口 - 监控多个产品并发送通知
check_recent_updates 检查最近N天的更新
compare_cloud_docs 对比阿里云和百度云的产品文档
get_statistics 获取监控统计信息

调用示例

// 监控多个产品
monitor_products(products=["/vpc", "/dns"], send_notification=true)

// 检查最近7天更新
check_recent_updates(product_alias="/vpc", days=7)

// 对比阿里云和百度云
compare_cloud_docs(product="VPC")

定时任务配置

方式一:系统 crontab

# 添加定时任务(每天 11:15 执行)
crontab -e

# 添加以下行
15 11 * * * /path/to/project/bin/run_check.sh >> /path/to/project/logs/cron.log 2>&1

方式二:Docker

docker-compose up -d

通知渠道

aiflow(百度内部)

notifications:
  - type: "aiflow"
    webhook_url: "${AIFLOW_WEBHOOK_URL}"

通知数据格式:

{
  "event": "doc_change_notification",
  "user": "alimujiangayiziba",
  "title": "云文档监控报告",
  "summary": "...",
  "changes": [...]
}

如流机器人

notifications:
  - type: "ruliu"
    webhook_url: "${RULIU_WEBHOOK_URL}"

本地文件

notifications:
  - type: "file"
    output_dir: "./notifications"

开发

# 语法检查
python -m py_compile src/*.py

# 运行测试
pytest

# 测试通知
python scripts/test_ruliu_notifier.py

许可证

MIT License

Metadata

Release files for cloud-doc-monitor 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cloud-doc-monitor 0.2.0
File Size Uploaded Provenance Actions
cloud_doc_monitor-0.2.0.tar.gz 31.5 kB Without provenance Details for cloud_doc_monitor-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cloud-doc-monitor 0.2.0
File Interpreter ABI Platform Actions
cloud_doc_monitor-0.2.0-py3-none-any.whl Python 3 none any Details for cloud_doc_monitor-0.2.0-py3-none-any.whl

Total release size: 69.7 kB

Release files / cloud_doc_monitor-0.2.0.tar.gz

Download URL cloud_doc_monitor-0.2.0.tar.gz
Size 31.5 kB
Tags Source
SHA-256 checksum
How to use checksums
332bf17597ca44cfaea6d04fa72d0cb0d46d4ea1b965649cdc141bf35e2cc2f2
BLAKE2b-256 checksum
How to use checksums
a7698330126bf16604153fb5ee4e4bbb0bdcb9ed0b179c94ebba6ff19b776d38
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / cloud_doc_monitor-0.2.0-py3-none-any.whl

Download URL cloud_doc_monitor-0.2.0-py3-none-any.whl
Size 38.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0a3e0fc05859b769c9b82962b3b9cf8bd12518512aab902d0ab1d7279926d7e1
BLAKE2b-256 checksum
How to use checksums
07fd879a4750f6af7a5889ea5ddd4b7ed0db2a5c293795dfca6344c454d2980e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for cloud-doc-monitor 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page