About shkyyy18/mi_fitness_data_bridge
shkyyy18/mi_fitness_data_bridge is an MCP server published by shkyyy18 in the Healthcare category: free synthetic demo. Conduid read 18 tools from its source: cancel_sync, get_connection_status, get_data_coverage, get_profile, get_sync_status, query_abnormal_heart_beat and 12 more. No package is published for it, so it installs from a source checkout.
The repository has 85 stars and 11 forks, and its last commit was on 1 Dec 2026. The latest release is v0.3.3 (29 Sep 2026): v0.3.3 — MCP tool quality and sync lifecycle Added Add cancel_sync for background MCP jobs. It follows v0.3.2 (23 Sep 2026), and the 4 most recent releases go back to v0.3.0 (13 Aug 2026). Its topics include csv, data-export, health-data, json, local-first and mi-fitness.
Install
git clone https://github.com/shkyyy18/mi_fitness_data_bridgeTools (18)
cancel_syncCancel a queued/running background MCP sync by its exact sync_id. Returns the terminal job status after cancellation completes; already-finished jobs are returned unchanged. Stops future requests without deleting or rolling back records already committed to SQLite; counts may be incomplete. Unknown IDs or foreground jobs return status=error. No new cloud request. Use get_sync_status to inspect progress and sync_data with user consent to resume via a new job.| Parameter | Type | Description |
|---|---|---|
| sync_id * | string | Exact ID of the background sync job to stop. |
get_connection_statusCheck whether the configured Mi Fitness account can connect before requesting a sync. May contact Xiaomi, authenticate and rotate credentials in the local keyring; does not sync health records. Requires local interactive CLI setup, never credentials in tool arguments. Returns connected, mode, last_sync_at and available_data_types; configured responses also include connection_state, region, last_connection_error and sync_in_progress. While syncing, reports existing connection state instead of probing. For cached date coverage use get_data_coverage.get_data_coverageInspect which date ranges already exist in the local cache before choosing query dates or requesting sync_data. Returns data.coverage [{data_type, first_date, last_date, days_with_data}] for nonempty datasets; omitted/empty data_types means all datasets. Empty datasets are omitted, and first/last dates do not guarantee uninterrupted coverage between them. This does not test cloud connectivity or report a background job; use get_connection_status or get_sync_status respectively. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use sync_data to refresh with user consent.| Parameter | Type | Description |
|---|---|---|
| data_types | array | Optional dataset names to inspect; omit or [] for all cached datasets. |
get_profileRead minimal metadata for the already-connected local account, not a medical or demographic profile. No cloud request or cache write; returns JSON text with status, source and data.profile containing account_id_masked, configured timezone and devices (currently an empty placeholder). Never returns credentials or plaintext account IDs. Returns status=error if disconnected; get_connection_status can establish/check the connection first. Use query_daily_activity for activity totals.get_sync_statusRead one MCP sync job by sync_id, including after a server restart. Returns sync_id, status, timestamps and available result counts. States are queued, running, ok, partial, error, cancelled or interrupted (previous process stopped). Read-only local lookup; no cloud request. History retains the latest 500 completed jobs per account; unknown/expired IDs return status=error. Use query_sync_history to discover IDs, cancel_sync to stop a live background job, or get_connection_status for cloud connectivity. Restarted lookups omit raw error text for privacy.| Parameter | Type | Description |
|---|---|---|
| sync_id * | string | Exact sync_id returned by sync_data or query_sync_history; not a workout ID. |
query_abnormal_heart_beatRead device-reported abnormal-heartbeat events starting within an inclusive YYYY-MM-DD range. Returns data.events [{event_id, start_at, end_at, duration_seconds}] and data.count, earliest first. limit defaults to 5000; use offset for subsequent pages. Events are upstream flags, not a diagnosis; an empty list is not evidence of a healthy heart. Use query_heart_rate for ordinary bpm samples, not this event list. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent.| Parameter | Type | Description |
|---|---|---|
| end_date * | string | Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date. |
| limit | integer | Maximum earliest matching records to return (default 5000); use a small positive value to limit context; use offset for subsequent pages. |
| start_date * | string | Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion. |
query_body_measurementsRead timestamped body measurements over an inclusive YYYY-MM-DD range. Returns data.measurements and data.count in timestamp order; latest_only=true returns only the last matching record, not the latest value of each field. Omitted/empty metrics returns all available fields; otherwise timestamp plus selected fields, with absent optional measurements omitted. Units are kg for mass, percent for body fat/water, dimensionless for BMI. Use query_metric_series(metric=weight_kg) for a daily or aggregated weight trend. latest_only selects before pagination. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent.| Parameter | Type | Description |
|---|---|---|
| end_date * | string | Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date. |
| latest_only | boolean | Return only the last measurement in this range when true; false returns all matching records. |
| metrics | array | Optional body-field projection; timestamp always remains. Omit or [] for all available fields. Missing optional fields are omitted, not zero. |
| start_date * | string | Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion. |
query_daily_activityChoose this for a multi-column daily activity table, not a single-metric trend. Read daily activity totals: steps, distance_m, active_kcal, total_kcal, floors and active_minutes, plus data_quality. Supply date for one day or both start_date/end_date for an inclusive YYYY-MM-DD range; date takes precedence if both forms are given. Returns data.summaries and data.data_quality. Missing optional upstream metrics may appear as zero with quality warnings; do not treat them as confirmed measurements. For one metric across days/weeks/months use query_metric_series; sleep and workouts have separate tools. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent.| Parameter | Type | Description |
|---|---|---|
| date | string | Single calendar date YYYY-MM-DD, inclusive; overrides start_date and end_date when supplied. |
| end_date | string | Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date. |
| start_date | string | Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion. |
query_heart_rateRead timestamped heart-rate samples in bpm over an inclusive YYYY-MM-DD range, optionally filtering sample_type. Returns data.samples [{timestamp, bpm, sample_type}] and data.count, earliest first. limit defaults to 5000; use a smaller page/date window for large datasets. The cloud adapter normally stores resting/active/passive, so sample_type=workout may be empty; use query_workout_series with a workout_id to analyze all samples in that activity window. Not a diagnosis. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent.| Parameter | Type | Description |
|---|---|---|
| end_date * | string | Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date. |
| limit | integer | Maximum earliest matching records to return (default 5000); use a small positive value to limit context; use offset for subsequent pages. |
| sample_type | string | Optional exact stored sample type; omit for all. Cloud records normally use resting/active/passive; for workout-window samples use query_workout_series. |
| start_date * | string | Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion. |
query_metric_seriesBuild a dated trend for steps (count), distance_m (meters), active_kcal (kcal), or weight_kg (kg) over an inclusive YYYY-MM-DD range. Returns data.metric and data.series [{date, value}], sorted ascending, without filling missing dates. Activity uses daily totals; weight uses the latest stored measurement per day. granularity=day returns these daily values; week groups from Monday, month from the first day. aggregation (default sum) applies only to week/month daily values; latest selects the last available day. Prefer avg or latest for weight. For raw body readings use query_body_measurements; heart-rate samples use query_heart_rate; one workout uses query_workout_series. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent.| Parameter | Type | Description |
|---|---|---|
| aggregation | string | Reducer over daily values in week/month buckets; ignored for day. latest means last available date; avg excludes missing days. Prefer avg/latest for weight. |
| end_date * | string | Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date. |
| granularity | string | day returns daily values; week groups by Monday; month by first day. Missing days are not zero-filled. |
| metric * | string | Metric and output units: steps=count, distance_m=meters, active_kcal=kcal, weight_kg=kg. |
| start_date * | string | Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion. |
query_sleepRead sleep sessions (start-date filtered) and a main-sleep summary (local wake-date filtered) over an inclusive YYYY-MM-DD range. Returns data.sessions, count, main_sessions, metrics and data_quality; main sleep is the longest valid non-nap per wake date. include_naps defaults true and affects the raw list only, not main-sleep selection. Times include start_at/end_at; durations are minutes; sleep_score/source can be null and missing scores are not zero. Expand dates around midnight if needed; raw counts can differ from wake-date summary counts. Use this instead of query_daily_activity for sleep. Pagination affects sessions/count only; main_sessions, metrics and quality still describe the full date range, so keep ranges narrow. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent.| Parameter | Type | Description |
|---|---|---|
| end_date * | string | Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date. |
| include_naps | boolean | Include naps in raw sessions (default true); main-sleep summary always excludes naps. |
| start_date * | string | Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion. |
query_spo2Read stored blood oxygen saturation samples (spo2_pct, percent) over an inclusive YYYY-MM-DD range. Returns data.samples [{timestamp, spo2_pct}] and data.count, earliest first. limit defaults to 5000; use offset for subsequent pages. These are device measurements, not a diagnosis; missing records do not indicate normal oxygen levels. Use query_heart_rate for bpm rather than oxygen saturation. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent.| Parameter | Type | Description |
|---|---|---|
| end_date * | string | Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date. |
| limit | integer | Maximum earliest matching records to return (default 5000); use a small positive value to limit context; use offset for subsequent pages. |
| start_date * | string | Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion. |
query_stressRead device stress samples over an inclusive YYYY-MM-DD range, optionally filtered by level (low/medium/high). Returns data.samples [{timestamp, stress_score, level}] and data.count, earliest first. stress_score is the upstream device score, not a clinical assessment. limit defaults to 5000; use offset for subsequent pages. Use query_sleep for sleep quality rather than inferring it from stress. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent.| Parameter | Type | Description |
|---|---|---|
| end_date * | string | Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date. |
| level | string | Optional exact stored stress level: low, medium or high; omit to include all levels. |
| limit | integer | Maximum earliest matching records to return (default 5000); use a small positive value to limit context; use offset for subsequent pages. |
| start_date * | string | Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion. |
query_sync_historyList this account's MCP sync jobs, newest first, from persistent local SQLite. Returns data.jobs and data.pagination with timestamps, statuses, available counts and safe error codes, never credentials, raw errors or health records. Includes foreground/background jobs started since this feature was installed, not CLI syncs; retains the latest 500 completed jobs plus active jobs. Read-only, no cloud calls. Use get_sync_status for one ID and cancel_sync for a live background job. Empty jobs means no retained history.query_workout_seriesRead an auto-downsampled heart-rate curve for one workout_id obtained from query_workouts (contract agent-safe-series/v1). Uses all cached heart-rate sample types inside the workout window. Returns data with numeric t offsets in seconds from start_time, bpm values, downsampled/source_points/returned_points/method and full-resolution summary statistics. resolution defaults to 60 seconds and increases to respect max_points (default 400, hard cap 500). Pass the same reference_max_hr in bpm for comparable time_in_zone across activities; otherwise each workout uses its own maximum, so zones are not comparable. Unknown workout IDs or unsupported metrics return status=error. For raw date-range samples use query_heart_rate. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent.| Parameter | Type | Description |
|---|---|---|
| max_points | integer | Requested maximum returned points (default 400, 1..500); server also clamps direct service calls to this range. |
| metric | string | Only heart_rate is supported; values are beats per minute (bpm). |
| reference_max_hr | integer | Optional positive reference maximum heart rate in bpm for zone normalization; use the same value across compared workouts. Omit to use this workout maximum. |
| resolution | integer | Requested bucket duration in seconds (default 60, at least 1); automatically increased to fit max_points. |
| workout_id * | string | Exact workout_id returned by query_workouts for this account; do not invent an ID. |
query_workoutsList recorded workouts starting within an inclusive YYYY-MM-DD range. Returns data.workouts, count and data_quality; rows include workout_id, activity_type, start_at/end_at, duration_minutes, distance_m, calories_kcal and available heart-rate/pace/cadence/altitude/training-metric fields (missing fields may be null, depending on device and upstream data). activity_types matches case-insensitively; min_duration is minutes and min_distance_km is kilometers (unlike output distance_m). Filters combine with AND before pagination. Use a returned workout_id with query_workout_series for a heart-rate curve; this tool returns session summaries, not samples. Read-only local SQLite query; no cloud request or automatic sync. Requires a configured local account/cache. Returns JSON text with status, source=cache, generated_at and data; empty lists mean no cached matches, not zero measurements. Use get_data_coverage to inspect availability or sync_data to refresh with user consent.| Parameter | Type | Description |
|---|---|---|
| activity_types | array | Optional activity labels from stored workouts (e.g. running); case-insensitive. Omit or [] for all; labels depend on device/upstream data. |
| end_date * | string | Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date. |
| min_distance_km | number | Minimum workout distance in kilometers, inclusive; 0 or omitted disables this filter. Returned distance uses meters. |
| min_duration | integer | Minimum workout duration in minutes, inclusive; 0 or omitted disables this filter. |
| start_date * | string | Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion. |
sync_dataDownload selected Mi Fitness datasets from Xiaomi into local SQLite; writes records and sync watermarks, may authenticate/rotate local credentials, and does not modify cloud health records. Requires local CLI setup and user authorization to access the account. Omitted data_types selects all adapter-supported types; an empty list is invalid. Dates are inclusive YYYY-MM-DD; start_date must not exceed end_date. Omitted end_date uses today; omitted start_date resumes the watermark or uses configured lookback (default 30 days). force_full_sync ignores the watermark, not the requested date range, and does not erase the database. Only one sync runs at a time. background=false waits for status ok/partial/error, sync_id, record counts and per-type results; background=true returns accepted plus sync_id to poll with get_sync_status. Partial results may already be stored; inspect results before retrying. Use cached query tools instead when no refresh is needed.| Parameter | Type | Description |
|---|---|---|
| background | boolean | False waits for results; true starts a process-local task and returns sync_id for get_sync_status polling. |
| data_types | array | Dataset names; omitted selects all adapter-supported datasets including workout_detail, which downloads per-workout FDS blobs (per-second samples and GPS) for cached workouts missing detail and skips workouts already covered; [] is invalid. |
| end_date | string | Inclusive last calendar date, YYYY-MM-DD; must be on or after start_date. Omitted: server local today. |
| force_full_sync | boolean | Ignore saved sync watermark and re-fetch the requested range; no deletion. If start_date is omitted use configured lookback. |
| start_date | string | Inclusive first calendar date, YYYY-MM-DD; must be on or before end_date. Uses stored calendar dates, not caller timezone conversion. Omitted: saved watermark, or configured lookback (default 30 days) if no watermark/force_full_sync=true. |
workout_detail_seriesRead an agent-safe per-second detail series (heart rate, cadence, pace or speed) for one workout_id obtained from query_workouts (contract agent-safe-series/v1). Data comes from the FDS detail cache (workout_detail_samples), populated by syncing workout_detail; workouts without synced detail return an empty series, not an error. Sensor zero values at activity start are excluded as missing and counted in data_quality. Points carry numeric t offsets in seconds from start; stats and time_in_zone are computed on full-resolution samples; downsampling is always disclosed (default 400 points, hard cap 500). time_in_zone is only produced for heart_rate. Read-only local SQLite query; no cloud request or automatic sync. Returns JSON text with status, source=cache, generated_at and data; use get_data_coverage with data_types=["workout_detail"] to check availability.| Parameter | Type | Description |
|---|---|---|
| max_points | integer | Requested maximum returned points (default 400, 1..500); server also clamps direct service calls to this range. |
| metric | string | heart_rate in bpm, cadence in spm, pace in s/km, speed in m/s; channel availability depends on the sport's record blob, missing channels yield empty series. |
| reference_max_hr | integer | Optional positive reference maximum heart rate in bpm for zone normalization; use the same value across compared workouts. Omit to use this workout maximum. Only affects heart_rate. |
| resolution | integer | Requested bucket duration in seconds (default 60, at least 1); automatically increased to fit max_points. |
| workout_id * | string | Exact workout_id returned by query_workouts for this account; do not invent an ID. |
Security checks
6 checks have not been run yet.