mcp-server-strava
Allows analysis of Strava workouts and provides training recommendations based on Strava data using the Model Context Protocol SDK
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-strava analyze my last 5 running activities and give me training recommendations"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Strava API integration with Model Context Protocol (MCP) SDK
Integration for training analysis and recommendations based on Strava data using the Model Context Protocol SDK.
π Features
Analysis of workouts from Strava
Training Recommendations
Automatic token update
Rate limiting for API requests
Related MCP server: Strava MCP Server
π Requirements
βοΈ Installation
# ΠΠ»ΠΎΠ½ΠΈΡΡΠ΅ΠΌ ΡΠ΅ΠΏΠΎΠ·ΠΈΡΠΎΡΠΈΠΉ
git clone https://github.com/rbctmz/mcp-server-strava.git
cd mcp-server-strava
# Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ° ΡΠ΅ΡΠ΅Π· uv (ΡΠ΅ΠΊΠΎΠΌΠ΅Π½Π΄ΡΠ΅ΡΡΡ)
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install .
# Π£ΡΡΠ°Π½ΠΎΠ²ΠΊΠ° Π² ΡΠ΅ΠΆΠΈΠΌΠ΅ ΡΠ°Π·ΡΠ°Π±ΠΎΡΠΊΠΈ
uv pip install -e ".[dev]"Installing MCP SDK
uv add "mcp[cli]"π§ Setting
Setting up Strava API
Go to the API settings page
Create an application:
Application Name: MCP Strava Integration
Category: Training Analysis
Website: http://localhost
Authorization Callback Domain: localhost
Setting up the environment
Create a file with environment variables:
cp .env-template .envGet access tokens:
python scripts/auth.pyCheck the setting:
mcp dev src/server.py curl -X GET "http://localhost:8000/activities"
π API and examples
Resources and Tools
Type | Name | Description |
Resource |
| List of activities |
Resource |
| Activity details |
Resource |
| Training zones |
Resource |
| Athlete's clubs |
Resource |
| Equipment Information |
Tool |
| Training Analysis |
Tool |
| Load analysis |
Tool |
| Recommendations |
Examples of use
from mcp import ClientSession
# ΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ Π°ΠΊΡΠΈΠ²Π½ΠΎΡΡΠ΅ΠΉ
async with ClientSession() as session:
activities = await session.read_resource("strava://activities")
activity = await session.read_resource("strava://activities/12345678")
# ΠΠ½Π°Π»ΠΈΠ· ΡΡΠ΅Π½ΠΈΡΠΎΠ²ΠΊΠΈ
result = analyze_activity(activity_id="12345678")
"""
{
"type": "Run",
"distance": 5000,
"moving_time": 1800,
"analysis": {
"pace": 5.5, # ΠΌΠΈΠ½/ΠΊΠΌ
"effort": "Π‘ΡΠ΅Π΄Π½ΡΡ"
}
}
"""
# ΠΠ½Π°Π»ΠΈΠ· Π½Π°Π³ΡΡΠ·ΠΊΠΈ
summary = analyze_training_load(activities)
"""
{
"activities_count": 10,
"total_distance": 50.5, # ΠΊΠΌ
"total_time": 5.2, # ΡΠ°ΡΡ
"heart_rate_zones": {
"easy": 4, # Π§Π‘Π‘ < 120
"medium": 4, # Π§Π‘Π‘ 120-150
"hard": 2 # Π§Π‘Π‘ > 150
}
}
"""
# ΠΠΎΠ»ΡΡΠ΅Π½ΠΈΠ΅ ΡΡΠ΅Π½ΠΈΡΠΎΠ²ΠΎΡΠ½ΡΡ
Π·ΠΎΠ½
async with ClientSession() as session:
zones = await session.read_resource("strava://athlete/zones")
"""
{
"heart_rate": {
"custom_zones": true,
"zones": [
{"min": 0, "max": 120, "name": "Z1 - Recovery"},
{"min": 120, "max": 150, "name": "Z2 - Endurance"},
{"min": 150, "max": 170, "name": "Z3 - Tempo"},
{"min": 170, "max": 185, "name": "Z4 - Threshold"},
{"min": 185, "max": -1, "name": "Z5 - Anaerobic"}
]
},
"power": {
"zones": [
{"min": 0, "max": 180},
{"min": 181, "max": 250},
{"min": 251, "max": 300},
{"min": 301, "max": 350},
{"min": 351, "max": -1}
]
}
}
"""π Development
CI/CD and Security
Checks in GitHub Actions
Type | Tool | Description |
Linting | ruff | Code formatting and analysis |
Tests | pytest | Unit and integration tests |
Coating | pytest-cov | Code Coverage Report |
Security and Secrets
Token protection:
.envto.gitignoreGitHub Secrets for CI/CD
Rate limiting: 100 requests/15 min
Setting up secrets:
# Π GitHub: Settings β Secrets β Actions STRAVA_CLIENT_ID=<client_id> STRAVA_CLIENT_SECRET=<client_secret> STRAVA_REFRESH_TOKEN=<refresh_token>
Contributing
Fork the repository
Install dependencies:
uv pip install -e ".[dev]"Create a branch:
git checkout -b feature/nameCheck the changes:
ruff format . ruff check . pytest --cov=srcCreate a Pull Request
π« Support
GitHub Issues: create issue
π License
Available Tools
4 toolsanalyze_activityC
ΠΠ½Π°Π»ΠΈΠ· Π°ΠΊΡΠΈΠ²Π½ΠΎΡΡΠΈ ΠΈΠ· Strava
Args:
activity_id: ID Π°ΠΊΡΠΈΠ²Π½ΠΎΡΡΠΈ (ΡΡΡΠΎΠΊΠ° ΠΈΠ»ΠΈ ΡΠΈΡΠ»ΠΎ)
Returns:
dict: Π Π΅Π·ΡΠ»ΡΡΠ°ΡΡ Π°Π½Π°Π»ΠΈΠ·Π° Π°ΠΊΡΠΈΠ²Π½ΠΎΡΡΠΈ
Inputs: activity_id (required).
analyze_training_loadD
ΠΠ½Π°Π»ΠΈΠ· ΡΡΠ΅Π½ΠΈΡΠΎΠ²ΠΎΡΠ½ΠΎΠΉ Π½Π°Π³ΡΡΠ·ΠΊΠΈ
Inputs: activities (required).
get_activity_by_idC
Get activity details from Strava
Args:
activity_id (Union[str, int]): Activity ID to fetch
Returns:
Dict: Activity details including type, distance, time and other metrics
Inputs: activity_id (required).
get_activity_recommendationsB
ΠΠΎΠ»ΡΡΠΈΡΡ ΡΠ΅ΠΊΠΎΠΌΠ΅Π½Π΄Π°ΡΠΈΠΈ ΠΏΠΎ ΡΡΠ΅Π½ΠΈΡΠΎΠ²ΠΊΠ°ΠΌ Π½Π° ΠΎΡΠ½ΠΎΠ²Π΅ Π°Π½Π°Π»ΠΈΠ·Π° ΠΏΠΎΡΠ»Π΅Π΄Π½ΠΈΡ Π°ΠΊΡΠΈΠ²Π½ΠΎΡΡΠ΅ΠΉ
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 4 tools
There is significant overlap between analyze_activity and get_activity_by_id, as both appear to retrieve and process activity data based on activity_id, making them easily confused. analyze_training_load and get_activity_recommendations are more distinct but still related to activity analysis, creating some ambiguity in the set.
The naming is mixed with both English and Russian terms (e.g., analyze_activity vs. analyze_training_load in English, but get_activity_recommendations in Russian description), and the verb patterns vary (analyze_ vs. get_). While readable, this inconsistency reduces predictability and coherence.
With 4 tools, the count is borderline thin for a Strava server, as it might lack broader functionality like user management, activity creation, or social features. However, it covers core analysis aspects, so it's not severely mismatched but feels slightly under-scoped.
The tool set is focused on activity analysis and recommendations, but there are significant gaps: no CRUD operations for activities (e.g., create, update, delete), no user profile or authentication tools, and no social or leaderboard features typical of Strava's domain. This will likely cause agent failures for common workflows.
Maintenance
Related MCP Connectors
Strava MCP tools for AI: athletes, activities, segments, clubs, routes. Powered by HAPI MCP server.
Ask your AI about your fitness: activities and data from Garmin, COROS, Strava, GPX and more
An athlete's training, recovery and plan data from Dravr, read with their consent.
Training calendar, workouts and health data from Garmin, Wahoo, Polar, Apple Health and more
Related MCP Servers
- AlicenseBqualityDmaintenanceA Model Context Protocol server that provides language models with access to Strava API data, allowing them to query and analyze athlete activities from Strava.425MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables language models to interact with Strava data, including activities, athlete statistics, routes, achievements, and social features.6MIT
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables users to access Strava fitness data, including user activities, activity details, segments, and leaderboards through a structured API interface.34MIT
- AlicenseBqualityBmaintenancePrivacy-first MCP server for Strava activities, streams, routes and training data.29235 npm3MIT