mcp-server-strava
Strava API と Model Context Protocol (MCP) SDK の統合
Model Context Protocol SDK を使用して、Strava データに基づくトレーニング分析と推奨事項を統合します。
🚀 機能
Stravaからのワークアウトの分析
トレーニングの推奨事項
自動トークン更新
APIリクエストのレート制限
Related MCP server: Strava MCP Server
📋 要件
⚙️ インストール
# Клонируем репозиторий
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]"MCP SDKのインストール
uv add "mcp[cli]"🔧 設定
Strava APIの設定
API設定ページへ移動
アプリケーションを作成します。
アプリケーション名: MCP Strava 統合
カテゴリー: トレーニング分析
ウェブサイト: http://localhost
承認コールバックドメイン: localhost
環境の設定
環境変数を含むファイルを作成します。
cp .env-template .envアクセス トークンを取得します。
python scripts/auth.py設定を確認してください:
mcp dev src/server.py curl -X GET "http://localhost:8000/activities"
📚 APIと例
リソースとツール
タイプ | 名前 | 説明 |
リソース |
| 活動リスト |
リソース |
| アクティビティの詳細 |
リソース |
| トレーニングゾーン |
リソース |
| アスリートクラブ |
リソース |
| 機器情報 |
道具 |
| トレーニング分析 |
道具 |
| 負荷解析 |
道具 |
| 推奨事項 |
使用例
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}
]
}
}
"""🛠 開発
CI/CDとセキュリティ
GitHub Actionsでのチェック
タイプ | 道具 | 説明 |
リンティング | ラフ | コードのフォーマットと分析 |
テスト | pytest | ユニットテストと統合テスト |
コーティング | pytest-cov | コードカバレッジレポート |
セキュリティと秘密
トークン保護:
.envから.gitignoreへCI/CD のための GitHub Secrets
レート制限: 100 リクエスト/15 分
シークレットの設定:
# В GitHub: Settings → Secrets → Actions STRAVA_CLIENT_ID=<client_id> STRAVA_CLIENT_SECRET=<client_secret> STRAVA_REFRESH_TOKEN=<refresh_token>
貢献
リポジトリをフォークする
依存関係をインストールします:
uv pip install -e ".[dev]"ブランチを作成する:
git checkout -b feature/name変更を確認します。
ruff format . ruff check . pytest --cov=srcプルリクエストを作成する
📫 サポート
📄 ライセンス
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