Skip to main content
Glama

mcp-server-strava

Strava API 与模型上下文协议 (MCP) SDK 集成

CI编解码器Python许可证:MIT拉夫

使用模型上下文协议 SDK 集成基于 Strava 数据的训练分析和建议。

🚀 功能

  • Strava 锻炼分析
  • 培训建议
  • 自动令牌更新
  • 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. 创建应用程序:
    • 应用程序名称:MCP Strava Integration
    • 类别:训练分析
    • 网站: http://localhost
    • 授权回调域: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 和安全

  • 覆盖范围
  • 测试
  • 拉夫
GitHub Actions 中的检查
类型工具描述
代码检查皱领代码格式化和分析
测试pytest单元和集成测试
涂层pytest-cov代码覆盖率报告
安全和秘密
  1. 代币保护:
    • .env.gitignore
    • GitHub 的 CI/CD 秘诀
    • 速率限制:100 个请求/15 分钟
  2. 设置秘密:
    # В GitHub: Settings → Secrets → Actions STRAVA_CLIENT_ID=<client_id> STRAVA_CLIENT_SECRET=<client_secret> STRAVA_REFRESH_TOKEN=<refresh_token>

贡献

  1. 分叉存储库
  2. 安装依赖项: uv pip install -e ".[dev]"
  3. 创建分支: git checkout -b feature/name
  4. 检查更改:
    ruff format . ruff check . pytest --cov=src
  5. 创建拉取请求

📫 支持

📄 许可证

麻省理工学院

-
security - not tested
A
license - permissive license
-
quality - not tested

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Strava API 与模型上下文协议 SDK 的集成

  1. 🚀 功能
    1. 📋 要求
      1. ⚙️ 安装
        1. 安装 MCP SDK
      2. 🔧 设置
        1. 设置 Strava API
        2. 设置环境
      3. 📚 API 和示例
        1. 资源和工具
        2. 使用示例
      4. 🛠 开发
        1. CI/CD 和安全
        2. 贡献
      5. 📫 支持
        1. 📄 许可证

          Related MCP Servers

          • A
            security
            F
            license
            A
            quality
            A Model Context Protocol server implementation for interacting with Salesforce through its REST API.
            Last updated -
            4
            34
            TypeScript
          • -
            security
            F
            license
            -
            quality
            A Model Context Protocol gateway that connects to RFK Jr-related endpoints, supporting both STDIO and SSE transport methods.
            Last updated -
            Python
          • A
            security
            A
            license
            A
            quality
            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.
            Last updated -
            4
            13
            Python
            MIT License
            • Apple
          • -
            security
            A
            license
            -
            quality
            A Model Context Protocol server that enables language models to interact with Strava data, including activities, athlete statistics, routes, achievements, and social features.
            Last updated -
            2
            Python
            MIT License
            • Linux
            • Apple

          View all related MCP servers

          MCP directory API

          We provide all the information about MCP servers via our MCP API.

          curl -X GET 'https://glama.ai/api/mcp/v1/servers/rbctmz/mcp-server-strava'

          If you have feedback or need assistance with the MCP directory API, please join our Discord server