Zepp MCP Server
# ⌚ Zepp MCP Server (Go)
[](https://go.dev)
[](https://modelcontextprotocol.io)
[](LICENSE)
[](#-tools)
Read-only MCP server for the unofficial Zepp cloud. It reads daily activity, sleep,
heart rate, workouts and body composition from an existing `apptoken`.
> [!IMPORTANT]
> This is an unofficial client. Zepp can change or block the private API at any time.
> The apptoken grants access to your account: keep it private. The server never writes
> to Zepp and never asks for your password.
## ✨ Features
- Steps, distance and active calories with daily and weekly aggregates.
- Sleep stages, duration, score and resting heart rate.
- Minute-level passive heart rate for the last seven days.
- Workout history and raw workout details (GPS, heart-rate and pace series when present), plus aerobic/anaerobic training effect, exercise load, RPE, VO2 max and SpO2 range.
- Readiness, HRV, respiratory rate, Body Charge and sleep-breathing (ODI) recovery metrics.
- Weight, BMI, body fat, muscle, water, bone mass, visceral fat and metabolic age.
- Weekly trends and period comparison across eleven metrics.
- Multiple config profiles over one HTTP endpoint via `X-MCP-User`.
- CSV or JSON export.
- stdio and stateless Streamable HTTP.
- Optional AES-256-GCM encryption for the saved apptoken.
- Failed upstream calls do not leak the apptoken or request URL.
## 🚀 Quick Start
### 1. Get the apptoken
1. Open <https://user.huami.com/privacy2/index.html> and sign in.
2. Open DevTools → Application → Cookies.
3. Copy the `apptoken` cookie value.
The apptoken usually lasts several weeks. When it expires, copy a fresh one and call
`setup_credentials` again.
### 2. Run
```bash
go build -o zepp-mcp ./cmd/zepp-mcp
```
Release binaries are on [Releases](https://github.com/kondratjev/zepp-mcp-go/releases).
Build from source to include changes on `main` before the next tag.
### 3. Configure your client
```json
{
"mcpServers": {
"zepp": {
"command": "/absolute/path/to/zepp-mcp",
"env": {
"ZEPP_APPTOKEN": "your-apptoken"
}
}
}
}
```
The first tool call syncs the configured history window. Call `setup_credentials`
when you prefer to save the token through MCP instead of the environment.
## 🧰 Tools
### Setup and account
| Tool | Purpose |
| --- | --- |
| `check_auth_status` | Report the saved profile, region, token presence and cache state without network access. |
| `setup_credentials` | Save and validate an apptoken, optional user id and region. |
| `get_profile` | Return user id, region, timezone and available data counts. |
### Health data
| Tool | Purpose |
| --- | --- |
| `get_daily_summary` | Daily steps, distance and active calories, newest first. |
| `get_sleep` | Sleep sessions with stages, duration, score and resting heart rate. |
| `get_heart_rate` | Resting and minute-level passive heart rate. |
| `list_workouts` | Workout history with type, duration, distance, calories and heart rate. |
| `get_workout_detail` | Raw detail for one workout track id. |
| `list_devices` | Bound devices with model, firmware and serial; device auth keys are never returned. |
| `get_workout_track` | Decoded GPS, altitude, heart rate, cadence and power points for a workout. |
| `export_workout_gpx` | Export one workout with a GPS track as GPX 1.1 text. |
| `get_stress` | Daily stress with zone percentages and 5-minute HRV readings. |
| `get_training_load` | Exercise score, recovery and ATL/CTL/TSB training load. |
| `get_sport_load` | Daily and weekly training load with the optimal range. |
| `get_vo2_max` | VO2 max estimates from qualifying outdoor workouts. |
| `get_readiness` | Readiness score with HRV, resting-HR, skin-temperature, breathing, physical and mental components. |
| `get_hrv` | Daily RMSSD/SDNN ranges; SDNN unit is marked unverified. |
| `get_respiratory_rate` | Daily respiratory rate from overnight per-minute samples. |
| `get_body_charge` | Body Charge min/max/average with mental and physical components. |
| `get_sleep_breathing` | Overnight ODI, desaturation events, measured minutes and sleep-breathing score. |
| `get_daily_health` | Steps, active calories, active minutes and distances with Zepp goals and goal-met flags. |
| `get_spo2` | Manual SpO2 and oxygen-desaturation events from the blood-oxygen stream. |
| `get_pai` | Daily PAI, rolling total, zone scores/minutes and heart rates. |
| `get_skin_temperature` | Overnight skin-temperature deviation from the personal baseline. |
| `get_health_events` | Generic event stream for respiratory rate, HRV, body battery and similar data. |
| `get_body_measurements` | Weight and body-composition records. |
### Analytics and export
| Tool | Purpose |
| --- | --- |
| `get_trend` | Weekly trend and slope for steps, distance, calories, sleep, resting heart rate, weight or body composition. |
| `compare_periods` | Compare average daily metrics between two date ranges. |
| `refresh_sync` | Bypass the five-minute cache and download a fresh snapshot. |
| `get_raw_collection` | Redacted raw payloads for `band`, `heart_rate`, `workouts` or `body`. |
| `export_data` | Export daily, sleep, heart-rate, workout or body rows as CSV or JSON. |
Every tool except `setup_credentials` is read-only.
## ⚙️ Configuration
Default path: `~/.zepp-mcp/config.json` (mode `0600`). Override with `ZEPP_CONFIG`.
Unknown top-level keys survive rewrites. Saves are atomic.
```json
{
"region": "global",
"historyDays": 2200,
"profiles": {
"default": {
"appToken": "enc:v1:...",
"userId": "123456",
"region": "global",
"timezone": "Local"
}
}
}
```
Environment:
| Variable | Default | Purpose |
| --- | --- | --- |
| `ZEPP_APPTOKEN` | — | Apptoken for the default profile. |
| `ZEPP_USER_ID` | auto | User id; normally discovered from recent band data. |
| `ZEPP_REGION` | `global` | `global`, `eu` or `us`. |
| `ZEPP_HISTORY_DAYS` | `2200` | History window. Requests are batched in 30-day chunks. |
| `ZEPP_TIMEZONE` | `Local` | IANA timezone for date boundaries. |
| `ZEPP_API_BASE` | region default | Override the activity API (proxy or tests). |
| `ZEPP_WEIGHT_API` | `https://api-mifit.zepp.com` | Override the weight API. |
| `ZEPP_CACHE_TTL` | `5m` | Snapshot cache duration. |
| `ZEPP_CONFIG` | `~/.zepp-mcp/config.json` | Config path. |
| `ZEPP_CONFIG_KEY` | — | AES-256-GCM key for saved secrets. |
| `ZEPP_CONFIG_KEY_FILE` | — | File containing the key. |
| `PORT` | — | Enables stateless HTTP on `:PORT`; absent means stdio. |
Encryption is optional. Generate a key with `openssl rand -hex 32`; if it is lost,
run `setup_credentials` again.
## 🌐 Remote MCP over HTTP
```bash
PORT=8000 ZEPP_CONFIG_KEY=... ./zepp-mcp
```
- `POST /mcp` — stateless Streamable HTTP.
- `GET /healthz` — `{"status":"ok"}`.
- `X-MCP-User: <name>` selects a named config profile; without it, `default` is used.
Run behind a TLS reverse proxy. The secret path and apptoken are both credentials.
## 🐳 Docker
```bash
docker build -t zepp-mcp .
docker run --rm -i \
-e ZEPP_APPTOKEN=your-apptoken \
-v zepp-config:/home/app/.zepp-mcp \
zepp-mcp
```
HTTP mode:
```bash
docker run --rm -p 8000:8000 \
-e PORT=8000 \
-e ZEPP_APPTOKEN=your-apptoken \
-v zepp-config:/home/app/.zepp-mcp \
zepp-mcp
```
The image runs as UID 10001 and defaults to stdio.
## 🔒 Security
- Apptoken and request URLs are never logged.
- `get_raw_collection` and all tool responses recursively redact `apptoken`,
`token`, `password`, `cookie` and `authorization`.
- Config saves are atomic; `0600` file in a `0700` directory.
- Optional AES-256-GCM at rest. A stolen config without the key does not expose the token.
- Only `setup_credentials` changes local state; no tool writes to Zepp.
## 🛠️ Development
```bash
gofmt -l .
go vet ./...
go test -race ./...
go build ./...
```
The test suite uses fake Zepp servers and requires no account.
## ⚠️ Limitations
- Unofficial private API; no public developer contract.
- Only `apptoken` authentication; no email/password or 2FA flow.
- Minute heart rate is limited to the last seven days.
- Raw workout detail shape depends on the sport and Zepp response.
- No BLE, no writes, no device management.
## 📄 License
MIT — see [LICENSE](LICENSE).
TDQS
Scored across 31 tools
Most tools map to a distinct Zepp metric, but several pairs have genuinely fuzzy boundaries: get_daily_health vs get_daily_summary both return daily steps/distance/calories, get_sport_load vs get_training_load both cover training load, and get_trend vs compare_periods both aggregate over ranges. The descriptions partially resolve these (get_spo2 explicitly redirects to get_sleep_breathing), but an agent still has to read carefully to pick the right one.
Every tool follows a consistent snake_case verb_noun pattern (get_, list_, export_, compare_, check_, refresh_, setup_) with a domain-specific noun. No camelCase mixing, no vague single-word names, and the verb choice reliably signals the operation type.
At 31 tools the surface is well past the comfortable 3-15 range and above the 25+ 'too many' threshold. While each metric is individually defensible, several tools could be folded together (e.g. daily_health/daily_summary, sport_load/training_load) or parameterized by metric type instead of one tool per Zepp field.
Coverage of the read-only Zepp health domain is broad and deep: sleep, HR/HRV, SpO2, stress, temperature, body composition, PAI, readiness, training load, workouts, GPS export and raw payloads are all present. Minor gaps remain, such as no way to clear/revoke saved credentials after setup_credentials, and no unified single-day report spanning all metrics.