Skip to main content

withings-mcp

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

MCP server for the Withings Health API with OAuth, local SQLite cache, and trend analysis.

What makes this different from other Withings MCP servers:

  • Local SQLite cache for fast offline queries and historical trend analysis
  • Incremental sync - only fetches new data since last sync
  • Broad Withings coverage: 17 body-composition metrics plus sleep, daily activity, workouts, and ECG/AFib
  • Automatic OAuth token refresh (access tokens: 3h, refresh tokens: 1 year)
  • Zero dependencies beyond mcp (HTTP via stdlib)
  • Python 3.13+ (tested on 3.13 and 3.14, on Linux, macOS and Windows, in CI)

Tools

Tool Description Data source
withings_sync Sync data from Withings API to local cache Live API -> SQLite
withings_get_body Body composition (weight, fat%, muscle, bone, BP, SpO2) Local cache (auto-syncs if stale)
withings_get_sleep Sleep summaries, or detailed phase time-series with detail=True Cache (summary) / live (detail)
withings_get_activity Daily steps, distance, calories, active time Local cache (auto-syncs if stale)
withings_get_workouts Workout sessions with type, duration, HR Local cache (auto-syncs if stale)
withings_get_heart ECG recordings and AFib detection Live API (always)
withings_get_devices Connected devices with battery status Live API (always)
withings_trends Period averages, weekly/monthly/quarterly trends, comparisons Local cache (auto-syncs if stale)

The cache-backed query tools auto-sync when their data is stale, and accept live=True to bypass the cache and fetch straight from the Withings API. withings_get_heart and withings_get_devices are always live. withings_get_sleep(detail=True) returns minute-by-minute sleep phases (live, up to 7 days per request).

Prerequisites

  • Python 3.13+ (tested on 3.13 and 3.14, on Linux, macOS and Windows, in CI)
  • uv (recommended) or pip
  • A Withings developer account and registered application

Installation

pip install withings-mcp

Or run it without installing with uvx withings-mcp. For development from a clone:

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

Setup

1. Register a Withings app

  1. Go to https://developer.withings.com/dashboard
  2. Create a new application
  3. Set the callback URL to http://localhost:8585
  4. Note your Client ID and Client Secret

2. Authenticate

.venv/bin/withings-mcp auth

This opens your browser for Withings authorization. After approving, tokens are saved locally in config/.

3. Register with Claude Code

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

4. First sync

In Claude Code, say: "Sync my Withings data"

This runs withings_sync to populate the local cache. Subsequent syncs only fetch new data.

If anything does not work - no data where you expect it, a sync that stops happening - run withings-mcp doctor. It reports the paths and credentials actually in use and what needs fixing, without making an API call.

You can also sync from the command line without an MCP client:

.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

Configuration

Environment Variable Default Description
WITHINGS_MCP_CONFIG_DIR ./config/ Directory for credentials and tokens
WITHINGS_MCP_DB_PATH ./withings.db SQLite database path

Example Prompts

  • "Sync my Withings data"
  • "Show my weight for the last 3 months"
  • "How has my sleep changed this year?"
  • "Compare my body composition this month vs last month"
  • "What workouts did I do in March?"
  • "What Withings devices do I have connected?"
  • "Show my sleep trends quarterly"

Development

# 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

Security

  • Read-only: No tools modify data on Withings servers
  • Local storage: Health data stays in your local SQLite database
  • Token storage: OAuth tokens stored in config/ (gitignored; created 0600 on POSIX - Windows ignores the mode and governs access by ACLs)
  • Error messages: Never contain health data values - only status codes
  • Pre-commit hook: An optional hook (scripts/check-no-data.sh) blocks database files and credentials from commits - install it with the one-liner in CONTRIBUTING.md

Contributing

See CONTRIBUTING.md for development setup, the test workflow, and the pre-commit hook. Changes are tracked in CHANGELOG.md.

License

GPL-3.0-or-later

Metadata

Release files for withings-mcp 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for withings-mcp 0.8.0
File Size Uploaded
withings_mcp-0.8.0.tar.gz 101.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for withings-mcp 0.8.0
File Interpreter ABI Platform
withings_mcp-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 160.5 kB

Release files / withings_mcp-0.8.0.tar.gz

Download URL withings_mcp-0.8.0.tar.gz
Size 101.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9c95f1f5117bbb15122d34be2cc0fbaf0cbdbea9333212efa52cdb0c4c5d88f6
BLAKE2b-256 checksum
How to use checksums
b4c56f9af6c8b3b7219a07f59cdee9a6eb1cbb8dd87983d22f9880c587157f7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.

Transparency log

Release files / withings_mcp-0.8.0-py3-none-any.whl

Download URL withings_mcp-0.8.0-py3-none-any.whl
Size 58.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36880ff3f946b79ca58bbdc3ac477f4d9a8d3887f73dfa619fd3d21794496f0f
BLAKE2b-256 checksum
How to use checksums
5a55e75253f0aadea651f71b939d97e5e3c75c2b9c27645315efad624f5e2d71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 6, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page