Skip to main content
Glama

withings-mcp

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

Servidor MCP para la Withings Health API con OAuth, caché local SQLite y análisis de tendencias.

Lo que hace diferente a este servidor de otros servidores MCP de Withings:

  • Caché local SQLite para consultas rápidas sin conexión y análisis histórico de tendencias

  • Sincronización incremental: solo obtiene datos nuevos desde la última sincronización

  • Amplia cobertura de Withings: 17 métricas de composición corporal más sueño, actividad diaria, entrenamientos y ECG/AFib

  • Refresco automático de tokens OAuth (tokens de acceso: 3 h, tokens de refresco: 1 año)

  • Cero dependencias más allá de mcp (HTTP vía stdlib)

  • Python 3.13+

Herramientas

Herramienta

Descripción

Fuente de datos

withings_sync

Sincroniza datos desde la API de Withings a la caché local

API en vivo -> SQLite

withings_get_body

Composición corporal (peso, % grasa, músculo, hueso, PA, SpO2)

Caché local (auto-sincroniza si está obsoleto)

withings_get_sleep

Resúmenes de sueño, o fases detalladas por hora con detail=True

Caché (resumen) / en vivo (detalle)

withings_get_activity

Pasos diarios, distancia, calorías, tiempo activo

Caché local (auto-sincroniza si está obsoleto)

withings_get_workouts

Sesiones de entrenamiento con tipo, duración, frecuencia cardíaca

Caché local (auto-sincroniza si está obsoleto)

withings_get_heart

Registros de ECG y detección de AFib

API en vivo (siempre)

withings_get_devices

Dispositivos conectados con estado de batería

API en vivo (siempre)

withings_trends

Promedios por período, tendencias semanales/mensuales/trimestrales, comparaciones

Caché local (auto-sincroniza si está obsoleto)

Las herramientas de consulta con respaldo en caché se sincronizan automáticamente cuando sus datos están desactualizados, y aceptan live=True para omitir la caché y obtener datos directamente de la API de Withings. withings_get_heart y withings_get_devices siempre usan datos en vivo. withings_get_sleep(detail=True) devuelve las fases de sueño minuto a minuto (en vivo, hasta 7 días por solicitud).

Related MCP server: Withings MCP Server

Prerrequisitos

  • Python 3.13+

  • uv (recomendado) o pip

  • Una cuenta de desarrollador de Withings y una aplicación registrada

Instalación

pip install withings-mcp

O ejecútalo sin instalar con uvx withings-mcp. Para desarrollo desde un clon:

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

Configuración

1. Registra una aplicación de Withings

  1. Ve a https://developer.withings.com/dashboard

  2. Crea una nueva aplicación

  3. Establece la URL de devolución de llamada a http://localhost:8585

  4. Anota tu Client ID y Client Secret

2. Autenticación

.venv/bin/withings-mcp auth

Esto abre tu navegador para la autorización de Withings. Después de aprobar, los tokens se guardan localmente en config/.

3. Regístrate con Claude Code

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

4. Primera sincronización

En Claude Code, di: "Sincroniza mis datos de Withings"

Esto ejecuta withings_sync para poblar la caché local. Las sincronizaciones posteriores solo obtienen datos nuevos.

Si algo no funciona (no hay datos donde esperas, una sincronización que deja de ocurrir), ejecuta withings-mcp doctor. Informa sobre las rutas y credenciales realmente en uso y qué necesita corregirse, sin hacer una llamada a la API.

También puedes sincronizar desde la línea de comandos sin un cliente 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

Configuración

Variable de Entorno

Valor por defecto

Descripción

WITHINGS_MCP_CONFIG_DIR

./config/

Directorio para credenciales y tokens

WITHINGS_MCP_DB_PATH

./withings.db

Ruta de la base de datos SQLite

(Note: The original table had two variables, but I see the original has WITHINGS_MCP_CONFIG_DIR and WITHINGS_MCP_DB_PATH with defaults ./config/ and ./withings.db respectively. I'll keep them.)

Wait, the original table says:

| WITHINGS_MCP_CONFIG_DIR | ./config/ | Directory for credentials and tokens | | WITHINGS_MCP_DB_PATH | ./withings.db | SQLite database path |

I'll translate the descriptions: "Directorio para credenciales y tokens" and "Ruta de la base de datos SQLite".

Now the rest.

Prompts de ejemplo

  • "Sincroniza mis datos de Withings"

  • "Muestra mi peso de los últimos 3 meses"

  • "¿Cómo ha cambiado mi sueño este año?"

  • "Compara mi composición corporal de este mes con la del mes pasado"

  • "¿Qué entrenamientos hice en marzo?"

  • "¿Qué dispositivos Withings tengo conectados?"

  • "Muestra mis tendencias de sueño del último año"

Desarrollo

# 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

Seguridad

  • Sin modificación de datos: ninguna herramienta modifica datos en los servidores de Withings

  • Almacenamiento local: los datos se guardan en tu base de datos SQLite local

  • Almacenamiento de tokens: en config/ (ignorado por git; creado con modo 0600 en Unix; Windows ignora el modo y controla el acceso mediante ACL)

  • Mensajes de error: nunca contienen valores de datos de salud, solo códigos de estado

  • Pre-commit opcional: un hook opcional (scripts/check-no-data.sh) evita que archivos de base de datos y credenciales se incluyan en los commits; instálalo con el comando de una línea en CONTRIBUTING.md

Contribuciones

Consulta CONTRIBUTING.md para la configuración de desarrollo, el flujo de trabajo de pruebas y el hook de pre-commit. Los cambios se rastrean en CHANGELOG.md.

Licencia

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