garmin-cn-mcp
Provides tools for reading health and fitness data from Garmin Connect China, including activities, activity details, training status, sleep, HRV, stress, SpO2, respiration, user profile, devices, badges, and gear.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@garmin-cn-mcpHow was my sleep and HRV last night?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Garmin Connect China MCP Server(上游修复版)
本仓库是 xinyuxinyuxintaihaohao/garmin-cn-mcp 的修复版(fork 意义上的下游修复分支,独立维护)。
上游的登录实现(
sso.garmin.cn/mobile/api/login取 ticket →connect.garmin.cn/modern?ticket=...换 session)已于 2026 年 8 月被佳明下线:消费 ticket 时会被重定向到新版/signin/页面,导致所有 API 调用 401。本修复版将认证层整体迁移到 garth OAuth(
garminconnect同源的底层库,官方支持国区domain=garmin.cn),工具层 20 个接口保持不变。已在真实国区账号上完成端到端验证(2026-08-30)。
佳明中国大陆版 (garmin.cn) 的 MCP 数据读取服务。
通过 MCP (Model Context Protocol) 协议,让 AI 助手可以直接读取你的佳明健康和运动数据。
与上游的差异
项目 | 上游 (xinyuxinyuxintaihaohao) | 本修复版 |
登录方式 | CAS ticket + | garth OAuth1/OAuth2( |
会话持久化 | cookie 缓存 4 小时 | garth token 落盘( |
依赖 | mcp, curl_cffi | mcp(<2), garth |
凭据注入 | 仅环境变量 | 环境变量 + |
工具数量 | 20 | 20(接口签名不变) |
Related MCP server: Garmin Connect China MCP Server
功能
类别 | 工具 | 说明 |
🏃 运动 |
| 运动列表 |
| 按日期查运动 | |
| 运动详情 | |
| 运动详细数据 | |
| 每公里配速 | |
| 心率区间 | |
| 运动类型列表 | |
| 最近一次运动 | |
📊 训练 |
| 训练状态/VO2 Max |
| 训练准备度 | |
👤 资料 |
| 用户信息 |
| 设备列表 | |
| 主训练设备 | |
💤 睡眠 |
| 睡眠数据/得分/阶段 |
❤️ HRV |
| 心率变异性 |
😰 压力 |
| 全天压力数据 |
🩸 血氧 |
| SpO2 数据 |
🫁 呼吸 |
| 呼吸频率 |
🏅 其他 |
| 已获徽章 |
| 装备数据 |
安装
git clone https://github.com/anthony11122/garmin-cn-mcp.git
cd garmin-cn-mcp
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt依赖说明:
mcp>=1.0.0,<2— 代码基于 v1 的FastMCPAPI;mcp 2.x 已将其改名,装 2.x 会ModuleNotFoundErrorgarth>=0.8.0— Garmin OAuth 认证(国区domain=garmin.cn)
配置
凭据通过环境变量注入,绝不要写进任何提交到仓库的文件:
# ~/.hermes/.env(权限建议 chmod 600)
GARMIN_CN_EMAIL=your-garmin-email@example.com
GARMIN_CN_PASSWORD=your-passwordHermes Agent 配置
hermes mcp add garmin-cn --command /path/to/garmin-cn-mcp/.venv/bin/python --args /path/to/garmin-cn-mcp/garmin_cn_mcp.py其他 MCP 客户端
{
"mcpServers": {
"garmin-cn": {
"command": "python3",
"args": ["/path/to/garmin_cn_mcp.py"],
"env": {
"GARMIN_CN_EMAIL": "your-garmin-email@example.com",
"GARMIN_CN_PASSWORD": "your-password"
}
}
}
}使用示例
配置好后,AI 助手可以直接查询你的佳明数据:
"我昨天睡得怎么样?"
"最近一周的运动记录"
"今天的 HRV 和压力数据"
"我的训练状态和 VO2 Max"
技术细节
认证流程(本修复版)
磁盘有 garth token →
garth.resume()恢复会话,探活成功即免登录token 缺失/失效 → 环境变量(或
~/.hermes/.env兜底)读取账号密码 →garth.configure(domain="garmin.cn")+garth.login()登录成功后
garth.save()落盘 token;会话中 API 401/异常时自动重登一次
API 路径
数据类型 | API 路径 |
运动列表 |
|
运动详情 |
|
睡眠数据 |
|
HRV |
|
压力 |
|
血氧 |
|
呼吸 |
|
许可证
MIT License
This server cannot be deployed
Maintenance
Related MCP Connectors
Garmin data in Claude & ChatGPT via the Garmin Health API. OAuth sign-in, no password sharing.
- freddyOAuthcoach.freddy
Connect your wearables, rings and training apps, then ask your AI about your own health data.
Connect your health, fitness, nutrition, sleep, and wearable data to your AI assistant.
Garmin data in Claude: 135 tools — activities, sleep, HRV, training, workouts. Free, open source.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables AI assistants to access and query Garmin Connect health and fitness data, including sleep, HRV, training load, and activities, with an optional coaching plugin for personalized training plans.1 npm4-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to read Garmin health and fitness data from the Chinese version (garmin.cn) via MCP protocol.4MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to access Garmin Connect activities, workouts, and workout templates for querying and creating workout plans.5MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to query live Garmin Connect health and fitness data, including daily metrics, activities, sleep analysis, and trends via natural language.MIT