Strava MCP Server
A Strava MCP server with local caching for improved performance and rate limit management.
Prerequisites
Installation
git clone https://github.com/lyledean1/strava-mcp
cd strava-mcp
make build
Claude Code Configuration
Add to your Claude Code MCP configuration:
{
"mcpServers": {
"strava": {
"command": "{pathToClonedRepo}/bin/strava-mcp",
"args": [],
"env": {
"STRAVA_CLIENT_SECRET": "{clientSecret}",
"STRAVA_CLIENT_ID": "{clientID}",
"FOLDER_PATH": "{pathToClonedRepo}"
}
}
}
}
Replace {pathToClonedRepo}
, {clientSecret}
, and {clientID}
with your actual values.
Strava Oauth CLI Tool
A command-line tool for authenticating with the Strava API using OAuth 2.0. This tool guides you through the OAuth flow and saves your access tokens for future API calls.
Prerequisites
Before you can use this tool, you need to create a Strava application to get your Client ID and Client Secret.
Creating a Strava Application
-
Go to Strava Developers: Visit https://www.strava.com/settings/api
-
Create Your Application:
- Click "Create & Manage Your App"
- Fill in the application details:
- Application Name: Choose any name (e.g., "My Strava CLI Tool")
- Category: Choose the most appropriate category
- Club: Leave blank unless you're creating for a specific club
- Website: You can use
http://localhost
for testing - Authorization Callback Domain: Set this to
localhost
- Agree to the API Agreement
- Click "Create"
-
Get Your Credentials:
- After creation, you'll see your application details
- Note down your Client ID (publicly visible)
- Click "Show" next to Client Secret and note it down (keep this private!)
Installation
Step 1: Run the Tool
Clone or create the project:
git clone https://github.com/lyledean1/strava-mcp
go run tools/main.go
The tool will display:
🚴 Strava OAuth CLI Tool
========================
Step 2: Enter Your Credentials
When prompted, enter your Strava application credentials:
Enter your Strava Client ID: [YOUR_CLIENT_ID]
Enter your Strava Client Secret: [YOUR_CLIENT_SECRET]
Step 3: Authorize the Application
The tool will generate an authorization URL:
📋 Step 1: Authorization
Click the following URL to authorize the application:
🔗 https://www.strava.com/oauth/authorize?client_id=...
- Click the URL or copy-paste it into your browser
- Login to Strava if you're not already logged in
- Review the permissions the app is requesting:
- Read your profile information
- Read all your activities
- Click "Authorize" to grant permissions
Step 4: Get the Authorization Code
After clicking "Authorize":
- You'll be redirected to
http://localhost/exchange_token?code=...
- The page will show an error - this is normal! The important part is the URL
- Copy the code parameter from the URL
Example URL:
http://localhost/exchange_token?code=abc123def456ghi789
Copy: abc123def456ghi789
Step 5: Complete Authentication
Paste the authorization code when prompted:
📥 Enter the authorization code from the URL: abc123def456ghi789
Step 6: Success!
The tool will exchange your code for tokens and display:
✅ Success! Here are your tokens:
===============================
🔑 Access Token: your_access_token_here
🔄 Refresh Token: your_refresh_token_here
⏰ Expires At: 1234567890
👤 Athlete: John Doe (johndoe)
💾 Save these tokens securely - you'll need them to make API calls!
The tokens are also automatically saved to refresh_token.json
in the current directory.
What You Get
After successful authentication, you'll receive:
- Access Token: Use this to make API calls (expires in ~6 hours)
- Refresh Token: Use this to get new access tokens when they expire
- Expires At: Unix timestamp when the access token expires
- Athlete Info: Basic information about the authenticated user
Permissions (Scopes)
This tool requests the following permissions:
read
: Access to read your profile informationactivity:read_all
: Access to read all your activities (public and private)
Security Notes
- Keep your Client Secret private - never share it or commit it to version control
- Store your tokens securely - they provide access to your Strava data
- Refresh tokens don't expire - treat them like passwords
- Access tokens expire in ~6 hours - use refresh tokens to get new ones
API Documentation
For more information about the Strava API:
- API Reference: https://developers.strava.com/docs/reference/
- Getting Started: https://developers.strava.com/docs/getting-started/
- Rate Limits: https://developers.strava.com/docs/rate-limits/
Strava MCP Server Tools
This MCP server provides tools to interact with your Strava activity data through Claude. All data is cached locally for improved performance and reduced API rate limits.
Available Tools [WIP]
get_activities
Retrieve your Strava activities with optional filtering and date range support.
Parameters:
filter
(optional): Activity type filter (e.g., 'runs', 'rides', 'swims')before
(optional): Return activities before this date (ISO 8601 format)after
(optional): Return activities after this date (ISO 8601 format)
Returns:
- Activity summary with total count and applied filters
- Detailed activity information including:
- Activity name and ID
- Activity type (run, ride, swim, etc.)
- Distance (in kilometers)
- Duration (hours, minutes, seconds)
- Average and max heart rate
- Average and max speed
- Power data (average and weighted average watts)
- Elevation gain
- Start date and location coordinates
Example Usage:
Get all my runs from last month
Get cycling activities after 2024-01-01
Show activities before 2024-06-01T00:00:00Z
get_activity_stream
Get detailed stream data for a specific activity including GPS coordinates, heart rate, power, and other sensor data.
Parameters:
activity_id
(required): The ID of the activity to retrieve stream data for
Returns:
- Activity name and ID
- Number of data points collected
- Available data types (time, power, heart rate, etc.)
- Complete stream data with time-series information
Example Usage:
Get stream data for activity 12345678
Show detailed GPS and heart rate data for my latest run
Data Format
Activities include comprehensive metrics when available:
- Basic Info: Name, type, date
- Performance: Distance, speed, duration
- Health: Heart rate data
- Power: Watts for cycling activities
- Geography: Elevation gain, GPS coordinates
Stream data provides time-series information for detailed analysis and visualization of your workout data.
Notes
- All dates should be in ISO 8601 format (e.g.,
2024-01-15T00:00:00Z
) - Data is automatically cached locally to minimize API calls
- The server respects Strava's rate limits through intelligent caching