livetrack-mcp
livetrack-mcp
Garmin LiveTrackをポーリングし、時系列データをSQLiteに保存し、claude-runnerを介して10分ごとにClaude分析をトリガーする自律型MCPサーバー。
アーキテクチャ
Garmin LiveTrack URL
│
│ (poll every 60 s)
▼
livetrack-mcp (port 38100)
├── poller.py — fetch trackpoints from Garmin API
├── store.py — SQLite time-series persistence (/data/livetrack.db)
├── tracker.py — asyncio scheduling + race-end detection
└── analyzer.py — build prompt, call claude-runner
│
│ POST /run (fire-and-forget)
▼
claude-runner (port 38095)
│
│ claude -p <analysis prompt>
▼
Claude (sonnet)
├── analyze timeseries
├── curl POST /control if thresholds need adjustment
└── mcp__telegram__send_message → coaching push主要な設計: livetrack-mcpは完全に自律的です。レース中にClaudeのセッションを維持する必要はありません。Claudeは10分ごとにステートレスな分析関数として呼び出されます。claude-runnerが一時的に利用できない場合、次の分析サイクルで自動的に再試行されます。
Related MCP server: Garmin-Strava-mcp
MCPツール
ツール | 説明 |
| LiveTrack共有URLのポーリングを開始 |
| ポーリングを停止(レース終了時にも自動停止) |
| アクティブ状態、経過時間、スタール時間、ポーリングエラー |
| SQLiteからの最近のデータ |
| レース中にHR/パワーのしきい値を更新 |
| スケジュールをバイパスして手動で分析をトリガー |
カスタムHTTPエンドポイント
エンドポイント | メソッド | 説明 |
| POST | レース中にしきい値を更新(Bashツールのcurl経由でClaudeが呼び出し) |
| GET | ヘルスチェック — トラッキング状態 + ストア統計 |
/control の使用方法(Claudeの分析プロンプトから)
curl -sf -X POST http://localhost:38100/control \
-H 'Content-Type: application/json' \
-d '{"power_max": 150}'許可されるフィールド: hr_max, hr_min, power_max, power_min, cadence_min, run_hr_max, run_hr_min, run_cadence_min
race_config フィールド
フィールド | 型 | デフォルト | 説明 |
| int | — | サイクリングHR上限 (bpm) |
| int | — | サイクリングHR下限 |
| int | — | ERGパワー上限 (watts) |
| int | — | ERGパワー下限 |
| int | — | 最低サイクリングケイデンス (rpm) |
| int | — | ランニングHR上限 |
| int | — | ランニングHR下限 |
| int | — | 最低ランニングケイデンス (spm) |
| int | 60 | LiveTrackをポーリングする頻度 |
| int | 600 | Claude分析をトリガーする頻度 |
| int | 10 | Claudeに渡されるデータウィンドウ(分) |
トライアスロンのフルレース用 race_config の例
{
"race_name": "CT2026",
"race_type": "triathlon",
"hr_max": 144,
"hr_min": 115,
"power_max": 165,
"cadence_min": 82,
"run_hr_max": 152,
"run_hr_min": 125,
"run_cadence_min": 165,
"poll_interval_secs": 60,
"analyze_interval_secs": 600,
"analyze_window_min": 10
}レース終了検知
サーバーは以下の場合に自動停止します:
15分以上新しいトラックポイントがない場合 (
STALE_STOP_MIN)かつ、合計経過時間が30分以上の場合 (
MIN_ELAPSED_MIN)
これはGarminの24時間URL遅延を処理するためのものです。URLはレース後も有効ですが、アスリートが終了すると新しいトラックポイントの到着が止まります。30分という最小時間は、GPSデータが少ない開始時の誤停止を防ぎます。
設定(環境変数)
変数 | デフォルト | 説明 |
|
| サーバーポート |
|
| バインドアドレス |
|
| MCPエンドポイントパス |
|
| SQLiteデータベースパス |
|
| claude-runnerベースURL |
|
| claude-runnerタスク用ワークスペース |
|
| ログレベル |
| — | OpenTelemetryコレクターURL(オプション) |
デプロイメント
cd ~/ai-platform/mcps
# Build and start
docker compose up -d --build livetrack-mcp
# Logs
docker compose logs -f livetrack-mcp
# Restart
docker compose restart livetrack-mcp
# Health check
curl http://localhost:38100/health一般的なセッション(トレーニングワークスペースのClaude経由)
# Start tracking
use_mcp_tool livetrack-mcp start_tracking \
url="https://livetrack.garmin.com/session/.../token/..." \
race_config={"hr_max": 144, "power_max": 165, "run_hr_max": 152}
# Check status
use_mcp_tool livetrack-mcp get_tracking_status
# Manual analysis trigger
use_mcp_tool livetrack-mcp trigger_analysis
# Stop (or let it auto-stop)
use_mcp_tool livetrack-mcp stop_trackingプロジェクト構造
livetrack_mcp/
├── Dockerfile
├── pyproject.toml
├── README.md
└── src/livetrack_mcp/
├── __init__.py
├── __main__.py
├── otel.py # OpenTelemetry setup
├── poller.py # Garmin LiveTrack URL parsing + HTTP fetch
├── store.py # SQLite time-series (sqlite3 + asyncio.to_thread)
├── tracker.py # Scheduling (asyncio.create_task) + race-end detection
├── analyzer.py # Prompt builder + claude-runner caller
└── server.py # FastMCP tools + /control + /healthTool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Adaptive running coach MCP server: training data, plans, and recovery for AI assistants.
tri-train is a training platform for triathletes that syncs activities from Strava and Garmin and exposes them to Claude through a remote MCP server. Ask Claude how your last block went, why your run pace dropped, or whether you are fresh enough for Sunday's race, and it answers from your real data: activities with laps and grade-adjusted pace, weekly load and the performance management chart (CTL/ATL/TSB), sleep, HRV and resting heart rate, and your race calendar with predictions. Claude can also act: create and adjust planned workouts with structured intervals, push them to your Garmin watch, add races and write notes. Every change is journaled and can be undone. Read and write access are separate OAuth scopes, and the server enforces them on every call. Built and hosted in Switzerland by a triathlete; data stays on our own servers (Swiss revDSG / GDPR).
Your own Garmin data (sleep, HRV, Body Battery, activities) in Claude, ChatGPT and any MCP app.
Garmin data in Claude: 135 tools — activities, sleep, HRV, training, workouts. Free, open source.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server that connects Garmin Connect data to Claude, enabling training analysis, recovery checks, and personalized plans based on real metrics like HRV, training load, and activities.26MIT
- FlicenseNot gradedqualityDmaintenanceMCP server that gives Claude access to real-time Garmin Connect and Strava data for analyzing training and suggesting sessions.-
- AlicenseAqualityDmaintenanceLocal MCP server that connects Claude Desktop with Garmin and Apple Health data to read training and recovery, estimate heart rate and pace zones, analyze performance, and create structured workouts.22MIT
- AlicenseAqualityCmaintenanceAn MCP server that transforms Garmin data into compact, verdict-first coaching reports for LLMs, computing metrics like CTL/ATL/TSB and ACWR to answer training readiness questions.1419 PyPIApache 2.0