Garmin MCP Server

Garmin MCP Server

Enables ChatGPT to access and analyze personal Garmin health data including daily steps, heart rate, calories, sleep duration, and body battery levels. Collects data via webhook from Garmin devices and provides health insights through natural language queries.

Category
访问服务器

README

Garmin MCP Server

A webhook receiver and MCP (Model Context Protocol) server that collects Garmin health data and makes it available to ChatGPT through OpenAI's Remote MCP integration.

Features

  • Garmin Webhook Receiver: Accepts health data from Garmin devices
  • SQLite Persistence: Stores data in SQLite database on EFS for reliability
  • MCP Integration: Provides health data to ChatGPT via OpenAI's Remote MCP
  • AWS Deployment: Runs on ECS Fargate with Terraform infrastructure
  • Rate Limiting: Protects webhook endpoints from abuse

Architecture

Garmin Device → Webhook → SQLite DB → MCP Server → ChatGPT

Data Collected

  • Daily step count
  • Resting heart rate
  • Active calories burned
  • Sleep duration
  • Body battery levels

Quick Start

Local Development

  1. Clone the repository:
git clone https://github.com/yourusername/garmin-mcp.git
cd garmin-mcp
  1. Install dependencies:
npm install
  1. Set up environment variables:
cp env.example .env
# Edit .env with your configuration
  1. Build and run:
npm run build
npm start

Docker

docker-compose up --build

Local HTTPS (Cloudflare Quick Tunnel)

You can expose your local server with a temporary public HTTPS URL (no DNS or account needed):

brew install cloudflared
./scripts/cloudflared-quick.sh

This prints a https://<random>.trycloudflare.com URL. Use it for testing endpoints:

  • Webhook: https://<random>.trycloudflare.com/garmin/webhook
  • Health: https://<random>.trycloudflare.com/healthz

Environment Variables

Variable Description Required
PORT Server port (default: 8080) No
MCP_API_TOKEN Bearer token for MCP authentication Yes
GARMIN_WEBHOOK_SECRET Secret for webhook signature verification No
GARMIN_API_KEY Garmin Health API key No
GARMIN_API_SECRET Garmin Health API secret No

API Endpoints

Webhook

  • POST /garmin/webhook - Receives Garmin health data

MCP (Model Context Protocol)

  • GET /mcp/tools - Lists available tools
  • POST /mcp/tools/call - Executes a tool
  • GET /mcp/sse - Server-sent events endpoint

Health

  • GET /healthz - Health check endpoint

MCP Tools

garmin.getDailySummary

Get daily health summary for a user and date.

Parameters:

  • user_id (string, required): User identifier
  • date (string, optional): Date in YYYY-MM-DD format (defaults to today)

garmin.getRecentDays

Get health data for the last N days.

Parameters:

  • user_id (string, required): User identifier
  • days (number, optional): Number of days to retrieve (default: 7)

Versioning & Deployment

Versioning Strategy

We use git-based versioning for Docker images:

  • Git Tags: Create semantic version tags (e.g., v1.0.0, v1.1.0)
  • Docker Tags: Images are tagged with both the git version and latest
  • Rollback: Can easily rollback by updating ECS task definition to use a previous version

Creating a Release

# 1. Create a git tag for the release
git tag v1.0.0

# 2. Build and push with versioning
cd terraform
./build-and-push.sh

# 3. Deploy to ECS
aws ecs update-service --cluster garmin-mcp-cluster --service garmin-mcp-service --force-new-deployment

Version History

  • v0.1.0: Initial release with SQLite persistence and integration tests
  • Next: v1.0.0 - Production ready with Cloudflare Tunnel deployment

Rollback Process

# List available versions in ECR
aws ecr describe-images --repository-name garmin-mcp --query 'imageDetails[*].imageTags' --output table

# Update task definition to use specific version
aws ecs update-service --cluster garmin-mcp-cluster --service garmin-mcp-service --task-definition garmin-mcp-task:REVISION_NUMBER

Deployment

AWS with Terraform (Cost Optimized - ~$9/month)

Our infrastructure uses a cost-optimized architecture with Cloudflare Tunnel for secure access:

  • ECS Fargate: Single task with 0.25 vCPU, 0.5GB RAM
  • No NAT Gateway: Saves ~$33/month by using public IP for outbound only
  • Cloudflare Tunnel: Provides secure HTTPS access without public inbound traffic
  • EFS Storage: SQLite database persistence (~$0.30/month)

Prerequisites

  1. Cloudflare Account: Create a tunnel and get the tunnel token
  2. AWS Credentials: Configure AWS CLI access
  3. Domain: Optional - for custom hostname instead of trycloudflare.com

Deploy Steps

  1. Create Cloudflare Tunnel:

    # Install cloudflared
    brew install cloudflared
    
    # Login to Cloudflare
    cloudflared tunnel login
    
    # Create tunnel
    cloudflared tunnel create garmin-mcp
    
    # Get tunnel token (save this)
    cloudflared tunnel token garmin-mcp
    
  2. Configure Terraform:

    cd terraform
    
    # Create terraform.tfvars with your tunnel token
    echo 'cloudflare_tunnel_token = "your-tunnel-token-here"' > terraform.tfvars
    
  3. Deploy:

    ./deploy.sh
    
  4. Configure Tunnel Route (optional):

    # For custom domain
    cloudflared tunnel route dns garmin-mcp webhook.yourdomain.com
    

Security Benefits

  • No Public Inbound: Security group blocks all incoming traffic
  • Outbound Only: Task can make outbound connections (Docker images, Cloudflare)
  • Encrypted Tunnel: All traffic encrypted through Cloudflare's edge
  • Cost Effective: No NAT Gateway or ALB required

Manual Deployment

  1. Build the Docker image
  2. Push to ECR
  3. Deploy to ECS Fargate

Privacy

This is a personal, non-commercial project. See PRIVACY.md for details on data collection and usage.

License

Personal use only. This project is not intended for commercial use.

Contributing

This is a personal project, but suggestions and improvements are welcome through issues and discussions.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选