Connect LLMs to Strava Data
Access Strava activities, athlete stats, segments, and routes - view heart rate/power data and export routes as GPX/TCX.
Why it matters
Enable Large Language Models to access and analyze your Strava activity data, athlete profiles, segments, and routes. This MCP server facilitates fitness tracking and data-driven insights.
Outcomes
What it gets done
Retrieve recent activities, athlete profiles, and statistics.
Access detailed activity data streams (power, heart rate, cadence).
Manage and explore Strava segments and routes.
Export route data in GPX or TCX formats.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-strava | bash Capabilities
Tools your agent gets
Retrieves recent activities for the authenticated user
Retrieves profile information for the authenticated athlete
Retrieves activity statistics (recent, year-to-date, all-time) for the authenticated athlete
Retrieves detailed information about a specific activity by its ID
Lists the clubs the authenticated athlete is a member of
Lists segments starred by the authenticated athlete
Retrieves detailed information about a specific segment by its ID
Searches for popular segments in a given geographic area (bounding box)
Overview
Strava MCP Server
Strava MCP Server gives Claude access to Strava activities, athlete stats, segments, and routes via Strava API V3, with automatic token refresh and route export to GPX/TCX. Use it for conversational access to Strava fitness data. Requires completing the Strava OAuth setup with the callback domain set to localhost before use.
What it does
Strava MCP Server integrates the Strava API with an LLM, giving it access to recent activities, athlete profile and stats, segments, segment efforts, clubs, and saved routes for fitness data tracking and analysis, using Strava API V3 with automatic token refresh.
When to use - and when NOT to
Use it when you want to ask things like "Show me my recent Strava activities," "What were my last 3 rides?," "Get the heart rate data from my morning run yesterday," or "Show me the power data from my last ride." It also supports exploring and starring segments, listing your segment efforts and clubs, and exporting saved routes to GPX or TCX files on your local filesystem. Do not skip the exact setup sequence - the project specifically requires: install the server, configure it in Claude, complete Strava's OAuth authorization, then restart Claude - and the Strava app's authorization callback domain must be set to localhost.
Capabilities
get-recent-activities,get-activity-details: recent activities and detail for a specific activity (including power/heart rate/cadence streams).get-athlete-profile,get-athlete-stats: profile info and recent/YTD/all-time statistics.list-athlete-clubs: clubs the athlete belongs to.list-starred-segments,get-segment,explore-segments(search by geographic bounding box),star-segment(star/unstar).get-segment-effort,list-segment-efforts(with optional date filtering).list-athlete-routes: list saved routes, with export to GPX/TCX format.
How to install
git clone https://github.com/r-huijts/strava-mcp.git
cd strava-mcp
npm install
npm run build
Configure Claude Desktop:
{
"mcpServers": {
"strava-mcp-local": {
"command": "node",
"args": ["/absolute/path/to/your/strava-mcp/dist/server.js"]
}
}
}
Required: STRAVA_CLIENT_ID, STRAVA_CLIENT_SECRET (from a Strava API application with the authorization callback domain set to localhost). Optional: STRAVA_ACCESS_TOKEN/STRAVA_REFRESH_TOKEN (generated during setup), ROUTE_EXPORT_PATH (where exported route files are saved). Complete Strava's OAuth flow before restarting Claude.
Responses are returned as AI-friendly JSON via MCP rather than raw Strava API payloads, so an LLM can consume activity, segment, and route data directly. The documented setup sequence is exact and ordered - 1) install the server, 2) configure it in Claude, 3) complete the Strava authorization process, 4) restart Claude - and skipping or reordering these steps, or leaving the authorization callback domain unset to localhost, is called out as a likely source of setup failures. Token refresh is handled automatically once the initial OAuth flow completes, so the access and refresh tokens generated during setup don't need manual renewal.
Who it's for
Athletes and fitness enthusiasts who want Claude to pull up their Strava activities, stats, and route/segment data conversationally instead of opening the Strava app.
Source README
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."
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
"What are the most popular cycling segments near Central Park?"
"Show me my starred segments"
"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.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Add this to the file:
{
"mcpServers": {
"strava": {
"command": "npx",
"args": ["-y", "@r-huijts/strava-mcp-server"]
}
}
}
Step 1 (alternative): Add to Claude Code
You can add this MCP server to claude code with the following command:
claude mcp add --transport stdio strava -- npx @r-huijts/strava-mcp-server
You can confirm successful instalation as follows:
% claude mcp list
Checking MCP server health...
strava: npx @r-huijts/strava-mcp-server - β Connected
Step 2: Restart Claude Desktop
Close and reopen Claude Desktop to load the new configuration.
Step 3: Connect Your Strava
Just say to Claude:
"Connect my Strava account"
A browser window will open. Enter your Strava API credentials, authorize the app, and you're done!
That's it! Start asking about your activities.
Connecting Your Strava Account
First Time Setup
When you say "Connect my Strava account", here's what happens:
- A browser window opens showing a setup page
- Enter your Strava API credentials (Client ID and Client Secret)
- Click "Continue to Strava" - you'll be redirected to Strava
- Authorize the app on Strava's website
- See the success message - you can close the browser
- Done! Claude confirms you're connected
Your credentials are saved locally at ~/.config/strava-mcp/config.json and persist across sessions.
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
That's it! You only need to do this once.
Managing Your Connection
- Check status: "Am I connected to Strava?"
- Reconnect: "Connect my Strava account" (use
force: trueto reconnect) - Disconnect: "Disconnect my Strava account"
Installation Options
Option A: Just Use It (Recommended)
No installation needed! The npx command in the Quick Start automatically downloads and runs the latest version.
Option B: Install Globally
If you prefer to install it once:
npm install -g @r-huijts/strava-mcp-server
Then update your Claude config to use:
{
"mcpServers": {
"strava": {
"command": "strava-mcp-server"
}
}
}
Note: Even though the package name is @r-huijts/strava-mcp-server, the executable name remains strava-mcp-server for backward compatibility.
Option C: Build from Source
For developers who want to modify the code:
git clone https://github.com/r-huijts/strava-mcp.git
cd strava-mcp
npm install
npm run build
Then point Claude to your local build:
{
"mcpServers": {
"strava": {
"command": "node",
"args": ["/path/to/strava-mcp/dist/server.js"]
}
}
}
Example Conversations
Morning Check-in
You: What did I do for exercise this week?
Claude: Looking at your Strava activities this week, you completed:
- Monday: 5.2km run (28:15)
- Wednesday: 45km bike ride (1:32:00)
- Saturday: 10km run (52:30)
Total: 60.2km across 3 activities. Nice consistency!
Workout Analysis
You: Analyze my last cycling workout in detail
Claude: Here's a breakdown of your ride "Evening Loop" from yesterday:
Overview
- Distance: 42.3 km
- Time: 1:28:45
- Avg Speed: 28.6 km/h
Power Analysis
- Average Power: 185W
- Normalized Power: 198W
- Max Power: 520W
Heart Rate
- Average: 142 bpm
- Max: 175 bpm
- Time in Zone 4+: 23 minutes
Your power-to-heart-rate ratio suggests good aerobic efficiency...
Finding New Routes
You: Find me some challenging cycling climbs near Boulder, Colorado
Claude: Here are popular climbing segments near Boulder:
- Flagstaff Road - 5.2km, 6.8% avg grade
- Sunshine Canyon - 3.8km, 7.2% avg grade
- Left Hand Canyon - 8.1km, 4.5% avg grade
Want me to star any of these so you can find them easily later?
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 |
| "Disconnect my Strava account" | Unlinks Strava and clears stored tokens |
| "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" | Detailed info about one activity |
| "Show the laps from my last run" | Lap-by-lap breakdown |
| "Get heart rate data from my ride" | Time-series workout data (optimized compact format) |
| "Show photos from my hike" | Activity photos |
Stats & Progress
| What you can ask | What it does |
|---|---|
| "What are my running stats?" | YTD and all-time totals |
| "How far have I cycled this year?" | Activity totals by type |
| "What's my longest ride?" | Personal records |
Segments
| What you can ask | What it does |
|---|---|
| "Show my starred segments" | Your favorite segments |
| "Find segments near [location]" | Discover popular segments |
| "Get details on segment 12345" | Segment info and leaderboard |
| "Star this segment" | Save to favorites |
| "Show my efforts on [segment]" | Your attempts on a segment |
Routes
| What you can ask | What it does |
|---|---|
| "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 |
Clubs
| What you can ask | What it does |
|---|---|
| "What clubs am I in?" | Lists your Strava clubs |
Workouts
| What you can ask | What it does |
|---|---|
| "Turn this workout into a Zwift file" | Formats a workout plan into a structured file (currently Zwift .zwo) |
Server
| What you can ask | What it does |
|---|---|
| "What version is the Strava server?" | Shows the MCP server version and metadata |
Troubleshooting
"Connect my Strava account" doesn't open a browser
- Make sure Claude Desktop is running the MCP server (check for errors in Claude)
- Try restarting Claude Desktop
- Check that port 8111 isn't blocked by a firewall
"Authentication failed" or "Invalid token"
- Your token may have expired - say "Connect my Strava account" to reconnect
- Make sure your Strava API application is still active at strava.com/settings/api
"Missing credentials" error
- You need to complete the OAuth flow - say "Connect my Strava account"
- If you're using environment variables, make sure all 4 are set (see Developer section)
Claude doesn't see the Strava tools
- Make sure your
claude_desktop_config.jsonis valid JSON (no trailing commas!) - Restart Claude Desktop after making config changes
- Check Claude's developer console for error messages
JSONRPC.ProtocolTransportError after package name change
If you're getting a JSONRPC error after updating to @r-huijts/strava-mcp-server:
- Clear npx cache: Run
rm -rf ~/.npm/_npxin terminal - Verify config uses
@r-huijts/strava-mcp-server(not the oldstrava-mcp-server) - Restart Claude Desktop completely (quit and reopen)
- Test manually: Run
npx -y @r-huijts/strava-mcp-server- you should see "Starting Strava MCP Server v1.2.1..."
For Developers
Click to expand technical details
Environment Variables
Instead of using the browser-based auth, you can set environment variables:
| Variable | Description |
|---|---|
STRAVA_CLIENT_ID |
Your Strava Application Client ID |
STRAVA_CLIENT_SECRET |
Your Strava Application Client Secret |
STRAVA_ACCESS_TOKEN |
OAuth access token |
STRAVA_REFRESH_TOKEN |
OAuth refresh token |
ROUTE_EXPORT_PATH |
Directory for GPX/TCX exports |
Token Refresh
The server automatically refreshes expired tokens. New tokens are saved to both process.env and ~/.config/strava-mcp/config.json.
Config Priority
- Environment variables (highest)
~/.config/strava-mcp/config.json- Local
.envfile
Building & Testing
npm install
npm run build
npm test
Activity Streams Optimization
The get-activity-streams tool uses a compact format by default, reducing payload size by ~70-80% while preserving all data:
- Compact format (default): Raw arrays with metadata, ~70-80% smaller, ideal for LLM processing
- Verbose format: Human-readable objects with formatted values (backward compatible)
- Smart chunking: Large activities automatically split into ~50KB chunks
- Optional downsampling: Can reduce very large datasets while preserving key features
The compact format includes comprehensive metadata (units, descriptions, statistics) so LLMs can understand the raw numeric data.
API Reference
The server implements the Model Context Protocol (MCP) and exposes 25 tools for Strava API v3. See the source code in src/tools/ for implementation details.
FAQ
Common questions
Discussion
Questions & comments Β· 0
Sign In Sign in to leave a comment.
