Skip to main content
Glama
wusaki0723
by wusaki0723

mi-health-mcp

项目简介

mi-health-mcp 把小米运动健康的亲友数据,包括睡眠、心率和步数,通过 MCP 协议暴露给 RikkaHub 等 LLM 客户端。服务运行在 Cloudflare Workers 上,无需自建服务器,可在 Cloudflare 免费额度内使用。本项目基于 Misty02600/mi-fitness-python 的接口逆向成果改写为 Cloudflare Worker + MCP 服务,感谢上游。

Related MCP server: Health Vault

一键部署

Deploy to Cloudflare

部署流程要求绑定 Cloudflare KV。如果按钮流程提示创建或选择 KV namespace,请按引导完成,并确保绑定名为 MI_HEALTH_KV

按钮不灵时的手动部署

需要 Node.js 20 或更高版本,以及一个 Cloudflare 账号。

git clone https://github.com/wusaki0723/mi-health-mcp.git
cd mi-health-mcp
npm install
npx wrangler login
npx wrangler kv namespace create MI_HEALTH_KV

将命令输出的 namespace ID 填入 wrangler.toml,替换 your-kv-namespace-id。然后设置访问令牌并部署:

npx wrangler secret put AUTH_TOKEN
npx wrangler deploy

AUTH_TOKEN 的值请使用自己生成的长随机串,不要写进源码、wrangler.toml 或 Git。

部署后配置

  1. 创建 KV namespace:

    npx wrangler kv namespace create MI_HEALTH_KV
  2. 将命令输出的 namespace ID 填入 wrangler.toml[[kv_namespaces]],替换 your-kv-namespace-id,然后重新部署。通过一键部署时,也可以在按钮流程中按引导创建并绑定 KV。

  3. 交互式设置 MCP 鉴权令牌。令牌请自行生成一个长随机串:

    npx wrangler secret put AUTH_TOKEN
  4. 配置有变化时重新部署:

    npx wrangler deploy

KV binding 名必须保持为 MI_HEALTH_KV

客户端配置

在 RikkaHub 中打开「设置 > MCP > 新建连接 > Streamable HTTP」,填写:

  • URL:https://<你的域名>/mcp

  • 自定义 Header:Authorization: Bearer <你的 token>

其中 <你的 token> 必须与部署时设置的 AUTH_TOKEN 完全一致。

使用流程

  1. 客户端先调用 health_login_start,取得 loginUrl

  2. 使用任意二维码工具把 loginUrl 渲染成二维码。

  3. 用小米运动健康 App 扫码并确认登录。

  4. 客户端轮调 health_login_poll,直到返回 success

  5. 登录成功后,使用 health_latesthealth_sleephealth_hearthealth_steps 查询数据。

Worker 不生成二维码图片。查询时会动态读取亲友列表并使用第一项,不在代码中写死用户 ID。

使用边界

仅供登录你自己的小米账号、查询你已获授权的亲友数据。请勿用于任何侵犯他人隐私或违反小米用户协议的用途。

许可证

本项目采用 GNU General Public License v3.0(GPL-3.0),与上游 Misty02600/mi-fitness-python 的许可证保持一致。

A
license - permissive license
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    C
    quality
    B
    maintenance
    Enables reading and syncing Xiaomi Mi Fitness health data (steps, heart rate, sleep, workouts) from the Chinese cloud region to a local SQLite database via MCP tools.
    10
    3
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Self-hosted MCP server that syncs Xiaomi fitness data to SQLite and provides authenticated tools to query health metrics (steps, sleep, HR, etc.) for AI assistants like Grok.
    GPL 3.0

View all related MCP servers

Related MCP Connectors

  • MCP server for Withings health data — sleep, activity, heart, and body metrics.

  • Garmin data in Claude & ChatGPT via the Garmin Health API. OAuth sign-in, no password sharing.

  • Connect your Oura Ring account securely in minutes. Enable authorized access to your sleep, activi…

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/wusaki0723/mi-health-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server