strava-mcp

strava-mcp

Enables full integration with Strava API v3 for managing activities, athletes, clubs, segments, and routes through MCP-compatible clients like Claude Desktop.

Category
访问服务器

README

Strava MCP Server ⚡

Python 3.8+ MCP Strava API

A comprehensive Model Context Protocol (MCP) server that provides full access to the Strava API v3. Perfect for integrating Strava data with Claude Desktop and other MCP-compatible clients.

✨ Features

🏃‍♂️ Activities

  • Create and update manual activities
  • Retrieve detailed activity information
  • Access comments, kudos, laps, and power zones
  • Search and filter activities with advanced parameters
  • Upload GPX/TCX files

👤 Athletes

  • Get authenticated athlete profile and stats
  • Access training zones and settings
  • Update athlete profile information
  • Retrieve athlete's club memberships

🏆 Clubs

  • Browse club details and activities
  • Access member lists and administrators
  • Get club-specific activity feeds

🎯 Segments & Routes

  • Explore segments in specific areas
  • Access starred segments and leaderboards
  • Get segment efforts and achievements
  • Retrieve route details and export formats

🔧 Additional Features

  • 40+ API endpoints with full Strava API v3 coverage
  • OAuth 2.0 authentication with automatic token management
  • Thread-safe operations for reliable concurrent access
  • Comprehensive error handling with detailed logging
  • MCP-compliant tools and resources classification

🚀 Quick Start

Prerequisites

  • Python 3.8 or higher
  • Strava Developer Account
  • Claude Desktop or other MCP client

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/strava-mcp.git
    cd strava-mcp
    
  2. Create virtual environment

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
  3. Install dependencies

    pip install -r requirements.txt
    
  4. Set up Strava API credentials

    • Go to Strava Developers
    • Create a new application
    • Set Authorization Callback Domain to: localhost
    • Set Authorization Callback URL to: http://localhost:8080
    • Note your Client ID and Client Secret
  5. Complete setup (Recommended - All users)

    python setup_complete.py
    

    This single script will:

    • Guide you through OAuth setup
    • Save tokens to .env file
    • Automatically update your Claude Desktop config

    Alternative setups for specific use cases:

    # For server deployments (no Claude Desktop):
    python -m mcp_server.oauth_setup
    
    # For token refresh only (when tokens expire):
    python update_claude_config.py
    
  6. Configure Claude Desktop (if not auto-updated) Add to your claude_desktop_config.json:

    {
      "mcpServers": {
        "strava-mcp": {
          "command": "path/to/your/strava-mcp/start_mcp_server.bat",
          "cwd": "path/to/your/strava-mcp"
        }
      }
    }
    

🔧 Usage

Manual Token Refresh

When your tokens expire, refresh them:

# Refresh tokens and update Claude Desktop config
python update_claude_config.py

# Or just refresh tokens in .env file
python refresh_tokens.py

Available Tools & Resources

🛠️ Tools (Write Operations)

  • create_strava_activity - Create manual activities
  • update_strava_activity - Update existing activities
  • update_athlete_profile - Update athlete information
  • star_strava_segment - Star/unstar segments
  • upload_activity_file - Upload GPX/TCX files
  • search_activities - Advanced activity search
  • explore_segments_in_area - Find segments by location
  • get_segment_leaderboard - Get segment rankings
  • get_activity_stream_data - Get activity stream data

📊 Resources (Read Operations)

  • Activity details, comments, kudos, laps, zones
  • Athlete profile, stats, zones, clubs
  • Club details, activities, members
  • Gear information and usage stats
  • Route details and export formats
  • Segment information and efforts
  • Stream data (GPS, power, heart rate)

🔐 Authentication

This server uses OAuth 2.0 with manual token refresh:

  • Secure token storage in environment variables
  • Thread-safe token management
  • Automatic Claude Desktop config updates
  • Manual refresh capability for full control

📁 Project Structure

strava-mcp/
├── mcp_server/
│   ├── __init__.py
│   ├── __main__.py          # MCP server entry point
│   ├── server.py            # FastMCP server with tools/resources
│   ├── api.py              # Complete Strava API v3 wrapper
│   ├── auth.py             # OAuth 2.0 authentication manager
│   └── oauth_setup.py      # Initial OAuth setup utility
├── requirements.txt         # Python dependencies
├── refresh_tokens.py       # Manual token refresh utility
├── update_claude_config.py # Claude Desktop config updater
├── start_mcp_server.bat   # Server startup script (Windows)
├── start_mcp_server.sh    # Server startup script (Unix/Linux)
└── README.md              # This file

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

⭐ Star this repo!

If you find this project useful, please consider giving it a star! It helps others discover this tool.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选