Navigation
Strava-MCP SDK Integration: Smarter Analytics & Dev Workflows - MCP Implementation

Strava-MCP SDK Integration: Smarter Analytics & Dev Workflows

Seamlessly merge Strava's fitness data with MCP SDK's contextual intelligence—supercharge athlete analytics and developer workflows in one intuitive package." )

Research And Data
4.8(29 reviews)
43 saves
20 comments

Ranked in the top 6% of all AI tools in its category

About Strava-MCP SDK Integration

What is Strava-MCP SDK Integration: Smarter Analytics & Dev Workflows?

This integration combines Strava's fitness data with the MCP SDK to provide advanced analytics and streamlined development workflows. It enables developers to access athlete performance metrics, automate workflows through API integrations, and enhance application functionality with real-time fitness insights. The solution includes security features for token management and rate limiting to ensure reliable data handling.

How to use Strava-MCP SDK Integration: Smarter Analytics & Dev Workflows?

  1. Configure OAuth2 credentials in your Strava developer dashboard
  2. Install dependencies via uv pip install -e "[dev]"
  3. Initialize the SDK with client credentials and environment variables
  4. Leverage pre-built functions for data aggregation and analysis
  5. Implement CI/CD pipelines using GitHub Actions templates

Strava-MCP SDK Integration Features

Key Features of Strava-MCP SDK Integration

  • Automated token refresh mechanisms
  • Multi-layered rate limiting (100 requests/15min)
  • Comprehensive testing framework with 72% coverage
  • Pre-configured error handling for API exceptions
  • Secure secret management via GitHub Actions
  • Integrated athlete zone analysis (HR/power zones)

Use Cases of Strava-MCP SDK Integration

Performance Analysis

Aggregate workout data to identify training patterns and performance trends

Automated Reporting

Generate weekly athlete progress reports using standardized templates

Integration Middleware

Create fitness dashboards by combining Strava data with third-party APIs

Error Monitoring

Automatically detect and log API failures using built-in logging framework

Strava-MCP SDK Integration FAQ

FAQ

Is this compatible with legacy Strava API versions?

No, requires v3+ API endpoints for proper functionality

How are user privacy concerns addressed?

Data access strictly follows OAuth2 scopes and GDPR compliance

Can I customize the analytics models?

Yes, through the /extensions API endpoints

What happens during API rate limits?

Automatic exponential backoff with retry logic up to 5 attempts

Content

Интеграция Strava API с Model Context Protocol (MCP) SDK

CI Codecov Python License: MIT Ruff

Интеграция для анализа тренировок и получения рекомендаций на основе данных Strava с использованием Model Context Protocol SDK.

🚀 Возможности

  • Анализ тренировок из Strava
  • Рекомендации по тренировкам
  • Автоматическое обновление токенов
  • Rate limiting для API запросов

📋 Требования

⚙️ Установка

# Клонируем репозиторий
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

  1. Перейдите на страницу настроек API
  2. Создайте приложение:
    * Application Name: MCP Strava Integration
    * Category: Training Analysis
    * Website: http://localhost
    * Authorization Callback Domain: localhost

Настройка окружения

  1. Создайте файл с переменными окружения:

    cp .env-template .env

  2. Получите токены доступа:

    python scripts/auth.py

  3. Проверьте настройку:

    mcp dev src/server.py

curl -X GET "http://localhost:8000/activities"

📚 API и примеры

Ресурсы и инструменты

Тип Название Описание
Ресурс strava://activities Список активностей
Ресурс strava://activities/{id} Детали активности
Ресурс strava://athlete/zones Тренировочные зоны
Ресурс strava://athlete/clubs Клубы атлета
Ресурс strava://gear/{gear_id} Информация о снаряжении
Инструмент analyze_activity(activity_id) Анализ тренировки
Инструмент analyze_training_load(activities) Анализ нагрузки
Инструмент get_activity_recommendations() Рекомендации

Примеры использования

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 и безопасность

  • Coverage
  • Tests
  • Ruff

Проверки в GitHub Actions

Тип Инструмент Описание
Линтинг ruff Форматирование и анализ кода
Тесты pytest Unit и интеграционные тесты
Покрытие pytest-cov Отчет о покрытии кода

Безопасность и секреты

  1. Защита токенов:
* `.env` в `.gitignore`
* GitHub Secrets для CI/CD
* Rate limiting: 100 запросов/15 мин
  1. Настройка секретов:

    В GitHub: Settings → Secrets → Actions

STRAVA_CLIENT_ID=<client_id>
STRAVA_CLIENT_SECRET=<client_secret>
STRAVA_REFRESH_TOKEN=<refresh_token>

Contributing

  1. Форкните репозиторий

  2. Установите зависимости: uv pip install -e ".[dev]"

  3. Создайте ветку: git checkout -b feature/name

  4. Проверьте изменения:

    ruff format .

ruff check .
pytest --cov=src
  1. Создайте Pull Request

📫 Поддержка

📄 Лицензия

MIT

Related MCP Servers & Clients