MCP server for the Withings Health API with OAuth, local cache, and trend analysis.
Project description
withings-mcp
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+
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+
- 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
- Go to https://developer.withings.com/dashboard
- Create a new application
- Set the callback URL to
http://localhost:8585 - 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.
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 --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
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, file permissions 0600) - 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file withings_mcp-0.2.2.tar.gz.
File metadata
- Download URL: withings_mcp-0.2.2.tar.gz
- Upload date:
- Size: 44.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9634d4728238563cd92f2a39c783615d7c7af7c5cf4988399ec242df80cf8562
|
|
| MD5 |
cb371b2d72daaf97aea6b1040da94d37
|
|
| BLAKE2b-256 |
84c72a3636287468447784bf031c743d9938e5209ca27eecfacc53e5f67a3553
|
Provenance
The following attestation bundles were made for withings_mcp-0.2.2.tar.gz:
Publisher:
publish.yml on partymola/withings-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
withings_mcp-0.2.2.tar.gz -
Subject digest:
9634d4728238563cd92f2a39c783615d7c7af7c5cf4988399ec242df80cf8562 - Sigstore transparency entry: 2146835893
- Sigstore integration time:
-
Permalink:
partymola/withings-mcp@273048643aadee5a89df7efca55ff17ff2ffc526 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/partymola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@273048643aadee5a89df7efca55ff17ff2ffc526 -
Trigger Event:
release
-
Statement type:
File details
Details for the file withings_mcp-0.2.2-py3-none-any.whl.
File metadata
- Download URL: withings_mcp-0.2.2-py3-none-any.whl
- Upload date:
- Size: 42.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8a1a6e42640c65cb31a1a64282edefc6a6d82608e6af19250c0a4439f8302945
|
|
| MD5 |
64696b1a04da994a2c37a7a0197e9afc
|
|
| BLAKE2b-256 |
b4a50869d42a0f7b34959d7101d5a7392f763a62b159794e084b3ebd8068e608
|
Provenance
The following attestation bundles were made for withings_mcp-0.2.2-py3-none-any.whl:
Publisher:
publish.yml on partymola/withings-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
withings_mcp-0.2.2-py3-none-any.whl -
Subject digest:
8a1a6e42640c65cb31a1a64282edefc6a6d82608e6af19250c0a4439f8302945 - Sigstore transparency entry: 2146836392
- Sigstore integration time:
-
Permalink:
partymola/withings-mcp@273048643aadee5a89df7efca55ff17ff2ffc526 -
Branch / Tag:
refs/tags/v0.2.2 - Owner: https://github.com/partymola
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@273048643aadee5a89df7efca55ff17ff2ffc526 -
Trigger Event:
release
-
Statement type: