Skip to main content
Glama
tomekkorbak

Strava MCP Server

by tomekkorbak

get_activities

Retrieve recent Strava activities for the authenticated athlete, with configurable limits for data analysis and tracking.

Instructions

Get the authenticated athlete's recent activities. Args: limit: Maximum number of activities to return (default: 10) Returns: Dictionary containing activities data

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNo

Implementation Reference

  • MCP tool handler for 'get_activities': fetches recent Strava activities using the StravaClient, handles errors and client initialization.
    @mcp.tool() def get_activities(limit: int = 10) -> dict[str, Any]: """ Get the authenticated athlete's recent activities. Args: limit: Maximum number of activities to return (default: 10) Returns: Dictionary containing activities data """ if strava_client is None: return { "error": "Strava client not initialized. Please provide refresh token, client ID, and client secret." # noqa: E501 } try: activities = strava_client.get_activities(limit=limit) return {"data": activities} except Exception as e: return {"error": str(e)}
  • StravaClient helper method that performs the actual API call to retrieve activities, filters results, and is called by the tool handler.
    def get_activities( self, limit: int = 10, before: Optional[int] = None, after: Optional[int] = None ) -> list: """ Get the authenticated athlete's activities. Args: limit: Maximum number of activities to return before: Unix timestamp to filter activities before this time after: Unix timestamp to filter activities after this time Returns: List of activities """ params = {"per_page": limit} if before: params["before"] = before if after: params["after"] = after activities = self._make_request("athlete/activities", params) return self._filter_activities(activities)

Latest Blog Posts

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/tomekkorbak/strava-mcp-server'

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