feat: REST API with API keys, QR login, and web dashboard (v0.2.0)

- REST API (FastAPI): all data endpoints, sync (foreground/background),
  coverage stats, interactive docs at /docs
- API key system: exchange Xiaomi credentials for mif_sk_* keys
  (multi-account contexts, last-used tracking, prefix revocation);
  static key via MI_FITNESS_API_KEY, admin endpoints via MI_FITNESS_ADMIN_KEY
- QR code login: reverse-engineered Xiaomi universal QR flow
  (sid=xiaomiio), auto-issues API key after scan confirmation
- Built-in web dashboard (Flask): visual console for all endpoints,
  key management, QR login; reverse proxy with server-side key relay
- Standalone testpage/ console (python app.py, no install needed)
- Fix: pin mcp<2 (SDK 2.x removed Server.list_tools, broke startup)
- CI: install [all,dev] extras; docs: full technical documentation
  and QR login implementation guide
This commit is contained in:
binglua committed 2026-09-03 22:28:31 +08:00
1 parent 7fcd06980f
commit 2dd32f1ee6
21 files changed
+8723 -165

No files matched your search

+10
View File
@@ -1,5 +1,15 @@
# Changelog
## 0.2.0
- 内置 Web 仪表盘(`mi-fitness-mcp web`,Flask):可视化测试全部 API 端点、Key 管理、扫码登录,内置反向代理(自动附加 X-API-Key/X-Admin-Key,上游耗时透传)
- REST API 服务(`mi-fitness-mcp api`,FastAPI):全部数据端点 + 同步(前台/后台)+ 覆盖统计,交互式文档 `/docs`
- API Key 体系:`POST /api/auth/keys` 用小米凭据换取 `mif_sk_*` Key(类大模型平台风格),支持多账号上下文、last_used 统计、按前缀吊销;静态 Key 经 `MI_FITNESS_API_KEY`、管理端点经 `MI_FITNESS_ADMIN_KEY`
- 扫码登录:逆向小米通用扫码流程(`sid=xiaomiio`),`/api/auth/qr/start|poll` 生成二维码并轮询换取凭据后自动发放 Key,无需浏览器 F12
- Rust 测试页 `testpage/`(可选,内置 Web 仪表盘的 Rust 替代实现)
- 修复:`mcp` 依赖加上界 `<2`(MCP SDK 2.x 移除 `Server.list_tools` 导致启动崩溃)
- 文档:完整技术文档 `docs/PROJECT_DOCUMENTATION.md`(架构/协议/已知问题/重构指南)、扫码登录方案 `docs/QR_LOGIN.md`
## 0.1.0
- initial standalone `mi-fitness-mcp` repository