Strava MCP Server
Strava MCP 服务器
一个将 Claude 连接到您的 Strava 账户的模型上下文协议 (MCP) 服务器。通过自然语言要求 Claude 分析您的训练、预测比赛时间、计算训练负荷或生成完整的周期性训练计划。
功能
13 个工具,涵盖 5 个类别:认证、活动、分析、预测、规划
带有自动本地回调服务器的 OAuth2 流程 — 无需手动复制代码
基于 VDOT 的训练配速(Jack Daniels 的跑步公式)
CTL/ATL/TSB 训练负荷指标(慢性/急性训练负荷,训练压力平衡)
通过 Riegel 公式进行比赛时间预测
完整的周期性训练计划(基础期 → 构建期 → 巅峰期 → 减量期),包含针对比赛的逻辑
Related MCP server: Strava MCP Server
要求
Node.js ≥ 18
Strava 账户
Claude Desktop(或任何兼容 MCP 的客户端)
设置
1. 创建 Strava API 应用程序
前往 strava.com/settings/api 并创建一个应用程序。
授权回调域 (Authorization Callback Domain):
localhost
记下您的 Client ID 和 Client Secret。
2. 配置环境变量
cp .env.example .env编辑 .env:
STRAVA_CLIENT_ID=your_client_id
STRAVA_CLIENT_SECRET=your_client_secret
STRAVA_REDIRECT_URI=http://localhost:8080/callback
TOKENS_FILE_PATH=./tokens.json3. 构建
npm install
npm run build4. 配置 Claude Desktop
编辑 %APPDATA%\Claude\claude_desktop_config.json (Windows) 或 ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):
{
"mcpServers": {
"strava": {
"command": "node",
"args": ["C:/path/to/McpStrava/dist/index.js"],
"env": {
"STRAVA_CLIENT_ID": "your_client_id",
"STRAVA_CLIENT_SECRET": "your_client_secret",
"TOKENS_FILE_PATH": "C:/path/to/McpStrava/tokens.json"
}
}
}
}您可以使用
.env或 Claude Desktop 配置中的env块 — 两者均可。
5. 认证
重启 Claude Desktop,然后在对话中:
调用
strava_get_auth_url— Claude 将返回一个 URL在浏览器中打开该 URL 并在 Strava 上授权该应用
页面将显示 "✓ Authentification réussie !",令牌将自动保存
可用工具
认证
工具 | 描述 |
| 生成 OAuth2 URL 并启动本地回调服务器 |
| 手动回退:将授权码交换为令牌 |
| 检查令牌是否有效及其过期时间 |
活动
工具 | 描述 |
| 列出最近的活动(跑步、骑行、步行、全部),包含距离、配速、心率 |
| 单个活动的完整详情:每公里分段、圈数、卡路里 |
| 全局 Strava 统计数据:本周、今年、历史总计 |
分析
工具 | 描述 |
| 每周训练量细分 + 一致性评分 |
| 通过 TRIMP 计算 CTL(体能)/ ATL(疲劳)/ TSB(新鲜度) |
| 分布在 6 个配速区间,80/20 法则检查 |
预测
工具 | 描述 |
| 通过 Riegel 公式根据参考表现预测完赛时间 |
| 根据任何比赛表现计算 VDOT 分数 + 5 个训练配速区间 |
训练规划
工具 | 描述 |
| 从今天到比赛日的完整周期性计划(基础/构建/巅峰/减量) |
| 仅生成给定阶段下周的训练课程 |
训练计划详情
阶段
阶段 | 重点 | 强度 |
基础 | 有氧基础 | 轻松跑、长距离跑、跨步跑 |
构建 | 乳酸阈值 | 节奏跑、中等强度跑、长距离跑 |
巅峰 | 最大摄氧量 + 比赛专项 | 间歇跑、节奏跑、长距离跑 |
减量 | 新鲜度 | 减少训练量,保持训练质量 |
训练量计算方式
起始训练量 — 结合您 4 周的平均公里数和基于 CTL 的每周公里数估算(对受伤中断具有鲁棒性)
巅峰训练量 — 当前的 1.4 倍,并设有比赛专项最低限额(5K: 40km, 10K: 50km, 半马: 60km, 全马: 80km)
每周进度 — 每周上限增加 +10%,以防止受伤
恢复周 — 每个阶段的第 4 周自动进行(训练量 × 0.8)
比赛专项逻辑
马拉松(构建期和巅峰期):长距离跑包含马拉松配速部分(约 45% 的跑步距离以比赛配速进行)
减量深度:5K 减量至巅峰训练量的 80%,马拉松减量至 40% — 短距离比赛需要的恢复较少
间歇跑:5K/10K 为 6 × 1000m,半马/全马为 5 × 1000m
VDOT 和配速区间
基于 Jack Daniels 的跑步公式。区间计算为 VDOT 的分数:
区间 | VDOT 百分比 | 用途 |
轻松 (Easy) | 65% | 日常跑、长距离跑 |
马拉松 (Marathon) | 80% | 马拉松配速部分 |
阈值 (Threshold) | 86% | 节奏跑 |
间歇 (Interval) | 98% | 最大摄氧量间歇跑 |
重复 (Repetition) | 105% | 速度训练 / 跨步跑 |
为朋友生成计划(手动模式)
strava_generate_training_plan 支持完全绕过 Strava 的手动模式。同时传入 current_weekly_km 和 goal_time,则无需 Strava 账户 — 这对于从您自己的 Claude Desktop 为朋友生成计划非常有用。
所需参数
参数 | 描述 | 示例 |
| 比赛距离 |
|
| 比赛日期 (YYYY-MM-DD) |
|
| 目标完赛时间 |
|
| 当前每周跑量 |
|
示例提示词
Génère un plan marathon pour mon ami, il court 55km par semaine et vise 3h45, la course est le 18 octobre 2026Mon amie veut courir un semi-marathon en 1h50 le 2026-09-14, elle fait environ 40km par semaine当同时提供 current_weekly_km 和 goal_time 时,该工具将跳过所有 Strava API 调用。响应中的 resume 将包含 source_volume: "Fourni manuellement" 以确认所使用的模式。
模式对比
Strava 模式 | 手动模式 | |
是否需要 Strava 账户 | 是 | 否 |
训练量校准 | 4 周平均值 + CTL | 您提供的值 |
VDOT 估算 | 根据近期活动或 | 根据 |
用例 | 您自己的训练 | 没有 Strava 的朋友/运动员 |
开发
# Watch mode (no build step needed)
npm run dev
# Build TypeScript
npm run build
# Run built server
npm start
# Clean build artifacts
npm run clean项目结构
src/
├── index.ts # MCP server entry point
├── config.ts # Env vars, Strava constants, race distances
├── types.ts # Shared TypeScript interfaces
├── auth/
│ ├── oauth.ts # OAuth2 URL builder, token exchange
│ ├── tokenStore.ts # Load/save tokens.json, expiry check
│ ├── callbackServer.ts # Local HTTP server for OAuth redirect
│ └── authTools.ts # MCP auth tools
├── strava/
│ ├── client.ts # Axios instance with auto token refresh
│ ├── activities.ts # Strava activities API
│ ├── athlete.ts # Strava athlete/stats API
│ └── activityTools.ts # MCP activity tools
├── analytics/
│ ├── metrics.ts # Weekly stats, pace zones, consistency score
│ ├── trainingLoad.ts # TRIMP, CTL/ATL/TSB computation
│ └── analysisTools.ts # MCP analysis tools
├── prediction/
│ ├── riegel.ts # Riegel race time prediction formula
│ ├── vdot.ts # VDOT computation, training paces, race equivalents
│ └── predictionTools.ts # MCP prediction tools
└── planning/
├── workouts.ts # Workout templates and distance bounds
├── plan.ts # Plan generation, phase allocation, VDOT estimation
└── planTools.ts # MCP planning tools令牌
tokens.json 存储您的 Strava 访问令牌和刷新令牌。它位于 .gitignore 中 — 切勿提交它。令牌在过期时会自动刷新(Strava 访问令牌有效期为 6 小时)。
示例提示词
Strava 模式(您自己的账户)
Analyse mes 8 dernières semaines d'entraînementQuelle serait mon heure sur un marathon si je cours un 10K en 45min ?Génère-moi un plan d'entraînement pour un semi-marathon le 2026-09-20Calcule ma charge d'entraînement actuelle et dis-moi si je suis en forme pour une course ce week-endMontre-moi la répartition de mes allures sur les 4 dernières semaines手动模式(朋友 / 无 Strava)
Génère un plan marathon pour mon ami, il court 55km par semaine et vise 3h45, la course est le 18 octobre 2026Mon amie veut courir un semi-marathon en 1h50 le 14 septembre 2026, elle fait 40km par semaine许可证
MIT
Available Tools
13 toolsstrava_analyze_trainingAnalyser l'entraînementA
Analyse la charge d'entraînement récente : volume hebdomadaire (km, temps, sorties), longue sortie, allure moyenne par semaine, score de régularité.
Inputs: weeks.
strava_athlete_statsStatistiques de l'athlèteA
Récupère les statistiques globales Strava : kilomètres cette semaine, ce mois, cette année, et all-time.
Inputs: no named parameters.
strava_auth_statusVérifier le statut d'authentificationA
Vérifie si des tokens Strava valides existent et quand ils expirent.
Inputs: no named parameters.
strava_exchange_tokenÉchanger le code d'autorisation contre des tokensA
Échange le code OAuth2 (depuis l'URL de redirection après autorisation dans le navigateur) contre des tokens d'accès et de rafraîchissement. Les tokens sont sauvegardés localement.
Inputs: code (required).
strava_generate_training_planGénérer un plan d'entraînement personnaliséA
Génère un plan d'entraînement structuré depuis aujourd'hui jusqu'au jour de la course, en 4 phases : Base (fondation aérobie), Build (développement du seuil), Peak (VO2max et spécifique course), Taper (affûtage). Mode Strava : calibre automatiquement le volume et le VDOT depuis l'historique. Mode manuel : passer current_weekly_km + goal_time pour générer un plan sans compte Strava.
Inputs: target_race (required), race_date (required), goal_time, current_weekly_km, +1 more.
strava_get_activitiesRécupérer les activités StravaA
Récupère la liste des activités récentes de l'athlète avec distance, temps, allure et fréquence cardiaque.
Inputs: days, activity_type, max_results.
strava_get_activity_detailDétail d'une activitéB
Récupère le détail complet d'une activité Strava (laps, splits kilomètre par kilomètre, calories).
Inputs: activity_id (required).
strava_get_auth_urlObtenir l'URL d'autorisation StravaA
Génère l'URL OAuth2 Strava. Ouvrir cette URL dans un navigateur, autoriser l'application, puis copier le paramètre 'code' depuis l'URL de redirection et le passer à strava_exchange_token.
Inputs: no named parameters.
strava_pace_zonesDistribution des zones d'allureA
Analyse la répartition des kilomètres par zone d'allure (Récupération, Facile, Aérobie, Seuil, VO2max, Anaérobie). Aide à vérifier la règle 80/20 (80% en zones basses).
Inputs: weeks, threshold_pace_min_km.
strava_predict_race_timePrédire les temps de course (formule Riegel)A
Prédit les temps sur les distances standard (5K, 10K, Semi, Marathon) en utilisant la formule de Riegel (T2 = T1 × (D2/D1)^1.06) depuis une performance récente. Auto-détecte la meilleure performance récente sur Strava, ou accepte une entrée manuelle.
Inputs: known_distance_m, known_time, target_distances, days_lookback.
strava_training_loadCalculer la charge d'entraînement (CTL/ATL/TSB)A
Calcule les métriques de forme, fatigue et fraîcheur via des moyennes exponentielles. CTL (fitness chronique, 42j) / ATL (fatigue aiguë, 7j) / TSB = CTL - ATL (fraîcheur). TSB > +10 = frais pour une course ; TSB < -20 = surcharge.
Inputs: days, hr_rest, hr_max, show_daily.
strava_vdotCalculer VDOT et allures d'entraînementA
Calcule ton score VDOT (indice de capacité aérobie de Jack Daniels) depuis une performance récente. Retourne : score VDOT, 5 zones d'allure d'entraînement (Facile, Marathon, Seuil, Intervalle, Répétition), et les équivalents de temps sur toutes les distances standard.
Inputs: distance_m (required), time (required).
strava_weekly_workoutGénérer les séances de la semaine prochaineA
Génère uniquement les séances d'entraînement de la semaine prochaine, basées sur le VDOT et le volume actuel. Plus léger que le plan complet.
Inputs: vdot, weekly_km, phase, target_race, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 13 tools
Most tools target distinct aspects of training analysis (load, pace zones, VDOT, weekly plan), but some overlap exists between race time prediction tools (predict_race_time and vdot both estimate race times, though from different formulas). Descriptions help differentiate, but potential confusion remains.
All tools start with 'strava_' and use snake_case, but there is inconsistency in verb-noun order: some start with a verb (strava_analyze_training, strava_get_activities) and others with a noun (strava_athlete_stats, strava_pace_zones). This mixed pattern reduces predictability.
13 tools is a well-scoped set for a training analysis server. It covers authentication, activity retrieval, multiple analysis dimensions, and plan generation without being overwhelming.
The tool set provides comprehensive coverage of training analysis (load, pace, VDOT, race prediction, plan generation) and basic activity retrieval. Minor gaps exist, such as no tool to fetch or modify generated training plans, but core workflows are supported.
Related MCP Connectors
Connect Intervals.icu to Claude and ChatGPT: read training, plan workouts. Training never stored.
tri-train is a training platform for triathletes that syncs activities from Strava and Garmin and exposes them to Claude through a remote MCP server. Ask Claude how your last block went, why your run pace dropped, or whether you are fresh enough for Sunday's race, and it answers from your real data: activities with laps and grade-adjusted pace, weekly load and the performance management chart (CTL/ATL/TSB), sleep, HRV and resting heart rate, and your race calendar with predictions. Claude can also act: create and adjust planned workouts with structured intervals, push them to your Garmin watch, add races and write notes. Every change is journaled and can be undone. Read and write access are separate OAuth scopes, and the server enforces them on every call. Built and hosted in Switzerland by a triathlete; data stays on our own servers (Swiss revDSG / GDPR).
Turn Claude or ChatGPT into a cycling coach that plans your week, grades it, and adapts. Free beta.
Pace is a remote MCP server that exposes wearable and fitness data to Claude via the Model Context Protocol. It connects to Garmin, Oura, Whoop, Polar, Fitbit and 20+ devices and provides 15 tools for querying sleep, activity, recovery, and training data. Hosted on Google Cloud Run, OAuth 2.1 authentication, Streamable HTTP transport. Instructions: First you need to create an account at: https://pacetraining.co and connect your wearables. After that you can connect the remote Server via Custom Connector in Claude and OAuth 2.1 Flow startet.
Related MCP Servers
- AlicenseBqualityDmaintenanceConnects Claude to the Strava API to provide direct access to fitness data, including athlete statistics, detailed activity logs, and time-series performance metrics. It enables users to analyze training progress, compare workouts, and retrieve specific segment details through natural language queries.8MIT
- AlicenseNot gradedqualityCmaintenanceConnects Claude to Strava data for natural language queries about rides, stats, and activities.8 npmMIT
- AlicenseAqualityDmaintenanceConnects Claude to your Strava account so you can query your activities, stats, routes, and segments using natural language.2721 npm1MIT
- AlicenseAqualityDmaintenanceConnects Strava training data to Claude, enabling personalized coaching through analysis of training load, workout planning, gear maintenance, and power metrics.1064 PyPI1MIT