A Model Context Protocol (MCP) server that connects to the Strava API, allowing AI agents to retrieve athlete stats, list activities, and get detailed activity information.
- Python 3.10+
- uv (installed and available in your PATH)
- Strava Account
- Strava API Application (to get Client ID and Secret)
- Go to Strava API Settings.
- Create an application if you haven't already.
- Note your
Client IDandClient Secret. - You need a Refresh Token.
- The easiest way to get one for your own account is to use the Strava OAuth playground or follow the Strava authentication docs to authorize your app and get the initial refresh token.
- Scope required:
activity:read_all,read_all(adjust based on needs).
Clone this repository and enter the directory.
Using uv (Recommended):
uv sync
source .venv/bin/activateUsing standard pip:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install .- Copy
.env.exampleto.env. - Fill in your credentials.
cp .env.example .env
# Edit .env with your favorite editorRun the server using fastmcp:
fastmcp run server.pyOr run it directly with uv:
uv run server.pyget_athlete_stats: Get statistics for the authenticated athlete.list_activities: List recent activities (default limit: 5).get_activity_details: Get detailed information for a specific activity ID.get_activity_laps: Get lap breakdowns for an activity (lap splits with metrics like pace, HR, power).get_activity_streams: Get raw stream data (GPS, heart rate, power, cadence, etc.) for an activity.search_activities: Search activities with filters (name query, type, date range, distance range).
analyze_data: Execute Python code to analyze Strava data safely using Monty.- Note: This tool allows the agent to write and execute Python code in a secure, sandboxed environment to perform complex calculations on your data (e.g., "calculate average pace for runs over 10km").
To use this server with Claude Desktop securely (keeping your API keys in .env and not in the config file), add the following to your claude_desktop_config.json:
Mac: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
You can use uv directly to run the server:
{
"mcpServers": {
"strava": {
"command": "uv",
"args": [
"run",
"server.py"
],
"cwd": "/absolute/path/to/strava-mcp"
}
}
}Note: Replace /absolute/path/to/strava-mcp with the full absolute path to your project directory. If Claude Desktop fails to start the server, you may need to provide the absolute path to the uv executable (e.g., /Users/yourname/.cargo/bin/uv). Run which uv (macOS/Linux) or where uv (Windows) in your terminal to find it.
To run the test suite:
# Install dev dependencies
uv sync --extra dev
# Run tests
uv run pytest tests- Modify
server.pyto add more tools using thestravalibclient.