FitDays MCP Server

Servidor MCP FitDays somente leitura: composição corporal, nutrição, água, tendências e visão geral da família para contas legacy, FitDays+ e 2.0.

Documentação

FitDays MCP Server (Go)

Go MCP License: MIT Tools Glama

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

go install github.com/kondratjev/fitdays-mcp-go/cmd/fitdays-mcp@latest

Or build from source:

go build -o fitdays-mcp ./cmd/fitdays-mcp

Requires Go 1.27+.

MCP configuration (stdio)

{
  "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

# 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.

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 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):

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:

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):

SYNC_ENV=1 VPS_SSH=user@host VPS_DIR=/opt/fitdays-mcp-go ./scripts/deploy.sh

Then deploy from the local branch:

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.

ToolPurpose
check_auth_statusNetwork-free profile, backend, token-presence and cache status
setup_credentialsValidate email/password, log in, persist digests and session
list_usersFamily profiles with height, sex, birthday, target weight
list_devicesBound scales with model, firmware and binding name
get_accountUnits, active profile id and account metadata
get_latest_weightLatest measurement, including body-composition fields
get_weight_historyPaginated weight/body-composition history
get_body_composition_summaryLatest values, min/max/average and deltas
get_trendBucketed trend with count, min/max/average and weekly slope
get_goal_progressTarget, remaining, percent, weekly rate and ETA
compare_measurementsCompare two dates and their metric deltas
get_nutrition_historyFitDays 2.0 food diary with calories, macros, window totals and day/week/month buckets
get_water_historyFitDays 2.0 water intake with daily totals and progress to the account goal
get_body_composition_detailSegmental masses, body score, WHR, SMI, raw composition and latest server AI analysis
get_family_overviewOne row per family profile: count, first/latest weight, change, target progress
export_dataMeasurements, nutrition or water as CSV/JSON text
get_auxiliary_historyHeight, girth, balance, gravity, heart rate, impedance, jump rope with normalized values
get_raw_collectionRedacted raw sync key, for fields not yet normalized
refresh_syncForce a fresh sync and return per-collection counts

Tool arguments accept RFC3339 timestamps or YYYY-MM-DD dates. Times are UTC.

Configuration

{
  "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:

VariableMeaning
FITDAYS_EMAIL, FITDAYS_PASSWORDInitial credentials, hashed and saved
FITDAYS_REGIONeu, us, cn, global
FITDAYS_BACKENDauto, legacy, plus, v2
FITDAYS_SYNC_DAYSHistory window in days
FITDAYS_CACHE_TTLSnapshot cache TTL (default 5m)
FITDAYS_API_BASEOverride host (tests, proxies)
FITDAYS_CONFIGAlternate config path
PORTServe 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

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:

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.