Strava integration for MCP
Project description
Strava MCP Server
A Model Context Protocol (MCP) server for interacting with the Strava API. Supports both stdio and streamable-http transports.
User Guide
Installation
You can install Strava MCP with uvx:
uvx strava-mcp
Docker
Build and run the server with Docker (defaults to streamable-http on port 8000):
docker build -t strava-mcp .
docker run -p 8000:8000 \
-e STRAVA_CLIENT_ID=your_client_id \
-e STRAVA_CLIENT_SECRET=your_client_secret \
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 (stdio transport): 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" ] }
-
HTTP transport (e.g. for remote or Docker deployments):
strava-mcp --transport streamable-http --host 0.0.0.0 --port 8000
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
Developer Guide
Project Setup
-
Clone the repository:
git clone git@github.com:piwibardy/strava-mcp-http.git cd strava-mcp-http
-
Install dependencies:
uv sync -
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
Or with HTTP transport:
uv run strava-mcp --transport streamable-http --port 8000
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 implementationmain.py: Main entry point (argparse for transport/host/port)
tests/: Unit testsDockerfile: Multi-stage Docker buildget_token.py: Utility script to get a refresh token manually
Running Tests
pytest
Publishing to PyPI
Building the package
uv build
Publishing to PyPI
# Publish to Test PyPI first
uv publish --index testpypi
# Publish to PyPI
uv publish
License
Acknowledgements
Project details
Release history Release notifications | RSS feed
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_http-0.5.1.tar.gz.
File metadata
- Download URL: strava_mcp_http-0.5.1.tar.gz
- Upload date:
- Size: 140.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da9f6181e3bb360193a93cdf5230f3fc67ce05ea2e5c9b7b3e7ac2293986f6a1
|
|
| MD5 |
b1bb07a1cebe979ec0c6b516912cc4b8
|
|
| BLAKE2b-256 |
ddcdac22b55d178e331650d0094ccce46e821e9141cc48e5821a8ef6f5915cbc
|
File details
Details for the file strava_mcp_http-0.5.1-py3-none-any.whl.
File metadata
- Download URL: strava_mcp_http-0.5.1-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f970a4619d5fbd64d2cd914401f274cf22b3e2131868294664d0261372316fa3
|
|
| MD5 |
1cd0602c43d55e1ac5606c68472ba533
|
|
| BLAKE2b-256 |
cdbc3fa1d5e6c8e9b0694a7508dd07e8bae1f1568818839dc5c5ea2693c6ddbe
|