Strava MCP Server
Provides tools to access and manage Strava data, including activities, stats, routes, segments, clubs, and profile information.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Strava MCP Server How far did I run this month?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Strava MCP Server
Talk to your Strava data using AI.
Connect Claude to your Strava account and ask questions in plain English: "How far did I run this month?", "Analyze my last ride", or "Show me my fastest segments."
This is a fork of r-huijts/strava-mcp. See What's different in this fork for the full list of changes.
What's Different in This Fork
π Auto-Authentication β No More "Connect my Strava"
The original requires you to run connect-strava every time your token expires. This fork handles it automatically:
Proactive refresh: If your token expires within 5 minutes, it's refreshed before the API call.
Reactive refresh: Any
401response triggers a silent token refresh and retries the request β you never see an auth error mid-session.Persistent tokens: After a refresh, the new token is saved to
~/.config/strava-mcp/config.json. On the next server restart, the saved (valid) token is preferred over the potentially-stale token in your env/config file. You stay logged in.
Set your credentials once in claude_desktop_config.json with STRAVA_CLIENT_ID, STRAVA_CLIENT_SECRET, STRAVA_ACCESS_TOKEN, and STRAVA_REFRESH_TOKEN β the server handles the rest.
πΊοΈ New Tool: find-nearby-routes
Find your saved Strava routes that start near a location, sorted by distance:
"Show me my routes within 15 km of Istanbul" "Find cycling routes near 48.8566, 2.3522"
Parameters: latitude, longitude, maxDistanceKm (default: 10 km), optional activityType (ride/run).
Uses the Haversine formula to calculate great-circle distances. Automatically paginates through all your saved routes.
π Bug Fixes
z.coerce.number()for all ID parameters: Claude serializes tool parameters as strings. The original usedz.number()which rejected them withExpected number, received string. All ID params (activityId,segmentId,effortId,athleteId) now usez.coerce.number().Consistent
activityIdnaming:getActivityLapsandgetActivityStreamspreviously usedidin their schemas, causingRequired, received undefinederrors when Claude passedactivityId. Renamed to match.
π Improved Tool Descriptions & Error Messages
All tool descriptions use active voice and describe what fields are returned, so Claude chooses the right tool more reliably.
Removed "Obtain this ID first by calling..." meta-hints that caused unnecessary chained calls.
All 26 tools return consistent, user-friendly error messages.
Related MCP server: Strava MCP Server
What Can You Do With This?
Once connected, just talk to Claude like you're talking to a friend who has access to all your Strava data:
π Track Your Progress
"How many kilometers did I run this month?"
"Compare my running stats from January to December"
"What's my longest ride ever?"
π Analyze Your Workouts
"Break down my last cycling workout - show me power, heart rate, and cadence"
"How did my heart rate zones look during yesterday's run?"
"What was my average pace for each lap in my interval training?"
πΊοΈ Explore Routes & Segments
"Find my saved routes within 20 km of my location"
"What are the most popular cycling segments near Central Park?"
"Export my Sunday morning route as a GPX file"
π Get Coaching Insights
"Analyze my training load this week"
"How does my current fitness compare to last month?"
"Give me a summary of my cycling performance this year"
Quick Start (3 Steps)
Step 1: Add to Claude Desktop
Open your Claude Desktop configuration file:
Mac:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Add this to the file:
{
"mcpServers": {
"strava": {
"command": "npx",
"args": ["-y", "@stugal/strava-mcp-server"],
"env": {
"STRAVA_CLIENT_ID": "your_client_id",
"STRAVA_CLIENT_SECRET": "your_client_secret",
"STRAVA_ACCESS_TOKEN": "your_access_token",
"STRAVA_REFRESH_TOKEN": "your_refresh_token"
}
}
}
}Setting the env vars here means you never need to run connect-strava β tokens are refreshed automatically.
Step 1 (alternative): Add to Claude Code
claude mcp add --transport stdio strava -- npx @stugal/strava-mcp-serverStep 2: Restart Claude Desktop
Close and reopen Claude Desktop to load the new configuration.
Step 3: Start Talking
That's it! Ask Claude about your Strava data directly. If you provided credentials in Step 1, you're already authenticated.
If you didn't set env vars, say:
"Connect my Strava account"
Connecting Your Strava Account
Getting Your Strava API Credentials
You need to create a free Strava API application (one-time setup):
Go to strava.com/settings/api
Click "Create an App" (or view your existing app)
Fill in the form:
Application Name: Anything you want (e.g., "My Claude Assistant")
Category: Choose any
Website: Can be anything (e.g.,
http://localhost)Authorization Callback Domain: Must be
localhost
Copy your Client ID and Client Secret
Getting Your Access & Refresh Tokens
Run the initial OAuth flow once to get your tokens:
Add only
STRAVA_CLIENT_IDandSTRAVA_CLIENT_SECRETto your configSay "Connect my Strava account" β a browser window opens
Authorize the app on Strava
Your tokens are saved to
~/.config/strava-mcp/config.jsonCopy them from there into your
claude_desktop_config.jsonenv block
After this one-time setup, token refresh is fully automatic.
Managing Your Connection
Check status: "Am I connected to Strava?"
Force reconnect: "Connect my Strava account"
Disconnect: "Disconnect my Strava account"
Installation Options
Option A: Just Use It (Recommended)
No installation needed! The npx command automatically downloads and runs the latest version.
Option B: Install Globally
npm install -g @stugal/strava-mcp-serverOption C: Build from Source
git clone https://github.com/samitugal/strava-mcp.git
cd strava-mcp
npm install
npm run buildThen point Claude to your local build:
{
"mcpServers": {
"strava": {
"command": "node",
"args": ["/path/to/strava-mcp/dist/server.js"]
}
}
}Available Tools
Account & Profile
What you can ask | What it does |
"Connect my Strava account" | Links your Strava to Claude |
"Check my Strava connection" | Shows connection status |
"Get my Strava profile" | Shows your profile info |
"What shoes do I have?" | Lists your shoes and usage distance |
"What are my training zones?" | Shows HR and power zones |
Activities
What you can ask | What it does |
"Show my recent activities" | Lists your latest workouts |
"Get all my runs from January" | Fetches activities with filters |
"Analyze activity 12345" | Distance, time, elevation, pace, HR, cadence, power |
"Show the laps from my last run" | Per-lap time, distance, speed, HR, cadence, power |
"Get heart rate data from my ride" | Time-series streams at configurable resolution |
"Show photos from my hike" | Activity photos |
Stats & Progress
What you can ask | What it does |
"What are my running stats?" | Recent, YTD, and all-time totals |
"How far have I cycled this year?" | Activity totals by type |
Routes (includes new tool)
What you can ask | What it does |
"Find routes within 10 km of [location]" | NEW β nearby routes by lat/lng + max distance |
"List my saved routes" | Your created routes |
"Get details for my [route name]" | Route info |
"Export [route] as GPX" | Download for GPS devices |
"Export [route] as TCX" | Download for GPS devices |
Segments
What you can ask | What it does |
"Show my starred segments" | Your favorite segments |
"Find segments near [location]" | Popular segments in a bounding box |
"Get details on segment 12345" | Location, distance, grade, elevation, effort counts |
"Star this segment" | Save to favorites |
"Show my efforts on [segment]" | Your attempts with time, distance, PR/KOM rank |
"Show the leaderboard for segment 12345" | Top times with optional filters |
Clubs
What you can ask | What it does |
"What clubs am I in?" | Lists your Strava clubs |
Troubleshooting
Token errors after restart
This fork saves refreshed tokens to ~/.config/strava-mcp/config.json and prefers them over env var tokens on restart. If you're still seeing auth errors, delete the config file and re-authenticate:
rm ~/.config/strava-mcp/config.jsonThen say "Connect my Strava account".
First npx run is slow
npx downloads the package on first run (~30 seconds). Subsequent runs use the cache and start immediately.
Claude doesn't see the Strava tools
Make sure your
claude_desktop_config.jsonis valid JSON (no trailing commas!)Restart Claude Desktop after config changes
Verify with:
npx -y @stugal/strava-mcp-serverβ you should see the server start message
"Scope not found" or similar npm errors
Make sure you're using @stugal/strava-mcp-server, not the original @r-huijts/strava-mcp-server.
For Developers
Environment Variables
Variable | Description |
| Your Strava Application Client ID |
| Your Strava Application Client Secret |
| OAuth access token |
| OAuth refresh token |
Token Refresh Flow
getValidToken()is called at the start of every tool executionIf
expiresAtis known and within 5 minutes, token is proactively refreshedIf no token exists but refresh token does, refresh is attempted automatically
Any
401response from the API triggershandleApiError()β silent refresh β retryRefreshed tokens are saved to both
process.envand~/.config/strava-mcp/config.jsonOn next server start,
loadConfig()prefers the saved file token if it's still valid
Config Priority
~/.config/strava-mcp/config.jsonβ if token is valid (not expired) β new behaviorEnvironment variables
Local
.envfile
Building & Testing
npm install
npm run build
npm testActivity Streams Optimization
The get-activity-streams tool uses a compact format by default, reducing payload size by ~70-80%:
Compact format (default): Raw arrays with metadata, ideal for LLM processing
Verbose format: Human-readable objects with formatted values
Smart chunking: Large activities split into ~50KB chunks
Intelligent downsampling: Reduces large datasets while preserving peaks and valleys
API Reference
The server implements the Model Context Protocol (MCP) and exposes 26 tools for Strava API v3. See src/tools/ for implementation details.
Contributing
Contributions welcome! Please submit a Pull Request to samitugal/strava-mcp.
Credits
This project is a fork of r-huijts/strava-mcp by Rick Huijts. The original project provides the solid MCP foundation and Strava API integration that this fork builds on.
License
MIT License - see LICENSE file for details.
Questions or issues? Open an issue on GitHub.
Available Tools
27 toolscheck-strava-connectionA
Check if Strava is connected and show the current connection status. Use this when the user asks about their connection status.
Inputs: no named parameters.
connect-stravaA
Connect your Strava account to enable activity tracking. This will open a browser window for secure authentication. Use this when the user asks to connect, link, or authenticate their Strava account.
Inputs: force.
disconnect-stravaA
Disconnect your Strava account and remove stored credentials. Use this when the user wants to logout, disconnect, or remove their Strava connection.
Inputs: no named parameters.
explore-segmentsA
Returns popular segments within a bounding box (south_west_lat,south_west_lng,north_east_lat,north_east_lng), optionally filtered by activity type (running/riding) and climb category.
Inputs: bounds (required), maxCat, minCat, activityType.
export-route-gpxA
Exports a specific Strava route in GPX format and saves it to a pre-configured local directory.
Inputs: routeId (required).
export-route-tcxA
Exports a specific Strava route in TCX format and saves it to a pre-configured local directory.
Inputs: routeId (required).
find-nearby-routesA
Returns the athlete's saved routes that start within a given distance of a location. Use when the user asks for routes near a place, nearby routes, or routes in a specific area. Provide latitude and longitude of the target location and a max distance in km.
Inputs: latitude (required), longitude (required), activityType, maxDistanceKm.
get-activity-detailsB
Returns detailed metrics for an activity β distance, time, elevation, pace, heart rate, cadence, power, and effort scores.
Inputs: activityId (required).
get-activity-lapsA
Returns per-lap metrics (time, distance, speed, heart rate, cadence, power) for a specific activity.
Inputs: activityId (required).
get-activity-photosA
Retrieves photos associated with a specific Strava activity.
Use Cases:
Fetch all photos uploaded to an activity
Get photo URLs for display or download
Access photo metadata including location and timestamps
Parameters:
id (required): The unique identifier of the Strava activity.
size (optional): Size of photos to return in pixels (e.g., 100, 600, 2048). If not specified, returns all available sizes.
Output Format: Returns both a human-readable summary and complete JSON data for each photo, including:
A text summary with photo count and URLs
Raw photo data containing all fields from the Strava API:
Photo ID and unique identifier
URLs for different sizes
Source (1 = Strava, 2 = Instagram)
Timestamps (uploaded_at, created_at)
Location coordinates if available
Caption if provided
Notes:
Requires activity:read scope for public/followers activities, activity:read_all for private activities
Photos may come from Strava uploads or linked Instagram posts
Returns empty array if activity has no photos
Inputs: id (required), size.
get-activity-streamsA
Returns time-series data streams (heart rate, power, GPS, pace, elevation) for an activity at configurable resolution, with pagination and intelligent downsampling for large datasets.
Inputs: activityId (required), page, types, format, +5 more.
get-all-activitiesA
Fetches activity history with optional filtering by date range and activity type. Set summaryMode=true to get aggregated statistics (totals, averages, bests, monthly/weekly breakdowns) instead of a list.
Inputs: endDate, perPage, startDate, sportTypes, +4 more.
get-athlete-profileA
Fetches the profile information for the authenticated athlete, including their unique numeric ID needed for other tools like get-athlete-stats.
Inputs: no named parameters.
get-athlete-shoesA
Fetches the authenticated athlete's shoes from Strava, including usage distance and primary flag.
Inputs: no named parameters.
get-athlete-statsA
Returns recent, year-to-date, and all-time activity totals (distance, elevation, time) for rides, runs, and swims for a given athlete.
Inputs: athleteId (required).
get-athlete-zonesA
Retrieves the authenticated athlete's configured heart rate and power zones.
Output includes both a formatted summary and the raw JSON data.
Inputs: no named parameters.
get-recent-activitiesA
Fetches the most recent activities for the authenticated athlete.
Inputs: perPage.
get-routeA
Fetches detailed information about a specific route using its ID.
Inputs: routeId (required).
get-segmentA
Returns detailed information about a segment β location, distance, grade, elevation, and effort/athlete counts.
Inputs: segmentId (required).
get-segment-effortA
Returns timing, power, and heart rate data for a specific segment effort.
Inputs: effortId (required).
get-segment-leaderboardA
Retrieves the leaderboard for a specific Strava segment. Shows top performances with times, power, and heart rate data. Supports filtering by gender, age group, weight class, club, date range, and followed athletes.
Use this to:
See top performances on a segment
Compare your efforts against others
Filter by demographics or time period
Check if you have a chance at a top position
Inputs: segmentId (required), page, gender, club_id, +5 more.
get-server-versionA
Returns the Strava MCP server version and related metadata.
Inputs: no named parameters.
list-athlete-clubsA
Lists the clubs the authenticated athlete is a member of.
Inputs: no named parameters.
list-athlete-routesA
Lists the routes created by the authenticated athlete, with pagination.
Inputs: page, perPage.
list-segment-effortsA
Returns the authenticated athlete's efforts on a segment, including time, distance, and PR/KOM rank, with optional date range filtering.
Inputs: segmentId (required), perPage, endDateLocal, startDateLocal.
list-starred-segmentsA
Lists the segments starred by the authenticated athlete.
Inputs: no named parameters.
star-segmentA
Stars or unstars a specific segment for the authenticated athlete.
Inputs: starred (required), segmentId (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 27 tools
Most tools target distinct resources and actions (e.g., activities vs. segments vs. routes), but a few pairs like get-recent-activities and get-all-activities could confuse agents without careful description reading. Overall, boundaries are clear enough for correct tool selection.
All tool names follow a consistent lowercase-with-hyphens verb-noun pattern (e.g., get-activity-details, list-athlete-routes, star-segment). Verbs vary appropriately by action, but no naming style conflicts or unpredictable formats exist.
27 tools is on the heavy side for an agent to choose from, slightly exceeding the 25-tool boundary where sets become overwhelming. However, the breadth of Strava's API justifies the count, making it borderline but not unreasonable.
The tool set covers major Strava workflows: activities, segments, routes, athlete profile, clubs, and connection management. Minor gaps exist (no activity upload, no club details, no activity edit), but these are non-core for typical use cases.
Maintenance
Related MCP Connectors
Connect Claude to your Intervals.icu watch data for fitness, workout review, and plan writing.
Connect Intervals.icu to Claude and ChatGPT: read training, plan workouts. Training never stored.
Garmin data in Claude & ChatGPT via the Garmin Health API. OAuth sign-in, no password sharing.
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).
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables Claude to access and analyze your Strava activities through OAuth authentication. Supports retrieving activity lists and detailed workout data for fitness tracking and analysis.2-
- 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.8125 npmISC
- AlicenseAqualityDmaintenanceConnects Claude to your Strava account for analyzing training, predicting race times, and generating periodized training plans via natural language.13125 npmISC
- AlicenseNot gradedqualityCmaintenanceConnects Claude to Strava data for natural language queries about rides, stats, and activities.8 npmMIT