Garmin China MCP
Garmin Connect 中国区 MCP 服务器 — 55 个工具,覆盖训练数据、恢复指标、天气热应激评估与健康聚合。
适配 WorkBuddy、Claude Desktop 等任意支持 MCP(Model Context Protocol)的客户端。
安装
pip install garmin-china
或使用 uv(推荐):
uv pip install garmin-china
认证
首次使用需登录 Garmin Connect 中国区获取 token:
# PowerShell
$env:GARMIN_EMAIL='你的邮箱@qq.com'
$env:GARMIN_PASSWORD='你的佳明密码'
garmin-china-auth
# Bash
export GARMIN_EMAIL='你的邮箱@qq.com'
export GARMIN_PASSWORD='你的佳明密码'
garmin-china-auth
Token 保存到 ~/.garmin-china/tokens/。可用 GARMIN_TOKEN_DIR 环境变量覆盖路径。
⚠️ 务必用普通权限终端运行认证。管理员终端会让 token 文件 owner 变成 Administrators,普通进程读不到。
配置 MCP 客户端
WorkBuddy
编辑 ~/.workbuddy/mcp.json(注意不是 .mcp.json):
{
"mcpServers": {
"garmin": {
"command": "garmin-china",
"disabled": false
}
}
}
Claude Desktop
编辑 claude_desktop_config.json:
{
"mcpServers": {
"garmin": {
"command": "garmin-china"
}
}
}
使用 uvx(无需安装)
{
"mcpServers": {
"garmin": {
"command": "uvx",
"args": ["garmin-china"]
}
}
}
配置后重启客户端,在连接器管理中信任 garmin 服务器即可。
工具列表(55 个)
训练与活动(20)
activities/last_activity/get_activity— 活动列表与详情activity_splits/activity_split_summaries/activity_typed_splits— 分段数据activity_hr_in_timezones/get_activity_gear— 心率时区与装备count_activities/get_activity_types— 统计与类型download_workout/get_workouts/get_workout_templates— 训练计划get_activity_weather/get_activity_exercise_sets— 天气与组数steps_data/daily_steps/get_weekly_steps— 步数get_activities_fordate— 按日期查活动
恢复与健康(18)
user_summary/daily_summary— 每日摘要sleep— 睡眠分析hrv/hr_intraday/resting_hr— 心率变异性与心率body_battery— 身体电量stress/get_weekly_stress— 压力spo2/respiration— 血氧与呼吸hydration— 补水weight— 体重training_status/training_readiness— 训练状态与准备vo2max/race_predictions— 最大摄氧量与比赛预测get_goals/personal_record— 目标与个人记录endurance_score/hill_score/lactate_threshold/get_fitness_age— 体能指标
周报与趋势(10)
weekly_health/stats_trend/progress_summary— 周报与趋势weekly_intensity_minutes— 周强度分钟user_summary/garmin_weekly_health— 健康聚合
天气与热应激(7)
weather_now— 实时天气 + 跑步热应激评估 + 配速衰减weather_forecast— 逐小时预报weather_at— 指定时刻历史实况weather_log— 气象日志归档(24h 回溯)weather_pace— 配速热修正计算器garmin_run_conditions— 跑步与气候合并评价(含等效配速)garmin_weekly_health— 周健康聚合
天气日志归档(可选)
官方逐小时实况只回溯 24 小时。注册 Windows 计划任务自动归档:
garmin-china-weather --install # 注册(每 6 小时归档一次)
garmin-china-weather --uninstall # 卸载
日志保存到 ~/.garmin-china/weather-log/。
自检
garmin-china-selftest # 检查协议与工具注册
garmin-china-selftest --call # 额外调用真实数据验证
红线
- 不要升级 garminconnect 到 0.3.x — 中国区 DI token 会全部失败。已锁定
0.2.40。 - 认证须用普通权限终端 — 管理员终端会导致 token 文件权限问题。
- 仅支持 Garmin 中国区(garmin.cn)— 不适用于国际版 Garmin Connect。
技术栈
- Python ≥ 3.11
- garminconnect 0.2.40 + garth 0.6.3(OAuth 认证)
- mcp ≥ 1.29.0(Model Context Protocol)
- 天气数据源:中国气象局公共气象服务中心(weather.com.cn)
License
MIT
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 garmin_china-1.0.0.tar.gz.
File metadata
- Download URL: garmin_china-1.0.0.tar.gz
- Upload date:
- Size: 32.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac12a49433c83f0748b2c28db441593e60e94d95c1a5bd6e4969c107c9365a86
|
|
| MD5 |
bd7ca3d34d32c20dab71de254d4a5062
|
|
| BLAKE2b-256 |
6ee5b9dae3098947e217a6ed34ccd3bba5235856c4b01d138d0a237ab44c0c0d
|
File details
Details for the file garmin_china-1.0.0-py3-none-any.whl.
File metadata
- Download URL: garmin_china-1.0.0-py3-none-any.whl
- Upload date:
- Size: 37.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
239061ccee147cd1717f9a6e6d2127f9926229ea0fd5fddbb67d6612875023c8
|
|
| MD5 |
baa4245e5aea6fe405c5fef95b3bed3a
|
|
| BLAKE2b-256 |
85d611a6e52a10c94e5016ad4dbb3c83309bb5940b04b0fffcaf22ad7405e099
|