Strava integration for MCP
Project description
Strava MCP Server
A Model Context Protocol (MCP) server for interacting with the Strava API.
User Guide
Installation
You can easily install Strava MCP with uvx:
uvx strava-mcp
Setting Up Strava Credentials
-
Create a Strava API Application:
- Go to https://www.strava.com/settings/api
- Create a new application to obtain your Client ID and Client Secret
- For "Authorization Callback Domain", enter
localhost
-
Configure Your Credentials: Create a credentials file (e.g.,
~/.ssh/strava.sh):export STRAVA_CLIENT_ID=your_client_id export STRAVA_CLIENT_SECRET=your_client_secret
-
Configure Claude Desktop: Add the following to your Claude configuration (
/Users/<username>/Library/Application Support/Claude/claude_desktop_config.json):"strava": { "command": "bash", "args": [ "-c", "source ~/.ssh/strava.sh && uvx strava-mcp" ] }
Authentication
The first time you use the Strava MCP tools:
- An authentication flow will automatically start
- Your browser will open to the Strava authorization page
- After authorizing, you'll be redirected back to a local page
- Your refresh token will be saved automatically for future use
Available Tools
Get User Activities
Retrieves activities for the authenticated user.
Parameters:
before(optional): Epoch timestamp for filteringafter(optional): Epoch timestamp for filteringpage(optional): Page number (default: 1)per_page(optional): Number of items per page (default: 30)
Get Activity
Gets detailed information about a specific activity.
Parameters:
activity_id: The ID of the activityinclude_all_efforts(optional): Include segment efforts (default: false)
Get Activity Segments
Retrieves segments from a specific activity.
Parameters:
activity_id: The ID of the activity
Get Segment Leaderboard
Gets the leaderboard for a specific segment.
Parameters:
segment_id: The ID of the segment- Various optional filters (gender, age group, etc.)
Developer Guide
Project Setup
-
Clone the repository:
git clone <repository-url> cd strava
-
Install dependencies:
uv install -
Set up environment variables:
export STRAVA_CLIENT_ID=your_client_id export STRAVA_CLIENT_SECRET=your_client_secret
Alternatively, create a
.envfile with these variables.
Running in Development Mode
Run the server with MCP CLI:
mcp dev strava_mcp/main.py
Manual Authentication
You can get a refresh token manually by running:
python get_token.py
Project Structure
strava_mcp/: Main package directory__init__.py: Package initializationconfig.py: Configuration settings using pydantic-settingsmodels.py: Pydantic models for Strava API entitiesapi.py: Low-level API client for Stravaauth.py: Strava OAuth authentication implementationoauth_server.py: Standalone OAuth server implementationservice.py: Service layer for business logicserver.py: MCP server implementation
tests/: Unit testsstrava_mcp/main.py: Main entry point to run the serverget_token.py: Utility script to get a refresh token manually
Running Tests
pytest
Publishing to PyPI
Building the package
# Build both sdist and wheel
uv build
Publishing to PyPI
# Publish to Test PyPI first
uv publish --index testpypi
# Publish to PyPI
uv publish
License
Acknowledgements
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strava_mcp-0.4.0.tar.gz.
File metadata
- Download URL: strava_mcp-0.4.0.tar.gz
- Upload date:
- Size: 120.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0b6543a7c9ec22193bed4dfe03b4a514966de7df5d5ba676a06b9970628cff72
|
|
| MD5 |
97ca2dff606b1371c3c4634e08c9a6a0
|
|
| BLAKE2b-256 |
6f9006151d62b4d705b8baaf8dfd8fc9e85cd78e8fb5a5a65a1140828b11d91f
|
Provenance
The following attestation bundles were made for strava_mcp-0.4.0.tar.gz:
Publisher:
ci.yml on yorrickjansen/strava-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strava_mcp-0.4.0.tar.gz -
Subject digest:
0b6543a7c9ec22193bed4dfe03b4a514966de7df5d5ba676a06b9970628cff72 - Sigstore transparency entry: 187935610
- Sigstore integration time:
-
Permalink:
yorrickjansen/strava-mcp@56547cb69e88037c3d217bdea9f453a93b41c613 -
Branch / Tag:
refs/pull/2/merge - Owner: https://github.com/yorrickjansen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@56547cb69e88037c3d217bdea9f453a93b41c613 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file strava_mcp-0.4.0-py3-none-any.whl.
File metadata
- Download URL: strava_mcp-0.4.0-py3-none-any.whl
- Upload date:
- Size: 16.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4df0672ea1ff734eb662a3cf452677fa846e433b90ed93d5e2c32c37de8c6176
|
|
| MD5 |
6663b2df052ddfc949346eb8c63b13e5
|
|
| BLAKE2b-256 |
edba6834bc6498a0c30ce32627c95c45a1d1b793baa4057e51b01b90113aed1a
|
Provenance
The following attestation bundles were made for strava_mcp-0.4.0-py3-none-any.whl:
Publisher:
ci.yml on yorrickjansen/strava-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
strava_mcp-0.4.0-py3-none-any.whl -
Subject digest:
4df0672ea1ff734eb662a3cf452677fa846e433b90ed93d5e2c32c37de8c6176 - Sigstore transparency entry: 187935614
- Sigstore integration time:
-
Permalink:
yorrickjansen/strava-mcp@56547cb69e88037c3d217bdea9f453a93b41c613 -
Branch / Tag:
refs/pull/2/merge - Owner: https://github.com/yorrickjansen
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yml@56547cb69e88037c3d217bdea9f453a93b41c613 -
Trigger Event:
pull_request
-
Statement type: