Compare commits
9 Commits
99fd37fc12
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| d5487c07fc | |||
| b8bce4ee7f | |||
| 6db9e87f96 | |||
| 7c8061eeea | |||
| 7d0364e0ed | |||
| 2223a2aafa | |||
| 63d41ed9db | |||
| 94e7cd6a8c | |||
| b463b2eeb8 |
@@ -34,6 +34,28 @@ jobs:
|
||||
- name: Run Ruff (Lint & Syntax Check)
|
||||
run: uv run ruff check src
|
||||
|
||||
publish-pypi:
|
||||
name: Publish to PyPI
|
||||
needs: lint
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install uv
|
||||
uses: astral-sh/setup-uv@v2
|
||||
with:
|
||||
version: "latest"
|
||||
|
||||
- name: Build package
|
||||
run: uv build
|
||||
|
||||
- name: Publish to PyPI
|
||||
run: uv publish --token ${{ secrets.PYPI_TOKEN }}
|
||||
env:
|
||||
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
||||
|
||||
build-and-push:
|
||||
name: Build & Push Docker Image
|
||||
needs: lint
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
name: Deploy Website to S3
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'website/**'
|
||||
- '.gitea/workflows/deploy-website.yaml'
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Sync to S3
|
||||
uses: https://github.com/jakejarvis/s3-sync-action@master
|
||||
with:
|
||||
args: --acl public-read --follow-symlinks --delete
|
||||
env:
|
||||
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
|
||||
AWS_S3_ENDPOINT: "https://s3.hnrx.net"
|
||||
AWS_S3_FORCE_PATH_STYLE: 'true'
|
||||
AWS_REGION: 'garage'
|
||||
SOURCE_DIR: 'website'
|
||||
@@ -0,0 +1,5 @@
|
||||
Das Git Repo zu dem Projekt:
|
||||
"Strava MCP Server"
|
||||
findest du hier: https://git.hnrx.net/hnrx/strava-mcp-server
|
||||
|
||||
Issues: https://git.hnrx.net/hnrx/strava-mcp-server/issues
|
||||
@@ -49,25 +49,80 @@ Built with [FastMCP](https://github.com/jlowin/fastmcp) and the [MCP Python SDK]
|
||||
|
||||
## Installation & Deployment
|
||||
|
||||
### Docker (Recommended)
|
||||
### Docker (Recommended for self-hosting)
|
||||
|
||||
The project includes a multi-arch Docker build (amd64/arm64).
|
||||
A pre-built multi-arch image (amd64/arm64) is automatically published to the Gitea registry on every release.
|
||||
|
||||
**1. Authenticate first** (only needed once, saves credentials to `~/.config/strava-mcp-server/config.env`):
|
||||
|
||||
```bash
|
||||
# Clone the repository
|
||||
git clone https://git.hnrx.net/hnrx/strava-mcp-server.git
|
||||
cd strava-mcp-server
|
||||
|
||||
# Build the image locally
|
||||
docker build -t strava-mcp-server:latest .
|
||||
|
||||
# Run the container (injecting your .env file)
|
||||
docker run --rm -p 8000:8000 --env-file .env strava-mcp-server:latest
|
||||
uvx --from strava-mcp-server-hnrx auth
|
||||
```
|
||||
|
||||
### Local Python (uv)
|
||||
**2. Pull and run the image:**
|
||||
|
||||
We use `uv` for lightning-fast dependency management and task execution.
|
||||
```bash
|
||||
# Pull the latest release
|
||||
docker pull git.hnrx.net/hnrx/strava-mcp-server:latest
|
||||
|
||||
# Run with your credentials from the config file
|
||||
docker run --rm -p 8000:8000 \
|
||||
-e STRAVA_CLIENT_ID=<your_client_id> \
|
||||
-e STRAVA_CLIENT_SECRET=<your_client_secret> \
|
||||
-e STRAVA_REFRESH_TOKEN=<your_refresh_token> \
|
||||
-e MCP_TRANSPORT=http \
|
||||
git.hnrx.net/hnrx/strava-mcp-server:latest
|
||||
```
|
||||
|
||||
Or using your config file directly:
|
||||
|
||||
```bash
|
||||
docker run --rm -p 8000:8000 \
|
||||
--env-file ~/.config/strava-mcp-server/config.env \
|
||||
-e MCP_TRANSPORT=http \
|
||||
git.hnrx.net/hnrx/strava-mcp-server:latest
|
||||
```
|
||||
|
||||
> **Tip:** Pin to a specific version for stability, e.g. `git.hnrx.net/hnrx/strava-mcp-server:v0.2.0`
|
||||
|
||||
<details>
|
||||
<summary>Build from source</summary>
|
||||
|
||||
```bash
|
||||
git clone https://git.hnrx.net/hnrx/strava-mcp-server.git
|
||||
cd strava-mcp-server
|
||||
docker build -t strava-mcp-server:latest .
|
||||
docker run --rm -p 8000:8000 --env-file ~/.config/strava-mcp-server/config.env -e MCP_TRANSPORT=http strava-mcp-server:latest
|
||||
```
|
||||
</details>
|
||||
|
||||
### Local Python (PyPI)
|
||||
|
||||
The easiest way to get started is using our **interactive onboarding wizard**. You don't even need to clone the repository:
|
||||
|
||||
```bash
|
||||
# 1. Start the interactive setup wizard
|
||||
uvx --from strava-mcp-server-hnrx auth
|
||||
|
||||
# 2. Run the MCP server
|
||||
uvx --from strava-mcp-server-hnrx server
|
||||
```
|
||||
|
||||
The wizard will guide you through creating a Strava API application and automatically save your credentials to a `.env` file.
|
||||
|
||||
### Installation
|
||||
|
||||
If you prefer a traditional installation:
|
||||
|
||||
```bash
|
||||
pip install strava-mcp-server-hnrx
|
||||
# or
|
||||
uv add strava-mcp-server-hnrx
|
||||
```
|
||||
|
||||
### Running from source
|
||||
|
||||
If you want to contribute or run the latest dev version:
|
||||
|
||||
```bash
|
||||
git clone https://git.hnrx.net/hnrx/strava-mcp-server.git
|
||||
@@ -80,17 +135,6 @@ uv run server
|
||||
uv run auth
|
||||
```
|
||||
|
||||
### Run on the fly with `uvx` (No git clone required)
|
||||
|
||||
You can run the server directly from the repository without cloning it manually by using `uvx`:
|
||||
|
||||
```bash
|
||||
# Set up your .env file in the current directory first!
|
||||
uvx --from git+https://git.hnrx.net/hnrx/strava-mcp-server.git server
|
||||
```
|
||||
|
||||
*(If you are already inside the cloned directory, you can also just run `uvx --from . server`)*
|
||||
|
||||
---
|
||||
|
||||
## Strava API Setup
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
STRAVA_CLIENT_ID=16037
|
||||
STRAVA_CLIENT_SECRET=cc332cb8b0f7f44dac80100be87495a0a1440a2d
|
||||
STRAVA_REFRESH_TOKEN=bb644951ca96e811f9520794c607a0e9b6505888
|
||||
+5
-2
@@ -6,7 +6,7 @@ build-backend = "hatchling.build"
|
||||
|
||||
|
||||
[project]
|
||||
name = "strava-mcp-server"
|
||||
name = "strava-mcp-server-hnrx"
|
||||
dynamic = ["version"]
|
||||
description = "A Model Context Protocol (MCP) server that exposes the Strava API v3 as tools, resources, and prompts for AI agents."
|
||||
readme = "README.md"
|
||||
@@ -33,7 +33,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
Homepage = "https://git.hnrx.net/hnrx/strava-mcp-server"
|
||||
Homepage = "https://strava-mcp.web.s3.hnrx.net"
|
||||
Repository = "https://git.hnrx.net/hnrx/strava-mcp-server"
|
||||
"Bug Tracker" = "https://git.hnrx.net/hnrx/strava-mcp-server/issues"
|
||||
|
||||
@@ -54,6 +54,9 @@ dev = [
|
||||
[tool.hatch.version]
|
||||
source = "vcs"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/strava_mcp_server"]
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
asyncio_mode = "auto"
|
||||
testpaths = ["tests"]
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
"""
|
||||
Configuration path resolution for strava-mcp-server.
|
||||
|
||||
Config is stored in the appropriate user config directory per platform:
|
||||
- macOS/Linux: ~/.config/strava-mcp-server/config.env (XDG convention)
|
||||
- Windows: %APPDATA%\\strava-mcp-server\\config.env
|
||||
|
||||
A local .env file (if present) always takes precedence for developer overrides.
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
APP_NAME = "strava-mcp-server"
|
||||
|
||||
|
||||
def get_config_dir() -> Path:
|
||||
"""Returns the appropriate config directory for the current platform."""
|
||||
if sys.platform == "win32":
|
||||
# Windows: use %APPDATA% (C:\Users\<user>\AppData\Roaming\)
|
||||
appdata = os.environ.get("APPDATA")
|
||||
if appdata:
|
||||
return Path(appdata) / APP_NAME
|
||||
# macOS / Linux: XDG convention (~/.config)
|
||||
return Path.home() / ".config" / APP_NAME
|
||||
|
||||
|
||||
def get_config_file() -> Path:
|
||||
"""Returns the path to the config file."""
|
||||
return get_config_dir() / "config.env"
|
||||
|
||||
|
||||
def ensure_config_dir() -> Path:
|
||||
"""Creates the config directory if it doesn't exist and returns its path."""
|
||||
config_dir = get_config_dir()
|
||||
config_dir.mkdir(parents=True, exist_ok=True)
|
||||
return config_dir
|
||||
@@ -19,7 +19,13 @@ from http.server import HTTPServer, BaseHTTPRequestHandler
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
from dotenv import load_dotenv
|
||||
|
||||
load_dotenv()
|
||||
from strava_mcp_server.config import get_config_file, ensure_config_dir
|
||||
|
||||
# Load config: platform config dir first, then local .env (local overrides)
|
||||
load_dotenv(
|
||||
get_config_file()
|
||||
) # e.g. ~/Library/Application Support/strava-mcp-server/config.env
|
||||
load_dotenv(override=False) # local .env overrides if present
|
||||
|
||||
CLIENT_ID = os.getenv("STRAVA_CLIENT_ID")
|
||||
CLIENT_SECRET = os.getenv("STRAVA_CLIENT_SECRET")
|
||||
@@ -27,11 +33,107 @@ REDIRECT_URI = "http://localhost:8765/callback"
|
||||
SCOPES = "profile:read_all,activity:read_all,activity:read,profile:write"
|
||||
|
||||
|
||||
class SetupHandler(BaseHTTPRequestHandler):
|
||||
setup_done = False
|
||||
client_id = ""
|
||||
client_secret = ""
|
||||
|
||||
def do_GET(self):
|
||||
if self.path == "/setup" or self.path == "/":
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/html; charset=utf-8")
|
||||
self.end_headers()
|
||||
self.wfile.write(self._get_setup_page().encode("utf-8"))
|
||||
elif self.path.startswith("/save"):
|
||||
parsed = urlparse(self.path)
|
||||
params = parse_qs(parsed.query)
|
||||
if "id" in params and "secret" in params:
|
||||
SetupHandler.client_id = params["id"][0].strip()
|
||||
SetupHandler.client_secret = params["secret"][0].strip()
|
||||
SetupHandler.setup_done = True
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/html; charset=utf-8")
|
||||
self.end_headers()
|
||||
self.wfile.write(
|
||||
"""
|
||||
<html>
|
||||
<head><meta http-equiv="refresh" content="2;url=/callback-wait"></head>
|
||||
<body style="background:#0A0A0A;color:white;font-family:sans-serif;display:flex;align-items:center;justify-content:center;height:100vh;">
|
||||
<div style="text-align:center;">
|
||||
<h2 style="color:#fc4c02;">Settings Saved!</h2>
|
||||
<p>Redirecting to Strava Authorization...</p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
""".encode("utf-8")
|
||||
)
|
||||
else:
|
||||
self.send_response(400)
|
||||
self.end_headers()
|
||||
self.wfile.write(b"Missing parameters")
|
||||
else:
|
||||
self.send_response(404)
|
||||
self.end_headers()
|
||||
|
||||
def _get_setup_page(self):
|
||||
return """
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Strava MCP Setup</title>
|
||||
<style>
|
||||
:root { --primary: #FC4C02; --bg: #0A0A0A; --card: #161616; --text: #FFFFFF; --text-dim: #A0A0A0; }
|
||||
body { font-family: -apple-system, system-ui, sans-serif; background: var(--bg); color: var(--text); margin: 0; display: flex; justify-content: center; align-items: center; min-height: 100vh; }
|
||||
.container { max-width: 500px; width: 90%; background: var(--card); padding: 40px; border-radius: 24px; box-shadow: 0 20px 40px rgba(0,0,0,0.4); border: 1px solid rgba(255,255,255,0.1); }
|
||||
h1 { color: var(--primary); margin-top: 0; font-size: 28px; }
|
||||
.guide { background: rgba(252, 76, 2, 0.1); padding: 20px; border-radius: 12px; margin-bottom: 30px; font-size: 14px; line-height: 1.5; border-left: 4px solid var(--primary); }
|
||||
.guide ol { margin: 10px 0 0 20px; padding: 0; }
|
||||
.guide li { margin-bottom: 8px; }
|
||||
label { display: block; margin-bottom: 8px; font-weight: 600; font-size: 14px; color: var(--text-dim); }
|
||||
input { width: 100%; padding: 12px 16px; background: #222; border: 1px solid #333; border-radius: 8px; color: white; margin-bottom: 20px; box-sizing: border-box; font-family: monospace; }
|
||||
input:focus { border-color: var(--primary); outline: none; }
|
||||
button { width: 100%; padding: 14px; background: var(--primary); color: white; border: none; border-radius: 8px; font-weight: 700; cursor: pointer; transition: transform 0.2s; font-size: 16px; }
|
||||
button:hover { transform: translateY(-2px); filter: brightness(1.1); }
|
||||
code { background: #000; padding: 2px 6px; border-radius: 4px; font-family: monospace; color: var(--primary); }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Strava MCP Setup</h1>
|
||||
<div class="guide">
|
||||
<strong>How to get your credentials:</strong>
|
||||
<ol>
|
||||
<li>Go to <a href="https://www.strava.com/settings/api" target="_blank" style="color:var(--primary);">Strava API Settings</a>.</li>
|
||||
<li>Create an app (any name/category).</li>
|
||||
<li>Set <b>"Authorization Callback Domain"</b> to <code>localhost</code>.</li>
|
||||
<li>Copy your <b>Client ID</b> and <b>Client Secret</b> below.</li>
|
||||
</ol>
|
||||
</div>
|
||||
<form action="/save" method="get">
|
||||
<label>Client ID</label>
|
||||
<input type="text" name="id" placeholder="e.g. 123456" required>
|
||||
<label>Client Secret</label>
|
||||
<input type="password" name="secret" placeholder="Your Strava Secret" required>
|
||||
<button type="submit">Save & Authenticate</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
"""
|
||||
|
||||
def log_message(self, format, *args):
|
||||
pass
|
||||
|
||||
|
||||
class CallbackHandler(BaseHTTPRequestHandler):
|
||||
client_id: str = ""
|
||||
client_secret: str = ""
|
||||
tokens: dict = {}
|
||||
error: str | None = None
|
||||
config_path: str = ""
|
||||
|
||||
def do_GET(self):
|
||||
parsed = urlparse(self.path)
|
||||
@@ -51,65 +153,46 @@ class CallbackHandler(BaseHTTPRequestHandler):
|
||||
},
|
||||
)
|
||||
response.raise_for_status()
|
||||
self.tokens = response.json()
|
||||
CallbackHandler.tokens = response.json()
|
||||
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/html; charset=utf-8")
|
||||
self.end_headers()
|
||||
|
||||
refresh_token = self.tokens.get("refresh_token")
|
||||
refresh_token = CallbackHandler.tokens.get("refresh_token")
|
||||
|
||||
self.wfile.write(
|
||||
f"""
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
body {{ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; line-height: 1.6; color: #333; max-width: 800px; margin: 40px auto; padding: 20px; text-align: left; }}
|
||||
.card {{ background: #f4f7f6; border-radius: 8px; padding: 20px; border-left: 5px solid #fc4c02; margin-top: 20px; }}
|
||||
pre {{ background: #222; color: #fff; padding: 15px; border-radius: 5px; overflow-x: auto; font-family: "SF Mono", Monaco, Consolas, monospace; font-size: 13px; }}
|
||||
.success-header {{ text-align: center; margin-bottom: 40px; }}
|
||||
.success-icon {{ color: #2ecc71; font-size: 48px; display: block; margin-bottom: 10px; }}
|
||||
h2, h3 {{ color: #fc4c02; }}
|
||||
.env-label {{ font-weight: bold; color: #666; font-size: 12px; text-transform: uppercase; margin-bottom: 5px; display: block; }}
|
||||
.copy-hint {{ font-size: 12px; color: #666; font-style: italic; }}
|
||||
code {{ background: #eee; padding: 2px 4px; border-radius: 4px; }}
|
||||
body {{ background: #0A0A0A; color: white; font-family: -apple-system, sans-serif; max-width: 600px; margin: 60px auto; padding: 20px; text-align: center; }}
|
||||
.card {{ background: #161616; border-radius: 16px; padding: 30px; border: 1px solid rgba(255,255,255,0.1); text-align: left; margin-top: 30px; }}
|
||||
h2 {{ color: #fc4c02; }}
|
||||
pre {{ background: #000; color: #fc4c02; padding: 20px; border-radius: 8px; overflow-x: auto; font-family: monospace; font-size: 14px; border: 1px solid #333; }}
|
||||
.success-icon {{ font-size: 64px; margin-bottom: 20px; display: block; }}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="success-header">
|
||||
<span class="success-icon">✅</span>
|
||||
<h2>Authorization successful!</h2>
|
||||
<p>You have successfully authenticated with Strava. You can now close this window.</p>
|
||||
</div>
|
||||
<span class="success-icon">✅</span>
|
||||
<h2>Setup Complete!</h2>
|
||||
<p>Your Strava account is now connected to the MCP server.</p>
|
||||
|
||||
<h3>1. Local Setup (.env)</h3>
|
||||
<p>Copy the following block into your <code>.env</code> file in the project root:</p>
|
||||
<div class="card">
|
||||
<span class="env-label">Your .env content:</span>
|
||||
<p style="margin-top:0; color: #A0A0A0; font-size: 14px; font-weight: bold;">UPDATED .ENV CONTENT:</p>
|
||||
<pre>STRAVA_CLIENT_ID={self.client_id}
|
||||
STRAVA_CLIENT_SECRET={self.client_secret}
|
||||
STRAVA_REFRESH_TOKEN={refresh_token}</pre>
|
||||
<p style="font-size: 13px; color: #666; margin-bottom: 0;">Automatically saved to:</p>
|
||||
<code style="font-size: 12px; color: #fc4c02; word-break: break-all;">{CallbackHandler.config_path}</code>
|
||||
</div>
|
||||
|
||||
<h3>2. Kubernetes Setup (Secret)</h3>
|
||||
<p>If you are deploying this server to Kubernetes, run the following command to create the required Secret:</p>
|
||||
<div class="card">
|
||||
<span class="env-label">Kubectl Command:</span>
|
||||
<pre>kubectl create secret generic strava-mcp-server-secret \\
|
||||
--from-literal=STRAVA_CLIENT_ID={self.client_id} \\
|
||||
--from-literal=STRAVA_CLIENT_SECRET={self.client_secret} \\
|
||||
--from-literal=STRAVA_REFRESH_TOKEN={refresh_token}</pre>
|
||||
</div>
|
||||
|
||||
<p style="margin-top: 40px; font-size: 14px; color: #666; text-align: center;">
|
||||
— Strava MCP Server Authorization Helper —
|
||||
</p>
|
||||
<p style="margin-top: 40px; color: #444;">You can now close this window and restart the server.</p>
|
||||
</body>
|
||||
</html>
|
||||
""".encode("utf-8")
|
||||
)
|
||||
except Exception as e:
|
||||
self.error = str(e)
|
||||
CallbackHandler.error = str(e)
|
||||
self.send_response(500)
|
||||
self.end_headers()
|
||||
self.wfile.write(f"Error exchanging token: {e}".encode())
|
||||
@@ -123,11 +206,72 @@ STRAVA_REFRESH_TOKEN={refresh_token}</pre>
|
||||
pass # Suppress server logs
|
||||
|
||||
|
||||
def main():
|
||||
if not CLIENT_ID or not CLIENT_SECRET:
|
||||
print("❌ Missing STRAVA_CLIENT_ID or STRAVA_CLIENT_SECRET in .env")
|
||||
return
|
||||
def save_to_env(client_id, client_secret, refresh_token=None):
|
||||
# Always save to the platform config directory so uvx finds it
|
||||
ensure_config_dir()
|
||||
config_path = get_config_file()
|
||||
|
||||
lines = []
|
||||
if config_path.exists():
|
||||
with open(config_path, "r") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
keys_to_set = {
|
||||
"STRAVA_CLIENT_ID": client_id,
|
||||
"STRAVA_CLIENT_SECRET": client_secret,
|
||||
}
|
||||
if refresh_token:
|
||||
keys_to_set["STRAVA_REFRESH_TOKEN"] = refresh_token
|
||||
|
||||
new_lines = []
|
||||
seen_keys = set()
|
||||
|
||||
for line in lines:
|
||||
matched = False
|
||||
for key, value in keys_to_set.items():
|
||||
if line.startswith(f"{key}="):
|
||||
new_lines.append(f"{key}={value}\n")
|
||||
seen_keys.add(key)
|
||||
matched = True
|
||||
break
|
||||
if not matched:
|
||||
new_lines.append(line)
|
||||
|
||||
for key, value in keys_to_set.items():
|
||||
if key not in seen_keys:
|
||||
new_lines.append(f"{key}={value}\n")
|
||||
|
||||
with open(config_path, "w") as f:
|
||||
f.writelines(new_lines)
|
||||
|
||||
saved_keys = ", ".join(keys_to_set.keys())
|
||||
print(f"📝 Saved to {config_path}: {saved_keys}")
|
||||
|
||||
|
||||
def main():
|
||||
global CLIENT_ID, CLIENT_SECRET
|
||||
|
||||
# 1. Start Setup Wizard if credentials missing
|
||||
if not CLIENT_ID or not CLIENT_SECRET:
|
||||
print(
|
||||
"ℹ️ Missing credentials. Starting setup wizard at http://localhost:8765 ..."
|
||||
)
|
||||
print("Please enter your Client ID and Secret in the browser window.")
|
||||
webbrowser.open("http://localhost:8765/setup")
|
||||
|
||||
HTTPServer.allow_reuse_address = True
|
||||
setup_server = HTTPServer(("localhost", 8765), SetupHandler)
|
||||
try:
|
||||
while not SetupHandler.setup_done:
|
||||
setup_server.handle_request()
|
||||
finally:
|
||||
setup_server.server_close()
|
||||
|
||||
CLIENT_ID = SetupHandler.client_id
|
||||
CLIENT_SECRET = SetupHandler.client_secret
|
||||
save_to_env(CLIENT_ID, CLIENT_SECRET)
|
||||
|
||||
# 2. Proceed to Strava OAuth
|
||||
auth_url = (
|
||||
f"https://www.strava.com/oauth/authorize"
|
||||
f"?client_id={CLIENT_ID}"
|
||||
@@ -137,69 +281,38 @@ def main():
|
||||
f"&scope={SCOPES}"
|
||||
)
|
||||
|
||||
# Configure handler
|
||||
CallbackHandler.client_id = CLIENT_ID
|
||||
CallbackHandler.client_secret = CLIENT_SECRET
|
||||
CallbackHandler.tokens = {}
|
||||
CallbackHandler.error = None
|
||||
CallbackHandler.config_path = str(get_config_file())
|
||||
|
||||
print("=" * 60)
|
||||
print("\n" + "=" * 60)
|
||||
print(" Strava OAuth2 Authorization")
|
||||
print("=" * 60)
|
||||
print(f"\nRequesting scopes: {SCOPES}\n")
|
||||
print("Opening Strava in your browser...")
|
||||
print("If the browser doesn't open, visit this URL manually:\n")
|
||||
print(f" {auth_url}\n")
|
||||
print("\nOpening Strava in your browser for final authentication...")
|
||||
|
||||
webbrowser.open(auth_url)
|
||||
|
||||
print("Waiting for callback on http://localhost:8765 ...")
|
||||
HTTPServer.allow_reuse_address = True
|
||||
server = HTTPServer(("localhost", 8765), CallbackHandler)
|
||||
server.handle_request() # Handle exactly one request (the callback)
|
||||
|
||||
if CallbackHandler.error:
|
||||
print(f"❌ Token exchange failed: {CallbackHandler.error}")
|
||||
return
|
||||
|
||||
if not CallbackHandler.tokens:
|
||||
print("❌ No tokens received.")
|
||||
return
|
||||
|
||||
data = CallbackHandler.tokens
|
||||
refresh_token = data["refresh_token"]
|
||||
athlete = data.get("athlete", {})
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print(" ✅ Authorization successful!")
|
||||
print("=" * 60)
|
||||
print(f"\nAthlete: {athlete.get('firstname')} {athlete.get('lastname')}")
|
||||
print(f"Scopes granted: {data.get('scope', 'unknown')}\n")
|
||||
print("Add the following to your .env file:")
|
||||
print("-" * 40)
|
||||
print(f"STRAVA_CLIENT_ID={CLIENT_ID}")
|
||||
print(f"STRAVA_CLIENT_SECRET={CLIENT_SECRET}")
|
||||
print(f"STRAVA_REFRESH_TOKEN={refresh_token}")
|
||||
print("-" * 40)
|
||||
|
||||
# Optional: Automatically update .env if it exists
|
||||
try:
|
||||
env_path = ".env"
|
||||
if os.path.exists(env_path):
|
||||
with open(env_path, "r") as f:
|
||||
lines = f.readlines()
|
||||
with open(env_path, "w") as f:
|
||||
found = False
|
||||
for line in lines:
|
||||
if line.startswith("STRAVA_REFRESH_TOKEN="):
|
||||
f.write(f"STRAVA_REFRESH_TOKEN={refresh_token}\n")
|
||||
found = True
|
||||
print("Waiting for Strava callback...")
|
||||
while not CallbackHandler.tokens and not CallbackHandler.error:
|
||||
server.handle_request()
|
||||
finally:
|
||||
server.server_close()
|
||||
|
||||
if not CallbackHandler.error and CallbackHandler.tokens:
|
||||
data = CallbackHandler.tokens
|
||||
refresh_token = data.get("refresh_token")
|
||||
if refresh_token:
|
||||
save_to_env(CLIENT_ID, CLIENT_SECRET, refresh_token)
|
||||
print("\n✅ Setup successful! All tokens saved to .env")
|
||||
else:
|
||||
f.write(line)
|
||||
if not found:
|
||||
f.write(f"\nSTRAVA_REFRESH_TOKEN={refresh_token}\n")
|
||||
print("Successfully updated your .env file!")
|
||||
except Exception as e:
|
||||
print(f"Could not automatically update .env: {e}")
|
||||
print("\n❌ Error: No refresh token in response.")
|
||||
elif CallbackHandler.error:
|
||||
print(f"\n❌ Error: {CallbackHandler.error}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -5,10 +5,15 @@ import sys
|
||||
from dotenv import load_dotenv
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
|
||||
from strava_mcp_server.config import get_config_file
|
||||
from strava_mcp_server.strava_client import StravaClient
|
||||
from strava_mcp_server.tools import register_tools
|
||||
|
||||
load_dotenv()
|
||||
# Load credentials: platform config dir first, then local .env (local overrides)
|
||||
load_dotenv(
|
||||
get_config_file()
|
||||
) # ~/Library/Application Support/strava-mcp-server/config.env
|
||||
load_dotenv(override=False) # local .env overrides if present
|
||||
|
||||
|
||||
def validate_credentials() -> None:
|
||||
@@ -58,7 +63,7 @@ def main() -> None:
|
||||
)
|
||||
|
||||
try:
|
||||
mcp._mcp_server.version = importlib.metadata.version("strava-mcp-server")
|
||||
mcp._mcp_server.version = importlib.metadata.version("strava-mcp-server-hnrx")
|
||||
except importlib.metadata.PackageNotFoundError:
|
||||
mcp._mcp_server.version = "dev"
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ from . import segments
|
||||
from . import segment_efforts
|
||||
from . import gear
|
||||
from . import prompts
|
||||
from . import server_info
|
||||
|
||||
|
||||
def register_tools(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
@@ -27,3 +28,4 @@ def register_tools(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
segment_efforts.register(mcp, strava)
|
||||
gear.register(mcp, strava)
|
||||
prompts.register(mcp, strava)
|
||||
server_info.register(mcp, strava)
|
||||
|
||||
@@ -2,7 +2,7 @@ import json
|
||||
from mcp.server.fastmcp import FastMCP, Context
|
||||
from mcp.types import TextContent, Annotations, EmbeddedResource, TextResourceContents
|
||||
from strava_mcp_server.strava_client import StravaClient
|
||||
from strava_mcp_server.utils import format_date_iso, format_date_human
|
||||
from strava_mcp_server.utils import format_date_human
|
||||
|
||||
|
||||
def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
@@ -28,34 +28,20 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
]
|
||||
location = ", ".join(location_parts) if location_parts else "N/A"
|
||||
|
||||
essential_data = {
|
||||
"id": athlete.get("id"),
|
||||
"username": athlete.get("username"),
|
||||
"name": f"{athlete.get('firstname')} {athlete.get('lastname')}".strip(),
|
||||
"location": location,
|
||||
"sex": athlete.get("sex"),
|
||||
"weight": athlete.get("weight"),
|
||||
"measurement_units": athlete.get("measurement_preference"),
|
||||
"is_premium": athlete.get("premium", False),
|
||||
"profile_medium": athlete.get("profile_medium"),
|
||||
"created_at": format_date_iso(athlete.get("created_at")),
|
||||
"updated_at": format_date_iso(athlete.get("updated_at")),
|
||||
"bio": athlete.get("bio"),
|
||||
"follower_count": athlete.get("follower_count"),
|
||||
"friend_count": athlete.get("friend_count"),
|
||||
}
|
||||
|
||||
full_name = (
|
||||
f"{athlete.get('firstname', '')} {athlete.get('lastname', '')}".strip()
|
||||
)
|
||||
markdown_summary = f"""
|
||||
👤 **Profile for {essential_data["name"]}** (ID: {essential_data["id"]})
|
||||
- Username: {essential_data["username"] or "N/A"}
|
||||
- Location: {essential_data["location"]}
|
||||
- Sex: {essential_data["sex"] or "N/A"}
|
||||
- Weight: {essential_data["weight"] or "N/A"} kg
|
||||
- Measurement Units: {essential_data["measurement_units"] or "N/A"}
|
||||
- Strava Summit Member: {"Yes" if essential_data["is_premium"] else "No"}
|
||||
- Profile Image (Medium): {essential_data["profile_medium"] or "N/A"}
|
||||
- Joined Strava: {format_date_human(essential_data["created_at"])}
|
||||
- Last Updated: {format_date_human(essential_data["updated_at"])}
|
||||
👤 **Profile for {full_name}** (ID: {athlete.get("id")})
|
||||
- Username: {athlete.get("username") or "N/A"}
|
||||
- Location: {location}
|
||||
- Sex: {athlete.get("sex") or "N/A"}
|
||||
- Weight: {athlete.get("weight") or "N/A"} kg
|
||||
- Measurement Units: {athlete.get("measurement_preference") or "N/A"}
|
||||
- Strava Summit Member: {"Yes" if athlete.get("premium") else "No"}
|
||||
- Profile Image (Medium): {athlete.get("profile_medium") or "N/A"}
|
||||
- Joined Strava: {format_date_human(athlete.get("created_at"))}
|
||||
- Last Updated: {format_date_human(athlete.get("updated_at"))}
|
||||
""".strip()
|
||||
|
||||
return [
|
||||
@@ -69,7 +55,7 @@ def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
resource=TextResourceContents(
|
||||
uri="internal://athlete/profile",
|
||||
mimeType="application/json",
|
||||
text=json.dumps(essential_data, indent=2),
|
||||
text=json.dumps(athlete, indent=2),
|
||||
),
|
||||
annotations=Annotations(audience=["assistant"]),
|
||||
),
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
"""
|
||||
Server Info Tool
|
||||
|
||||
Exposes server version, capabilities, and metadata as an MCP tool
|
||||
so that LLM clients can query the server's current state.
|
||||
"""
|
||||
|
||||
import importlib.metadata
|
||||
import os
|
||||
from datetime import datetime, timezone
|
||||
|
||||
from mcp.server.fastmcp import FastMCP
|
||||
from mcp.types import EmbeddedResource, TextResourceContents
|
||||
|
||||
from strava_mcp_server.strava_client import StravaClient
|
||||
|
||||
|
||||
def _get_version() -> str:
|
||||
try:
|
||||
return importlib.metadata.version("strava-mcp-server-hnrx")
|
||||
except importlib.metadata.PackageNotFoundError:
|
||||
return "dev"
|
||||
|
||||
|
||||
def register(mcp: FastMCP, strava: StravaClient) -> None:
|
||||
|
||||
@mcp.tool(
|
||||
name="get_server_info",
|
||||
description=(
|
||||
"Returns metadata about this MCP server instance: version, available tools, "
|
||||
"transport mode, and connection status. Call this first to understand the "
|
||||
"server's capabilities and current configuration."
|
||||
),
|
||||
)
|
||||
async def get_server_info() -> list:
|
||||
version = _get_version()
|
||||
transport = os.getenv("MCP_TRANSPORT", "stdio")
|
||||
host = os.getenv("HOST", "0.0.0.0")
|
||||
port = os.getenv("PORT", "8000")
|
||||
has_token = bool(os.getenv("STRAVA_REFRESH_TOKEN"))
|
||||
queried_at = datetime.now(timezone.utc).isoformat()
|
||||
|
||||
# Human-readable summary
|
||||
status = (
|
||||
"✅ Authenticated" if has_token else "⚠️ Unauthenticated (no REFRESH_TOKEN)"
|
||||
)
|
||||
endpoint = f"http://{host}:{port}/mcp" if transport == "http" else "stdio"
|
||||
|
||||
markdown = f"""## Strava MCP Server
|
||||
|
||||
| Field | Value |
|
||||
|---------------|-------------------------------|
|
||||
| **Version** | `{version}` |
|
||||
| **Transport** | `{transport}` → `{endpoint}` |
|
||||
| **Status** | {status} |
|
||||
| **Queried** | {queried_at} |
|
||||
|
||||
### Available Tool Categories
|
||||
- 🏃 **Athlete** – Profile, stats, heart rate zones
|
||||
- 🚴 **Activities** – List, detail, laps, streams, comments
|
||||
- 🏆 **Segments** – Popular segments, starred segments, efforts
|
||||
- 🛣️ **Routes** – Athlete routes
|
||||
- 🏟️ **Clubs** – Membership, club activities
|
||||
- ⚙️ **Gear** – Bikes and shoes with mileage
|
||||
|
||||
### Quick Links
|
||||
- [Repository](https://git.hnrx.net/hnrx/strava-mcp-server)
|
||||
- [Website](https://strava-mcp.web.s3.hnrx.net)
|
||||
- [PyPI](https://pypi.org/project/strava-mcp-server-hnrx/)
|
||||
"""
|
||||
|
||||
data = {
|
||||
"server": "strava-mcp-server-hnrx",
|
||||
"version": version,
|
||||
"transport": transport,
|
||||
"endpoint": endpoint,
|
||||
"authenticated": has_token,
|
||||
"queried_at": queried_at,
|
||||
"tool_categories": [
|
||||
"athlete",
|
||||
"activities",
|
||||
"segments",
|
||||
"routes",
|
||||
"clubs",
|
||||
"gear",
|
||||
],
|
||||
"links": {
|
||||
"repository": "https://git.hnrx.net/hnrx/strava-mcp-server",
|
||||
"website": "https://strava-mcp.web.s3.hnrx.net",
|
||||
"pypi": "https://pypi.org/project/strava-mcp-server-hnrx/",
|
||||
},
|
||||
}
|
||||
|
||||
import json
|
||||
|
||||
return [
|
||||
{"type": "text", "text": markdown},
|
||||
EmbeddedResource(
|
||||
type="resource",
|
||||
resource=TextResourceContents(
|
||||
uri="strava://server/info",
|
||||
mimeType="application/json",
|
||||
text=json.dumps(data, indent=2),
|
||||
),
|
||||
),
|
||||
]
|
||||
@@ -893,7 +893,7 @@ wheels = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "strava-mcp-server"
|
||||
name = "strava-mcp-server-hnrx"
|
||||
source = { editable = "." }
|
||||
dependencies = [
|
||||
{ name = "fastapi" },
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 749 KiB |
@@ -0,0 +1,230 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Strava MCP Server | Modern Training Data Access</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="bg-gradient"></div>
|
||||
|
||||
<div class="container">
|
||||
<nav>
|
||||
<div class="logo">STRAVA<span>MCP</span></div>
|
||||
<ul class="nav-links">
|
||||
<li><a href="#features" data-i18n="nav-features">Features</a></li>
|
||||
<li><a href="#architecture" data-i18n="nav-arch">Architecture</a></li>
|
||||
<li><a href="#installation" data-i18n="nav-install">Installation</a></li>
|
||||
<li><a href="https://git.hnrx.net/hnrx/strava-mcp-server" data-i18n="nav-repo">GitHub</a></li>
|
||||
</ul>
|
||||
<div class="lang-switch">
|
||||
<button class="lang-btn active" onclick="setLanguage('en')">EN</button>
|
||||
<button class="lang-btn" onclick="setLanguage('de')">DE</button>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<header class="hero">
|
||||
<img src="assets/hero.png" alt="Futuristic Background" class="hero-img">
|
||||
<h1 data-i18n="hero-title">Empower your AI with Strava Data.</h1>
|
||||
<p data-i18n="hero-subtitle">A production-ready Model Context Protocol (MCP) server that exposes the Strava
|
||||
API for AI agents and LLMs.</p>
|
||||
<div class="btn-group">
|
||||
<a href="https://git.hnrx.net/hnrx/strava-mcp-server" class="btn btn-primary" data-i18n="btn-start">Get
|
||||
Started</a>
|
||||
<a href="#architecture" class="btn btn-secondary" data-i18n="btn-more">Learn More</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section id="features">
|
||||
<div class="section-title">
|
||||
<h2 data-i18n="features-title">Features</h2>
|
||||
<p data-i18n="features-subtitle">Comprehensive access to your training data through standardized MCP
|
||||
tools.</p>
|
||||
</div>
|
||||
<div class="grid">
|
||||
<div class="card">
|
||||
<span class="card-icon">👤</span>
|
||||
<h3 data-i18n="feat-1-t">Athlete Profiles</h3>
|
||||
<p data-i18n="feat-1-d">Detailed profiles, heart rate zones, and power stats for personalized
|
||||
analysis.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<span class="card-icon">🚴</span>
|
||||
<h3 data-i18n="feat-2-t">Activity Deep-Dive</h3>
|
||||
<p data-i18n="feat-2-d">Access laps, streams, comments, and detailed segment efforts.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<span class="card-icon">📍</span>
|
||||
<h3 data-i18n="feat-3-t">Segments & Routes</h3>
|
||||
<p data-i18n="feat-3-d">Explore popular segments and your saved routes with all metadata.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<span class="card-icon">⚙️</span>
|
||||
<h3 data-i18n="feat-4-t">Hardware Tracking</h3>
|
||||
<p data-i18n="feat-4-d">Manage your equipment and track the mileage of your bikes and shoes.</p>
|
||||
</div>
|
||||
<div class="card">
|
||||
<span class="card-icon">🪄</span>
|
||||
<h3 data-i18n="feat-5-t">Interactive Onboarding</h3>
|
||||
<p data-i18n="feat-5-d">Zero configuration needed. Our guided wizard sets up your API access in minutes.</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="architecture" class="architecture">
|
||||
<div>
|
||||
<h2 data-i18n="arch-title">Dual-Output Architecture</h2>
|
||||
<p data-i18n="arch-p">Optimized for both humans and machines. Every tool delivers two outputs:</p>
|
||||
<br>
|
||||
<ul style="list-style: none; color: var(--text-dim);">
|
||||
<li style="margin-bottom: 1rem;"><strong style="color: var(--primary);" data-i18n="arch-user-t">User
|
||||
Content:</strong> <span data-i18n="arch-user-d">Formatted markdown for an aesthetic display
|
||||
in the chat.</span></li>
|
||||
<li><strong style="color: #fff;" data-i18n="arch-llm-t">Assistant Resource:</strong> <span
|
||||
data-i18n="arch-llm-d">Structured JSON for precise data processing by the LLM.</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="code-window">
|
||||
<div class="code-header">
|
||||
<div class="dot red"></div>
|
||||
<div class="dot yellow"></div>
|
||||
<div class="dot green"></div>
|
||||
</div>
|
||||
<div class="code-content">
|
||||
<pre>
|
||||
<span class="comment">// JSON Resource for Assistant</span>
|
||||
{
|
||||
<span class="keyword">"id"</span>: <span class="string">"12345678"</span>,
|
||||
<span class="keyword">"name"</span>: <span class="string">"Morning Ride"</span>,
|
||||
<span class="keyword">"distance"</span>: <span class="string">"45200"</span>,
|
||||
<span class="keyword">"moving_time"</span>: <span class="string">"5400"</span>,
|
||||
<span class="keyword">"audience"</span>: [<span class="string">"assistant"</span>]
|
||||
}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="installation" class="quick-start">
|
||||
<h2 data-i18n="install-title">Quick Start</h2>
|
||||
<p data-i18n="install-p">Get started in seconds with our interactive onboarding wizard.</p>
|
||||
|
||||
<div class="terminal">
|
||||
<span class="comment"># 1. Authenticate & Setup</span>
|
||||
<span>$</span> <code data-i18n="install-auth">uvx --from strava-mcp-server-hnrx auth</code>
|
||||
<br><br>
|
||||
<span class="comment"># 2. Run the Server</span>
|
||||
<span>$</span> <code data-i18n="install-cmd">uvx --from strava-mcp-server-hnrx server</code>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 2rem; text-align: center;">
|
||||
<a href="https://git.hnrx.net/hnrx/strava-mcp-server" class="btn btn-secondary" style="font-size: 0.9rem;" data-i18n="btn-docs">View full Documentation</a>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<footer>
|
||||
<p>© 2024 Strava MCP Server. Build for high-performance AI Agents.</p>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const translations = {
|
||||
en: {
|
||||
"nav-features": "Features",
|
||||
"nav-arch": "Architecture",
|
||||
"nav-install": "Installation",
|
||||
"nav-repo": "Source",
|
||||
"hero-title": "Empower your AI with Strava Data.",
|
||||
"hero-subtitle": "A production-ready Model Context Protocol (MCP) server that exposes the Strava API for AI agents and LLMs.",
|
||||
"btn-start": "Get Started",
|
||||
"btn-more": "Learn More",
|
||||
"btn-docs": "View full Documentation",
|
||||
"features-title": "Features",
|
||||
"features-subtitle": "Comprehensive access to your training data through standardized MCP tools.",
|
||||
"feat-1-t": "Athlete Profiles",
|
||||
"feat-1-d": "Detailed profiles, heart rate zones, and power stats for personalized analysis.",
|
||||
"feat-2-t": "Activity Deep-Dive",
|
||||
"feat-2-d": "Access laps, streams, comments, and detailed segment efforts.",
|
||||
"feat-3-t": "Segments & Routes",
|
||||
"feat-3-d": "Explore popular segments and your saved routes with all metadata.",
|
||||
"feat-4-t": "Hardware Tracking",
|
||||
"feat-4-d": "Manage your equipment and track the mileage of your bikes and shoes.",
|
||||
"feat-5-t": "Interactive Onboarding",
|
||||
"feat-5-d": "Zero configuration needed. Our guided wizard sets up your API access in minutes.",
|
||||
"arch-title": "Dual-Output Architecture",
|
||||
"arch-p": "Optimized for both humans and machines. Every tool delivers two outputs:",
|
||||
"arch-user-t": "User Content:",
|
||||
"arch-user-d": "Formatted markdown for an aesthetic display in the chat.",
|
||||
"arch-llm-t": "Assistant Resource:",
|
||||
"arch-llm-d": "Structured JSON for precise data processing by the LLM.",
|
||||
"install-title": "Quick Start",
|
||||
"install-p": "Get started in seconds with our interactive onboarding wizard.",
|
||||
"install-auth": "uvx --from strava-mcp-server-hnrx auth",
|
||||
"install-cmd": "uvx --from strava-mcp-server-hnrx server"
|
||||
},
|
||||
de: {
|
||||
"nav-features": "Funktionen",
|
||||
"nav-arch": "Architektur",
|
||||
"nav-install": "Installation",
|
||||
"nav-repo": "Quellcode",
|
||||
"hero-title": "Analysiere deine Strava-Daten mit KI-Power.",
|
||||
"hero-subtitle": "Ein produktionsreifer Model Context Protocol (MCP) Server, der die Strava API für AI Agents und LLMs nutzbar macht.",
|
||||
"btn-start": "Loslegen",
|
||||
"btn-more": "Mehr erfahren",
|
||||
"btn-docs": "Gesamte Dokumentation",
|
||||
"features-title": "Funktionen",
|
||||
"features-subtitle": "Umfangreicher Zugriff auf deine Trainingsdaten über standardisierte MCP Tools.",
|
||||
"feat-1-t": "Athleten-Profile",
|
||||
"feat-1-d": "Detaillierte Profile, Herzfrequenz-Zonen und Power-Stats für personalisierte Analysen.",
|
||||
"feat-2-t": "Aktivitäts-Analyse",
|
||||
"feat-2-d": "Zugriff auf Laps, Streams, Kommentare und detaillierte Segment-Efforts.",
|
||||
"feat-3-t": "Segmente & Routen",
|
||||
"feat-3-d": "Erkunde beliebte Segmente und deine gespeicherten Routen mit allen Metadaten.",
|
||||
"feat-4-t": "Hardware-Tracking",
|
||||
"feat-4-d": "Verwalte deine Ausrüstung und verfolge die Laufleistung deiner Bikes und Schuhe.",
|
||||
"feat-5-t": "Interaktives Onboarding",
|
||||
"feat-5-d": "Keine manuelle Konfiguration nötig. Unser Wizard richtet deinen API-Zugang in Minuten ein.",
|
||||
"arch-title": "Dual-Output Architektur",
|
||||
"arch-p": "Optimiert für Mensch und Maschine. Jedes Tool liefert zwei Ausgaben:",
|
||||
"arch-user-t": "User Content:",
|
||||
"arch-user-d": "Formatiertes Markdown für eine ästhetische Anzeige im Chat.",
|
||||
"arch-llm-t": "Assistant Resource:",
|
||||
"arch-llm-d": "Strukturiertes JSON für präzise Datenverarbeitung durch das LLM.",
|
||||
"install-title": "Schnellstart",
|
||||
"install-p": "Starte in Sekunden mit unserem interaktiven Onboarding-Wizard.",
|
||||
"install-auth": "uvx --from strava-mcp-server-hnrx auth",
|
||||
"install-cmd": "uvx --from strava-mcp-server-hnrx server"
|
||||
}
|
||||
};
|
||||
|
||||
function setLanguage(lang) {
|
||||
localStorage.setItem('preferredLang', lang);
|
||||
|
||||
// Update all text elements
|
||||
document.querySelectorAll('[data-i18n]').forEach(el => {
|
||||
const key = el.getAttribute('data-i18n');
|
||||
if (translations[lang][key]) {
|
||||
el.textContent = translations[lang][key];
|
||||
}
|
||||
});
|
||||
|
||||
// Update toggle buttons
|
||||
document.querySelectorAll('.lang-btn').forEach(btn => {
|
||||
btn.classList.remove('active');
|
||||
if (btn.textContent.toLowerCase() === lang) {
|
||||
btn.classList.add('active');
|
||||
}
|
||||
});
|
||||
|
||||
document.documentElement.lang = lang;
|
||||
}
|
||||
|
||||
// Initialize from storage or browser language
|
||||
const savedLang = localStorage.getItem('preferredLang') || (navigator.language.startsWith('de') ? 'de' : 'en');
|
||||
setLanguage(savedLang);
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,325 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');
|
||||
|
||||
:root {
|
||||
--primary: #FC4C02;
|
||||
--primary-glow: rgba(252, 76, 2, 0.4);
|
||||
--bg-dark: #0A0A0A;
|
||||
--bg-card: rgba(255, 255, 255, 0.05);
|
||||
--text-main: #FFFFFF;
|
||||
--text-dim: #A0A0A0;
|
||||
--glass-border: rgba(255, 255, 255, 0.1);
|
||||
--transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
|
||||
}
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: 'Outfit', sans-serif;
|
||||
background-color: var(--bg-dark);
|
||||
color: var(--text-main);
|
||||
line-height: 1.6;
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
/* Background Effects */
|
||||
.bg-gradient {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: radial-gradient(circle at 80% 20%, #1a100a 0%, transparent 40%),
|
||||
radial-gradient(circle at 10% 80%, #0d0a14 0%, transparent 40%);
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
/* Layout */
|
||||
.container {
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
padding: 0 2rem;
|
||||
}
|
||||
|
||||
/* Navigation */
|
||||
nav {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 2rem 0;
|
||||
backdrop-filter: blur(10px);
|
||||
position: sticky;
|
||||
top: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
.logo {
|
||||
font-size: 1.5rem;
|
||||
font-weight: 800;
|
||||
letter-spacing: -1px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.logo span {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.nav-links {
|
||||
display: flex;
|
||||
gap: 2.5rem;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.nav-links a {
|
||||
color: var(--text-dim);
|
||||
text-decoration: none;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.nav-links a:hover {
|
||||
color: var(--primary);
|
||||
}
|
||||
|
||||
.lang-switch {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
padding: 0.25rem;
|
||||
border-radius: 100px;
|
||||
border: 1px solid var(--glass-border);
|
||||
}
|
||||
|
||||
.lang-btn {
|
||||
padding: 0.4rem 0.8rem;
|
||||
border-radius: 100px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
background: transparent;
|
||||
color: var(--text-dim);
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.lang-btn.active {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
}
|
||||
|
||||
/* Hero Section */
|
||||
.hero {
|
||||
padding: 8rem 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.hero-img {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
width: 140%;
|
||||
opacity: 0.15;
|
||||
pointer-events: none;
|
||||
z-index: -1;
|
||||
}
|
||||
|
||||
.hero h1 {
|
||||
font-size: 5rem;
|
||||
font-weight: 800;
|
||||
line-height: 1.1;
|
||||
margin-bottom: 1.5rem;
|
||||
background: linear-gradient(to bottom, #fff 40%, #888);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
}
|
||||
|
||||
.hero p {
|
||||
font-size: 1.25rem;
|
||||
color: var(--text-dim);
|
||||
max-width: 600px;
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
display: flex;
|
||||
gap: 1.5rem;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 1rem 2.5rem;
|
||||
border-radius: 100px;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
transition: var(--transition);
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: var(--primary);
|
||||
color: white;
|
||||
box-shadow: 0 10px 30px var(--primary-glow);
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 15px 40px var(--primary-glow);
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
color: white;
|
||||
border: 1px solid var(--glass-border);
|
||||
backdrop-filter: blur(10px);
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
|
||||
/* Features Grid */
|
||||
.section-title {
|
||||
text-align: center;
|
||||
margin-bottom: 4rem;
|
||||
}
|
||||
|
||||
.section-title h2 {
|
||||
font-size: 3rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
|
||||
gap: 2rem;
|
||||
margin-bottom: 8rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--bg-card);
|
||||
border: 1px solid var(--glass-border);
|
||||
padding: 3rem;
|
||||
border-radius: 2rem;
|
||||
transition: var(--transition);
|
||||
backdrop-filter: blur(20px);
|
||||
}
|
||||
|
||||
.card:hover {
|
||||
border-color: var(--primary);
|
||||
transform: translateY(-10px);
|
||||
background: rgba(252, 76, 2, 0.03);
|
||||
}
|
||||
|
||||
.card-icon {
|
||||
font-size: 2.5rem;
|
||||
margin-bottom: 1.5rem;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.card h3 {
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.card p {
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
/* Code Preview Section */
|
||||
.architecture {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 4rem;
|
||||
align-items: center;
|
||||
margin-bottom: 8rem;
|
||||
background: rgba(255, 255, 255, 0.02);
|
||||
padding: 4rem;
|
||||
border-radius: 3rem;
|
||||
border: 1px solid var(--glass-border);
|
||||
}
|
||||
|
||||
.code-window {
|
||||
background: #000;
|
||||
border-radius: 1rem;
|
||||
overflow: hidden;
|
||||
border: 1px solid var(--glass-border);
|
||||
box-shadow: 0 30px 60px rgba(0,0,0,0.5);
|
||||
}
|
||||
|
||||
.code-header {
|
||||
background: #1A1A1A;
|
||||
padding: 0.75rem 1rem;
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.dot {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.red { background: #FF5F56; }
|
||||
.yellow { background: #FFBD2E; }
|
||||
.green { background: #27C93F; }
|
||||
|
||||
.code-content {
|
||||
padding: 1.5rem;
|
||||
font-family: 'Monaco', 'Consolas', monospace;
|
||||
font-size: 0.85rem;
|
||||
color: #f8f8f2;
|
||||
}
|
||||
|
||||
.code-content pre {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.keyword { color: #ff79c6; }
|
||||
.string { color: #f1fa8c; }
|
||||
.comment { color: #6272a4; }
|
||||
|
||||
/* Quick Start */
|
||||
.quick-start {
|
||||
text-align: center;
|
||||
max-width: 800px;
|
||||
margin: 0 auto 8rem;
|
||||
}
|
||||
|
||||
.terminal {
|
||||
background: #111;
|
||||
padding: 1.5rem 2rem;
|
||||
border-radius: 1rem;
|
||||
font-family: monospace;
|
||||
margin-top: 2rem;
|
||||
display: inline-block;
|
||||
border: 1px solid var(--glass-border);
|
||||
}
|
||||
|
||||
.terminal span {
|
||||
color: var(--primary);
|
||||
margin-right: 1rem;
|
||||
}
|
||||
|
||||
footer {
|
||||
padding: 4rem 0;
|
||||
border-top: 1px solid var(--glass-border);
|
||||
text-align: center;
|
||||
color: var(--text-dim);
|
||||
}
|
||||
|
||||
/* Mobile Responsiveness */
|
||||
@media (max-width: 768px) {
|
||||
.hero h1 { font-size: 3rem; }
|
||||
.architecture { grid-template-columns: 1fr; padding: 2rem; }
|
||||
.nav-links { display: none; }
|
||||
}
|
||||
Reference in New Issue
Block a user