Server data from the Official MCP Registry
Self-hosted running coach: your Apple Health training data, plans and Apple Watch workouts.
About
Self-hosted running coach: your Apple Health training data, plans and Apple Watch workouts.
Remote endpoints: streamable-http: https://{host}/mcp
Security Report
The Loopback training MCP server is a per-user, token-passthrough coach interface over a self-hosted training API, with consent-based tool filtering and explicit auth via bearer tokens. The visible code shows no exfiltration, shell execution, or hardcoded secrets; the main observations are the broad network_http and env_vars use for the backend API and the 0.0.0.0 HTTP bind option, plus the truncated README and unseen tool implementations that limit full verification. Supply chain analysis found 6 known vulnerabilities in dependencies (1 critical, 1 high severity).
11 files analyzed · 9 issues found
Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.
Permissions Found in Source Code
Found by scanning the linked source code. This listing connects to a hosted endpoint, so none of this runs on your machine: it describes what the server software does where it is hosted.
How to Connect
Remote Plugin
No local installation needed. Your AI client connects to the remote endpoint directly.
Add this to your MCP configuration to connect:
{
"mcpServers": {
"io-github-aderaaij-loopback-training-server": {
"url": "https://{host}/mcp",
"headers": {
"Authorization": "Bearer <YOUR_TOKEN>"
}
}
}
}This server needs this header. Replace each <YOUR_...> placeholder with your own value:
Authorization(optional): A coach token from the dashboard (Settings, AI coach, Connect). Leave it out to sign in with OAuth instead, as Claude and ChatGPT do.
Documentation
View on GitHubFrom the project's GitHub README.
Loopback Server
A self-hosted running coach for Claude, ChatGPT or another AI assistant. The assistant you already use connects to the built-in MCP endpoint and does more than read your data: the training plan it writes becomes structured workouts on your Apple Watch, and each finished run comes back linked to the workout it was planned as. Loopback Server keeps your runs, sleep and recovery data from Apple Health next to your plans, and a web dashboard shows the same data to athletes and admins.
It is the server half of Loopback – Running Coach, an open-source app for iPhone and Apple Watch.
Website: loopback.ardenlab.dev
Built with FastAPI, PostgreSQL, SQLAlchemy, and React. The MCP (Model Context Protocol) endpoint is part of the same container and needs no setup of its own.
This is the server half of a two-part system — you also need the Loopback iOS app. The app is what feeds the server: it syncs Apple HealthKit workouts and daily health metrics to it, and installs queued workouts on Apple Watch. The server runs fine on its own (API, dashboard, MCP), but without the app nothing puts data in or gets workouts onto your watch. The app installs from the public TestFlight beta (iOS 26), or builds from source.
Naming note: this is the companion server for the Loopback running app — no relation to the LoopBack Node.js framework or Rogue Amoeba's Loopback audio tool. The technical name used throughout the codebase (packages, containers, DB) is
training-api.

| Workout detail | Health trends |
|---|---|
![]() | ![]() |
Demo data shown; every screen is scoped to the signed-in athlete.
Features
- MCP server — Built in at
/mcp: let AI assistants query your training data, create workouts and plans, and correlate health metrics via natural language. Claude and ChatGPT connect by signing in with OAuth (paste the address once and approve in the dashboard; for Claude that covers the web, the phone and the desktop app); other tools, and Claude Desktop on a server that is not reachable from the internet, use a token - Workouts onto Apple Watch — Queue structured workouts (intervals, warm-up and cooldown, pace alerts); the Loopback iOS app schedules them on the watch through WorkoutKit
- Workout actions — Edit or delete workouts already synced to Apple Watch via pending action queue
- Workout storage — CRUD API for workouts with activity type, distance, duration, heart rate, splits, and arbitrary JSONB data
- Analytics — Summary endpoints with aggregation by week, month, or year
- Device inventory — Track what workouts are currently on the user's Apple Watch
- Missed workout feedback — Record and query feedback when users miss scheduled workouts, with pattern detection for coaching
- Training plans — Create and manage training plans with goals, guardrails, phases, and athlete context stored as flexible JSONB metadata, plus an explicit completion flow (rating + feedback fed back to the coaching context)
- Scheduling & calendar — Attach a recurring weekly cadence to a plan and query a unified calendar that merges queued runs with scheduled strength sessions, flagging conflicts
- Plan validation — A deterministic "linter" for upcoming schedules: weekly-ramp and taper checks, missing down weeks, back-to-back hard days, guardrail breaches, strength-day collisions — warnings, never blocks (
POST /api/plans/{id}/validate, also returned when queueing) - Health metrics — Bulk upsert daily HealthKit metrics (sleep, HR, HRV, weight, VO2Max, steps, body composition) with date-based upsert
- Nutrition — Daily dietary totals from HealthKit (energy, macros, fiber, sodium, water, caffeine + open-ended micronutrients), and a summary endpoint that aligns intake with body weight and training load per week or month, including protein g/kg — so diet can be read against performance in one query. Only energy and the macros are true daily totals; the rest are lower bounds, because food databases record them on a fraction of entries — the MCP tells the coach so it can't read a sparse sum as a deficiency
- Plan-workout linking — Link queued workouts to plans (
plan_id) and recorded workouts to their planned counterpart (plan_workout_id) for planned-vs-actual analysis - Multi-user — Username/password accounts with per-device API tokens (
POST /api/auth/login); all data is scoped per user. The admin invites people with a link, and each picks their own username and password. The phone app connects by scanning a QR code in the dashboard, with nothing to type - Web dashboard — Authenticated React SPA served same-origin by the API: overview, calendar, workouts, plans, health charts, and queue for athletes; user management and system monitoring for admins
- Admin & monitoring — Per-user token inspection/revoke (cut off one stolen device), sync-freshness per athlete, an auth audit trail (logins, password/token/user changes), and a system screen reporting DB size and backup freshness
Quick Start
Prerequisites
- Docker with Docker Compose v2.24 or newer
1. Clone and configure
git clone https://github.com/aderaaij/loopback-training-server.git
cd loopback-training-server
cp .env.example .env
Everything in .env has a sensible default (the comments in the file explain each one) — for a first install you don't need to edit anything.
2. Start
docker compose up -d # or: make up
The first start pulls a prebuilt multi-arch image from GHCR (amd64/arm64; if the pull fails it builds from source instead, which takes a few minutes — docker compose build forces that) and runs the database migrations. The API and dashboard are then at http://localhost:8001 (verify with curl http://localhost:8001/api/health).
3. Create your admin account
Open http://localhost:8001 — a fresh install greets you with a setup screen. Create the admin account there and you land signed in. Admins get the management console (Users + System); regular accounts get the training dashboard.
For headless or scripted installs, set BOOTSTRAP_ADMIN_PASSWORD in .env before the first start instead — the account is created at boot and the setup screen never appears. Either way, setup closes permanently once the admin has a password; if you ever lock yourself out, recovery is the CLI (docker compose exec app python -m app.cli set-password admin).
4. Add your household
One instance serves a household: a handful of accounts, all data scoped per user, and no open registration — nobody gets an account without the admin.
- As
admin, open Users → Invite someone. You get a link, which you can copy, share, or show as a QR code to someone next to you. It works once and for seven days, and you can withdraw it under Waiting invitations until it is used. The admin account itself has no training screens, so for your own training invite yourself: the dialog has a link that opens the invitation in the browser you are in. - Whoever opens the link picks their own username and password and is signed in to the dashboard at once, on a page that walks them through the next two steps. The admin never sees the password. The link opens the dashboard, so it works where the dashboard does: the device opening it has to be able to reach the server (same network, or your VPN on), and the address in the link is the one your dashboard is open at unless you change it in the dialog. A link to a server their device cannot reach opens nothing at all, not even a page that says why, so check what your way of exposing the server asks of them before you send it: nothing for a public address, a good deal for a tailnet or another VPN (see What each person needs). The dialog reads the address in the link and lists what it can tell from it.
- Each athlete connects the iOS app (TestFlight beta). The quick way is a QR code: in the dashboard, open Settings → Phone app → Show QR code, then tap Scan QR Code on the app's sign-in screen and point it at the screen. Nothing is typed: the app shows the account and the server it is about to connect to, and on your say-so gets a token of its own. The code works once and for five minutes, and the address in it is the one the dashboard is open at, so open the dashboard at an address the phone can reach too (not
localhost), or correct the address shown under the code. Typing the server URL, username and password into the app works as before. - Optional AI-coach access: each athlete connects their own assistant from the dashboard (Settings → AI coach → Connect; see MCP Server).
An account can still be made by hand (Users → Create by hand, where you choose the username and the password and pass them on). That is how another admin is added: an invitation only ever makes an ordinary account.
Passwords, per-device tokens (revoke one stolen device without touching the rest), and deactivation are all managed in the dashboard. Changing or resetting an admin's password, or deactivating that admin, also cancels the invitations they made that are still waiting.
A deactivated account keeps its data and its username and can be reactivated. To remove one for good, deactivate it and then choose Delete on its row: the account goes with everything stored for it, the username becomes free again, and it cannot be undone. Backups made before that still contain the account until newer ones replace them (see Backups).
Creating accounts, setting passwords and making tokens also exist as a CLI fallback:
docker compose exec app python -m app.cli --help
Try it with demo data
Want to see a filled-in dashboard before wiring up your own data? A disposable demo stack ships with the repo — its own compose project, database volume, and port, fully isolated from a real deployment:
docker compose -f docker-compose.demo.yml up -d
python3 scripts/seed_demo.py # stdlib only, no dependencies
The seeder creates a synthetic athlete and ~16 weeks of realistic training through the public API: runs with splits, heart rate, cadence and GPS routes along the Lisbon riverfront, Hevy-style strength sessions, daily health metrics, nutrition logs (deliberately imperfect: a fifth of days unlogged, one week missed, today still in progress), a completed and an active training plan with a strength schedule, queued watch sessions (one skipped, with feedback), and coaching notes. The screenshots above are this data.
Then open http://localhost:8011 and sign in as athlete sofia / sofia-demo (or admin admin / demo-admin for the management console). The seeder also prints an API token you can point an MCP client at.
To put a demo where other people can reach it, see deploy/demo. seed_demo.py --read-only locks the athlete's account once the data is in, so its password can be published: it can be signed in to and looked at, and nothing in it can be changed.
Tear it down (wipes the demo database, touches nothing else):
docker compose -f docker-compose.demo.yml down -v
Exposing the server
The iOS app syncs in the background, so the server has to be reachable from wherever the phone is — over HTTPS, or over HTTP on a network you trust. Dashboard, API and coach (/mcp) all share the one port, so whichever option you pick covers all three.
Built-in HTTPS (a server with a public IP and a domain)
Point a domain's DNS at the server, make sure ports 80 and 443 are open, and add two lines to .env:
COMPOSE_FILE=docker-compose.yml:deploy/https/caddy.yml
DOMAIN=loopback.example.com
Then docker compose up -d. This adds a Caddy container that obtains and renews a Let's Encrypt certificate by itself and serves everything at https://<DOMAIN>. It also closes plain-HTTP port 8001 to everything but the host itself, and makes the server see each client's real address, so the login rate limit applies per client and the audit trail shows who connected.
COMPOSE_FILE replaces Compose's automatic file discovery: if you keep a docker-compose.override.yml, add it to the list (docker-compose.yml:docker-compose.override.yml:deploy/https/caddy.yml). On Windows the separator is ;.
Tailscale (a home server: no domain, no open ports)
Tailscale puts the server on a private network of your own devices (a "tailnet"). The add-on below gives the server a Tailscale device of its own, with HTTPS and a name, and nothing to configure on your router. Add one line to .env:
COMPOSE_FILE=docker-compose.yml:deploy/tailscale/tailscale.yml
Then docker compose up -d, and docker compose logs tailscale: the log shows a link that adds the server to your tailnet. Open it and approve; there is no hurry, the link waits until you use it. (To skip the link, put an auth key in .env as TS_AUTHKEY.) The device is called loopback; set TS_HOSTNAME for another name.
The server then has two entrances, both at loopback.<your-tailnet>.ts.net:
| Address | Who can reach it | What is there |
|---|---|---|
https://loopback.<your-tailnet>.ts.net:8443 | Devices on your tailnet | Everything: dashboard, API (the phone app), coach |
https://loopback.<your-tailnet>.ts.net/mcp | The internet | The coach alone, for assistants that connect from the cloud (claude.ai) |
Install Tailscale on each phone and point the app at the first address.
Adding a person on Tailscale
Everything a person does with the server happens on the first address: opening their invitation, connecting the app, the app's syncing, and signing in to approve an assistant. So each device they use has to get there, and three things have to be true for that:
-
Tailscale on each of their devices, installed, signed in and switched on. That is the phone the app runs on, and whatever they open the invitation on.
-
A place on your tailnet. In the Tailscale admin console, invite them on the Users page, or share the server's device with them from the Machines page (for someone with a tailnet of their own, who then sees that one device and nothing else of yours).
-
Access to the server's device on TCP port 8443. A tailnet starts out letting every device reach every other, and then there is nothing to do. If yours has rules of its own (the Access controls page), being on the tailnet is not enough: add a rule for them. As a grant, with the Tailscale IP address of the server's device from the Machines page:
{ "src": ["sam@example.com"], "dst": ["100.101.102.103"], "ip": ["tcp:8443"] }
When one of the three is missing, nothing says which: the invitation link does not load, the app reports that it could not reach the server, and an assistant's sign-in page stays empty. The dashboard therefore says it up front: Users → Invite someone lists the three with the name and the port from the link.
Each name on your tailnet is a device with rules of its own. If the server can also be reached under another one (Tailscale on the host itself next to the add-on, say), hand out one address, or give people access to both. With PUBLIC_URL set to the add-on's address (https://loopback.<your-tailnet>.ts.net), a dashboard opened under the other name knows where assistants send people to sign in, lists that address in the invitation dialog as well, and checks it from the device before someone sets off to connect Claude.
Only the coach is public, and it answers nothing without a token. What reaches the server from the internet is listed in deploy/tailscale/serve.json: /mcp, /oauth/token and two small documents that tell an assistant where to sign in. Tailscale answers every other path itself with a 404, so the dashboard, the API and every page that takes a password stay on your tailnet. Signing in to approve an assistant happens on the first address, in your own browser. The page behind an invitation link is one of those pages: someone you invite has to be on your tailnet before the link opens for them.
Two settings in your tailnet make this work, both in the Tailscale admin console and both one-time: HTTPS certificates (with MagicDNS), and Funnel allowed for the device, which is what makes the second address public. Without Funnel the first address works all the same and only assistants in the cloud cannot connect.
The add-on also closes plain-HTTP port 8001 to everything but the host itself, and makes the server see each client's real address. If your phones were using http://<machine-name>:8001, move them to the first address above. COMPOSE_FILE replaces Compose's automatic file discovery: if you keep a docker-compose.override.yml, add it to the list.
Other ways
- Tailscale on the host, without the add-on: install Tailscale on the server and each phone; clients use
http://<machine-name>:8001inside the tailnet and nothing is exposed to the internet.tailscale serve --bg --https 8443 8001adds HTTPS. An assistant in the cloud cannot connect to such a server; that is what the add-on above is for. - Cloudflare Tunnel: also works from behind a home router, with a domain on Cloudflare. Be aware that Cloudflare terminates the TLS connection, so it can read the health data passing through; with Caddy or Tailscale it is only ever decrypted on your own machine.
deploy/demo/docker-compose.public.ymlshows the pattern.
What each person needs
The way you expose the server decides what has to be in place on the devices of the people you invite, before their invitation link opens at all. A link to a server a device cannot reach opens nothing, not even a page that says why, so this is worth a look before you send one.
| The server's address is | Each of their devices needs | You arrange |
|---|---|---|
| Public: built-in HTTPS, a Cloudflare Tunnel, a reverse proxy of your own | Nothing | Nothing |
| On Tailscale | Tailscale installed, signed in and switched on | A place on your tailnet, and access to the server's port: Adding a person on Tailscale |
| On another VPN (WireGuard, ZeroTier and the like) | That VPN set up and switched on | Their device as a peer, let through to the server's address and port |
| On your home network and nowhere else | To be on that network | Nothing. Their phone syncs only at home |
"Their devices" is the phone the app runs on, and whatever they open the invitation or approve an assistant on.
Two things hold whichever row is yours:
- No login page in front of the server. Cloudflare Access, Authelia, a proxy's own password and the like stop the phone app and every assistant: those can sign in to Loopback and to nothing else. Loopback has its own accounts, and nobody gets one without you; let its address through.
- A certificate their devices trust, when the address starts with
https. Certificates from Let's Encrypt (the built-in HTTPS), Tailscale and Cloudflare are trusted everywhere. One your server signed itself, or one from a certificate authority of your own, has to be installed and trusted on each device first: without that a browser warns, and the app does not connect.
The dashboard says what it can tell from the address when you invite someone (Users → Invite someone): for a Tailscale address the list above with the name and the port filled in, for a private address (192.168.…, 10.…, a .local name) that their device has to be on that network or on a VPN that leads to it. For both it offers the invited person's part as a note to send with the link. A public name gets no list, since it asks nothing of them. On the phone, the app's sign-in screen says the same when nothing answers at a Tailscale address.
- Your own reverse proxy: put nginx / Traefik / Caddy with a real certificate in front and forward to
127.0.0.1:8001. SetFORWARDED_ALLOW_IPSin.envto the address the proxy connects from, or every client shares one rate limit (see Configuration). - LAN only: fine for trying it out, but a phone that leaves the house stops syncing.
If the server ends up publicly reachable: login is rate-limited (5/min per client address), there is no registration endpoint (the first-run setup endpoint closes permanently once the admin account exists), and the admin System screen shows an auth audit trail — but public exposure still means strong passwords on every account.
SECURITY.md says what the server protects and from whom, what leaves it (your AI assistant, map tiles), where its protection stops, and how to report a problem.
Backups
The server backs itself up. A nightly pg_dump (03:30 container time by default) is written into the BACKUP_HOST_DIR mount (default ./backups), keeping the newest 30 dumps; if the server was off at backup time it catches up shortly after starting. Upgrades that include database migrations take an extra dump right before migrating. The admin System screen reports backup freshness (green < 26 h old) and has a Back up now button. Tune with BACKUP_TIME, BACKUP_KEEP, and TZ in .env.
The dumps are plain pg_dump | gzip files — point BACKUP_HOST_DIR at (or sync it to) somewhere off-machine and you're covered. One caveat for NAS setups: the database volume itself must live on local disk — Postgres data over NFS/SMB is the classic self-hoster corruption trap; syncing the dump directory to the NAS is the safe way to get backups off-machine.
Restoring. A dump holds the whole database and loads into an empty one, so restoring empties the database first, and everything stored since the dump was made is gone afterwards:
docker compose stop app
docker exec postgres__training-api dropdb -U training-api training-api
docker exec postgres__training-api createdb -U training-api training-api
gunzip -c backups/<dump>.sql.gz | docker exec -i postgres__training-api psql -U training-api training-api
docker compose up -d
The first line stops the server so nothing writes while the dump loads, the next two empty the database, and the last starts the server again, which brings a dump from an older version up to date. Do not skip the two in the middle: loaded into a database that still holds data, nearly every statement fails because the tables are already there, nothing is put back, and psql does not say so at the end. One line of output is expected, ERROR: unrecognized configuration parameter "transaction_timeout": the dump is written by a newer pg_dump than the PostgreSQL 16 it is loaded into, and that setting is all that is lost. On a new machine the steps are the same after a first docker compose up -d, and there is no admin account to create, since the accounts are in the dump.
Prefer to manage backups yourself? Set BACKUP_ENABLED=false, mount the directory read-only (:ro in an override file), and run something like this on the host — the System screen reports freshness on whatever training-api-*.sql.gz files it finds either way:
# crontab -e
30 3 * * * docker exec postgres__training-api pg_dump -U training-api training-api | gzip > /path/to/backups/training-api-$(date +\%F).sql.gz
Releases & upgrading
Releases are git tags (vX.Y.Z) with notes in CHANGELOG.md; each one publishes multi-arch Docker images to GHCR. Three kinds of image tags exist:
| Image tag | Meaning |
|---|---|
0.1.0 | An exact release — immutable |
0.1 | The latest patch release of a minor line |
latest | Every push to main — may be ahead of any release |
Compose runs latest by default. Once you depend on the server day-to-day, pin a release in .env — especially if something like Watchtower auto-pulls your containers, since latest tracks unreleased main:
IMAGE_TAG=0.1
To upgrade: skim the changelog, then
docker compose pull && docker compose up -d
Database migrations run automatically on startup, and an upgrade with pending migrations dumps the database first (see Backups). The running version is reported by GET /api/health and on the admin System screen. Versioning is semantic, with the usual 0.x caveat: breaking changes bump the minor version until 1.0, so 0.1 → 0.2 deserves a changelog read while 0.1.x → 0.1.y is always safe.
Going back is not the same as upgrading in reverse. After a release that changed the database, an older version refuses to start on it (the log says it cannot locate a revision), so setting IMAGE_TAG back is not enough: the backup from before the upgrade has to go back as well. Set IMAGE_TAG to the older version, then follow the restore steps under Backups with the dump the upgrade made, the …-premigrate.sql.gz file with the time of the upgrade in its name. Their last line starts the server on the version you set. Do not leave an older version running on the newer database in the meantime: it restarts over and over, and every restart writes another -premigrate dump, of the newer database, which pushes your older dumps out once there are more than BACKUP_KEEP.
Configuration
Everything is configured through environment variables in the root .env (read by Docker Compose):
| Variable | Default | Purpose |
|---|---|---|
BOOTSTRAP_ADMIN_PASSWORD | (unset) | Headless alternative to the browser setup screen: pre-sets the first-run admin password. Applied only while the admin has none, so rotating it later is a no-op. If that account was deleted and another admin exists, it is not made again |
BOOTSTRAP_ADMIN_USERNAME | admin | First-run admin username |
POSTGRES_PASSWORD / POSTGRES_USER / POSTGRES_DB | training-api | Database credentials (not published outside the compose network; also fed to the app as DATABASE_URL) |
API_PORT | 8001 | Host port for the API + dashboard |
MCP_ENABLED | true | Serve the coach MCP at /mcp on the same port (see MCP Server). false removes the endpoint |
PUBLIC_URL | (unset) | The server's address as an assistant reaches it, e.g. https://loopback.example.com. Only needed behind a proxy that does not pass the original Host header on: the server otherwise reads its address from each request (see Signing in from an assistant) |
OAUTH_AUTHORIZATION_ORIGIN | (unset) | Where the page that asks you to sign in and approve an assistant lives, when that is not the address the assistant connects to: a coach endpoint that is public next to a dashboard that is not |
OAUTH_AUTHORIZATION_PORT | (unset) | The same, when the two differ only in the port: the coach on the standard port and the dashboard on this one. deploy/tailscale/tailscale.yml sets it to 8443 for you |
TS_HOSTNAME | loopback | Name of the server's device on your tailnet, used with deploy/tailscale/tailscale.yml (see Exposing the server) |
TS_AUTHKEY | (unset) | A Tailscale auth key, to add that device to your tailnet without opening the link from its log |
FORWARDED_ALLOW_IPS | (unset) | Behind a reverse proxy: the address(es) or CIDR the proxy connects from, whose X-Forwarded-For the server trusts for the client address (login rate limit, audit trail). Unset, only loopback is trusted and every proxied client looks like the proxy. deploy/https/caddy.yml sets this for you. Never use * while port 8001 is reachable by anything but the proxy |
DOMAIN | (unset) | Hostname for built-in HTTPS, used with deploy/https/caddy.yml (see Exposing the server) |
BACKUP_HOST_DIR | ./backups | Host directory the server writes its pg_dump backups to (and reports freshness from) |
BACKUP_ENABLED | true | Server-managed backups: nightly dump, catch-up after downtime, pre-migration dump. false = bring your own (see Backups) |
BACKUP_TIME | 03:30 | Nightly backup time, container-local (set TZ to make it your local time) |
BACKUP_KEEP | 30 | How many dumps to keep — older training-api-*.sql.gz files in the backup dir are pruned |
TZ | UTC | Container timezone (e.g. Europe/Lisbon), used by BACKUP_TIME |
CARTO_API_KEY | (unset) | Route maps use CARTO's dark tiles, which now require a free API key (non-commercial, up to 5M requests/month, from CARTO); without one the map shows an "API key required" watermark. Setting this switches to the keyed CARTO URL |
MAP_TILE_URL | (unset) | Use any other tile provider: a Leaflet URL template ({s} {z} {x} {y} {r} and a ?key=… query are fine). Overrides CARTO_API_KEY |
MAP_TILE_ATTRIBUTION | © OpenStreetMap © CARTO | Attribution line shown on the map (HTML allowed); set it to match your provider |
MAP_TILE_SUBDOMAINS | abcd | Only used when MAP_TILE_URL contains {s} |
IMAGE_TAG | latest | Docker image tag for the app service — pin a release like 0.1 or 0.1.0 (see Releases & upgrading) |
Running the backend outside Docker reads backend/config/.env instead (template: backend/config/.env.example).
Upgrading from a pre-auth version: keep your old API_KEY set in backend/config/.env — the migration seeds it as a token owned by the admin account, so existing clients keep working while you move them to per-user tokens.
Web dashboard
The frontend/ directory holds the React 19 + TypeScript SPA (Vite, TanStack Query, hand-rolled SVG charts, Leaflet route maps). The Docker build bakes frontend/dist into the image and FastAPI serves it at / with an SPA fallback — same origin, no CORS.
Signing in as a regular user shows the athlete screens (overview, calendar, workouts, plans, notes, health, queue). Admins get a management console instead: Users (account CRUD, per-device token revoke, sync freshness) and System (backup freshness, DB size, auth activity feed).
cd frontend
npm run dev # Vite dev server on :5173, proxies /api → localhost:8001
npx tsc -b # typecheck
npm run build # production build (also run inside the Docker build)
API
All /api endpoints except /api/health, /api/auth/login, /api/auth/pairing/redeem and the two under /api/auth/invite/ require a Bearer token in the Authorization header. Tokens are issued per device by POST /api/auth/login (username + password, rate-limited 5/min/IP), by trading in the code from the dashboard's QR code, or by accepting an invitation; /api/admin/* additionally requires the admin role. A token is either full (everything its owner can do) or a coach token, which gets a 403 on every endpoint the coach's tools do not call (what that covers).
Wire casing: JSON casing varies by resource — auth, admin, feedback, and calendar are camelCase; workouts, queue, plans, and health metrics are snake_case.
Auth
| Method | Endpoint | Description |
|---|---|---|
GET | /api/auth/setup | Whether first-run setup is open ({"required": bool}; unauthenticated) |
POST | /api/auth/setup | Create the first admin account (returns a signed-in session; 409 once an admin exists) |
POST | /api/auth/login | Log in, mint a per-device token (bad credentials → 401) |
GET | /api/auth/me | Current user + their tokens (each with its scope: full or coach) |
POST | /api/auth/password | Change own password (revokes every other token) |
POST | /api/auth/tokens | Mint a named token (shown once; optional expiresAt; "scope": "coach" makes a coach token, the default is full) |
DELETE | /api/auth/tokens/{id} | Revoke one of your own tokens |
POST | /api/auth/pairing | Make a code for connecting the phone app: {id, code, expiresAt, expiresIn}. Good once, for five minutes; replaces your earlier code. The dashboard shows it as a QR code holding https://loopback.ardenlab.dev/connect/#server=<address>&user=<username>&code=<code>, a link iOS opens in the app (403 for an admin account or a coach token) |
GET | /api/auth/pairing/{id} | What became of your code: status is waiting, connected (with the phone's deviceName) or expired |
POST | /api/auth/pairing/redeem | Trade a code for a full per-device token ({code, deviceName}; unauthenticated, 10/min/IP; answers like a login; 401 for a code that is used, expired, unknown or not shaped like one) |
POST | /api/auth/invite/check | Whether the code of an invitation link is still good, and who it is from: {displayName, invitedBy, expiresAt} ({code} in the body; unauthenticated, 10/min/IP; 404 for a code that is used, withdrawn, expired or unknown) |
POST | /api/auth/invite/accept | Make the account an invitation is for and sign in to it ({code, username, password, displayName?}; unauthenticated, 10/min/IP; answers like a login). The username is 1 to 32 lower-case letters, digits, dots, hyphens or underscores; the password at least 8 characters. 404 for a code that is no longer good, 409 for a taken username, 400 for a username or password that cannot be used; after a 409 or 400 the invitation is still good |
GET | /api/coach/claude-desktop.mcpb | The Claude Desktop extension for the coach, as a file (optional serverUrl fills in the server address; never contains a token) |
Signing in from an assistant (OAuth 2.1 with PKCE; see MCP Server). The first four take no token; the last three are the dashboard's approval page acting as the signed-in athlete.
| Method | Endpoint | Description |
|---|---|---|
GET | /.well-known/oauth-protected-resource | Which server issues tokens for /mcp (also at …/oauth-protected-resource/mcp) |
GET | /.well-known/oauth-authorization-server | Where to send the athlete and where to trade the code |
GET | /oauth/authorize | Checks an assistant's request and passes the browser on to the approval page |
POST | /oauth/token | Trades the one-time code for a token (a coach token; no refresh tokens) |
GET | /api/oauth/requests/{id} | The request waiting for an answer (404 once answered or after 10 minutes) |
POST | /api/oauth/requests/{id}/approve | Approve as yourself; returns where to send the browser (403 for an admin account) |
POST | /api/oauth/requests/{id}/deny | Decline; returns where to send the browser |
Admin
| Method | Endpoint | Description |
|---|---|---|
GET | /api/admin/users | List users with token stats + sync freshness |
POST | /api/admin/users | Create a user by hand, with a username and password you choose |
GET | /api/admin/invites | The invitations nobody has used yet (never their codes) |
POST | /api/admin/invites | Make an invitation: {id, code, displayName, createdBy, createdAt, expiresAt} (optional displayName says who it is for). Good once, for seven days. The code is shown only here; the dashboard puts it in a link to its own page, <address>/join#code=<code> |
DELETE | /api/admin/invites/{id} | Withdraw an invitation that is still waiting |
PATCH | /api/admin/users/{id} | Activate/deactivate (deactivation revokes all tokens), or make read-only with {"readOnly": true}: the account can then be read and every change is refused with a 403 (not for admins) |
DELETE | /api/admin/users/{id} | Delete an account for good, with all its data. Only a deactivated account (409 otherwise), never your own (400) |
POST | /api/admin/users/{id}/password | Reset a user's password |
GET | /api/admin/users/{id}/tokens | List a user's tokens |
DELETE | /api/admin/users/{id}/tokens/{tid} | Revoke a single token (one stolen device) |
GET | /api/admin/events | Auth audit trail (logins, password/token/user changes; prunes >365d on read) |
GET | /api/admin/system | Backup freshness, DB size, row counts, migration head |
Workouts
| Method | Endpoint | Description |
|---|---|---|
POST | /api/workouts | Create or upsert a workout |
GET | /api/workouts | List workouts (filters: activity_type, start_after, start_before, plan_workout_id, limit, offset) |
GET | /api/workouts/summary | Aggregated stats by period (week/month/year) and activity type |
GET | /api/workouts/{id} | Get workout detail |
GET | /api/workouts/{id}/splits | Get per-split breakdown |
GET | /api/workouts/{id}/heartrate | Get heart rate samples |
PUT | /api/workouts/{id}/shoe | Assign a pair of shoes to a workout ({"shoeId": null} takes it off) |
DELETE | /api/workouts/{id} | Delete a workout |
GET | /api/shoes | List pairs of shoes with their mileage (meters), in use first |
POST | /api/shoes | Add a pair (name, startDistance, targetDistance, isDefault) |
PATCH | /api/shoes/{id} | Change a pair: rename, set distances, make it the default, retire it |
DELETE | /api/shoes/{id} | Delete a pair (its workouts stay, without a pair) |
Training Queue
| Method | Endpoint | Description |
|---|---|---|
POST | /api/queue | Queue a structured workout (response carries an additive validation key with schedule warnings) |
POST | /api/queue/batch | Queue several workouts at once → {items, validation} envelope |
GET | /api/queue | List queue items (filter by status) |
GET | /api/queue/pending | List pending items |
PATCH | /api/queue/{id} | Edit a queue item's fields |
PATCH | /api/queue/{id}/status | Update item status (pending / fetched / synced / completed / skipped) |
DELETE | /api/queue/{id} | Delete a queue item |
GET | /api/workouts/queue | App-facing: get pending workouts as WorkoutKit compositions |
GET | /api/workouts/queue/scheduled?from= | App-facing: delivered, still-due workouts as compositions; the app restores missing ones onto a new or reinstalled phone's watch |
PATCH | /api/workouts/queue/{id} | App-facing: confirm install → synced (never downgrades completed/skipped) |
DELETE | /api/workouts/queue/{id} | App-facing: mark item as synced (persists the record) |
Workout Actions
Documentation truncated — see the full README on GitHub.
Reviews
No reviews yet
Be the first to review this server!
More Developer Tools MCP Servers
Rea
Freeby Morluto · Developer Tools
Reverse engineer anything from your terminal or agent with one CLI and MCP server.
Paperclip
Freeby Paperclipai · Developer Tools
Trending hip-hop artist momentum scores across four cultural dimensions.
Scrapling
Freeby D4Vinci · Developer Tools
Web scraping with stealth HTTP, real browsers, and Cloudflare bypass. CSS selectors supported.
Server Time
Freeby Modelcontextprotocol · Developer Tools
Current time lookup and conversion between IANA timezones
Toleno
Freeby Toleno · Developer Tools
Toleno Network MCP Server — Manage your Toleno mining account with Claude AI using natural language.
MCP Marketplace
Freeby mcp-marketplace · Developer Tools
Search and install MCP servers from inside your AI client.


