rbctmz_mcp-server-strava

rbctmz_mcp-server-strava

3.5

Integration for analyzing workouts and getting recommendations based on Strava data using Model Context Protocol SDK.

The MCP Server Strava integration allows users to analyze their workout data from Strava and receive personalized training recommendations. It leverages the Model Context Protocol SDK to facilitate seamless data exchange and analysis. The integration supports automatic token updates and implements rate limiting to manage API requests efficiently. Users need Python 3.10+, a Strava account, and the Claude Desktop application to get started. The setup process involves cloning the repository, installing dependencies, and configuring the Strava API settings. The integration provides various resources and tools for accessing and analyzing workout data, including activities, athlete zones, and gear information. It also offers tools for activity analysis and training load assessment, making it a comprehensive solution for fitness enthusiasts looking to optimize their training regimen.

Features

  • Workout analysis from Strava
  • Training recommendations
  • Automatic token updates
  • Rate limiting for API requests

MCP Tools

  • analyze_activity(activity_id): Analyzes a specific workout activity.
  • analyze_training_load(activities): Analyzes the training load from multiple activities.
  • get_activity_recommendations(): Provides training recommendations based on activity data.

MCP Resources

  • {'name': 'strava://activities', 'description': 'List of activities.'}
  • {'name': 'strava://activities/{id}', 'description': 'Details of a specific activity.'}
  • {'name': 'strava://athlete/zones', 'description': 'Training zones of the athlete.'}
  • {'name': 'strava://athlete/clubs', 'description': "Athlete's clubs."}
  • {'name': 'strava://gear/{gear_id}', 'description': 'Information about gear.'}

Usage with Different Platforms

mcp

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}
            ]
        }
    }
    """