๐ Strava MCP Server
A Model Context Protocol (MCP) server that connects Claude to your Strava account โ ask in natural language to analyze your training, predict race times, compute training loads, or generate a full periodized training plan.
โจ Features
- ๐งฐ 13 tools across 5 categories: auth, activities, analysis, prediction, planning
- ๐ OAuth2 flow with an automatic local callback server โ no manual code copying
- ๐
VDOT-based training paces (Jack Daniels' Running Formula)
- ๐ CTL / ATL / TSB training load metrics โ Chronic & Acute Training Load, Training Stress Balance
- โฑ๏ธ Race time predictions via the Riegel formula
- ๐
Full periodized training plans (Base โ Build โ Peak โ Taper) with race-specific logic
๐ Requirements
| Requirement |
Details |
| Runtime |
Node.js โฅ 18 |
| Account |
A Strava account |
| Client |
Claude Desktop (or any MCP-compatible client) |
๐ Quick Start
1. Create a Strava API application
Go to strava.com/settings/api and create an application.
- Authorization Callback Domain:
localhost
๐ก Note down your Client ID and Client Secret โ you'll need them in the next steps.
2. Configure environment variables
cp .env.example .env
Edit .env:
STRAVA_CLIENT_ID=your_client_id
STRAVA_CLIENT_SECRET=your_client_secret
STRAVA_REDIRECT_URI=http://localhost:8080/callback
TOKENS_FILE_PATH=./tokens.json
3. Build
npm install
npm run build
4. Configure Claude Desktop
Edit %APPDATA%\Claude\claude_desktop_config.json (Windows) or ~/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"
}
}
}
}
๐ก Tip
You can use either .env or the env block in the Claude Desktop config โ both work.
5. Authenticate
Restart Claude Desktop, then in a conversation:
- Call
strava_get_auth_url โ Claude will return a URL
- Open the URL in your browser and authorize the app on Strava
- The page will show "โ Authentification rรฉussie !" and tokens are saved automatically
๐ ๏ธ Available Tools
๐ Authentication
| Tool |
Description |
strava_get_auth_url |
Generates the OAuth2 URL and starts the local callback server |
strava_exchange_token |
Manual fallback: exchange an auth code for tokens |
strava_auth_status |
Check if tokens are valid and when they expire |
๐ Activities
| Tool |
Description |
strava_get_activities |
List recent activities (Run, Ride, Walk, All) with distance, pace, HR |
strava_get_activity_detail |
Full detail for one activity: splits per km, laps, calories |
strava_athlete_stats |
Global Strava stats: this week, this year, all-time |
๐ Analysis
| Tool |
Description |
strava_analyze_training |
Weekly volume breakdown + consistency score |
strava_training_load |
CTL (fitness) / ATL (fatigue) / TSB (freshness) via TRIMP |
strava_pace_zones |
Distribution across 6 pace zones, 80/20 rule check |
โฑ๏ธ Prediction
| Tool |
Description |
strava_predict_race_time |
Predict finish times via Riegel formula from a reference effort |
strava_vdot |
Compute VDOT score + 5 training pace zones from any race performance |
๐
Training Planning
| Tool |
Description |
strava_generate_training_plan |
Full periodized plan from today to race day (Base/Build/Peak/Taper) |
strava_weekly_workout |
Generate just next week's sessions for a given phase |
๐ Training Plan Details
Phases
| Phase |
Focus |
Intensity |
| Base |
Aerobic foundation |
Easy runs, long run, strides |
| Build |
Lactate threshold |
Tempo, easy medium, long run |
| Peak |
VO2max + race-specific |
Intervals, tempo, long run |
| Taper |
Freshness |
Reduced volume, maintenance quality |
๐งฎ How volume is calculated
- Starting volume โ blend of your 4-week average km and CTL-derived weekly km estimate (robust to injury breaks)
- Peak volume โ 1.4ร current, with race-specific minimums (5K: 40 km, 10K: 50 km, Half: 60 km, Marathon: 80 km)
- Weekly progression โ capped at +10% per week to prevent injury
- Recovery weeks โ automatic every 4th week within each phase (volume ร 0.8)
๐ฏ Race-specific logic
- Marathon (Build & Peak): Long runs include a marathon-pace section (~45% of the run at race pace)
- Taper depth: 5K tapers to 80% of peak volume, Marathon to 40% โ shorter races need less recovery
- Intervals: 6 ร 1000 m for 5K/10K, 5 ร 1000 m for Half/Marathon
๐
VDOT & pace zones
Based on Jack Daniels' Running Formula. Zones computed as a fraction of VDOT:
| Zone |
% of VDOT |
Use |
| Easy |
65% |
Daily runs, long run |
| Marathon |
80% |
Marathon-pace sections |
| Threshold |
86% |
Tempo runs |
| Interval |
98% |
VO2max intervals |
| Repetition |
105% |
Speed work / strides |
๐ฅ Generating Plans for Friends (Manual Mode)
strava_generate_training_plan supports a manual mode that bypasses Strava entirely. Pass current_weekly_km and goal_time together and no Strava account is needed โ useful for generating plans for friends from your own Claude Desktop.
Required parameters
| Parameter |
Description |
Example |
target_race |
Race distance |
"Marathon" |
race_date |
Race date (YYYY-MM-DD) |
"2026-10-18" |
goal_time |
Target finish time |
"3:45:00" |
current_weekly_km |
Current weekly mileage |
55 |
Example prompts
Generate a marathon plan for my friend โ he runs 55 km per week and is targeting 3h45, the race is on October 18, 2026
My friend wants to run a half marathon in 1h50 on 2026-09-14, she does about 40 km per week
๐ก How it works
When both current_weekly_km and goal_time are provided, the tool skips all Strava API calls. The resume in the response will include source_volume: "Fourni manuellement" to confirm which mode was used.
Mode comparison
|
Strava mode |
Manual mode |
| Strava account needed |
Yes |
No |
| Volume calibration |
4-week avg + CTL |
Value you provide |
| VDOT estimation |
From recent activities or goal_time |
From goal_time (required) |
| Use case |
Your own training |
Friends / athletes without Strava |
๐ง๐ป Development
npm run dev
npm run build
npm start
npm run clean
๐ Project structure
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
tokens.json stores your Strava access and refresh tokens. It is in .gitignore โ never commit it. Tokens are refreshed automatically when they expire (Strava access tokens last 6 hours).
๐ฌ Example Prompts
Strava mode (your own account)
Analyze my last 8 weeks of training
What would my marathon time be if I run a 10K in 45 min?
Generate me a training plan for a half marathon on 2026-09-20
Compute my current training load and tell me whether I'm fresh for a race this weekend
Show me my pace distribution over the last 4 weeks
Manual mode (friends / no Strava)
Generate a marathon plan for my friend โ he runs 55 km per week and is targeting 3h45, the race is on October 18, 2026
My friend wants to run a half marathon in 1h50 on September 14, 2026, she does 40 km per week
๐ License
MIT