# Garmin Connect (treinos) — how to use (mcp.ai)

Listar, obter, criar, editar (substituir), apagar e agendar treinos estruturados no Garmin Connect (corrida, ciclismo, natação, multi-sport / triatlo). Usa a API não oficial via sessão Garmin (email + senha); tokens OAuth são guardados encriptados para reduzir logins.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_garmin?ms=1781045220000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `garmin_delete_workout`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/garmin`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/garmin/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/garmin/delete/workout` — Delete a workout template from Garmin Connect by workout_id.
  - body: { workout_id: string, account?: string, workout_ids?: string[] }
- `POST https://api.mcp.ai/api/garmin/edit/workout` — Replace a workout: uploads a new workout from payload, then deletes workout_id (no native PUT). Returns new workout_id and previous_workout_id.
  - body: { workout_id: string, workout: object, account?: string, workout_ids?: string[] }
- `POST https://api.mcp.ai/api/garmin/get/scheduled/workout` — Get one scheduled workout entry by scheduled_workout_id.
  - body: { scheduled_workout_id: string, account?: string, scheduled_workout_ids?: string[] }
- `POST https://api.mcp.ai/api/garmin/get/workout` — Get one workout template by workout_id (full structure: segments, steps, targets). Includes raw_data JSON string.
  - body: { workout_id: string, account?: string, workout_ids?: string[] }
- `POST https://api.mcp.ai/api/garmin/list/accounts` — List all Garmin logins linked to this install (id, email, label, created_at).
  - body: { account?: string }
- `POST https://api.mcp.ai/api/garmin/list/scheduled/workouts` — List calendar scheduled workouts for a given month/year from Garmin calendar-service.
  - body: { year: integer, month: integer, account?: string }
- `POST https://api.mcp.ai/api/garmin/list/workouts` — List saved workouts from Garmin Connect (workout-service). Returns summaries plus raw_data (full JSON string from Garmin).
  - body: { start?: integer, limit?: integer, account?: string }
- `POST https://api.mcp.ai/api/garmin/schedule/workout` — Schedule an existing workout onto the calendar. date must be YYYY-MM-DD (or ISO-8601 date prefix). Returns Garmin schedule response as raw_data.
  - body: { workout_id: string, date: string, account?: string, workout_ids?: string[] }
- `POST https://api.mcp.ai/api/garmin/submit/workout` — Create a new structured workout on Garmin Connect. Body must match Garmin API (workoutName, sportType, workoutSegments with ExecutableStepDTO / RepeatGroupDTO). You may omit displayOrder/displayable e
  - body: { workout: object, account?: string }
- `POST https://api.mcp.ai/api/garmin/unschedule/workout` — Remove workout from calendar by scheduled_workout_id (does not delete the workout template).
  - body: { scheduled_workout_id: string, account?: string, scheduled_workout_ids?: string[] }

## Example prompts
- "Crie um treino de corrida intervalado e agende pra amanhã"
- "Liste meus treinos da próxima semana"
- "Edite o treino de bike de quinta pra um Z2 longo"

## More
- Page: https://mcp.ai/garmin
- Agent spec (llms.txt): https://mcp.ai/garmin/llms.txt
- Postman collection: https://mcp.ai/garmin/postman.json
