garmin-mcp
Enables AI assistants to query live Garmin Connect health and fitness data, including daily metrics, activities, sleep analysis, and trends via natural language.
README
garmin-mcp
A Model Context Protocol (MCP) server that provides AI assistants like Claude with access to your Garmin Connect health and fitness data.
Overview
This MCP server enables Claude Desktop (and other MCP-compatible clients) to query your Garmin data on demand, including:
- Daily Health Metrics: Sleep Score, Training Readiness, Body Battery, HRV, Resting Heart Rate, Stress
- Activity Data: Workouts, runs, walks, cycling sessions with duration, distance, heart rate, and calories
- Sleep Analysis: Detailed sleep stages, timing, and score breakdowns
- Trend Analysis: Query metrics across date ranges for pattern recognition
No scheduled jobs, no CSV files, no stale data. Just live access to your Garmin Connect data when you need it.
Features
- On-Demand Data Access: Query your Garmin data in real-time during conversations
- Date Range Queries: Retrieve metrics across multiple days for trend analysis (up to 30 days)
- Secure Authentication: Uses Garmin's OAuth flow with persistent token storage
- Comprehensive Metrics: Access the same data you see in Garmin Connect
- Zero Maintenance: Tokens persist for ~1 year; no cron jobs or scheduled tasks
Prerequisites
- Python 3.10 - 3.13 (3.14 is not yet supported by dependencies)
- A Garmin Connect account with a compatible Garmin device syncing data
- Claude Desktop (or another MCP-compatible client)
Installation
1. Clone the Repository
cd ~/Dev
git clone https://github.com/shawnduggan/garmin-mcp.git
cd garmin-mcp
2. Create Virtual Environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
3. Install Dependencies
pip install -r requirements.txt
Configuration
There are two ways to provide your Garmin credentials: environment file (recommended for initial setup) or Claude Desktop config (recommended for ongoing use).
Option A: Environment File (Recommended for Setup)
-
Create your environment file:
cp .env.example .env -
Edit
.envwith your Garmin Connect credentials:# Garmin Connect Credentials GARMIN_EMAIL=your_garmin_email@example.com GARMIN_PASSWORD=your_garmin_password -
Run initial authentication:
python -m garmin_mcp.authIf successful, you'll see:
Authenticating as your_email@example.com... ✓ Authentication successful! ✓ Session saved to /Users/shawn/Dev/garmin-mcp/.garth ✓ Tokens are valid for approximately one year. ✓ Verification: Today's step count = 4521 -
Security Note: After successful authentication, you can delete the
.envfile. The session tokens in.garth/are sufficient for ongoing use.
Option B: Claude Desktop Config with Credentials
If you prefer to keep credentials in the Claude Desktop config (they're passed as environment variables to the MCP server):
{
"mcpServers": {
"garmin": {
"command": "/Users/shawn/Dev/garmin-mcp/venv/bin/python",
"args": ["-m", "garmin_mcp.server"],
"cwd": "/Users/shawn/Dev/garmin-mcp",
"env": {
"GARMIN_EMAIL": "your_garmin_email@example.com",
"GARMIN_PASSWORD": "your_garmin_password"
}
}
}
}
Claude Desktop Setup
Add the garmin-mcp server to your Claude Desktop configuration:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Minimal Configuration (After Token Auth)
If you've already authenticated and have tokens saved in .garth/:
{
"mcpServers": {
"garmin": {
"command": "/Users/shawn/Dev/garmin-mcp/venv/bin/python",
"args": ["-m", "garmin_mcp.server"],
"cwd": "/Users/shawn/Dev/garmin-mcp"
}
}
}
Full Configuration (With Credentials)
If you want credentials available for re-authentication:
{
"mcpServers": {
"garmin": {
"command": "/Users/shawn/Dev/garmin-mcp/venv/bin/python",
"args": ["-m", "garmin_mcp.server"],
"cwd": "/Users/shawn/Dev/garmin-mcp",
"env": {
"GARMIN_EMAIL": "your_garmin_email@example.com",
"GARMIN_PASSWORD": "your_garmin_password"
}
}
}
}
Adding to Existing Configuration
If you already have other MCP servers configured, add garmin to your existing mcpServers object:
{
"mcpServers": {
"some-other-server": {
"...": "..."
},
"garmin": {
"command": "/Users/shawn/Dev/garmin-mcp/venv/bin/python",
"args": ["-m", "garmin_mcp.server"],
"cwd": "/Users/shawn/Dev/garmin-mcp"
}
}
}
Restart Claude Desktop
After saving your configuration, fully quit and restart Claude Desktop for the MCP server to become available.
Available Tools
get_daily_summary
Retrieve comprehensive health metrics for a specific date.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
date |
string | No | Date in YYYY-MM-DD format. Defaults to today. |
Returns:
{
"date": "2026-01-03",
"sleep_score": 73,
"training_readiness": 58,
"body_battery_high": 85,
"body_battery_low": 23,
"hrv_status": "BALANCED",
"hrv_value": 24,
"resting_heart_rate": 52,
"avg_stress": 28,
"steps": 8432
}
get_summary_range
Retrieve health metrics for a date range, useful for trend analysis.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
start_date |
string | Yes | Start date in YYYY-MM-DD format |
end_date |
string | Yes | End date in YYYY-MM-DD format |
Limits: Maximum 30-day range per request.
Returns:
{
"start_date": "2025-12-28",
"end_date": "2026-01-03",
"days": 7,
"summaries": [
{"date": "2025-12-28", "sleep_score": 80, "...": "..."},
{"date": "2025-12-29", "sleep_score": 64, "...": "..."}
]
}
get_activities
Retrieve fitness activities (runs, walks, cycling, strength training, etc.) for a specific date.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
date |
string | No | Date in YYYY-MM-DD format. Defaults to today. |
Returns:
{
"date": "2026-01-02",
"count": 1,
"activities": [
{
"name": "Indoor Walking",
"type": "walking",
"start_time": "2026-01-02T11:30:00",
"duration_minutes": 32.5,
"distance_km": 2.8,
"calories": 185,
"avg_hr": 118,
"max_hr": 135,
"training_effect_aerobic": 2.3,
"training_effect_anaerobic": 0.1
}
]
}
get_sleep_details
Retrieve detailed sleep data including stages, timing, and score breakdown.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
date |
string | No | Date in YYYY-MM-DD format. Returns sleep for the night ending on this date. |
Returns:
{
"date": "2026-01-03",
"sleep_start": "23:15",
"sleep_end": "06:42",
"total_sleep_minutes": 387,
"deep_sleep_minutes": 62,
"light_sleep_minutes": 198,
"rem_sleep_minutes": 89,
"awake_minutes": 38,
"sleep_scores": {
"overall": {"value": 73},
"quality": {"value": 68},
"recovery": {"value": 71},
"duration": {"value": 82}
}
}
Usage Examples
Once configured, you can ask Claude things like:
Daily Check-ins:
- "What were my Garmin stats yesterday?"
- "How did I sleep last night?"
- "What's my Training Readiness today?"
Trend Analysis:
- "Show me my sleep and HRV trends for the past week"
- "Compare my recovery metrics from last week to this week"
- "What's my average resting heart rate been this month?"
Activity Review:
- "What activities did I log on Tuesday?"
- "Pull my workout data for the past 7 days"
- "How many steps have I averaged this week?"
Health Correlations:
- "On days when my sleep score was below 60, what was my stress level?"
- "Show me my Body Battery patterns for December"
Troubleshooting
Authentication Errors
If you see authentication failures:
-
Delete existing tokens:
rm -rf /Users/shawn/Dev/garmin-mcp/.garth -
Wait 15 minutes (Garmin rate limits failed attempts)
-
Verify credentials by logging into connect.garmin.com in a browser
-
Re-authenticate:
cd /Users/shawn/Dev/garmin-mcp source venv/bin/activate python -m garmin_mcp.auth
Two-Factor Authentication (2FA)
If you have 2FA enabled on your Garmin account:
- You may need to create an app-specific password
- Or temporarily disable 2FA during initial authentication
- Once tokens are saved, 2FA won't affect subsequent use
Token Expiration
Tokens are valid for approximately one year. If requests start failing after extended use:
- Delete the
.garthdirectory - Re-run authentication
- Restart Claude Desktop
Rate Limiting
Garmin may temporarily block requests if you query too frequently. The server includes automatic retry logic, but if you encounter persistent failures:
- Wait 15-30 minutes before trying again
- Avoid making many rapid requests in succession
MCP Server Not Appearing in Claude
- Verify your
claude_desktop_config.jsonsyntax is valid JSON - Check the path to your Python virtual environment is correct
- Ensure you've fully quit and restarted Claude Desktop
- Check Claude Desktop's logs for MCP connection errors
"No data available" Responses
- Ensure your Garmin device has synced recently
- Some metrics (like Training Readiness) require specific Garmin devices
- Check that data exists for the requested date in the Garmin Connect app
Project Structure
garmin-mcp/
├── README.md
├── LICENSE
├── pyproject.toml
├── requirements.txt
├── .env.example
├── .gitignore
└── src/
└── garmin_mcp/
├── __init__.py
├── server.py # MCP server implementation
└── auth.py # Authentication module
How It Works
-
Authentication: On first run, the server authenticates with Garmin Connect using your credentials and stores OAuth tokens in the
.garthdirectory. -
Token Persistence: Subsequent requests use the stored tokens, so your credentials aren't needed after initial setup.
-
MCP Protocol: Claude Desktop launches the server as a subprocess and communicates via the Model Context Protocol over stdin/stdout.
-
On-Demand Queries: When you ask Claude about your Garmin data, it calls the appropriate tool, which fetches live data from the Garmin Connect API.
Acknowledgments
This project was inspired by AI_Fitness by johnson4601, which demonstrated the approach for extracting Garmin data using the garminconnect library.
The Garmin Connect API access is powered by the garminconnect Python library and garth for OAuth token management.
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please:
- Open an issue to discuss proposed changes before submitting a PR
- Follow existing code style
- Add tests for new functionality
- Update documentation as needed
Disclaimer
This project is not affiliated with or endorsed by Garmin. It accesses the unofficial Garmin Connect API, which may change without notice. Use responsibly and in accordance with Garmin's terms of service.
Support
If you encounter issues:
- Check the Troubleshooting section
- Search existing GitHub Issues
- Open a new issue with:
- Your Python version
- Your operating system
- The full error message
- Steps to reproduce
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。