Withings Mcp

io.github.partymola由 GitHub 账号 partymola 发布v0.11.0更新于 Nov 6, 2026

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

概览

AI 生成的概览

面向 Withings 健康 API 的本地 MCP 服务器,把身体、睡眠、活动、锻炼和心脏数据同步到 SQLite 缓存并做趋势分析。

可以做什么
  • 把 Withings 数据同步到本地 SQLite 缓存,支持增量同步或指定历史天数
  • 从缓存查询身体成分、每日活动和锻炼记录,也可绕过缓存直接实时获取
  • 读取睡眠摘要或逐分钟睡眠阶段明细,以及心电图与房颤记录
  • 列出已连接设备及其电量状态
  • 计算周期平均值、周/月/季度趋势和周期对比
适用场景
适合让助手回答关于自己 Withings 测量数据的问题,例如体重与身体成分、睡眠、步数、锻炼、心电图,并进行周期对比或长期趋势分析,也可离线使用缓存数据。
运行要求
需要 Python 3.13+ 及 pip 或 uv,以本地 stdio 进程运行。需要 Withings 开发者账号和已注册应用(回调地址为本地地址),并完成一次交互式 OAuth 授权,令牌保存在本地。可选环境变量 WITHINGS_MCP_CONFIG_DIR 和 WITHINGS_MCP_DB_PATH 指定凭据与数据库位置。同步和实时查询需要网络访问。
安装前请注意
OAuth 令牌保存在配置目录中,应妥善保护该目录并避免提交到版本库。个人健康数据会写入本地 SQLite 数据库。工具对 Withings 侧为只读,但同步和实时查询会向 Withings API 发送请求。清单未声明认证或环境变量,配置依赖命令行授权流程。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Withings Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

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, 3.14 and 3.15, on Linux, macOS and Windows, in CI)

Tools

ToolDescriptionData source
withings_syncSync data from Withings API to local cacheLive API -> SQLite
withings_get_bodyBody composition (weight, fat%, muscle, bone, BP, SpO2)Local cache (auto-syncs if stale)
withings_get_sleepSleep summaries, or detailed phase time-series with detail=TrueCache (summary) / live (detail)
withings_get_activityDaily steps, distance, calories, active timeLocal cache (auto-syncs if stale)
withings_get_workoutsWorkout sessions with type, duration, HRLocal cache (auto-syncs if stale)
withings_get_heartECG recordings and AFib detectionLive API (always)
withings_get_devicesConnected devices with battery statusLive API (always)
withings_trendsPeriod averages, weekly/monthly/quarterly trends, comparisonsLocal 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, 3.14 and 3.15, on Linux, macOS and Windows, in CI)
  • uv (recommended) or pip
  • A Withings developer account and registered application

Installation

bash
pip install withings-mcp

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

bash
git clone https://github.com/partymola/withings-mcp.gitcd withings-mcpuv venv --python 3.13 .venvuv 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

bash
.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

bash
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:

bash
.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 fixingwithings-mcp --version    Print the installed package version

Configuration

Environment VariableDefaultDescription
WITHINGS_MCP_CONFIG_DIR./config/Directory for credentials and tokens
WITHINGS_MCP_DB_PATH./withings.dbSQLite 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

bash
# Install with dev dependenciesuv 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, files under config/ and large files from commits. It does not read file contents. 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

来源:README.md,提交 55228d9

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:软件包安装失败。

版本历史

6
  1. v0.11.0最新Nov 6, 2026
  2. v0.10.2Nov 6, 2026
  3. v0.10.1Nov 5, 2026
  4. v0.10.0Nov 4, 2026
  5. v0.9.0Nov 3, 2026
  6. v0.8.0Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分