Skip to main content
Glama

Strava MCP 服务器

CI/CD 管道 代码验证

用于与 Strava API 交互的模型上下文协议 (MCP) 服务器。

用户指南

安装

您可以使用uvx轻松安装 Strava MCP:

uvx strava-mcp

设置 Strava 凭证

  1. 创建 Strava API 应用程序

  2. 配置您的凭证:创建凭证文件(例如, ~/.ssh/strava.sh ):

    export STRAVA_CLIENT_ID=your_client_id export STRAVA_CLIENT_SECRET=your_client_secret
  3. 配置 Claude 桌面:将以下内容添加到您的 Claude 配置( /Users/<username>/Library/Application Support/Claude/claude_desktop_config.json ):

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

验证

首次使用 Strava MCP 工具时:

  1. 身份验证流程将自动启动

  2. 您的浏览器将打开 Strava 授权页面

  3. 授权后,您将被重定向回本地页面

  4. 您的刷新令牌将自动保存以供将来使用

可用工具

获取用户活动

检索经过身份验证的用户的活动。

参数:

  • before (可选):用于过滤的纪元时间戳

  • after (可选):用于过滤的纪元时间戳

  • page (可选):页码(默认值:1)

  • per_page (可选):每页项目数(默认值:30)

获取活动

获取有关特定活动的详细信息。

参数:

  • activity_id :活动的 ID

  • include_all_efforts (可选):包括细分工作(默认值:false)

获取活动片段

从特定活动中检索片段。

参数:

  • activity_id :活动的 ID

获取细分排行榜

获取特定部分的排行榜。

参数:

  • segment_id :段的 ID

  • 各种可选过滤器(性别、年龄组等)

开发者指南

项目设置

  1. 克隆存储库:

    git clone <repository-url> cd strava
  2. 安装依赖项:

    uv install
  3. 设置环境变量:

    export STRAVA_CLIENT_ID=your_client_id export STRAVA_CLIENT_SECRET=your_client_secret

    或者,使用这些变量创建一个.env文件。

以开发模式运行

使用 MCP CLI 运行服务器:

mcp dev strava_mcp/main.py

手动身份验证

您可以通过运行以下命令手动获取刷新令牌:

python get_token.py

项目结构

  • strava_mcp/ :主包目录

    • __init__.py :包初始化

    • config.py :使用 pydantic-settings 进行配置设置

    • models.py :Strava API 实体的 Pydantic 模型

    • api.py的低级 API 客户端

    • auth.py :Strava OAuth 身份验证实现

    • oauth_server.py :独立 OAuth 服务器实现

    • service.py :业务逻辑的服务层

    • server.py :MCP 服务器实现

  • tests/ :单元测试

  • strava_mcp/main.py :运行服务器的主入口点

  • get_token.py :用于手动获取刷新令牌的实用程序脚本

运行测试

pytest

发布到 PyPI

构建包

# Build both sdist and wheel uv build

发布到 PyPI

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

执照

MIT 许可证

致谢

Deploy Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Related MCP Servers

  • -
    security
    F
    license
    -
    quality
    A Model Context Protocol server for tracking personal health and well-being, offering tools for workout logging, nutrition management, and daily journaling with AI-assisted analysis integration.
    Last updated -
    8
  • A
    security
    A
    license
    A
    quality
    Integration Strava API с Model Context Protocol SDK
    Last updated -
    4
    MIT License
  • -
    security
    F
    license
    -
    quality
    A Model Context Protocol server that provides language models with access to personal Whoop fitness data, allowing queries for cycles, recovery, strain, and workout information from the Whoop API.
    Last updated -
    14
    • Apple
  • 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
    17
    MIT License
    • 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/yorrickjansen/strava-mcp'

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