Mi Fitness MCP CN
This server allows you to sync, query, and analyze Xiaomi Mi Fitness health data (China region) through a local SQLite cache exposed via MCP tools.
Check Connection Status (
get_connection_status): Verify that your Mi Fitness account credentials and cloud connection are working properly.Sync Data (
sync_data): Pull Mi Fitness cloud data into a local SQLite database, with options for date range, specific data types, and full/incremental sync. Supported types include daily activity, heart rate, sleep, workouts, body measurements, resting heart rate, SpO2, stress, and abnormal heart beat events.Get User Profile (
get_profile): Retrieve your Mi Fitness account profile information.Get Daily Summary (
get_daily_summary): View aggregated daily activity summaries (steps, distance, calories) for a specific date or date range.Query Metric Series (
query_metric_series): Fetch time-series data for metrics (steps, distance, active calories, weight) with configurable aggregation (sum/avg/min/max/latest) and granularity (day/week/month).Query Heart Rate (
query_heart_rate): Retrieve heart rate samples filtered by date range and sample type (resting, active, passive, or workout).Query Body Measurements (
query_body_measurements): Access body composition data such as weight, BMI, body fat percentage, muscle mass, and water percentage, with an option to retrieve only the latest reading.Query Sleep Sessions (
query_sleep): Analyze sleep records for a date range, with an option to include or exclude naps.Query Workouts (
query_workouts): Retrieve workout records filtered by date, activity type, minimum duration, or minimum distance.Get Data Coverage (
get_data_coverage): Check which data types have been synced and what date ranges are available locally.
Provides tools for reading and syncing health data from Xiaomi's Mi Fitness cloud, including daily activity, heart rate, sleep, workouts, and body measurements.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Mi Fitness MCP CNshow my steps for today"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Mi Fitness MCP CN
小米运动健康 / Mi Fitness 数据本地 MCP Server。
本项目基于 kubulashvili/mi-fitness-mcp 修改,增加中国区小米健康云适配,并补充睡眠与运动记录同步能力。
非小米官方项目,仅用于读取和分析你自己的健康数据。数据默认同步到本地 SQLite。
功能
读取小米运动健康云端数据
本地 SQLite 缓存
MCP Server 支持
支持中国区:
--region cn支持数据类型:
daily_activity:步数、距离、活动卡路里heart_rate:心率采样sleep:睡眠记录workouts:运动记录body_measurements:体重 / 身体成分,视账号数据而定
Related MCP server: Garmin Connect China MCP Server
已逆向验证的接口
健康数据接口
POST https://hlth.io.mi.com/app/v1/data/get_fitness_data_by_time常用 key:
steps
calories
heart_rate
weight
sleep睡眠请求示例:
{
"start_time": 1767225600,
"end_time": 1782086399,
"key": "sleep"
}运动记录接口
POST https://hlth.io.mi.com/app/v1/data/get_sport_records_by_time请求示例:
{
"start_time": 1767225600,
"end_time": 1782086399,
"limit": 50
}返回字段通常包含:
sport_records
has_more
next_key每条运动记录的 value 是 JSON 字符串,包含 start_time、end_time、duration、distance、calories、avg_hrm、max_hrm 等字段。
安装
git clone git@github.com:binglua/mi-fitness-mcp-cn.git
cd mi-fitness-mcp-cn
python -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'如果当前环境没有系统 keyring,可安装:
pip install keyrings.alt注意:keyrings.alt 可能以明文文件方式保存凭据。
配置
需要从 https://account.xiaomi.com 登录后的 Cookie 中获取:
userIdpassToken
中国区账号建议:
mi-fitness-mcp setup \
--mode mi_fitness_cloud \
--user-id "<userId>" \
--pass-token "<passToken>" \
--region cn检查连接:
mi-fitness-mcp doctor同步数据
同步全部可探测数据:
mi-fitness-mcp sync --start-date 2026-01-01 --end-date 2026-06-21按类型同步:
mi-fitness-mcp sync --type daily_activity --start-date 2026-01-01 --end-date 2026-06-21
mi-fitness-mcp sync --type heart_rate --start-date 2026-01-01 --end-date 2026-06-21
mi-fitness-mcp sync --type sleep --start-date 2026-01-01 --end-date 2026-06-21
mi-fitness-mcp sync --type workouts --start-date 2026-01-01 --end-date 2026-06-21
mi-fitness-mcp sync --type body_measurements --start-date 2026-01-01 --end-date 2026-06-21启动 MCP Server
mi-fitness-mcp serveClaude Desktop 配置示例:
{
"mcpServers": {
"mi-fitness": {
"command": "mi-fitness-mcp",
"args": ["serve"]
}
}
}MCP 工具
get_connection_statussync_dataget_profileget_daily_summaryquery_metric_seriesquery_heart_ratequery_body_measurementsquery_sleepquery_workoutsget_data_coverage
本地数据库
默认位置:
~/.local/share/mi-fitness-mcp/mi_fitness.db主要表:
daily_activity
heart_rate_samples
sleep_sessions
workouts
body_measurements
sync_state安全说明
passToken是敏感凭据,不要泄露。不要提交本地配置、数据库、keyring 文件。
如果 token 泄露,建议退出小米账号并重新登录刷新。
免责声明
本项目与小米公司无关。请仅用于读取和分析你自己的健康数据。
新增健康指标
本分支额外逆向并验证了以下小米运动健康云端 key,并已接入 CLI 同步、本地 SQLite 缓存和 MCP 查询工具:
resting_heart_rate:静息心率,合并到query_heart_rate(sample_type="resting")。spo2:血氧饱和度,CLI 类型spo2,MCP 工具query_spo2。stress:压力值,CLI 类型stress,MCP 工具query_stress。abnormal_heart_beat:异常心跳事件,CLI 类型abnormal_heart_beat,MCP 工具query_abnormal_heart_beat。
示例:
mi-fitness-mcp sync --type spo2 --start-date 2026-06-01 --end-date 2026-06-22
mi-fitness-mcp sync --type stress --start-date 2026-06-01 --end-date 2026-06-22
mi-fitness-mcp sync --type abnormal_heart_beat --start-date 2026-06-01 --end-date 2026-06-22License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/binglua/mi-fitness-mcp-cn'
If you have feedback or need assistance with the MCP directory API, please join our Discord server