garmin-mcp

garmin-mcp

Enables creating, previewing, scheduling, and managing Garmin Connect workouts, plus reading activities and health metrics, all through a local MCP server.

Category
访问服务器

README

Personal Garmin MCP

A local MCP server for creating and scheduling structured workouts in Garmin Connect through unofficial Garmin endpoints.

This is an experimental personal project. Garmin may change the endpoints, rate-limit requests, or revoke a session without notice. Do not expose the server to the internet without adding separate authentication.

Features

  • verifies a saved Garmin session;
  • previews Garmin JSON without making changes;
  • creates workouts and optionally adds them to the calendar;
  • lists the workout library and calendar;
  • reads completed activities, compact summaries, and lap/split metrics;
  • reads available sleep, HRV, Body Battery, Training Readiness, and Training Status;
  • deletes workouts and removes workouts from the calendar;
  • supports running, cycling, walking, and hiking;
  • supports time, distance, and lap button steps;
  • supports interval repeats;
  • supports pace, heart-rate, power, and cadence targets;
  • requires confirm=true for every change.

Installation

Docker Compose — recommended

Local use requires Docker with Compose support. Build the image from the repository root:

docker compose build

The build installs Python dependencies with uv strictly from uv.lock.

Run the interactive login once. The password and MFA code are entered directly in the container and are not stored. OAuth tokens are saved in the private garmin-mcp_garmin_tokens named volume:

docker compose --profile login run --rm garmin-login

Start the MCP server:

docker compose up -d garmin-mcp
docker compose ps

The endpoint is available at http://127.0.0.1:8000/mcp. To use a different local port:

GARMIN_MCP_PORT=8765 docker compose up -d garmin-mcp

View logs or stop the server:

docker compose logs -f garmin-mcp
docker compose down

docker compose down preserves the Garmin tokens. Running docker compose down -v deletes the volume and its tokens.

Local installation without Docker

Python 3.12+ and uv are required.

cd /path/to/garmin-mcp
uv sync --extra dev

One-time login

uv run garmin-mcp-login

The script interactively requests an email address, password, and MFA code when required. The password is not stored. OAuth tokens are saved to .garmin-tokens/garmin_tokens.json with restricted permissions. The directory is already included in .gitignore.

To store tokens somewhere else:

export GARMIN_TOKEN_DIR=/safe/private/path/garmin-tokens
uv run garmin-mcp-login

Local MCP over stdio

export GARMIN_TOKEN_DIR=/safe/private/path/garmin-tokens
uv run garmin-mcp

Example MCP client configuration:

{
  "mcpServers": {
    "garmin": {
      "command": "/absolute/path/to/garmin-mcp/.venv/bin/garmin-mcp",
      "env": {
        "GARMIN_TOKEN_DIR": "/safe/private/path/garmin-tokens"
      }
    }
  }
}

Streamable HTTP for ChatGPT

export GARMIN_MCP_TRANSPORT=streamable-http
export GARMIN_MCP_HOST=127.0.0.1
export GARMIN_MCP_PORT=8000
export GARMIN_TOKEN_DIR=/safe/private/path/garmin-tokens
uv run garmin-mcp

Endpoint: http://127.0.0.1:8000/mcp.

ChatGPT must be able to reach the endpoint over HTTPS. A protected tunnel can be used for personal testing. Do not expose this MVP directly to the internet: it intentionally does not include a separate OAuth resource server for access to the MCP server itself.

Example preview_workout argument

{
  "workout": {
    "name": "6 x 800",
    "sport": "running",
    "description": "Controlled intervals",
    "blocks": [
      {
        "steps": [
          {
            "step_type": "warmup",
            "duration_type": "time",
            "duration_value": 900
          }
        ]
      },
      {
        "repeat": 6,
        "steps": [
          {
            "step_type": "interval",
            "duration_type": "distance",
            "duration_value": 800,
            "target_type": "pace_seconds_per_km",
            "target_low": 250,
            "target_high": 260
          },
          {
            "step_type": "recovery",
            "duration_type": "time",
            "duration_value": 120
          }
        ]
      },
      {
        "steps": [
          {
            "step_type": "cooldown",
            "duration_type": "time",
            "duration_value": 600
          }
        ]
      }
    ]
  }
}

Pace values are specified in seconds per kilometre: 250 = 4:10/km and 260 = 4:20/km. The server converts them to the m/s values used by Garmin Connect.

After previewing, call create_workout with the same object, a date in YYYY-MM-DD format, and confirm=true.

Read-only training context

The server exposes compact read-only tools for adapting future plans to completed work:

  • list_activities lists activities in an inclusive date range, with an optional Garmin activity type filter;
  • get_activity_summary returns planning metrics for one activity;
  • get_activity_splits returns compact lap and interval metrics;
  • get_recovery_status aggregates available sleep, HRV, Body Battery, Training Readiness, and Training Status for one date.

Activity responses intentionally omit GPS coordinates and owner details. Recovery metrics vary by Garmin device, account, and date. A missing source is returned as unavailable and does not make the entire recovery request fail.

Checks

uv run --extra dev pytest
uv run --extra dev ruff check .

Unit tests do not contact Garmin and do not require credentials.

Important limitations

  • This is not an official Garmin Training API.
  • Frequent logins may receive HTTP 429 responses; reuse saved tokens.
  • Tokens provide access to Garmin Connect and must be protected like a password.
  • If creation succeeds but scheduling fails, the tool returns created_not_scheduled and workout_id; the created workout remains in the library.
  • Before regular use, test one simple workout in Garmin Connect and on the specific watch model.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选