Garmin Connect MCP Server

Garmin Connect MCP Server

Retrieves daily health, fitness, and activity statistics from Garmin Connect and exposes them to LLMs via tools like steps, heart rate, sleep, and more.

Category
访问服务器

README

Garmin Connect MCP Server

Languages: English | 日本語 (Japanese) | 简体中文 (Simplified Chinese)

A Model Context Protocol (MCP) server designed to retrieve daily health, fitness, and activity statistics from Garmin Connect and expose them to Large Language Models (LLMs). Built on Python's FastMCP, this server features robust authentication token persistence to protect your Garmin Connect account from being locked due to repeated login requests.


Features

  • Token Session Persistence Cache: The Garmin Connect API frequently locks accounts if too many login requests are made in a short time. This server automatically caches your session tokens locally (defaults to ~/.garminconnect or configured path) upon the first successful login, reusing them for subsequent requests.
  • 15 Rich Data Tools: Access steps, heart rate, sleep scores, stress, hydration, respiration, SpO2, body composition (weight/body fat), activity history, connected devices, and more.
  • Strict Type Safety & Testing: Fully compliant with mypy --strict and ruff, with a comprehensive mock-based test suite.

Setup Instructions

Prerequisites

  • Python 3.12 or higher
  • uv (fast Python package and project manager)

1. Installation

Clone this repository and install it in editable mode:

git clone https://github.com/rmc8/rmc_garmin_mcp.git
cd rmc_garmin_mcp
uv pip install -e .

2. Environment Configuration

Copy .env.example to create a .env file and configure your Garmin credentials:

cp .env.example .env

Edit the .env file:

# Garmin Connect Login Email
GARMIN_EMAIL=your_email@example.com
# Garmin Connect Login Password
GARMIN_PASSWORD=your_password

# (Optional) Change the token directory path
# GARMINTOKENS=/path/to/tokens

3. Multi-Factor Authentication (MFA) Setup (Optional)

If your Garmin Connect account has MFA (Multi-Factor Authentication) enabled, you cannot log in directly from the MCP server as it runs in the background and cannot prompt for inputs.

Instead, run the interactive login helper command once in your terminal before launching the server:

uvx --with rmc-garmin-mcp rmc-garmin-login

(Or uv run rmc-garmin-login if you have cloned the source locally).

Enter your credentials and the MFA verification code. Once authentication is successful, the session tokens will be cached locally, and the MCP server will start up seamlessly in the background without prompting you again.


Running the Server

Via uvx (Recommended)

You can run the server directly without manual cloning or installation using uvx:

uvx rmc-garmin-mcp

Stdio Mode (From Local Source)

If you have cloned the repository locally, you can run the server using uv:

uv run rmc-garmin-mcp

Testing with MCP Inspector

You can test the exposed tools using the interactive MCP Inspector GUI:

npx @modelcontextprotocol/inspector uv run rmc-garmin-mcp

After executing, open the URL provided in your browser to run test executions of the tools.


MCP Client Configuration

To configure the server for MCP clients (such as Claude Desktop), add the following to your configuration file (e.g. claude_desktop_config.json):

Using uvx (Recommended)

This method executes the server directly from PyPI without requiring a local clone.

{
  "mcpServers": {
    "rmc-garmin-mcp": {
      "command": "uvx",
      "args": ["rmc-garmin-mcp"],
      "env": {
        "GARMIN_EMAIL": "your_email@example.com",
        "GARMIN_PASSWORD": "your_password"
      }
    }
  }
}

Using Local Source (via uv)

If you prefer to run the server from a cloned local repository, configure it like this:

{
  "mcpServers": {
    "rmc-garmin-mcp": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/rmc_garmin_mcp",
        "run",
        "rmc-garmin-mcp"
      ],
      "env": {
        "GARMIN_EMAIL": "your_email@example.com",
        "GARMIN_PASSWORD": "your_password"
      }
    }
  }
}

[!IMPORTANT]

  • Replace /absolute/path/to/rmc_garmin_mcp with the actual absolute path to the directory where you cloned the repository.
  • If you have MFA enabled, ensure you run the interactive login helper (uvx --with rmc-garmin-mcp rmc-garmin-login) once in your terminal to cache the tokens before launching Claude Desktop.

Exposed MCP Tools

Tool Name Description Key Arguments
get_steps_data Fetch detailed step readings for a date. cdate (YYYY-MM-DD)
get_heart_rates Fetch heart rate data for a date. cdate (YYYY-MM-DD)
get_daily_steps Fetch summarized daily steps for a date range. start, end (YYYY-MM-DD)
get_body_battery Fetch Body Battery data for a date range. start (req), end (opt)
get_hydration_data Fetch hydration logs for a date. cdate (YYYY-MM-DD)
get_last_activity Fetch details of the most recent logged activity. None
get_sleep_data Fetch sleep scores and stages analysis for a date. cdate (YYYY-MM-DD)
get_stress_data Fetch detailed stress readings for a date. cdate (YYYY-MM-DD)
get_all_day_stress Fetch all-day stress records for a date. cdate (YYYY-MM-DD)
get_user_summary Fetch daily summary (steps, calories, resting HR). cdate (YYYY-MM-DD)
get_respiration_data Fetch respiration rates (breaths per minute) for a date. cdate (YYYY-MM-DD)
get_spo2_data Fetch SpO2 (blood oxygen) logs for a date. cdate (YYYY-MM-DD)
get_body_composition Fetch body composition (weight, body fat, muscle). startdate (req), enddate (opt)
get_activities List logged fitness activities with pagination. start (offset), limit (count)
get_devices List registered Garmin devices on the account. None

[!NOTE] All date parameters must be strings in YYYY-MM-DD format.


Development and Verification

Code Formatting and Linting

uv run ruff format .
uv run ruff check . --fix

Type Checking (Mypy Strict)

uv run mypy src tests

Running Unit Tests (Pytest)

uv run pytest

Tests mock the Garmin Connect API to verify validator logic and tool execution behavior without hitting real endpoints.

推荐服务器

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

官方
精选