mcp-server-strava
Strava API 与模型上下文协议 (MCP) SDK 集成
使用模型上下文协议 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 Integration
类别:训练分析
网站: 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到.gitignoreGitHub 的 CI/CD 秘诀
速率限制: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