Skip to main content
Glama

withings-mcp

CI License: GPL v3 Python 3.13+ PyPI Glama MCP Server

MCP-сервер для Withings Health API с OAuth, локальным SQLite-кэшем и анализом трендов.

Чем это отличается от других Withings MCP-серверов:

  • Локальный SQLite-кэш для быстрых офлайн-запросов и анализа исторических трендов

  • Инкрементальная синхронизация — загружаются только новые данные с момента последней синхронизации

  • Широкое покрытие Withings: 17 показателей состава тела, а также сон, дневная активность, тренировки и ЭКГ/ФП

  • Автоматическое обновление OAuth-токенов (токены доступа: 3 часа, токены обновления: 1 год)

  • Ноль зависимостей, кроме mcp (HTTP через стандартную библиотеку)

  • Python 3.13+

Инструменты

Tool

Description

Data source

withings_sync

Синхронизирует данные из Withings API с локальным кэшем

API в реальном времени -> SQLite

withings_get_body

Состав тела (вес, процент жира, мышцы, кости, АД, SpO2)

Локальный кэш (автосинхронизация при устаревании)

withings_get_sleep

Сводки по сну или подробные временные ряды фаз с detail=True

Кэш (сводка) / в реальном времени (детально)

withings_get_activity

Ежедневные шаги, дистанция, калории, время активности

Локальный кэш (автосинхронизация при устаревании)

withings_get_workouts

Тренировки с типом, продолжительностью, ЧСС

Локальный кэш (автосинхронизация при устаревании)

withings_get_heart

Записи ЭКГ и обнаружение ФП

API в реальном времени (всегда)

withings_get_devices

Подключённые устройства с состоянием батареи

API в реальном времени (всегда)

withings_trends

Средние за период, недельные/месячные/квартальные тренды, сравнения

Локальный кэш (автосинхронизация при устаревании)

Инструменты запросов на основе кэша автоматически синхронизируются, когда их данные устаревают, и принимают live=True, чтобы обойти кэш и получить данные напрямую из Withings API. withings_get_heart и withings_get_devices всегда работают в реальном времени. withings_get_sleep(detail=True) возвращает поминутные фазы сна (в реальном времени, до 7 дней за запрос).

Related MCP server: Withings MCP Server

Предварительные требования

  • Python 3.13+

  • uv (рекомендуется) или pip

  • Учётная запись разработчика Withings и зарегистрированное приложение

Установка

pip install withings-mcp

Или запустите без установки через uvx withings-mcp. Для разработки из клона:

git clone https://github.com/partymola/withings-mcp.git
cd withings-mcp
uv venv --python 3.13 .venv
uv pip install -e .

Настройка

1. Зарегистрируйте приложение Withings

  1. Перейдите на https://developer.withings.com/dashboard

  2. Создайте новое приложение

  3. Установите URL обратного вызова: http://localhost:8585

  4. Запишите ваш Client ID и Client Secret

2. Аутентификация

.venv/bin/withings-mcp auth

Это откроет ваш браузер для авторизации Withings. После одобрения токены сохраняются локально в config/.

3. Регистрация в Claude Code

claude mcp add -s user withings -- /path/to/withings-mcp/.venv/bin/withings-mcp

4. Первая синхронизация

В Claude Code скажите: "Синхронизируй мои данные Withings"

Это запускает withings_sync для заполнения локального кэша. Последующие синхронизации загружают только новые данные.

Если что-то не работает — нет данных там, где вы их ожидаете, синхронизация перестала выполняться — запустите withings-mcp doctor. Он сообщает фактически используемые пути и учётные данные и что нужно исправить, без выполнения API-запроса.

Вы также можете синхронизировать из командной строки без MCP-клиента:

.venv/bin/withings-mcp sync                      # all data types, last 30 days
.venv/bin/withings-mcp sync --types body,sleep   # a subset
.venv/bin/withings-mcp sync --days 90            # deeper history on first sync

CLI

withings-mcp              Start the MCP server (stdio transport)
withings-mcp auth         Interactive OAuth setup (opens the browser)
withings-mcp sync         Sync data to the local cache (--types, --days)
withings-mcp doctor       Check the setup and report what needs fixing
withings-mcp --version    Print the installed package version

Конфигурация

Environment Variable

Default

Description

WITHINGS_MCP_CONFIG_DIR

./config/

Каталог для учётных данных и токенов

WITHINGS_MCP_DB_PATH

./withings.db

Путь к базе данных SQLite

Примеры запросов

  • "Синхронизируй мои данные Withings"

  • "Покажи мой вес за последние 3 месяца"

  • "Как изменился мой сон в этом году?"

  • "Сравни мой состав тела в этом месяце с прошлым"

  • "Какие тренировки я делал в марте?"

  • "Какие устройства Withings у меня подключены?"

  • "Покажи мои тренды сна по кварталам"

Разработка

# Install with dev dependencies
uv pip install -e . && uv pip install pytest

# Run tests (all use in-memory SQLite with fictional data)
.venv/bin/python -m pytest tests/ -v      # .venv\Scripts\python on Windows

Безопасность

  • Только чтение: Никакие инструменты не изменяют данные на серверах Withings

  • Локальное хранение: Данные о здоровье остаются в вашей локальной базе данных SQLite

  • Хранение токенов: OAuth-токены хранятся в config/ (исключены из git; создаются с правами 0600 на POSIX — Windows игнорирует режим и управляет доступом через ACL)

  • Сообщения об ошибках: Никогда не содержат значения данных о здоровье — только коды состояния

  • Pre-commit хук: Необязательный хук (scripts/check-no-data.sh) блокирует добавление файлов базы данных и учётных данных в коммиты — установите его однострочной командой из CONTRIBUTING.md

Участие в разработке

Смотрите CONTRIBUTING.md для настройки разработки, тестового процесса и pre-commit хука. Изменения отслеживаются в CHANGELOG.md.

Лицензия

GPL-3.0-or-later

Available Tools

8 tools
withings_get_activityA

Get daily activity summaries (steps, distance, calories, active time).

Returns one entry per day from the local cache by default. Run withings_sync first to populate the cache.

Args: start_date: Start date as "YYYY-MM-DD", "YYYY-MM", or "30d". Default: 30 days back from the end date or today, whichever is earlier. end_date: End date as "YYYY-MM-DD", "YYYY-MM" (its last day), or "Nd". Default: today. live: If true, fetch from Withings API instead of cache.

Returns daily activity data sorted by date, with steps, distance in km, calories, and active minutes by intensity level. Not for workout sessions -- use withings_get_workouts instead.

Inputs: live, end_date, start_date.

withings_get_bodyA

Get body composition measurements (weight, fat, muscle, etc.).

Returns measurements from the local cache by default. Use live=True to fetch directly from Withings API. Run withings_sync first to populate the cache.

Args: start_date: Start date as "YYYY-MM-DD", "YYYY-MM", or "30d" for relative days. Default: 30 days back from the end date or today, whichever is earlier. end_date: End date as "YYYY-MM-DD", "YYYY-MM" (its last day), or "Nd". Default: today. metrics: Comma-separated metric filter, e.g. "weight_kg,fat_pct". Default: all available metrics. Names match exactly and are case-sensitive; one that is not on this list is refused, naming them. Options: weight_kg, height_m, lean_mass_kg, fat_pct, fat_mass_kg, muscle_mass_kg, hydration_kg, bone_mass_kg, heart_rate, systolic_bp, diastolic_bp, spo2_pct, temperature_c, body_temperature_c, pulse_wave_velocity, visceral_fat_index, basal_metabolic_rate.

live: If true, fetch from Withings API instead of cache.

Returns measurements sorted by date, one entry per measurement group. Not for sleep or activity data -- use withings_get_sleep or withings_get_activity instead.

Inputs: live, metrics, end_date, start_date.

withings_get_devicesA

Get connected Withings devices with battery and firmware info.

Always fetched live from the Withings API.

Returns device type, model name, battery level (high/medium/low), and last session date for each connected device.

Inputs: no named parameters.

withings_get_heartA

Get ECG recordings and atrial fibrillation detection results.

Always fetched live from the Withings API (not cached due to large signal data). Requires a Withings device with ECG capability (ScanWatch, BPM Core).

Args: start_date: Start date as "YYYY-MM-DD", "YYYY-MM", or "30d". Default: 30 days back from the end date or today, whichever is earlier. end_date: End date as "YYYY-MM-DD", "YYYY-MM" (its last day), or "Nd". Default: today.

Returns ECG recording list with timestamps, AFib classification (negative/positive/inconclusive), and heart rate. Does not include raw signal waveforms. For resting heart rate trends, use withings_get_body or withings_get_sleep instead.

Inputs: end_date, start_date.

withings_get_sleepA

Get sleep data (summaries or detailed phases).

Summary mode (default): nightly totals with duration, sleep score, HR, respiratory rate, and snoring. From local cache unless live=True.

Detail mode (detail=True): minute-by-minute sleep phases (awake, light, deep, REM) with HR and respiratory rate. Always fetched live. Maximum 7 days per request (Withings API limit).

Args: start_date: Start date as "YYYY-MM-DD", "YYYY-MM", or "7d". Default: 7 days (detail) or 30 days (summary) back from the end date or today, whichever is earlier. end_date: End date as "YYYY-MM-DD", "YYYY-MM" (its last day), or "Nd". Default: today. detail: If true, return minute-by-minute sleep phases instead of nightly summaries. Always live, max 7 days. live: If true, fetch summaries from API instead of cache. Ignored when detail=True (always live).

Returns nightly sleep data sorted by date. Not for body composition -- use withings_get_body instead.

Inputs: live, detail, end_date, start_date.

withings_get_workoutsA

Get workout sessions (type, duration, HR, calories).

Returns individual workout sessions from the local cache by default. Run withings_sync first to populate the cache.

Args: start_date: Start date as "YYYY-MM-DD", "YYYY-MM", or "90d". Default: 90 days back from the end date or today, whichever is earlier. end_date: End date as "YYYY-MM-DD", "YYYY-MM" (its last day), or "Nd". Default: today. category: Filter by workout type, case-insensitive partial match. A value matching none of the categories below is refused, naming the ones your cache holds. Options: badminton, baseball, basketball, bmx, bodyboard, boxing, calisthenics, climbing, cycling, dancing, elliptical, fencing, football, golf, handball, hiking, hockey, horse_riding, ice_hockey, ice_skating, indoor_cycling, indoor_running, indoor_walk, kitesurfing, martial_arts, multi_sport, other, pilates, rowing, rugby, run, skating, skiing, snowboarding, soccer, squash, surfing, swimming, table_tennis, tennis, volleyball, walk, waterpolo, weightlifting, windsurfing, wrestling, yoga, zumba.

live: If true, fetch from Withings API instead of cache.

Returns workout sessions sorted by date with type, duration, calories, distance, and heart rate data. Not for daily step/activity totals -- use withings_get_activity.

Inputs: live, category, end_date, start_date.

withings_syncA

Sync Withings health data to the local cache.

Fetches data from the Withings API and stores it in SQLite for fast offline queries. Run this before using other withings_get_* tools.

Syncs incrementally: only fetches data newer than the last sync. First sync fetches the specified number of days of history.

Args: data_types: What to sync. Options: "all", "body", "sleep", "activity", "workouts". Comma-separated for multiple, e.g. "body,sleep". Default: "all". days: Days of history for first sync (default: 30). Ignored on subsequent syncs (uses last sync timestamp).

Returns summary of records synced per data type. Not for querying data - use withings_get_body, withings_get_sleep, withings_get_activity, or withings_get_workouts instead.

Inputs: days, data_types.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 8 tools

    Disambiguation5/5

    Each tool targets a clearly distinct data domain or action: sync, devices, body, sleep, activity, workouts, heart/ECG, and trends. Descriptions explicitly cross-reference each other and clarify boundaries such as activity vs workouts, body vs heart, and trends vs raw data.

    Naming Consistency4/5

    All tools share the withings_ prefix and mostly follow a verb_noun pattern (get_body, get_sleep, get_activity). However, withings_sync and withings_trends deviate from the get_* pattern, which is a minor inconsistency.

    Tool Count5/5

    Eight tools is well-scoped for a health data server, covering each major data type with dedicated query tools plus sync and trends. No tool appears redundant or unnecessary.

    Completeness4/5

    The surface covers the core Withings health domains: devices, sync, body composition, sleep, activity, workouts, ECG, and trend analysis. Minor gaps exist around user profile/goals or device settings, but these are not essential for the apparent read-focused purpose.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables retrieval of health data from Withings smart scales including weight measurements and comprehensive body composition metrics like fat mass, muscle mass, and hydration levels. Supports multiple users, unit preferences, and OAuth authentication for secure access to personal health data.
      2
      ISC
    • A
      license
      A
      quality
      C
      maintenance
      Enables access to Withings Health API data including body measurements, activity tracking, sleep analysis, workouts, and heart rate monitoring through OAuth2 authentication.
      8
      1
      MIT
    • A
      license
      A
      quality
      F
      maintenance
      Enables read-only access to your own Withings health data through a personal developer app, exposing body measurements, blood pressure, daily activity, sleep summaries, and linked devices for natural-language queries.
      8
      MIT