Skip to main content
Glama

Strava MCP Server

test_strava_curl.py•3.2 kB
#!/usr/bin/env python3 """ Test script to generate curl commands for Strava API """ import os from dotenv import load_dotenv def generate_curl_commands(): """Generate curl commands for testing Strava API""" # Load environment variables from .env file load_dotenv() print("šŸ”§ Strava API Curl Commands") print("=" * 50) # Get values from environment variables CLIENT_ID = os.getenv("CLIENT_ID") CLIENT_SECRET = os.getenv("CLIENT_SECRET") ACCESS_TOKEN = os.getenv("ACCESS_TOKEN") if not all([CLIENT_ID, CLIENT_SECRET, ACCESS_TOKEN]): print("āŒ Missing environment variables!") print("Please check your .env file contains:") print("- CLIENT_ID") print("- CLIENT_SECRET") print("- ACCESS_TOKEN") return # Show loaded credentials (with masking for security) print(f"āœ… Loaded credentials:") print(f" CLIENT_ID: {CLIENT_ID}") print(f" CLIENT_SECRET: {CLIENT_SECRET[:8]}...") print(f" ACCESS_TOKEN: {ACCESS_TOKEN[:8]}...") print("\n1ļøāƒ£ Get Access Token (Client Credentials):") print("─" * 40) print(f'''curl -X POST "https://www.strava.com/api/v3/oauth/token" \\ -H "Content-Type: application/x-www-form-urlencoded" \\ -d "client_id={CLIENT_ID}&client_secret={CLIENT_SECRET}&grant_type=client_credentials&scope=read"''') print("\n2ļøāƒ£ Get Athlete Profile:") print("─" * 40) print(f'''curl -X GET "https://www.strava.com/api/v3/athlete" \\ -H "Authorization: Bearer {ACCESS_TOKEN}" \\ -H "Content-Type: application/json"''') print("\n3ļøāƒ£ Get Recent Activities (default - last 30):") print("─" * 40) print(f'''curl -X GET "https://www.strava.com/api/v3/athlete/activities?per_page=20&page=1" \\ -H "Authorization: Bearer {ACCESS_TOKEN}" \\ -H "Content-Type: application/json"''') print("\n4ļøāƒ£ Get Activities with Date Range:") print("─" * 40) print(f'''curl -X GET "https://www.strava.com/api/v3/athlete/activities?before=$(date +%s)&after=$(date -d '7 days ago' +%s)&per_page=10" \\ -H "Authorization: Bearer {ACCESS_TOKEN}" \\ -H "Content-Type: application/json"''') print("\n5ļøāƒ£ Get Specific Activity:") print("─" * 40) print(f'''curl -X GET "https://www.strava.com/api/v3/activities/123456789" \\ -H "Authorization: Bearer {ACCESS_TOKEN}" \\ -H "Content-Type: application/json"''') print("\nšŸŽÆ Setup Steps:") print("=" * 50) print("1. Go to https://www.strava.com/settings/api") print("2. Create an application to get CLIENT_ID and CLIENT_SECRET") print("3. Replace YOUR_CLIENT_ID, YOUR_CLIENT_SECRET in commands above") print("4. Run the first command to get an access token") print("5. Replace YOUR_ACCESS_TOKEN with the token from step 4") print("6. Use commands 2-5 to interact with Strava data") print("\nšŸ’” Tips:") print("─" * 40) print("• Use 'jq' to format JSON responses: ... | jq") print("• Save token to file: token_response.json") print("• Check rate limits in response headers") if __name__ == "__main__": generate_curl_commands()

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/Beefsupreme21/mcp-hackathon'

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