Skip to main content
Glama

mi-health-mcp

Project Introduction

mi-health-mcp exposes Xiaomi Sports Health's family member data, including sleep, heart rate, and steps, to LLM clients such as RikkaHub through the MCP protocol. The service runs on Cloudflare Workers, requiring no self-hosted server, and can be used within Cloudflare's free tier. This project is based on the interface reverse-engineering work of Misty02600/mi-fitness-python, rewritten as a Cloudflare Worker + MCP service. Thanks to the upstream project.

Related MCP server: apple-health-shortcuts-mcp

One-Click Deploy

Deploy to Cloudflare

The deployment flow requires binding a Cloudflare KV. If the button flow prompts you to create or select a KV namespace, follow the guidance and make sure the binding is named MI_HEALTH_KV.

Manual Deployment When the Button Doesn't Work

You need Node.js 20 or higher, and a Cloudflare account.

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

Fill the namespace ID output by the command into wrangler.toml, replacing your-kv-namespace-id. Then set the access token and deploy:

npx wrangler secret put AUTH_TOKEN
npx wrangler deploy

Use a long random string you generate yourself for the AUTH_TOKEN value. Do not write it into source code, wrangler.toml, or Git.

Post-Deployment Configuration

  1. Create a KV namespace:

    npx wrangler kv namespace create MI_HEALTH_KV
  2. Fill the namespace ID output by the command into [[kv_namespaces]] in wrangler.toml, replacing your-kv-namespace-id, then redeploy. When using one-click deploy, you can also create and bind the KV by following the guidance in the button flow.

  3. Interactively set the MCP authentication token. Generate a long random string yourself for the token:

    npx wrangler secret put AUTH_TOKEN
  4. Redeploy when configuration changes:

    npx wrangler deploy

The KV binding name must remain MI_HEALTH_KV.

Client Configuration

In RikkaHub, open "Settings > MCP > New Connection > Streamable HTTP" and fill in:

  • URL: https://<your-domain>/mcp

  • Custom Header: Authorization: Bearer <your-token>

The <your-token> must exactly match the AUTH_TOKEN set during deployment.

Usage Flow

  1. The client first calls health_login_start to obtain the loginUrl.

  2. Use any QR code tool to render the loginUrl into a QR code.

  3. Scan the QR code with the Xiaomi Sports Health app and confirm the login.

  4. The client polls health_login_poll until it returns success.

  5. After a successful login, use health_latest, health_sleep, health_heart, or health_steps to query data.

The Worker does not generate QR code images. When querying, it dynamically reads the family member list and uses the first item; user IDs are not hardcoded in the code.

Usage Boundaries

For logging into your own Xiaomi account and querying family member data you have been authorized for only. Do not use it for any purpose that infringes on others' privacy or violates Xiaomi's user agreement.

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0), consistent with the upstream Misty02600/mi-fitness-python license.

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

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    A personal MCP server on Cloudflare Workers that connects Claude to Google Health API v4, enabling reading of health data like activity, sleep, heart rate, SpO₂, HRV, and nutrition.
    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

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/yunz75583-debug/mi-health-mcp'

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