A Model Context Protocol (MCP) server for the Strava API. Provides Claude with tools to fetch and analyze your Strava activities, athlete stats, and gear.
- Automatic OAuth flow - Opens browser for authorization on first run
- Token management - Auto-refreshes access tokens, stores securely in XDG directories
- Smart caching - Caches athlete profile and gear data to reduce API calls
- Comprehensive tools - Access activities, streams, photos, stats, and gear
- Python 3.13+
- Strava API credentials (client ID and secret)
uvpackage manager
- Go to https://www.strava.com/settings/api
- Create an application
- Note your Client ID and Client Secret
- Set Authorization Callback Domain to
localhost
cd strava-mcp
uv syncCreate ~/.config/strava/credentials.sh:
mkdir -p ~/.config/strava
cat > ~/.config/strava/credentials.sh << 'EOF'
export STRAVA_CLIENT_ID=YOUR_CLIENT_ID
export STRAVA_CLIENT_SECRET=YOUR_CLIENT_SECRET
EOFReplace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with your actual credentials.
source ~/.config/strava/credentials.sh
uv run python -m strava_mcpOn first run, this will:
- Open your browser to Strava's authorization page
- Wait for you to approve access
- Store tokens in
~/.local/share/strava-mcp/tokens.json - Start the MCP server
In your Claude Code project, create or update .mcp.json:
{
"strava": {
"command": "bash",
"args": [
"-c",
"source ~/.config/strava/credentials.sh && cd /absolute/path/to/strava-mcp && uv run python -m strava_mcp"
]
}
}Update /absolute/path/to/strava-mcp to the actual path.
Fetch recent activities with pagination.
- Args:
per_page(default 30),page(default 1) - Returns: List of activity summaries
Get detailed information for a single activity.
- Args:
activity_id - Returns: Full activity details including segments and splits
Get time-series data (HR, power, cadence, temperature, etc.)
- Args:
activity_id,keys(comma-separated stream types) - Returns: Stream data arrays
Get your athlete profile (cached for 1 day).
- Args:
refresh(bool, force cache refresh) - Returns: Athlete profile with ID, name, weight, etc.
Get yearly and all-time statistics.
- Returns: Total distance, elevation, time for recent/ytd/all-time
Get photos attached to an activity.
- Args:
activity_id,size(pixels, default 600) - Returns: List of photo data
Get your bikes and shoes (cached for 1 week).
- Args:
refresh(bool, force cache refresh) - Returns: Dict with 'bikes' and 'shoes' lists
Force a new OAuth flow (useful if scopes change).
- Returns: Success message
All data is stored in XDG-compliant directories:
- Tokens:
~/.local/share/strava-mcp/tokens.json - Athlete cache:
~/.local/share/strava-mcp/athlete.json - Gear cache:
~/.local/share/strava-mcp/gear.json
Strava API limits:
- 200 requests per 15 minutes
- 2000 requests per day
This server caches data where appropriate to minimize API calls.
- Check that your client ID and secret are correct
- Ensure callback domain is set to
localhostin Strava API settings
- Run
reauthorizetool to trigger a fresh OAuth flow - Or manually delete
~/.local/share/strava-mcp/tokens.json
- Wait for the time specified in error message
- Consider using cached tools (
get_athlete,get_gear) instead of fresh requests
Run tests:
uv run pytestFormat code:
uv run ruff format .MIT