Skip to main content
Glama
Intervals.icu MCP Server

Intervals.icu MCP Server

by mvilanova

Intervals.icu MCP 服务器

用于将 Claude 和 ChatGPT 与 Intervals.icu API 连接的模型上下文协议 (MCP) 服务器。它提供了用于身份验证以及检索活动、事件和健康数据的工具。

如果您觉得此模型上下文协议 (MCP) 服务器有用,请考虑通过捐赠来支持其持续开发。

要求

Related MCP server: Intervals.icu MCP Server

设置

1. 安装 uv (推荐)

macOS/Linux:

curl -LsSf https://astral.sh/uv/install.sh | sh

Windows (PowerShell):

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

安装完成后,找到 uv 的完整路径 — 您稍后在配置 Claude Desktop 时会用到它:

where.exe uv
# Example output: C:\Users\<USERNAME>\.local\bin\uv.exe

2. 克隆此仓库

git clone https://github.com/mvilanova/intervals-mcp-server.git
cd intervals-mcp-server

3. 创建并激活虚拟环境

# Create virtual environment with Python 3.12
uv venv --python 3.12

# Activate virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate

4. 同步项目依赖

uv sync

5. 设置环境变量

通过运行以下命令,将 .env.example 复制并重命名为 .env:

macOS/Linux:

cp .env.example .env

Windows (PowerShell):

Copy-Item .env.example .env

然后编辑 .env 文件并设置您的 Intervals.icu 运动员 ID 和 API 密钥:

API_KEY=your_intervals_api_key_here
ATHLETE_ID=your_athlete_id_here

获取您的 Intervals.icu API 密钥

  1. 登录您的 Intervals.icu 账户

  2. 前往 Settings > API

  3. 生成一个新的 API 密钥

查找您的运动员 ID

当您登录 Intervals.icu 时,您的运动员 ID 通常显示在 URL 中。它看起来像这样:

  • https://intervals.icu/athlete/i12345/... 其中 i12345 就是您的运动员 ID

更新

本项目处于活跃开发状态,会定期添加新功能和修复程序。要保持最新状态,请按照以下步骤操作:

1. 从 main 分支拉取最新更改

⚠️ 在运行此命令之前,请确保您没有未提交的更改。

macOS/Linux:

git checkout main && git pull

Windows (PowerShell):

git checkout main; git pull

2. 更新 Python 依赖

激活您的虚拟环境并同步依赖:

macOS/Linux:

source .venv/bin/activate
uv sync

Windows (PowerShell):

.venv\Scripts\activate
uv sync

故障排除

如果 Claude Desktop 因配置更改而失败,请按照以下步骤操作:

  1. 删除 claude_desktop_config.json 中现有的 Intervals.icu 条目。

  2. 从 intervals-mcp-server 目录重新配置 Claude Desktop。

macOS/Linux:

mcp install src/intervals_mcp_server/server.py --name "Intervals.icu" --with-editable . --env-file .env

Windows: 按照 Windows 配置部分 中的说明手动重新添加条目。

常见错误

spawn uv ENOENT — Claude Desktop 找不到 uv 可执行文件。在 command 字段中使用 uv 的完整路径。运行 which uv (macOS/Linux) 或 where.exe uv (Windows) 来获取它。

spawn /Users/... ENOENT on Windows — 配置文件包含 macOS/Linux 风格的路径。按照下方的 Windows 配置部分 使用反斜杠将其替换为正确的 Windows 路径。

Windows Store 安装:配置更改未生效 — 您可能编辑了错误的配置文件。从 Microsoft Store 安装的 Claude Desktop 读取的是 AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json,而不是 AppData\Roaming\Claude\。

与 Claude 一起使用

1. 配置 Claude Desktop

要将此服务器与 Claude Desktop 一起使用,您需要将其添加到您的 Claude Desktop 配置中。

macOS/Linux

  1. 从 intervals-mcp-server 目录运行以下命令以配置 Claude Desktop:

mcp install src/intervals_mcp_server/server.py --name "Intervals.icu" --with-editable . --env-file .env
  1. 如果您打开 Claude Desktop 应用的配置文件 claude_desktop_config.json,它应该如下所示:

{
  "mcpServers": {
    "Intervals.icu": {
      "command": "/Users/<USERNAME>/.local/bin/uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with-editable",
        "/path/to/intervals-mcp-server",
        "mcp",
        "run",
        "/path/to/intervals-mcp-server/src/intervals_mcp_server/server.py"
      ],
      "env": {
        "INTERVALS_API_BASE_URL": "https://intervals.icu/api/v1",
        "ATHLETE_ID": "<YOUR_ATHLETE_ID>",
        "API_KEY": "<YOUR_API_KEY>",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

其中 /path/to/ 是您系统中 intervals-mcp-server 代码文件夹的路径。

Windows

mcp install 命令可能会因环境或权限问题在 Windows 上失败。请改为手动配置 Claude Desktop:

  1. 找到 Claude Desktop 配置文件。如果 Claude Desktop 是从 Microsoft Store 安装的,配置文件位于:

    C:\Users\<USERNAME>\AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json

    如果是通过标准安装程序安装的,它可能位于:

    C:\Users\<USERNAME>\AppData\Roaming\Claude\claude_desktop_config.json

    如果文件或文件夹不存在,请创建它。

  2. 将以下条目添加到 claude_desktop_config.json 中,并将占位符替换为您的实际值:

{
  "mcpServers": {
    "Intervals.icu": {
      "command": "C:\\Users\\<USERNAME>\\.local\\bin\\uv.exe",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with-editable",
        "C:\\path\\to\\intervals-mcp-server",
        "mcp",
        "run",
        "C:\\path\\to\\intervals-mcp-server\\src\\intervals_mcp_server\\server.py"
      ],
      "env": {
        "INTERVALS_API_BASE_URL": "https://intervals.icu/api/v1",
        "ATHLETE_ID": "<YOUR_ATHLETE_ID>",
        "API_KEY": "<YOUR_API_KEY>",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}
  • 在 JSON 中,所有 Windows 路径请使用双反斜杠 (\\)。

  • 要查找 uv.exe 的完整路径,请在 PowerShell 中运行 where.exe uv。

  • 要查找克隆仓库的完整路径,请在 intervals-mcp-server 文件夹内运行 pwd。

Windows Store 安装注意事项: 从 Microsoft Store 安装的 Claude Desktop 将其配置沙盒化在 AppData\Local\Packages\... 下。编辑 AppData\Roaming\Claude\claude_desktop_config.json 不会产生任何效果 — 请确保您编辑的是正确的文件。

  1. 重启 Claude Desktop。

2. 在 Claude 中使用 MCP 服务器

一旦服务器运行且 Claude Desktop 配置完成,您就可以使用以下工具来询问有关您过去和未来的活动、事件和健康数据的问题。

  • get_activities: 检索活动列表

  • get_activity_details: 获取特定活动的详细信息

  • get_activity_intervals: 获取特定活动的详细区间数据

  • get_wellness_data: 获取健康数据

  • get_events: 检索即将发生的事件(锻炼、比赛等)

  • get_event_by_id: 获取特定事件的详细信息

与 ChatGPT 一起使用

ChatGPT 的测试版 MCP 连接器也可以通过 SSE 传输与此服务器通信。

  1. 以 SSE 模式启动服务器,使其暴露 /sse 和 /messages/ 端点:

    export FASTMCP_HOST=127.0.0.1 FASTMCP_PORT=8765 MCP_TRANSPORT=sse FASTMCP_LOG_LEVEL=INFO
    python src/intervals_mcp_server/server.py

    启动日志会打印完整的 URL(例如 http://127.0.0.1:8765/sse)。ChatGPT 需要该公共 URL,因此如果您没有直接暴露服务器,请使用诸如 ngrok http 8765 之类的工具转发端口。

  2. 在 ChatGPT 中,打开 Settings → Features → Custom MCP Connectors 并点击 Add。填写:

    • Name: Intervals.icu

    • MCP Server URL: https://<your-public-host>/sse

    • Authentication: 除非您保护了隧道,否则请保留为 No authentication。

    您可以在此处重复使用相同的 ngrok http 8765 隧道 URL;只需确保它转发到您上面导出的主机/端口即可。

  3. 保存连接器并打开一个新的聊天。ChatGPT 将保持 SSE 连接打开,并向服务器通告的 /messages/ 端点发送后续请求。如果您重启了 MCP 服务器或隧道,请重新运行 SSE 命令并在 URL 发生变化时更新连接器 URL。

开发与测试

安装开发依赖并运行测试套件:

uv sync --all-extras
pytest -v tests

在本地运行服务器

要手动启动服务器(在开发或测试时很有用),请运行:

mcp run src/intervals_mcp_server/server.py

启用调试日志

要捕获服务器日志以进行调试,请将命令包装在 shell 中并将 stderr 重定向到文件。

macOS/Linux — 修改您的 claude_desktop_config.json 如下:

{
  "mcpServers": {
    "Intervals.icu": {
      "command": "/bin/bash",
      "args": [
        "-c",
        "/Users/<USERNAME>/.local/bin/uv run --with 'mcp[cli]' --with-editable /path/to/intervals-mcp-server mcp run /path/to/intervals-mcp-server/src/intervals_mcp_server/server.py 2>> /path/to/intervals-mcp-server/mcp-server.log"
      ],
      "env": {
        "INTERVALS_API_BASE_URL": "https://intervals.icu/api/v1",
        "ATHLETE_ID": "<YOUR_ATHLETE_ID>",
        "API_KEY": "<YOUR_API_KEY>",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

然后 tail 日志文件以实时查看输出:

tail -f /path/to/intervals-mcp-server/mcp-server.log

Windows — 修改您的 claude_desktop_config.json 如下:

{
  "mcpServers": {
    "Intervals.icu": {
      "command": "powershell",
      "args": [
        "-Command",
        "C:\\Users\\<USERNAME>\\.local\\bin\\uv.exe run --with 'mcp[cli]' --with-editable C:\\path\\to\\intervals-mcp-server mcp run C:\\path\\to\\intervals-mcp-server\\src\\intervals_mcp_server\\server.py 2>> C:\\path\\to\\intervals-mcp-server\\mcp-server.log"
      ],
      "env": {
        "INTERVALS_API_BASE_URL": "https://intervals.icu/api/v1",
        "ATHLETE_ID": "<YOUR_ATHLETE_ID>",
        "API_KEY": "<YOUR_API_KEY>",
        "LOG_LEVEL": "INFO"
      }
    }
  }
}

然后使用 PowerShell 实时监控日志文件:

Get-Content C:\path\to\intervals-mcp-server\mcp-server.log -Wait

许可证

GNU 通用公共许可证 v3.0

精选

Glama.ai

Available Tools

10 tools
add_or_update_eventB

Post event for an athlete to Intervals.icu this follows the event api from intervals.icu If event_id is provided, the event will be updated instead of created.

Many arguments are required as this MCP tool function maps directly to the Intervals.icu API parameters.

Args: athlete_id: The Intervals.icu athlete ID (optional, will use ATHLETE_ID from .env if not provided) api_key: The Intervals.icu API key (optional, will use API_KEY from .env if not provided) event_id: The Intervals.icu event ID (optional, will use event_id from .env if not provided) start_date: Start date in YYYY-MM-DD format (optional, defaults to today) name: Name of the activity workout_doc: steps as a list of Step objects (optional, but necessary to define workout steps) workout_type: Workout type (e.g. Ride, Run, Swim, Walk, Row) moving_time: Total expected moving time of the workout in seconds (optional) distance: Total expected distance of the workout in meters (optional)

Example: "workout_doc": { "description": "High-intensity workout for increasing VO2 max", "steps": [ {"power": {"value": "80", "units": "%ftp"}, "duration": "900", "warmup": true}, {"reps": 2, "text": "High-intensity intervals", "steps": [ {"power": {"value": "110", "units": "%ftp"}, "distance": "500", "text": "High-intensity"}, {"power": {"value": "80", "units": "%ftp"}, "duration": "90", "text": "Recovery"} ]}, {"power": {"value": "80", "units": "%ftp"}, "duration": "600", "cooldown": true} {"text": ""}, # Add comments or blank lines for readability ] }

Step properties: distance: Distance of step in meters {"distance": "5000"} duration: Duration of step in seconds {"duration": "1800"} power/hr/pace/cadence: Define step intensity Percentage of FTP: {"power": {"value": "80", "units": "%ftp"}} Absolute power: {"power": {"value": "200", "units": "w"}} Heart rate: {"hr": {"value": "75", "units": "%hr"}} Heart rate (LTHR): {"hr": {"value": "85", "units": "%lthr"}} Cadence: {"cadence": {"value": "90", "units": "rpm"}} Pace by ftp: {"pace": {"value": "80", "units": "%pace"}} Pace by zone: {"pace": {"value": "Z2", "units": "pace_zone"}} Zone by power: {"power": {"value": "Z2", "units": "power_zone"}} Zone by heart rate: {"hr": {"value": "Z2", "units": "hr_zone"}} Ranges: Specify ranges for power, heart rate, or cadence: {"power": {"start": "80", "end": "90", "units": "%ftp"}} Ramps: Instead of a range, indicate a gradual change in intensity (useful for ERG workouts): {"ramp": True, "power": {"start": "80", "end": "90", "units": "%ftp"}} Repeats: include the reps property and add nested steps {"reps": 3, "steps": [ {"power": {"value": "110", "units": "%ftp"}, "distance": "500", "text": "High-intensity"}, {"power": {"value": "80", "units": "%ftp"}, "duration": "90", "text": "Recovery"} ]} Free Ride: Include free to indicate a segment without ERG control, optionally with a suggested power range: {"free": true, "power": {"value": "80", "units": "%ftp"}} Comments and Labels: Add descriptive text to label steps: {"text": "Warmup"}

How to use steps: - Set distance or duration as appropriate for step - Use "reps" with nested steps to define repeat intervals (as in example above) - Define one of "power", "hr" or "pace" to define step intensity

Inputs: workout_type (required), name (required), athlete_id, api_key, +5 more. Returns: result

delete_eventB

Delete event for an athlete from Intervals.icu Args: athlete_id: The Intervals.icu athlete ID (optional, will use ATHLETE_ID from .env if not provided) api_key: The Intervals.icu API key (optional, will use API_KEY from .env if not provided) event_id: The Intervals.icu event ID

Inputs: event_id (required), athlete_id, api_key. Returns: result

delete_events_by_date_rangeA

Delete events for an athlete from Intervals.icu in the specified date range.

Args: athlete_id: The Intervals.icu athlete ID (optional, will use ATHLETE_ID from .env if not provided) api_key: The Intervals.icu API key (optional, will use API_KEY from .env if not provided) start_date: Start date in YYYY-MM-DD format end_date: End date in YYYY-MM-DD format

Inputs: start_date (required), end_date (required), athlete_id, api_key. Returns: result

get_activitiesA

Get a list of activities for an athlete from Intervals.icu

Args: athlete_id: The Intervals.icu athlete ID (optional, will use ATHLETE_ID from .env if not provided) api_key: The Intervals.icu API key (optional, will use API_KEY from .env if not provided) start_date: Start date in YYYY-MM-DD format (optional, defaults to 30 days ago) end_date: End date in YYYY-MM-DD format (optional, defaults to today) limit: Maximum number of activities to return (optional, defaults to 10) include_unnamed: Whether to include unnamed activities (optional, defaults to False)

Inputs: athlete_id, api_key, start_date, end_date, +2 more. Returns: result

get_activity_detailsA

Get detailed information for a specific activity from Intervals.icu

Args: activity_id: The Intervals.icu activity ID api_key: The Intervals.icu API key (optional, will use API_KEY from .env if not provided)

Inputs: activity_id (required), api_key. Returns: result

get_activity_intervalsA

Get interval data for a specific activity from Intervals.icu

This endpoint returns detailed metrics for each interval in an activity, including power, heart rate, cadence, speed, and environmental data. It also includes grouped intervals if applicable.

Args: activity_id: The Intervals.icu activity ID api_key: The Intervals.icu API key (optional, will use API_KEY from .env if not provided)

Inputs: activity_id (required), api_key. Returns: result

get_activity_streamsA

Get stream data for a specific activity from Intervals.icu

This endpoint returns time-series data for an activity, including metrics like power, heart rate, cadence, altitude, distance, temperature, and velocity data.

Args: activity_id: The Intervals.icu activity ID api_key: The Intervals.icu API key (optional, will use API_KEY from .env if not provided) stream_types: Comma-separated list of stream types to retrieve (optional, defaults to all available types) Available types: time, watts, heartrate, cadence, altitude, distance, core_temperature, skin_temperature, velocity_smooth

Inputs: activity_id (required), api_key, stream_types. Returns: result

get_event_by_idB

Get detailed information for a specific event from Intervals.icu

Args: event_id: The Intervals.icu event ID athlete_id: The Intervals.icu athlete ID (optional, will use ATHLETE_ID from .env if not provided) api_key: The Intervals.icu API key (optional, will use API_KEY from .env if not provided)

Inputs: event_id (required), athlete_id, api_key. Returns: result

get_eventsA

Get events for an athlete from Intervals.icu

Args: athlete_id: The Intervals.icu athlete ID (optional, will use ATHLETE_ID from .env if not provided) api_key: The Intervals.icu API key (optional, will use API_KEY from .env if not provided) start_date: Start date in YYYY-MM-DD format (optional, defaults to today) end_date: End date in YYYY-MM-DD format (optional, defaults to 30 days from today)

Inputs: athlete_id, api_key, start_date, end_date. Returns: result

get_wellness_dataB

Get wellness data for an athlete from Intervals.icu

Args: athlete_id: The Intervals.icu athlete ID (optional, will use ATHLETE_ID from .env if not provided) api_key: The Intervals.icu API key (optional, will use API_KEY from .env if not provided) start_date: Start date in YYYY-MM-DD format (optional, defaults to 30 days ago) end_date: End date in YYYY-MM-DD format (optional, defaults to today)

Inputs: athlete_id, api_key, start_date, end_date. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 10 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: add_or_update_event creates/updates events, delete_event and delete_events_by_date_range handle deletion, get_activities and get_events retrieve lists, get_event_by_id and get_activity_details fetch specific items, get_activity_intervals and get_activity_streams provide specialized data, and get_wellness_data covers a separate domain. The descriptions clearly differentiate between events and activities, and between summary and detailed data.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern with snake_case: add_or_update_event, delete_event, delete_events_by_date_range, get_activities, get_activity_details, get_activity_intervals, get_activity_streams, get_event_by_id, get_events, get_wellness_data. The verbs (add_or_update, delete, get) are used predictably, and nouns (event, activity, wellness_data) are clearly specified, making the naming highly consistent and readable.

    Tool Count5/5

    With 10 tools, this server is well-scoped for managing athlete data in Intervals.icu, covering events, activities, and wellness data. Each tool serves a specific function (e.g., CRUD for events, detailed queries for activities), and none seem redundant or missing for the domain. This count aligns with typical server sizes (3-15 tools) and supports comprehensive workflows without being overwhelming.

    Completeness4/5

    The tool set provides strong coverage for the Intervals.icu domain, including CRUD for events (add/update, delete, get), detailed activity retrieval (list, details, intervals, streams), and wellness data. Minor gaps exist, such as no update or delete tools for activities (only get operations) and no tools for athlete management (e.g., list athletes), but agents can likely work around these with the available event and data tools.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers