FitDays MCP Server
# FitDays MCP Server (Go)
[](go.mod)
[](https://modelcontextprotocol.io/)
[](LICENSE)
[](README.md#tools)
Read-only MCP server for the unofficial FitDays cloud APIs: legacy FitDays,
FitDays+, and FitDays 2.0. It covers every sync collection,
weight/body-composition history, trend and goal analytics, the FitDays 2.0 food
and water diary, and a redacted raw escape hatch.
This is an unofficial client. ICOMON can change the private API at any time.
The server never writes to FitDays: no measurements, goals, users or devices are
created, changed or deleted.
## Backends
FitDays migrated accounts from the legacy service to **FitDays+**, then to the
current **FitDays 2.0** app. `backend:auto` tries legacy, then Plus, then 2.0,
falling back only when the previous backend reports a migration, freeze or
missing-account code. New accounts normally resolve to 2.0. `region:global` is
Plus-only.
Credentials are stored as protocol password-equivalent digests, never as
plaintext. The config file is `~/.fitdays-mcp/config.json` (directory `0700`,
file `0600`).
## Install
```bash
go install github.com/kondratjev/fitdays-mcp-go/cmd/fitdays-mcp@latest
```
Or build from source:
```bash
go build -o fitdays-mcp ./cmd/fitdays-mcp
```
Requires Go 1.27+.
## MCP configuration (stdio)
```json
{
"mcpServers": {
"fitdays": {
"command": "/absolute/path/to/fitdays-mcp",
"env": {
"FITDAYS_EMAIL": "you@example.com",
"FITDAYS_PASSWORD": "your-password",
"FITDAYS_REGION": "eu",
"FITDAYS_BACKEND": "auto"
}
}
}
}
```
On first use call `check_auth_status`, then `setup_credentials` if needed,
then any read tool. Environment credentials are hashed in memory at startup;
the config file is written after `setup_credentials` or the first successful
sync.
## Docker
```bash
# stdio
docker run -i --rm \
-v fitdays-config:/home/app/.fitdays-mcp \
-e FITDAYS_EMAIL=you@example.com \
-e FITDAYS_PASSWORD=your-password \
ghcr.io/kondratjev/fitdays-mcp-go:0.2.1
# stateless HTTP
docker run --rm -p 8000:8000 \
-v fitdays-config:/home/app/.fitdays-mcp \
-e PORT=8000 \
ghcr.io/kondratjev/fitdays-mcp-go:0.2.1
```
The named volume keeps the non-root container's `~/.fitdays-mcp/config.json`.
## HTTP
Set `PORT` to serve stateless Streamable HTTP at `/mcp` with `/healthz`.
`X-MCP-User` selects a named profile; stdio always uses `default`.
```bash
PORT=8000 FITDAYS_EMAIL=... FITDAYS_PASSWORD=... ./fitdays-mcp
curl -s localhost:8000/healthz # {"status":"ok"}
```
Use a reverse proxy with TLS. HTTP is enough only on a trusted network.
## Self-hosted server (Docker)
HTTPS is handled by the shared [mcp-edge](https://github.com/kondratjev/mcp-edge)
repository. This repo has no Caddy config: the container joins the `mcp-edge`
network and advertises `/<MCP_SECRET>/fitdays/*` through Docker labels.
One-time edge setup from this machine (point DNS at the VPS first):
```bash
git clone https://github.com/kondratjev/mcp-edge.git
cd mcp-edge
cp .env.example .env # set DOMAIN and MCP_SECRET
SYNC_ENV=1 VPS_SSH=user@host VPS_DIR=/opt/mcp-edge ./scripts/deploy.sh
```
Then set this server's credentials and deploy it:
```bash
cp .env.example .env # FITDAYS_EMAIL and FITDAYS_PASSWORD
SYNC_ENV=1 VPS_SSH=user@host VPS_DIR=/opt/fitdays-mcp-go ./scripts/deploy.sh
```
Connect the client to `https://<DOMAIN>/<MCP_SECRET>/fitdays/mcp`; everything
else returns 404. Remote MCP connectors cannot send auth headers, so the secret
path is the access control: guard the URL like a password. Config and tokens
live in the `fitdays-config` named volume, so they survive rebuilds
(`docker compose down -v` deletes login state).
### Deploy to a VPS
The server is a clean git mirror: code is never edited there, and `.env` plus
Docker volumes survive a `git reset --hard`.
First deploy (the script clones the repo on the VPS if it is missing and copies
the local `.env`):
```bash
SYNC_ENV=1 VPS_SSH=user@host VPS_DIR=/opt/fitdays-mcp-go ./scripts/deploy.sh
```
Then deploy from the local branch:
```bash
VPS_SSH=user@host VPS_DIR=/opt/fitdays-mcp-go ./scripts/deploy.sh
```
The script pushes the current branch, creates the server clone when needed,
pulls it, and rebuilds with `docker compose` (or legacy `docker-compose`).
`SYNC_ENV=1` copies `.env` over scp (encrypted, mode 0600). If the repository is
private, the VPS needs GitHub credentials for the initial clone.
`.env` is git-ignored, so it never lands in the repository. Export `VPS_SSH` and
`VPS_DIR` in your shell rc to run bare `./scripts/deploy.sh`.
## Tools
All tools are read-only except `setup_credentials`.
| Tool | Purpose |
|---|---|
| `check_auth_status` | Network-free profile, backend, token-presence and cache status |
| `setup_credentials` | Validate email/password, log in, persist digests and session |
| `list_users` | Family profiles with height, sex, birthday, target weight |
| `list_devices` | Bound scales with model, firmware and binding name |
| `get_account` | Units, active profile id and account metadata |
| `get_latest_weight` | Latest measurement, including body-composition fields |
| `get_weight_history` | Paginated weight/body-composition history |
| `get_body_composition_summary` | Latest values, min/max/average and deltas |
| `get_trend` | Bucketed trend with count, min/max/average and weekly slope |
| `get_goal_progress` | Target, remaining, percent, weekly rate and ETA |
| `compare_measurements` | Compare two dates and their metric deltas |
| `get_nutrition_history` | FitDays 2.0 food diary with calories, macros, window totals and day/week/month buckets |
| `get_water_history` | FitDays 2.0 water intake with daily totals and progress to the account goal |
| `get_body_composition_detail` | Segmental masses, body score, WHR, SMI, raw composition and latest server AI analysis |
| `get_family_overview` | One row per family profile: count, first/latest weight, change, target progress |
| `export_data` | Measurements, nutrition or water as CSV/JSON text |
| `get_auxiliary_history` | Height, girth, balance, gravity, heart rate, impedance, jump rope with normalized values |
| `get_raw_collection` | Redacted raw sync key, for fields not yet normalized |
| `refresh_sync` | Force a fresh sync and return per-collection counts |
Tool arguments accept RFC3339 timestamps or `YYYY-MM-DD` dates. Times are UTC.
## Configuration
```json
{
"region": "eu",
"backend": "auto",
"syncDays": 2200,
"profiles": {
"default": {
"email": "you@example.com",
"legacyPasswordDigest": "…",
"plusAccessCode": "…",
"plusAccessSign": "…",
"plusClientId": "…",
"resolvedBackend": "legacy",
"token": "…",
"uid": 123,
"activeSuid": 456,
"apiBase": "https://online-eu.fitdays.cn/api"
}
}
}
```
Regions: `eu` (default), `us`, `cn`, `global` (Plus only). Backends: `auto`,
`legacy`, `plus`, `v2`. The sync window defaults to 2200 days; older history can be
requested with `refresh_sync` days, and a requested `since` older than the
current window sets `truncated:true`.
Environment variables:
| Variable | Meaning |
|---|---|
| `FITDAYS_EMAIL`, `FITDAYS_PASSWORD` | Initial credentials, hashed and saved |
| `FITDAYS_REGION` | `eu`, `us`, `cn`, `global` |
| `FITDAYS_BACKEND` | `auto`, `legacy`, `plus`, `v2` |
| `FITDAYS_SYNC_DAYS` | History window in days |
| `FITDAYS_CACHE_TTL` | Snapshot cache TTL (default `5m`) |
| `FITDAYS_API_BASE` | Override host (tests, proxies) |
| `FITDAYS_CONFIG` | Alternate config path |
| `PORT` | Serve HTTP instead of stdio |
## Units and profiles
Weight is kilograms, heights centimetres, circumferences centimetres, body
composition percentages, BMR kcal/day, heart rate bpm, impedance ohms. The
legacy `weight_lb` and `height_inch` fields are preserved in raw data.
A FitDays account can contain several family profiles (`suid`). Tools default
to the account's active profile; pass `suid` to read another. Deleted rows are
excluded by default; history tools accept `include_deleted`.
## Security
- The config contains password-equivalent values and tokens. Protect it like a
password. Use a dedicated FitDays account where possible.
- Every tool response is recursively redacted: `token`, `refresh_token`,
`access_code`, `access_sign` and `password` are removed, including inside raw
collections.
- Request URLs are never logged because the legacy protocol puts the token in
the query string.
- The server needs no inbound access beyond the optional `/mcp` endpoint.
## Development
```bash
go test ./...
go vet ./...
go build ./...
```
`cmd/fitdays-probe` logs in with `FITDAYS_EMAIL`/`FITDAYS_PASSWORD`, syncs and
writes the raw JSON for protocol inspection:
```bash
go run ./cmd/fitdays-probe -days 30 -out raw.json
```
The probe is not part of the MCP surface and is not shipped in the Docker image
or release archives.
## Limitations
- Unofficial and read-only; writes, Apple Health and Google Fit sync are out of
scope. Food and water history are read-only and available on the 2.0 backend.
- Unknown sync fields may be absent from normalized output until mapped; use
`get_raw_collection` in the meantime.
- Live FitDays behavior can change without notice. The test suite uses local
fake servers; a live account is needed to validate a new protocol version.
MIT licensed.
TDQS
Scored across 19 tools
Most tools target distinct resources or query shapes, such as account, users, devices, nutrition, water, trends, and raw sync data. There is some overlap among measurement/body-composition tools like get_latest_weight, get_weight_history, get_body_composition_summary, and compare_measurements, but the descriptions provide enough distinction to avoid most misselection.
All tool names use consistent snake_case with a verb_noun pattern such as get_account, list_users, get_weight_history, compare_measurements, and refresh_sync. The convention is predictable throughout the set.
At 19 tools, the server is slightly above the typical well-scoped range, but the breadth is justified by the domain: authentication, profiles, devices, measurements, body composition, nutrition, water, trends, goals, export, and raw data. Each tool appears to cover a distinct query need rather than duplicating functionality.
The surface covers a broad read-only FitDays analytics domain, including auth, account/profile management, devices, measurement history, body composition, nutrition, water, auxiliary metrics, goals, trends, export, and raw fallback access. Minor gaps exist around write/update operations for profiles, goals, or measurements, but those may be outside the server's read-only scope.