Mi Fitness MCP
Provides tools to sync and serve Mi Fitness cloud data, including daily activity (steps, distance, calories), heart rate, and body measurements (weight, BMI, body composition metrics).
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 MCPShow my daily activity for the last 14 days"
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
MCP server for Mi Fitness data.
This project provides a local SQLite-backed MCP server for Mi Fitness cloud data.
Current data coverage
Confirmed with the current cloud flow:
daily activity
steps
distance
active calories
heart rate
body measurements
weight
BMI
fat, water, bone, and muscle metrics
visceral fat
basal metabolism
official Xiaomi workout sessions
sport/category, duration, distance, calories, pace, cadence, speed, elevation
heart-rate zones, training effect/load, recovery time, VO2 max when supplied
Not yet supported:
sleep. The available endpoint and payload contract have not been confirmed, so sleep is intentionally not advertised or synchronized yet.
Related MCP server: Mi Fitness MCP CN
Install
python -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'Setup
You need:
userIdpassToken
Typical flow:
Open
https://account.xiaomi.comSign in to your Xiaomi account
Open browser DevTools
Inspect cookies for
account.xiaomi.comCopy
userIdandpassToken
Configure the server. The interactive prompt hides passToken and stores credentials in the
system keyring:
mi-fitness-mcp setup --mode mi_fitness_cloud --user-id "<userId>" --region ru
mi-fitness-mcp doctorFor automation, prefer --pass-token-stdin or MI_FITNESS_PASS_TOKEN. The legacy
--pass-token argument remains available for backward compatibility but is deprecated because
command-line arguments may be visible in shell history and process listings.
Xiaomi accounts may be hosted in regional Mi Fitness backends. ru remains the default for
compatibility, while the adapter can discover and persist another accepted global/EU region such
as de, i2, sg, or us. This does not change the Xiaomi userId + passToken login flow.
For local endpoint exploration there is also a probe script:
uv run python probe_mifitness.py --user-id "<userId>"The probe prompts for passToken without echo. For automation, provide
MI_FITNESS_USER_ID and MI_FITNESS_PASS_TOKEN, or use --pass-token-stdin with a
protected input source. Secret command-line arguments are intentionally unsupported.
Use
mi-fitness-mcp sync --start-date 2025-04-01 --end-date 2025-05-31
mi-fitness-mcp serveMCP client config
Example Claude Desktop config:
{
"mcpServers": {
"mi-fitness": {
"command": "mi-fitness-mcp",
"args": ["serve"]
}
}
}Example prompts
Show my daily activity for the last 14 daysHow has my resting heart rate changed this month?Summarize my latest body measurementsShow my running workouts from the last 30 daysSummarize workout volume by sport or ISO weekCompare this month's workout totals with last monthWhat were my longest-distance and fastest-pace workout records?Sync my latest Mi Fitness data
MCP tools
get_connection_statussync_dataget_profileget_daily_summaryquery_metric_seriesquery_heart_ratequery_body_measurementsquery_workoutssummarize_workoutsget_workout_recordscompare_workout_periodsget_data_coverage
Existing tool names, argument semantics, and status: ok|error response envelopes remain
backward compatible. Sync reports successful and failed data types separately; a partial sync
returns ok, while a sync where every requested type fails returns error.
Commands
mi-fitness-mcp --help
mi-fitness-mcp setup --help
mi-fitness-mcp doctor
mi-fitness-mcp sync --help
mi-fitness-mcp serveDevelopment
uv run ruff check .
uv run pytest -q
uv run python -m buildThe current test suite contains 89 tests and reports 78% statement coverage. CI runs on Python
3.11, 3.12, and 3.13, keeps HTTP tests offline with respx, and installs the built wheel in a
clean environment before checking mi-fitness-mcp --help.
Configuration compatibility
SQLite schema changes use the existing versioned migration runner; existing tables and data are preserved.
busy_timeoutconfigures SQLite lock waiting in milliseconds and defaults to5000.auto_sync_on_start,stale_after_minutes,store_raw_payloads,default_lookback_days, andlogs_pathare retained for config-file compatibility but are deprecated no-ops.
Troubleshooting
Connection: failedverify
userIdandpassTokenverify the configured region; global/EU accounts may resolve to another backend
Credentials not foundrun
setupagain
syncreturns no datatry another date range
verify that the data actually exists in Mi Fitness cloud
Security
passTokenis stored via the system keyringuserIdis masked in CLI and MCP diagnostics;passTokenis never printeddo not commit
.env, local config files, or real credentialsrotate tokens if they were pasted into chats or shell history
Disclaimer
This is an unofficial project and is not affiliated with Xiaomi.
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 Servers
- AlicenseBqualityBmaintenanceMCP server that provides local caching, sync, and tools for Zepp Life health data including steps, sleep, heart rate, workouts, and body measurements, supporting both file exports and cloud session access.109MIT
- AlicenseCqualityBmaintenanceEnables 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.103MIT
- AlicenseNot gradedqualityCmaintenanceSelf-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
- AlicenseAqualityBmaintenanceMCP server for reading and querying Garmin Connect data, including activities, strength history, recovery, trends, and optionally creating workouts.12MIT
Related MCP Connectors
MCP server for Withings health data — sleep, activity, heart, and body metrics.
MCP server wrapping the Tesla Fleet API and TeslaMate API
MCP server for Zooza — class scheduling, attendance, and booking for activity businesses.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/kubulashvili/mi-fitness-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server