关于 polarmcp
面向使用 Polar 的训练与健康 Agent,提供本地服务读取 AccessLink v4 中的睡眠、恢复、训练和生理数据。它处理本地 OAuth、统一端点数据,并默认隐藏 GPS 坐标和令牌。
主要功能
- 01读取睡眠、Nightly Recharge 和活动数据
- 02获取训练负荷、训练目标与测试信息
- 03访问连续心率、PPI 和温度样本
- 04提供每日及每周训练摘要
- 05默认隐藏 GPS 坐标并本地保存令牌
- 06包含提示词、资源和隐私审计工具
适用场景
- 01汇总每日睡眠、活动、恢复和训练状况
- 02比较周训练负荷并查看恢复趋势
- 03结合心率和 PPI 样本检查生理数据
MCP 相关
通过 MCP 工具、提示词和资源公开 Polar AccessLink Dynamic API v4 数据。服务默认使用 STDIO,也支持环回地址上的无状态 Streamable HTTP;OAuth 令牌保存在本机。
配置
本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。
npx -y polar-mcp-unofficialPOLAR_CLIENT_IDPolar OAuth client ID. Optional when configured with polar-mcp-server setup.POLAR_CLIENT_SECRET密钥Polar OAuth client secret. Prefer polar-mcp-server setup so this secret is stored in ~/.polar-mcp/config.json instead of MCP client config.POLAR_REDIRECT_URIRedirect URI configured in the Polar AccessLink admin. Optional when configured with polar-mcp-server setup.POLAR_TOKEN_PATH密钥Optional local path for OAuth tokens. Defaults to ~/.polar-mcp/tokens.json.POLAR_PRIVACY_MODEOptional payload mode: summary, structured, or raw. Defaults to structured. raw means full Polar AccessLink payloads for supported endpoints.POLAR_CACHEOptional SQLite cache toggle. Set to true or sqlite to enable.POLAR_CACHE_PATHOptional local SQLite cache path. Defaults to ~/.polar-mcp/cache.sqlite.POLAR_NO_CACHESet to true to bypass the in-memory HTTP response cache (60s TTL for GET only). POST/PUT/DELETE and 4xx/5xx responses are never cached regardless.本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。
工具
37收录的工具列表 · 更新于 2 周前
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| response_format | enum | 否 | markdown | json |
详细介绍
Polar MCP
让你的 AI Agent 在本地使用 Polar Nightly Recharge、训练负荷、PPI 和 HRV 数据。
本地优先的 MCP 服务 — 令牌绝不会离开你的设备。
⚡ 使用 Delx Wellness for Hermes 一键安装:
npx -y delx-wellness-hermes setup— 在专用的 Hermes 配置文件中预先配置此连接器和其他 8 个连接器。也可以将其单独接入 Claude Desktop / Cursor / ChatGPT Desktop — 请参阅下方的安装部分。
HTTP(v2 无状态)
默认使用 stdio。可选的 Streamable HTTP — 无会话 ID,返回 JSON,仅限环回地址:
npx -y polar-mcp-unofficial --http
# GET http://127.0.0.1:3000/health
# POST http://127.0.0.1:3000/mcp (sessionless)
环境变量:POLAR_MCP_HOST、POLAR_MCP_PORT、POLAR_MCP_TRANSPORT=http。
本地优先的 MCP 服务,可将 AI Agent 连接到 Polar 训练、睡眠、Nightly Recharge 和连续采样数据。
非官方项目。 与 Polar Electro Oy 无关联,也未获得其认可或支持。Polar 是其各自所有者的商标。请仅将此项目用于你自己的 Polar 账户,并遵守 Polar AccessLink API 条款。
由 David Mosiah 为使用 Claude、Cursor、Hermes、OpenClaw 或其他兼容 MCP 的 Agent 来分析训练负荷、恢复和耐力的人打造,无需从 Polar Flow 复制粘贴数据。
这是 Delx Wellness 的一部分,这是一个本地优先的健康类 MCP 连接器目录。
如果此连接器对你的 Agent 工作流有所帮助,请为仓库点个星。星标能让其他 AI 开发者更容易发现此项目,也有助于 Delx 持续构建本地优先的健康基础设施。
为何存在
在消费级可穿戴设备中,Polar 拥有最深入的训练生理数据体系之一,包括 Nightly Recharge、连续采样、PPI(脉搏间期)、训练目标、运动档案、直立测试和体能测试。Polar AccessLink Dynamic API v4 可提供这些数据,但它有 16 个细粒度的 OAuth 权限范围,其结构也比常见的消费级 API 更难浏览。
此软件包在本地处理 OAuth 授权流程,规范化 v4 端点的响应,默认隐藏 GPS 数据,并通过 Model Context Protocol 提供 Polar 服务。令牌不会离开你的设备。
60 秒完成设置
你需要一个 Polar AccessLink 客户端(在此创建),并将重定向 URI 设为 http://127.0.0.1:3000/callback。
npx -y polar-mcp-unofficial setup # interactive: paste client id + secret
npx -y polar-mcp-unofficial auth # opens browser, captures the OAuth code
npx -y polar-mcp-unofficial doctor # verifies you're ready
建议的权限范围(根据你需要的数据申请相应权限):
activity:read calendar:read continuous_samples:read devices:read
nightly_recharge:read ppi_data:read profile:read routes:read
skin_contact:read sleep:read sports:read temperature_measurement:read
tests:read training_sessions:read training_targets:read user_subscription:read
然后将以下内容添加到 MCP 客户端配置中:
{
"mcpServers": {
"polar": {
"command": "npx",
"args": ["-y", "polar-mcp-unofficial"]
}
}
}
对于 Claude Desktop,运行 setup --client claude,系统会为你写入配置片段。
用你的 Agent 试试看
先问以下三个问题:
Use polar_connection_status to check setup, then run polar_daily_summary.
Give me a 5-line training brief for today.
Call polar_weekly_summary with response_format=json. Identify my biggest
training-load/recovery bottleneck and give me a next-week plan.
Use the polar_training_load_investigation prompt, after=2026-04-01.
Walk me through my recent training sessions + Nightly Recharge.
数据可用性
此软件包使用官方的 Polar AccessLink Dynamic API v4。本 README 中的 raw 指受支持端点的上游 Polar JSON,而不是设备传感器的原始数据流。
| 数据 | 可用性 | 说明 |
|---|---|---|
| 每日活动 + 日历 | 是 | 需要 activity:read / calendar:read |
| 睡眠 + 睡眠/唤醒向量 | 是 | 需要 sleep:read |
| Nightly Recharge(恢复评分) | 是 | 需要 nightly_recharge:read;仅限受支持的设备 |
| 训练课程 + 训练目标 | 是 | 需要 training_sessions:read / training_targets:read |
| 连续采样(随时间变化的 HR) | 是 | 需要 continuous_samples:read |
| PPI 采样(脉搏间期,与 HRV 相关) | 是 | 需要 ppi_data:read;仅限受支持的设备 |
| 温度测量 | 是 | 需要 temperature_measurement:read;仅限受支持的设备 |
| 皮肤接触时段 | 是 | 需要 skin_contact:read |
| 测试(体能 / 直立 / 跑步) | 是 | 需要 tests:read |
| 路线 + GPS 几何数据 | 可选启用 | 除非使用原始模式,否则会隐藏 GPS 坐标 |
| 运动 + 运动档案 + 设备 | 是 | 目录和用户元数据 |
| 设备实时遥测数据 | - | Polar AccessLink 不提供 |
工具
从这些工具开始:
polar_quickstart- 个性化的 3 步设置向导,会根据已完成的配置进行调整polar_connection_status- 在调用 Polar 前验证本地设置、权限范围和就绪状态polar_data_inventory— 列出支持的数据领域、权限范围、隐私模式和建议的首次调用,不调用 Polar API。polar_demo- 合成示例载荷,让 Agent 在调用真实 API 前了解数据约定polar_daily_summary- 今日的睡眠、活动、Nightly Recharge 和训练简报polar_weekly_summary- 记分卡、与上周的比较以及下周计划polar_wellness_context- 以共享的wellness_context结构提供 Nightly Recharge、睡眠和训练负荷
身份验证与诊断
polar_capabilities、polar_agent_manifest、polar_privacy_audit、polar_cache_statuspolar_get_auth_url、polar_exchange_code、polar_revoke_access
账户
polar_get_account_data、polar_list_user_devices、polar_list_subscriptions
共享健康档案(本地数据,绝不包含 Polar 数据)
polar_onboarding、polar_profile_get、polar_profile_update— 与其他连接器共享的 Delx Wellness 档案;只存储用户输入的内容,绝不存储令牌或生物标志物
活动与睡眠
polar_list_activity、polar_list_calendarpolar_list_sleeps、polar_list_sleep_wake_vectors— 睡眠列表默认会使用 v4 的sleep-result、sleep-evaluation和sleep-score功能填充可用日期
心率与生理指标(日期范围)
polar_heart_series— 来自连续样本、受范围限制的 agent-safe-series/v1 心率数据(建议 Agent 使用此工具)polar_list_continuous_samples、polar_list_ppi_samplespolar_list_temperature_measurements、polar_list_skin_contacts
训练
polar_list_training_sessions、polar_list_training_targets、polar_list_training_target_favoritespolar_list_tests
运动与路线
polar_list_sports、polar_list_sport_profile_catalog、polar_list_sport_profilespolar_get_route- 除非使用 raw 模式,否则会隐藏 GPS 坐标
提示词
polar_daily_checkin- 实用的每日训练与恢复检查polar_weekly_review- 回顾活动、睡眠和恢复趋势polar_training_load_investigation- 调查训练课程及恢复情况
资源
polar://capabilities、polar://agent-manifest、polar://inventorypolar://summary/daily、polar://summary/weeklypolar://account-data、polar://latest/sleep
隐私与安全
- OAuth 令牌存储在
~/.polar-mcp/tokens.json中,权限为0600,工具绝不会返回这些令牌。 - 服务绝不会打印访问令牌或刷新令牌。
POLAR_PRIVACY_MODE默认值为structured。Structured 模式会保留完整的上游生理数据载荷,同时移除机密字段和 GPS 字段;规范化别名是附加信息,绝不会替换嵌套的 v4 对象。只有选择raw模式或对单次调用进行覆盖时,才会提供 Polar 原始 JSON。- 在
summary和structured模式下会隐藏 GPS 路线几何信息;只有raw模式会公开原始坐标。 - 每个端点都会验证日期格式和支持的
features。对于 Polar 限制为单日的功能查询,会逐个可用日期填充数据。 - MCP 客户端看不到访问令牌或刷新令牌。
- 这不是医疗建议。 服务提供用户授权的数据,供个人 AI 工作流使用,不用于诊断或开具训练计划。
配置
setup 会将其中大多数配置写入 ~/.polar-mcp/config.json(权限为 0600)。支持手动设置环境变量覆盖:
POLAR_CLIENT_ID=<client-id>
POLAR_CLIENT_SECRET=<client-secret>
POLAR_REDIRECT_URI=http://127.0.0.1:3000/callback
# Optional
POLAR_SCOPES="activity:read calendar:read continuous_samples:read ..."
POLAR_PRIVACY_MODE=structured # summary | structured | raw
POLAR_CACHE=sqlite # optional read-through cache
POLAR_TOKEN_PATH=~/.polar-mcp/tokens.json
POLAR_CACHE_PATH=~/.polar-mcp/cache.sqlite
Hermes / 远程设置
npx -y polar-mcp-unofficial setup --client hermes --no-auth
npx -y polar-mcp-unofficial auth # run locally if browser auth is needed
npx -y polar-mcp-unofficial doctor --client hermes
hermes mcp test polar
修改 Hermes 配置后,请使用 /reload-mcp 或 hermes mcp test polar。正常访问数据时无需重启网关。
如果浏览器 OAuth 必须在与 Hermes 不同的机器上进行,请在本地运行 auth,然后将 ~/.polar-mcp/tokens.json 复制到服务器,并设置 chmod 600。
要求
- Node.js 20+
- 在 https://admin.polaraccesslink.com 注册的 Polar AccessLink 客户端,重定向 URI 为
http://127.0.0.1:3000/callback
开发
git clone https://github.com/davidmosiah/polar-mcp.git
cd polar-mcp
npm install
npm test
npm run build
使用 MCP Inspector 测试:
npx @modelcontextprotocol/inspector node dist/index.js
链接
- npm:https://www.npmjs.com/package/polar-mcp-unofficial
- 文档站点:https://wellness.delx.ai/connectors/polar
- 旧版文档:https://polarmcp.vercel.app/
- GitHub:https://github.com/davidmosiah/polar-mcp
- Delx Wellness 注册表:https://github.com/davidmosiah/delx-wellness
- 连接器质量标准:https://github.com/davidmosiah/delx-wellness/blob/main/docs/connector-quality-standard.md
- Polar AccessLink Dynamic API v4 文档:https://www.polar.com/polar-api-v4/
另请参阅
完整的 Delx Wellness 连接器库:
Hermes 一键设置 — 预配置以上所有连接器,以及健康技能和入门引导:delx-wellness-hermes。
📧 联系与支持
- 📨 [email protected] — 一般问题、集成帮助、合作事宜
- 🐛 错误报告/功能请求 — GitHub Issues
- 🐦 更新 — X 上的 @delx369
- 🌐 网站 — wellness.delx.ai
许可证
MIT — 参见 LICENSE。
免责声明
本软件按“原样”提供。它不是医疗器械,不提供医疗建议,不应用于诊断、治疗或训练方案制定。如有医疗或训练方面的疑虑,请务必咨询合格的专业人士。
Skill 或 MCP
同一个包,两种使用方式。MCP 通过 stdio/HTTP 注册工具。当客户端不支持 MCP 时,skill 可通过 CLI 调用同一批工具:
npx -y polar-mcp-unofficial call polar_connection_status --json '{}'
将 skill/SKILL.md 复制到你的 Agent 技能目录中。
评论
一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。