
Strava MCP
โ 2from theagilepadawan
Integrate your Strava activity data with AI models using a local SQLite database.
Create Strava MCP
Automated setup tool for integrating Strava data with Claude Desktop via Model Context Protocol (MCP).
What This Tool Does
- Downloads the Strava MCP: Clones the Python repository to your local machine
- Sets up Python Environment: Creates a virtual environment and installs dependencies
- Guides Strava API Setup: Walks you through creating a Strava API application
- Handles Authentication: Manages the OAuth flow to get your tokens
- Data Sync: Downloads your initial Strava activity data to a local SQLite database
- Claude Integration: Automatically updates your Claude Desktop config file
- Optional Restart: Can restart Claude Desktop to activate the MCP immediately
- Ready to Use: After setup, Claude will have access to your Strava data
Maintenance Commands
# Update your Strava data
cd /path/to/strava-mcp
source venv/bin/activate # On Windows: venv\Scripts\activate
python strava-sync.py
# Check MCP status
# (View Claude Desktop logs)Token Security
- Your App Credentials: Keep
Client IDandClient Secretsecure but they can be shared with users - User Tokens: Each user's
Access TokenandRefresh Tokenare personal and should stay private - Local Storage: All tokens are stored locally on the user's machine, never sent to you
Alternative to pipx
If users don't want to install pipx, they can also use:
# Direct pip install and run
pip install create-strava-mcp
python -c "import setup_strava_mcp; setup_strava_mcp.main()"
# Or install and use entry point
pip install create-strava-mcp
create-strava-mcpSupport
If you encounter issues:
- Check the troubleshooting section above
- Check Claude Desktop logs for MCP errors
- Re-run
python strava-sync.pyto refresh data - Create an issue on the GitHub repository
Contributing
Contributions welcome! Please see the main repository for guidelines.
License
MIT License - see LICENSE file for details.
# Install pipx if you don't have it
pip install pipx
# Run the setup tool (installs temporarily and executes)
pipx run create-strava-mcpBefore it works, you'll need: STRAVA_CLIENT_IDSTRAVA_CLIENT_SECRETSTRAVA_REFRESH_TOKENSTRAVA_DB_PATH
Quick Start
The Python equivalent of npx is pipx. Install and run:
# Install pipx if you don't have it
pip install pipx
# Run the setup tool (installs temporarily and executes)
pipx run create-strava-mcpOr install globally:
# Install globally
pipx install create-strava-mcp
# Run anytime
create-strava-mcpOr use pip + python -m:
# Install and run directly
pip install create-strava-mcp
python -m create-strava-mcpStrava API Application Setup
The "One App for Everybody" Approach
You need to create ONE Strava API application that all users will authenticate through:
-
Register Your App (you do this once):
- Go to Strava API Settings
- Click "Create App"
- Fill in the details:
- Application Name: "Strava MCP" (or your preferred name)
- Category: Choose appropriate category
- Website:
http://localhost - Authorization Callback Domain:
localhost
- Click "Create"
-
Share Your App Credentials:
- You'll get a
Client IDandClient Secret - Users will use your
Client IDandClient Secret - Each user gets their own personal
Access TokenandRefresh Token
- You'll get a
-
User Authentication Flow:
- Users run the setup tool with your app credentials
- They authenticate through your Strava app
- They get their own personal tokens
- Their data stays private to them
Authentication Flow Details
Your Strava App (Client ID + Secret)
โ
User runs setup tool โ Browser opens โ User logs into Strava
โ
User authorizes YOUR app โ Gets personal tokens โ Stored locally
โ
MCP uses user's personal tokens โ Accesses only their dataManual Installation
If you prefer manual setup:
# Clone your Strava MCP repository
git clone https://github.com/your-username/strava-mcp.git
cd strava-mcp
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Set up environment
cp .env.example .env
# Edit .env with your Strava app credentials
# Run authentication and initial sync
python strava-sync.py
# Add to Claude config manually (see Configuration section)Configuration
The tool automatically updates your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%/Claude/claude_desktop_config.json - Linux:
~/.config/claude/claude_desktop_config.json
Example configuration:
{
"mcpServers": {
"strava-mcp": {
"command": "python",
"args": ["/path/to/strava-mcp/strava-mcp.py"],
"env": {
"STRAVA_CLIENT_ID": "your_client_id",
"STRAVA_CLIENT_SECRET": "your_client_secret",
"STRAVA_REFRESH_TOKEN": "users_personal_refresh_token",
"STRAVA_DB_PATH": "/path/to/strava_data.db"
}
}
}
}For Developers: Publishing Your Setup Tool
1. Package Structure
create-strava-mcp/
โโโ setup_strava_mcp.py # Main setup script
โโโ pyproject.toml # Modern Python packaging
โโโ setup.py # Alternative setup file
โโโ README.md # This file
โโโ requirements.txt # Dependencies (none for setup tool)2. Update Configuration
In setup_strava_mcp.py, update:
# Replace with your actual Strava MCP repository
repo_url = "https://github.com/your-username/strava-mcp.git"3. Publish to PyPI
# Build the package
python -m pip install build
python -m build
# Upload to PyPI
python -m pip install twine
python -m twine upload dist/*4. Test Installation
# Test with pipx
pipx run create-strava-mcp
# Or test with pip
pip install create-strava-mcp
create-strava-mcpUsage After Setup
Once set up, you can ask Claude questions about your Strava data:
- "Show me my recent running activities"
- "What's my average pace this month?"
- "Compare my performance to last year"
- "Generate a training summary"
- "Which bike have I used the most this year?"
Uninstalling
To remove the Strava MCP:
- Delete the installation directory (shown during setup)
- Remove the "strava-mcp" entry from your Claude Desktop config file
- Restart Claude Desktop
Troubleshooting
Setup Issues
- Python not found: Install Python 3.8+ from python.org
- Git not found: Install Git from git-scm.com
- Permission errors: Run with appropriate permissions or choose a different install directory
- Virtual environment issues: Ensure you have
venvmodule:python -m pip install virtualenv
Strava API Issues
- Invalid credentials: Double-check your Client ID and Client Secret from Strava
- Authorization failed: Ensure your Strava app has the correct callback domain (
localhost) - Token expired: The MCP automatically refreshes tokens, but you can manually re-run
strava-sync.py - Rate limiting: Strava has API limits; wait a few minutes if you hit them
Claude Integration Issues
- MCP not appearing: Restart Claude Desktop completely
- Connection errors: Check that file paths in the config are correct
- Python not found: Ensure the Python path in Claude config points to your virtual environment
- Data not loading: Run
python strava-sync.pyin the MCP directory