Skip to main content
Glama

Servidor Strava MCP

Canalización de CI/CD código decodificador

Un servidor de Protocolo de Contexto de Modelo (MCP) para interactuar con la API de Strava.

Guía del usuario

Instalación

Puedes instalar fácilmente Strava MCP con uvx :

uvx strava-mcp

Configuración de credenciales de Strava

  1. Crear una aplicación API de Strava :

    • Vaya a https://www.strava.com/settings/api

    • Cree una nueva aplicación para obtener su ID de cliente y secreto de cliente

    • Para "Dominio de devolución de llamada de autorización", ingrese localhost

  2. Configure sus credenciales : cree un archivo de credenciales (por ejemplo, ~/.ssh/strava.sh ):

    export STRAVA_CLIENT_ID=your_client_id
    export STRAVA_CLIENT_SECRET=your_client_secret
  3. Configurar Claude Desktop : agregue lo siguiente a su configuración de Claude ( /Users/<username>/Library/Application Support/Claude/claude_desktop_config.json ):

    "strava": {
        "command": "bash",
        "args": [
            "-c",
            "source ~/.ssh/strava.sh && uvx strava-mcp"
        ]
    }

Autenticación

La primera vez que utilice las herramientas Strava MCP:

  1. Se iniciará automáticamente un flujo de autenticación.

  2. Su navegador se abrirá en la página de autorización de Strava.

  3. Después de autorizar, será redirigido a una página local.

  4. Su token de actualización se guardará automáticamente para uso futuro

Herramientas disponibles

Obtener actividades del usuario

Recupera actividades del usuario autenticado.

Parámetros:

  • before (opcional): Marca de tiempo de época para filtrar

  • after (opcional): Marca de tiempo de época para filtrar

  • page (opcional): Número de página (predeterminado: 1)

  • per_page (opcional): Número de elementos por página (predeterminado: 30)

Obtener actividad

Obtiene información detallada sobre una actividad específica.

Parámetros:

  • activity_id : El ID de la actividad

  • include_all_efforts (opcional): incluye esfuerzos del segmento (predeterminado: falso)

Obtener segmentos de actividad

Recupera segmentos de una actividad específica.

Parámetros:

  • activity_id : El ID de la actividad

Obtener la tabla de clasificación del segmento

Obtiene la tabla de clasificación para un segmento específico.

Parámetros:

  • segment_id : El ID del segmento

  • Varios filtros opcionales (género, grupo de edad, etc.)

Related MCP server: Strava MCP Server

Guía para desarrolladores

Configuración del proyecto

  1. Clonar el repositorio:

    git clone <repository-url>
    cd strava
  2. Instalar dependencias:

    uv install
  3. Configurar variables de entorno:

    export STRAVA_CLIENT_ID=your_client_id
    export STRAVA_CLIENT_SECRET=your_client_secret

    Alternativamente, cree un archivo .env con estas variables.

Ejecutando en modo de desarrollo

Ejecute el servidor con MCP CLI:

mcp dev strava_mcp/main.py

Autenticación manual

Puede obtener un token de actualización manualmente ejecutando:

python get_token.py

Estructura del proyecto

  • strava_mcp/ : Directorio principal del paquete

    • __init__.py : Inicialización del paquete

    • config.py : Ajustes de configuración mediante pydantic-settings

    • models.py : Modelos de Pydantic para entidades de la API de Strava

    • api.py : Cliente API de bajo nivel para Strava

    • auth.py : Implementación de la autenticación OAuth de Strava

    • oauth_server.py : Implementación de servidor OAuth independiente

    • service.py : Capa de servicio para la lógica empresarial

    • server.py : implementación del servidor MCP

  • tests/ : Pruebas unitarias

  • strava_mcp/main.py : Punto de entrada principal para ejecutar el servidor

  • get_token.py : script de utilidad para obtener un token de actualización manualmente

Ejecución de pruebas

pytest

Publicación en PyPI

Construyendo el paquete

# Build both sdist and wheel
uv build

Publicación en PyPI

# Publish to Test PyPI first
uv publish --index testpypi

# Publish to PyPI
uv publish

Licencia

Licencia MIT

Expresiones de gratitud

Available Tools

3 tools
get_activityC

Get details of a specific activity.

Args: ctx: The MCP request context activity_id: The ID of the activity include_all_efforts: Whether to include all segment efforts

Returns: The activity details

Inputs: activity_id (required), include_all_efforts.

get_activity_segmentsC

Get the segments of a specific activity.

Args: ctx: The MCP request context activity_id: The ID of the activity

Returns: List of segment efforts for the activity

Inputs: activity_id (required).

get_user_activitiesB

Get the authenticated user's activities.

Args: ctx: The MCP request context before: An epoch timestamp for filtering activities before a certain time after: An epoch timestamp for filtering activities after a certain time page: Page number per_page: Number of items per page

Returns: List of activities

Inputs: before, after, page, per_page.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose with no overlap: get_activity retrieves details of a specific activity, get_activity_segments focuses on segments within an activity, and get_user_activities lists the user's activities. The descriptions clearly differentiate these functions, making tool selection unambiguous for an agent.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with snake_case (get_activity, get_activity_segments, get_user_activities). The naming is predictable and readable, using 'get' as the verb throughout, which aligns well with the read-only nature of these tools.

    Tool Count2/5

    With only 3 tools, this server feels under-scoped for a Strava integration, which typically involves activities, segments, athletes, and more. While the tools cover some read operations, the count is too low to support comprehensive agent workflows, such as creating or updating activities, which are common in fitness tracking domains.

    Completeness2/5

    The tool surface is severely incomplete for a Strava server, as it only includes read operations (get) with no support for create, update, or delete actions. There are significant gaps, such as missing tools for managing segments, athletes, or uploading activities, which will likely cause agent failures when attempting full interactions with the Strava API.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that provides language models with access to Strava API data, allowing them to query and analyze athlete activities from Strava.
      4
      25
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server that enables language models to interact with Strava data, including activities, athlete statistics, routes, achievements, and social features.
      6
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      An MCP server that enables interaction with the Strava API v3 to manage fitness activities, athlete profiles, segments, and routes. It supports retrieving detailed performance metrics, exploring geographic data, and managing club information through natural language.
      33
      PolyForm Noncommercial 1.0.0