Skip to main content

NoticeMe

轻量级通知管理系统,支持多通知源、多通知渠道、实时通知、MCP 协议接入。

特性

  • 通知源: Webhook (HTTP API) 或 MQTT 订阅,仅作为消息入口
  • 通知组: 一组通知渠道
  • 默认通知组: 可在已有通知组中指定一个作为默认;通知者未绑定任何组时推送到它(不可删除)
  • 通知者: 从历史记录自动发现,绑定通知组决定推送去向
  • 通知渠道: MQTT 发布 或 API 请求转发
  • 实时通知: 持久化显示,ID 标识,WebSocket 实时推送,可编辑更新
  • 普通通知: 一次性推送,fire-and-forget
  • 历史记录: 完整记录创建/更新/推送/清除操作
  • MCP 服务器: stdio (编辑器/Agent 集成) + streamable-http (共用 API 端口)
  • CLI 工具: nme 命令行管理源、渠道、通知
  • Web UI: 深色主题 SPA,手机自适应
  • 轻量存储: SQLite,零外部依赖

安装

pip install noticeme-srv

或从源码安装:

git clone https://github.com/CandyXT/NoticeMe.git
cd NoticeMe
pip install -e .

快速开始

# 启动服务 (API + WebUI + WebSocket + MCP streamable-http)
nme serve

# 或指定参数
nme serve --host 0.0.0.0 --port 8200 --reload

访问: http://localhost:8200

数据存储在 ~/.noticeme/ (SQLite 数据库)

CLI 命令

nme --version              # 查看版本

# 服务器
nme serve                  # 启动 HTTP 服务器
nme serve --port 8200      # 指定端口
nme serve --reload         # 开发模式 (自动重载)

# MCP 服务器
nme mcp                    # 在 stdio 上运行 MCP 服务器

# 初始化
nme init                   # 初始化数据库

# 通知源 (仅作为消息入口,不参与渠道路由)
nme source list            # 列出所有通知源
nme source add -n "监控" -t webhook
nme source add -n "IoT" -t mqtt --broker 192.168.1.100 --topic "devices/#"
nme source remove <id>

# 通知组 (打包渠道)
nme group list             # 列出所有通知组
nme group add -n "服务器告警" -d "服务器相关"
nme group map <group_id> <channel_id1> <channel_id2>
nme group default <group_id>    # 把已有的某个通知组设为默认(通知者未绑组时的去向)
nme group remove <id>           # 删除通知组(默认组不可删除)

# 通知渠道
nme channel list           # 列出所有渠道
nme channel add -n "飞书" -t api --url "https://open.feishu.cn/..."
nme channel add -n "MQTT转发" -t mqtt --broker localhost --topic "out"
nme channel remove <id>

# 通知者 (从历史记录自动发现,绑定通知组)
nme notifier list                              # 列出通知者及其通知组
nme notifier map <sender_id> <group_id1> <group_id2>

# 推送通知
nme notify --title "部署完成" --content "v2.1.0 已上线" --level success
nme notify --group <group_id> --title "告警"          # 直接指定通知组
nme notify --channel <channel_id> --title "告警"      # 直接指定渠道
nme notify --sender <sender_id> --title "告警"        # 用通知者绑定的通知组
nme notify --id cpu-alert --title "CPU" --content "使用率 92%" --level warning

# 实时通知
nme realtime list          # 列出活跃实时通知
nme realtime clear <id>    # 清除单个
nme realtime clear         # 清除全部

# 历史记录
nme history                # 查看最近记录
nme history --limit 50
nme history --notification <id>

MCP 服务器

stdio 模式 (编辑器/Agent 集成)

nme mcp

在 Claude Desktop、Cursor 等 MCP 客户端中配置:

{
  "mcpServers": {
    "noticeme": {
      "command": "nme",
      "args": ["mcp"]
    }
  }
}

streamable-http 模式

与 API/WebUI 共用端口,端点: http://localhost:8200/mcp

MCP 工具列表

工具 说明
list_sources 列出通知源
create_source 创建通知源
delete_source 删除通知源
list_channels 列出通知渠道
create_channel 创建渠道
delete_channel 删除渠道
list_notifiers 列出通知者及其通知组映射
set_notifier_groups 设置通知者绑定的通知组
list_groups 列出通知组及默认组
set_default_group 设置默认通知组
list_realtime_notifications 列出实时通知
push_realtime_notification 推送实时通知
update_realtime_notification 更新实时通知
clear_realtime_notification 清除实时通知
push_notification 推送普通通知
get_history 查询历史记录

API

通知源

GET    /api/sources              # 列表
POST   /api/sources              # 创建
GET    /api/sources/{id}         # 详情
PUT    /api/sources/{id}         # 编辑
DELETE /api/sources/{id}         # 删除

通知组

GET    /api/groups               # 列表
POST   /api/groups               # 创建
GET    /api/groups/{id}          # 详情
PUT    /api/groups/{id}          # 编辑
DELETE /api/groups/{id}          # 删除
GET    /api/groups/{id}/channels # 获取组的渠道
PUT    /api/groups/{id}/channels # 设置组的渠道
PUT    /api/groups/{id}/default  # 设为默认通知组

通知渠道

GET    /api/channels             # 列表
POST   /api/channels             # 创建
GET    /api/channels/{id}        # 详情
PUT    /api/channels/{id}        # 编辑
DELETE /api/channels/{id}        # 删除

通知者 (通知组路由)

GET    /api/notifiers                      # 列表 (含绑定的通知组)
GET    /api/notifiers/{sender_id}/groups   # 获取绑定
PUT    /api/notifiers/{sender_id}/groups   # 设置绑定

通知推送

# 实时通知 (带 ID,持久化)
curl -X POST http://localhost:8200/api/notifications/realtime \
  -H "Content-Type: application/json" \
  -d '{"id": "cpu", "title": "CPU 使用率", "content": "92%", "level": "warning"}'

# 更新实时通知
curl -X PUT http://localhost:8200/api/notifications/realtime/cpu \
  -H "Content-Type: application/json" \
  -d '{"content": "45%", "level": "success"}'

# 普通通知
curl -X POST http://localhost:8200/api/notifications/push \
  -H "Content-Type: application/json" \
  -d '{"title": "部署完成", "content": "v2.1.0"}'

# Webhook 入口
curl -X POST http://localhost:8200/hook/<source_id> \
  -H "Content-Type: application/json" \
  -d '{"id": "disk", "title": "磁盘不足", "level": "error"}'

实时通知管理

GET    /api/notifications/realtime       # 列表
GET    /api/notifications/realtime/{id}   # 详情
PUT    /api/notifications/realtime/{id}   # 更新
DELETE /api/notifications/realtime/{id}   # 删除单个
DELETE /api/notifications/realtime        # 清空全部

历史记录

GET /api/history                       # 最近记录
GET /api/history/{notification_id}     # 指定通知的历史

WebSocket

WS /ws    # 实时通知推送

目录结构

NoticeMe/
├── __init__.py            # 包初始化 (版本号)
├── app.py                 # FastAPI 应用工厂 + 路由注册
├── main.py                # 开发入口 (python -m NoticeMe.main)
├── cli.py                 # Click CLI (nme 命令)
├── mcp_server.py          # MCP 服务器 (stdio + streamable-http)
├── core/
│   ├── models.py          # Pydantic 数据模型
│   ├── database.py        # SQLite 数据层
│   ├── sources.py         # 通知源管理 (Webhook/MQTT)
│   ├── channels.py        # 通知渠道管理 (MQTT/API)
│   └── manager.py         # 核心调度管理器
├── static/
│   └── index.html         # Web UI (Alpine.js + Tailwind)
├── ~/.noticeme/           # 运行时数据 (数据库, 配置)
├── .github/workflows/
│   └── release.yml        # CI/CD (tag → GitHub Release + PyPI)
├── pyproject.toml         # 包配置
├── requirements.txt       # 依赖清单
└── README.md

技术栈

组件 选型
后端 FastAPI + uvicorn
实时通信 WebSocket + aiomqtt
HTTP 客户端 httpx
MCP 协议 mcp SDK
前端 Alpine.js + Tailwind CSS CDN
存储 SQLite
CLI Click
打包 hatchling
CI/CD GitHub Actions

许可证

MIT License

Metadata

Release files for noticeme-srv 0.3.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 noticeme-srv 0.3.0
File Size Uploaded Provenance Actions
noticeme_srv-0.3.0.tar.gz 38.1 kB With provenance Details for noticeme_srv-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for noticeme-srv 0.3.0
File Interpreter ABI Platform Actions
noticeme_srv-0.3.0-py3-none-any.whl Python 3 none any Details for noticeme_srv-0.3.0-py3-none-any.whl

Total release size: 81.9 kB

Release files / noticeme_srv-0.3.0.tar.gz

Download URL noticeme_srv-0.3.0.tar.gz
Size 38.1 kB
Tags Source
SHA-256 checksum
How to use checksums
1f45f2dad794034b79696b7ece886850f32027d479437a883b41b65637c153f3
BLAKE2b-256 checksum
How to use checksums
b309c6576d34772766e4cf52b26eceeca9f3fb3e63b6d3786b183891cb0c0e97
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Release files / noticeme_srv-0.3.0-py3-none-any.whl

Download URL noticeme_srv-0.3.0-py3-none-any.whl
Size 43.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6ae339ef9dea098e3c8869f89e00512a9304f7a717c47ad9ee3312a394098936
BLAKE2b-256 checksum
How to use checksums
ae5846f425ad0927526382868e0e6c9b949ecfb269707bc76f3147319c9c346a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

Security for noticeme-srv 0.3.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for noticeme_srv-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 16, 2026.

Transparency log

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.

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