garmin-mcp
Exposes Garmin Connect data and workout management to AI agents, supporting tools, resources, and prompts for health data, workout creation, and coaching workflows.
README
garmin-mcp
MCP server that exposes Garmin Connect data and workout management to AI agents. Supports tools, resources, and prompts — covering reading health data, creating and scheduling structured workouts, and guided coaching workflows.
Setup
git clone https://github.com/marcelohensantos/garmin-mcp
cd garmin-mcp
make setup
make setup handles everything interactively:
- prompts for your Garmin Connect credentials and creates
.env - creates the virtual environment and installs dependencies
- tests the connection against the Garmin API
- prints the exact JSON snippet to paste into your MCP client
First login triggers a Garmin OAuth flow. If you have MFA enabled, check your email for a verification link, then re-run
make setupormake check.
Switching accounts? Clear the cached tokens first:
make clean-auth && make setup
Configure your MCP client
Claude Desktop — edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS)
or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"garmin": {
"command": "/path/to/garmin-mcp/.venv/bin/python",
"args": ["/path/to/garmin-mcp/src/server.py"]
}
}
}
Claude Code — add to .mcp.json at the project root:
{
"mcpServers": {
"garmin": {
"command": "/path/to/garmin-mcp/.venv/bin/python",
"args": ["/path/to/garmin-mcp/src/server.py"]
}
}
}
Restart the client after saving.
Docker (no Python setup required)
# First run — authenticate and cache OAuth tokens
docker run --rm -it \
--env-file .env \
-v garmin-tokens:/root/.garminconnect \
--entrypoint python \
ghcr.io/marcelohensantos/garmin-mcp src/check.py
# MCP client config
{
"mcpServers": {
"garmin": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"--env-file", "/path/to/garmin-mcp/.env",
"-v", "garmin-tokens:/root/.garminconnect",
"ghcr.io/marcelohensantos/garmin-mcp"
]
}
}
}
The garmin-tokens volume persists OAuth tokens across container restarts — you only authenticate once. Create .env with your credentials before the first run (see Setup).
Available tools
Activities
| Tool | Description |
|---|---|
get_activities |
Most recent N activities; optional activity_type filter (running, strength_training, swimming, …) |
get_activities_by_date |
Activities in a date range; same optional activity_type filter |
get_activity_details |
Full details for one activity |
export_activity |
Download GPX / TCX / FIT / CSV for one activity |
export_activities_csv |
Summary CSV for a date range |
Health & wellness
| Tool | Description |
|---|---|
get_stats |
Daily steps, calories, floors |
get_heart_rates |
Heart-rate timeline |
get_sleep |
Sleep stages and score |
get_stress |
Stress levels throughout the day |
get_body_battery |
Body Battery charge curve |
get_body_composition |
Weight, BMI, body fat |
get_hrv_data |
Heart Rate Variability |
get_spo2 |
Blood oxygen saturation |
Training & fitness
| Tool | Description |
|---|---|
get_training_status |
Training load and status |
get_personal_records |
All-time PRs |
get_vo2max |
VO2 max estimates |
Workouts & calendar
| Tool | Description |
|---|---|
create_running_workout |
Structured running workout — pace zones, repeat groups, distance/time-based steps |
update_running_workout |
Update an existing running workout in-place via PUT (preserves calendar scheduling) |
create_swimming_workout |
Structured pool swimming workout — stroke types, pool length, repeat groups |
create_strength_workout |
Strength session — exercises grouped as repeat sets with weight and rest |
schedule_workout |
Schedule an existing workout on the Garmin calendar |
get_workouts |
List saved workouts |
delete_workout |
Delete a workout by ID |
get_scheduled_workouts |
List scheduled workouts in a date range |
Plans
| Tool | Description |
|---|---|
save_plan |
Persist an agent-generated training plan as JSON to ~/devel/garmin/data/ |
Profile & devices
| Tool | Description |
|---|---|
get_user_profile |
Account profile |
get_devices |
Linked Garmin devices |
get_gear |
Shoes, bikes, and other gear |
Resources
Resources provide persistent context the agent can read without an explicit tool call.
| URI | Contents |
|---|---|
garmin://athlete/profile |
User profile + all personal records |
garmin://health/today |
Today's stats, Body Battery, HRV, and sleep snapshot |
Both resources are cached for 5 minutes to avoid redundant API calls.
Prompts
Guided workflow templates for common coaching tasks.
| Prompt | Purpose |
|---|---|
create_running_workout |
Step-by-step guide: spec format, pace syntax, examples, schedule call |
plan_training_week |
Multi-step protocol: assess recovery data → check calendar → create and schedule workouts |
training_readiness_check |
Pre-session readiness: Body Battery, HRV, sleep, stress → go / reduce / rest decision |
Project layout
src/
├── server.py # Entry point — imports all modules to trigger registration
├── app.py # FastMCP instance (shared across all modules)
├── auth.py # Garmin client singleton; wraps login errors in GarminAuthError
├── cache.py # @cached(ttl_seconds) in-memory TTL decorator
├── errors.py # GarminAPIError hierarchy + tool_guard decorator
├── utils.py # serialize(), today(), export_dir()
├── resources.py # MCP resources: athlete/profile, health/today
├── prompts.py # MCP prompts: create_running_workout, plan_training_week, …
├── check.py # Connectivity smoke test (make check)
└── tools/
├── builder.py # WorkoutBuilder base class + repeat_group() helper
├── running.py # RunningBuilder + create/update_running_workout
├── swimming.py # SwimmingBuilder + create_swimming_workout
├── strength.py # StrengthBuilder + create_strength_workout
├── calendar.py # schedule, get, delete, get_scheduled workouts
├── activities.py # Activity retrieval, filtering, and export
├── health.py # Health & wellness tools (cached 5 min)
├── training.py # Training status, VO2 max, PRs (cached 5–10 min)
├── profile.py # User profile, devices, gear (cached 10 min)
└── plans.py # save_plan — persist plans to data/
tests/
├── unit/ # Mocked — 50 tests, no network required
└── integration/ # Live tests against Garmin Connect API
Running tests
# Unit tests (no credentials needed)
make test
# Integration tests (requires real Garmin account)
make test-integration
Notes
- Caching — health, training, and profile tools cache responses for 5–10 minutes. If you need fresh data immediately, restart the server.
- Error types — API errors are typed:
GarminAuthError,GarminRateLimitError,GarminNotFoundError. Tools return{"error": "...", "type": "..."}on failure. - Exported files land in
~/garmin_exports/. - MFA accounts — set
return_on_mfa=Trueinauth.pyand handle the prompt manually. - First run triggers a full OAuth login; subsequent runs reuse cached tokens at
~/.garminconnect/. - Pace zones —
pace.zonetargets use m/s internally (targetValueOne > targetValueTwo). Single pace"4:31"applies a tolerance (default ±10 s); range["5:26", "5:59"]uses exact bounds. - Easy runs — a single no-pace interval with warmup/cooldown merges into one time step + lap-button cooldown.
- Distance-based warmup/cooldown — use
warmup_km+warmup_pace: ["fast", "slow"]for E zone guidance on distance steps. - Bodyweight exercises — set
weight_kg: -1.0increate_strength_workout. - Activity filter —
get_activitiesfilters byactivityType.typeKeyclient-side; use a largerlimitwhen filtering to avoid truncation before the filter runs. save_planalways writes to~/devel/garmin/data/— the directory is created if absent.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。