内容
<!-- delx-wellness header v2 -->
<h1 align="center">Withings 连接服务器</h1>
<div align="center">
<img src="assets/banner.png" alt="Withings 连接服务器 — 适用于 AI 代理的 Withings 连接服务器" width="85%" />
</div>
<h3 align="center">
为您的 AI 代理提供 Withings 身体测量、睡眠、活动和心率数据 — 本地运行。<br>
本地优先的连接服务器 — <strong>令牌从未离开您的设备</strong>。
</h3>
<p align="center">
<a href="https://www.npmjs.com/package/withings-mcp-unofficial"><img src="https://img.shields.io/npm/v/withings-mcp-unofficial?style=for-the-badge&labelColor=0F172A&color=10B981&logo=npm&logoColor=white" alt="npm 版本" /></a>
<a href="https://github.com/davidmosiah/withings-mcp/releases/latest"><img src="https://img.shields.io/github/v/release/davidmosiah/withings-mcp?style=for-the-badge&labelColor=0F172A&color=2563EB&logo=github" alt="GitHub 发布版本" /></a>
<a href="https://www.npmjs.com/package/withings-mcp-unofficial"><img src="https://img.shields.io/npm/dm/withings-mcp-unofficial?style=for-the-badge&labelColor=0F172A&color=0EA5A3&logo=npm&logoColor=white" alt="npm 下载量" /></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/LICENSE-MIT-22C55E?style=for-the-badge&labelColor=0F172A" alt="MIT 许可证" /></a>
<a href="https://wellness.delx.ai/connectors/withings"><img src="https://img.shields.io/badge/SITE-wellness.delx.ai-0EA5A3?style=for-the-badge&labelColor=0F172A" alt="站点" /></a>
</p>
<p align="center">
<a href="https://github.com/davidmosiah/withings-mcp/stargazers"><img src="https://img.shields.io/github/stars/davidmosiah/withings-mcp?style=for-the-badge&labelColor=0F172A&color=FBBF24&logo=github" alt="GitHub 星标" /></a>
<a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/BUILT_FOR-MCP-7C3AED?style=for-the-badge&labelColor=0F172A" alt="为 MCP 而建" /></a>
<a href="https://github.com/davidmosiah/delx-wellness-hermes"><img src="https://img.shields.io/badge/HERMES-one--command_setup-10B981?style=for-the-badge&labelColor=0F172A" alt="Hermes 一键设置" /></a>
<a href="https://github.com/davidmosiah/delx-wellness"><img src="https://img.shields.io/badge/Withings-00B6DE?style=for-the-badge&labelColor=0F172A&logoColor=white" alt="Withings" /></a>
</p>
> ⚡ **一键安装**,使用 [Delx Wellness for Hermes](https://github.com/davidmosiah/delx-wellness-hermes):
> `npx -y delx-wellness-hermes setup` — 预配置此连接器和其他 8 个连接器在一个专用的 Hermes 配置文件中。
>
> 或者将其单独连接到 Claude Desktop / Cursor / ChatGPT Desktop — 请参见下面的安装部分。
---
<!-- /delx-wellness header v2 -->
**本地优先的连接服务器,用于连接 AI 代理到您的 Withings 身体测量、睡眠、活动和心率数据。**
> **非官方项目。** 未与 Withings 官方关联、背书或支持。Withings 是其各自所有者的商标。请仅使用您自己的 Withings 账户,并按照 Withings 公共 API 条款使用。
由 [David Mosiah](https://github.com/davidmosiah) 为使用 Claude、Cursor、Hermes、OpenClaw 或其他 MCP 兼容代理来思考身体成分、睡眠和长期健康趋势的人而建,无需从 Withings 应用复制粘贴数字。
[Delx Wellness](https://github.com/davidmosiah/delx-wellness) 的一部分,这是一个本地优先的健康连接服务器注册表。
> 如果此连接器有助于您的代理工作流,请给仓库加星标。星标使项目对其他 AI 构建者更易发现,并帮助 Delx 持续提供本地优先的健康基础设施。
## 为什么存在
Withings 拥有最长期的消费者身体成分和睡眠生态系统(智能秤、睡眠分析仪、ScanWatch)。数据非常丰富 — 准确的体重 + 体脂 + 肌肉质量测量、睡眠阶段、心电图级心率记录 — 但 Withings 公共 API 使用签名令牌 OAuth 流,相比大多数消费者 API 更为复杂。
此软件包在本地处理签名 OAuth 流程,规范响应,并通过模型上下文协议公开 Withings。令牌从未离开您的设备。隐私模式默认为结构化,需要时可选择原始模式。
## 60 秒设置
您需要在 Withings 应用([在此处创建](https://account.withings.com/partner/dashboard_oauth2))中设置一个重定向 URI 为 `http://127.0.0.1:3000/callback` 的应用。
```bash
npx -y withings-mcp-unofficial setup # 交互式:粘贴客户端 ID + 密钥
npx -y withings-mcp-unofficial auth # 打开浏览器,捕获 OAuth 代码
npx -y withings-mcp-unofficial doctor # 验证您已准备就绪
```
推荐的范围:
```text
user.activity user.metrics
```
然后将其添加到您的 MCP 客户端配置中:
```json
{
"mcpServers": {
"withings": {
"command": "npx",
"args": ["-y", "withings-mcp-unofficial"]
}
}
}
```
对于 Claude Desktop,运行 `setup --client claude`,为您编写代码段。
> **注意:** Withings OAuth 授权代码有效期短(几分钟)。请勿在批准同意屏幕和运行 `withings_exchange_code` 之间暂停。
## 与您的代理一起试用
首先询问三个问题:
```text
使用 withings_connection_status 检查设置,然后运行 withings_daily_summary。
给我今天的 5 行健康简报。
```
```text
调用 withings_weekly_summary,响应格式为 json。找出我最大的睡眠/身体瓶颈,并给我一个下周的计划。
```
```text
使用 withings_body_sleep_investigation 提示,after=2026-04-01。
带我了解身体成分 + 睡眠的变化。
```
## 数据可用性
此软件包使用官方 Withings 公共 API。当本自述文件提到 `原始` 时,它指的是支持的端点的上游 Withings JSON — 而不是原始设备传感器流。
| 数据 | 可用 | 备注 |
|---|:---:|---|
| 身体测量(体重、脂肪百分比、肌肉、水分) | ✓ | 需要 `user.metrics` 权限 |
| 每日活动(步数、卡路里、距离、强度) | ✓ | 需要 `user.activity` 权限 |
| 锻炼 + 运动元数据 | ✓ | 需要 `user.activity` 权限 |
| 睡眠摘要(时长、阶段、效率、心率) | ✓ | 需要 `user.activity` 权限 |
| 睡眠详细记录 | ✓ | 当设备暴露时 |
| 心率记录(ECG、血压等) | ✓ | 需要 `user.metrics` 权限;根据设备/计划不同 |
| 连续传感器遥测 | — | Withings 公共 API 不提供 |
## 工具
**从这些开始:**
- `withings_connection_status` — 在调用 Withings 之前验证本地设置
- `withings_data_inventory` — 清点支持的数据域、范围、隐私模式和推荐的无需调用 Withings API 的初始调用
- `withings_daily_summary` — 今日身体、睡眠、活动和心率简报
- `withings_weekly_summary` — 记分卡、与上一周的比较、下周计划
**身份验证和诊断**
- `withings_capabilities`、`withings_agent_manifest`、`withings_privacy_audit`、`withings_cache_status`
- `withings_get_auth_url`、`withings_exchange_code`、`withings_revoke_access`
**身体和指标**
- `withings_list_body_measures` — 准确的体重/成分记录。使用 ISO 8601 `after` / `before` 窗口获取大履歴;服务器发送 Withings `startdate` / `enddate` 上游,并限制返回记录。
- `withings_list_heart` — 设备/计划允许时记录心率
**活动**
- `withings_list_activity` — 每日活动摘要
- `withings_list_workouts` — 记录的锻炼
**睡眠**
- `withings_list_sleep_summary` — 每日睡眠摘要,包含心率/阶段字段
- `withings_list_sleep` — 详细的睡眠记录
## 提示
- `withings_daily_checkin` — 实用的日常健康和身体检查
- `withings_weekly_review` — 查看身体、睡眠、活动趋势
- `withings_body_sleep_investigation` — 同时调查身体测量 + 睡眠
## 资源
- `withings://capabilities`、`withings://agent-manifest`
- `withings://latest/activity`、`withings://latest/sleep`
- `withings://summary/daily`、`withings://summary/weekly`
## 隐私和安全
- OAuth 令牌存储在 `~/.withings-mcp/tokens.json` 中,权限为 `0600`,且从不被工具返回。
- Withings 使用签名请求 OAuth 流 — 软件包在本地处理签名;客户端密钥从未到达 MCP 客户端。
- 服务器从不打印访问或刷新令牌。
- `WITHINGS_PRIVACY_MODE` 默认设置为 `structured`。原始 Withings JSON 需要通过 `raw` 模式或逐个调用覆盖。
- `withings_revoke_access` 清除本地令牌;完整的账户端令牌撤销取决于您的 Withings 计划。
- MCP 客户端从未看到访问或刷新令牌。
- 这 **不是医疗建议**。Withings 公开可能类似于医疗信号(ECG、血压、身体成分)的数据 — 但此服务器用于个人 AI 工作流,而不是诊断或治疗。
## 配置
`setup` 将大部分内容写入 `~/.withings-mcp/config.json`(`0600`)。支持手动环境覆盖:
```bash
WITHINGS_CLIENT_ID=…
WITHINGS_CLIENT_SECRET=…
WITHINGS_REDIRECT_URI=http://127.0.0.1:3000/callback
# 可选
WITHINGS_SCOPES="user.activity user.metrics"
WITHINGS_PRIVACY_MODE=structured # summary | structured | raw
WITHINGS_CACHE=sqlite # 可选的读透缓存
WITHINGS_TOKEN_PATH=~/.withings-mcp/tokens.json
WITHINGS_CACHE_PATH=~/.withings-mcp/cache.sqlite
```
## Hermes / 远程设置
```bash
npx -y withings-mcp-unofficial setup --client hermes --no-auth
npx -y withings-mcp-unofficial auth # 在需要浏览器身份验证时本地运行
npx -y withings-mcp-unofficial doctor --client hermes
hermes mcp test withings
```
在 Hermes 配置文件更改后,使用 `/reload-mcp` 或 `hermes mcp test withings`。不要为正常数据访问重启网关。
如果浏览器 OAuth 必须在与 Hermes 不同的计算机上进行,请在本地运行 `auth` 并将 `~/.withings-mcp/tokens.json` 复制到服务器并使用 `chmod 600`。
## 要求
- Node.js 20+
- 在 <https://account.withings.com/partner/dashboard_oauth2> 上的 Withings 应用,重定向 URI 为 `http://127.0.0.1:3000/callback`
## 开发
```bash
git clone https://github.com/davidmosiah/withings-mcp.git
cd withings-mcp
npm install
npm test
npm run build
```
使用 MCP 检验工具进行测试:
```bash
npx @modelcontextprotocol/inspector node dist/index.js
```
## 链接
- npm:<https://www.npmjs.com/package/withings-mcp-unofficial>
- 文档站点:<https://wellness.delx.ai/connectors/withings>
- 旧文档:<https://withingsmcp.vercel.app/>
- GitHub:<https://github.com/davidmosiah/withings-mcp>
- Delx Wellness 注册表:<https://github.com/davidmosiah/delx-wellness>
- 连接器质量标准:<https://github.com/davidmosiah/delx-wellness/blob/main/docs/connector-quality-standard.md>
- Withings 公共 API 文档:<https://developer.withings.com/api-reference/>
<!-- delx-wellness see-also -->
## 参见
完整的 [Delx Wellness](https://wellness.delx.ai) 连接器库:
| 提供商 | 软件包 | 仓库 |
|---|---|---|
| WHOOP | [`whoop-mcp-unofficial`](https://www.npmjs.com/package/whoop-mcp-unofficial) | [whoop-mcp](https://github.com/davidmosiah/whoop-mcp) |
| Oura | [`oura-mcp-unofficial`](https://www.npmjs.com/package/oura-mcp-unofficial) | [ouramcp](https://github.com/davidmosiah/ouramcp) |
| Garmin | [`garmin-mcp-unofficial`](https://www.npmjs.com/package/garmin-mcp-unofficial) | [garminmcp](https://github.com/davidmosiah/garminmcp) |
| Strava | [`strava-mcp-unofficial`](https://www.npmjs.com/package/strava-mcp-unofficial) | [strava-mcp](https://github.com/davidmosiah/strava-mcp) |
| Fitbit | [`fitbit-mcp-unofficial`](https://www.npmjs.com/package/fitbit-mcp-unofficial) | [fitbitmcp](https://github.com/davidmosiah/fitbitmcp) |
| Withings | [`withings-mcp-unofficial`](https://www.npmjs.com/package/withings-mcp-unofficial) | [withings-mcp](https://github.com/davidmosiah/withings-mcp) |
| Apple Health | [`apple-health-mcp-unofficial`](https://www.npmjs.com/package/apple-health-mcp-unofficial) | [apple-health-mcp](https://github.com/davidmosiah/apple-health-mcp) |
| Polar | [`polar-mcp-unofficial`](https://www.npmjs.com/package/polar-mcp-unofficial) | [polarmcp](https://github.com/davidmosiah/polarmcp) |
| Nourish(营养) | [`wellness-nourish`](https://www.npmjs.com/package/wellness-nourish) | [wellness-nourish](https://github.com/davidmosiah/wellness-nourish) |
**Hermes 一键设置** — 预配置上述所有连接器 + 健康技能 + 入门:[`delx-wellness-hermes`](https://github.com/davidmosiah/delx-wellness-hermes)。
<!-- /delx-wellness see-also -->
## 📧 联系与支持
- 📨 **support@delx.ai** — 一般问题、集成帮助、合作伙伴
- 🐛 **错误报告/功能请求** — [GitHub Issues](https://github.com/davidmosiah/withings-mcp/issues)
- 🐦 **更新** — [@delx369](https://x.com/delx369) 在 X 上
- 🌐 **站点** — [wellness.delx.ai](https://wellness.delx.ai)
## 许可证
MIT — 参见 [LICENSE](LICENSE)。
## 免责声明
该软件按原样提供。它不是医疗设备,不提供医疗建议,不应用于诊断或治疗。Withings 公开的数据可能类似于医疗信号(ECG、血压、身体成分) — 始终咨询合格的专业人员以获取医疗问题。