rhythm-fitbit-mcp
Provides MCP tools for accessing all raw Fitbit Air data via the Google Health API, including activity, heart rate, sleep, SpO2, intraday metrics, exercises/TCX, profile, settings, devices, daily rollups, raw JSON, CSV export, and sync controls.
Provides access to Google Health API data for Fitbit Air, including all readable health data types, raw API JSON, daily records and rollups, profile/settings/devices, and read-only API passthrough queries.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
rhythm-fitbit-mcp
A self-hosted, single-user MCP server that gives AI agents (Claude web/desktop/mobile, Claude Code, ChatGPT, Cursor, Codex, Gemini CLI, …) access to all raw data from a Fitbit Air, via the Google Health API.
It is a pure data layer. It fetches every readable data type, keeps it fresh in SQLite, and serves it through MCP tools. All analysis, including trends, baselines, correlations and dashboards, is left to the agent.
Fitbit Air ─BT─► Google Health app ─► Google cloud ──webhook / 30-min poll──► SQLite (data/fitbit.db)
│
Claude / ChatGPT / Cursor … ──HTTPS + (Google login | bearer token)──► nginx ──► MCP server (/mcp)Data: all 40 readable Google Health data types plus profile, settings and devices. Data is kept at full resolution (per-second heart rate, per-minute steps/SpO2…), with the full API JSON preserved and history backfilled.
Fresh: webhooks (near real-time), a 30-minute catch-up poll, a nightly 7-day re-sync, and an on-demand freshness check before answering.
Private: OAuth login restricted to one Google account, or a generated bearer token.
run_sqlis read-only, enforced by the SQLite engine.
The legacy Fitbit Web API was shut down on 2026-11-02. This server uses its replacement, the Google Health API.
1. Google Cloud setup (one time, about 10 minutes)
Phone: install the Google Health app, sign in, and make sure your Fitbit Air syncs. The API only returns data for accounts linked to Google Health.
console.cloud.google.com → New project. Note the project number shown on the dashboard.
APIs & Services → Library → enable Google Health API.
Google Auth Platform → Branding / Audience: user type External. Fill in the app name and emails.
Data Access → Add or remove scopes → add every
googlehealth.*.readonlyscope (activity_and_fitness, health_metrics_and_measurements, sleep, nutrition, ecg, irn, location, profile, settings), plusopenidand.../auth/userinfo.email.Audience: keep publishing status Testing and add your Google account under Test users. In Testing mode Google expires the refresh token after 7 days. When it does, reconnect (
/setup→ Reconnect, orfitbit-mcp authlocally).data_statusand/setupshow when access expires, warn 48 h ahead, and the catch-up fills any gap once you reconnect, so no data is lost. Claude web / ChatGPT connectors will also ask you to sign in again about weekly.Clients → Create client → Web application. Add these Authorized redirect URIs:
https://YOUR_DOMAIN/google/callback(health-data consent, setup login, webhook registration)https://YOUR_DOMAIN/auth/callback(MCP client login)http://localhost:8765/callback(optional: local development)
Copy the Client ID and Client secret.
Related MCP server: Fitbit MCP
2. Deploy on the VPS
Requirements: Docker + Compose, your existing nginx, certbot, and a DNS A record for YOUR_DOMAIN pointing at the VPS.
git clone https://github.com/vaasminion/rhythm-fitbit-mcp-public.git fitbit-mcp && cd fitbit-mcp
cp .env.example .env # fill the 5 values: DOMAIN, ALLOWED_EMAIL, GOOGLE_CLIENT_ID,
# GOOGLE_CLIENT_SECRET, GOOGLE_PROJECT_NUMBER
docker compose up -d # app listens on 127.0.0.1:8000 only
# hook it into your existing nginx
sudo cp deploy/nginx/fitbit-mcp.conf /etc/nginx/sites-available/
sudo nano /etc/nginx/sites-available/fitbit-mcp.conf # set server_name to YOUR_DOMAIN
sudo ln -s /etc/nginx/sites-available/fitbit-mcp.conf /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d YOUR_DOMAINThen open https://YOUR_DOMAIN/setup:
Sign in with Google. Only
ALLOWED_EMAILis accepted.Connect Fitbit data → approve all scopes. The backfill starts automatically, newest 14 days first.
Enable webhooks (recommended). This asks Google once for Cloud-project access to register the webhook subscribers. That token is used once and then revoked. Without webhooks, data still syncs every 30 minutes.
Copy your MCP URL / bearer token / client snippet.
All data lives in the ./data folder next to docker-compose.yml, so you can read it directly on the VPS:
Path | What |
| SQLite database. Open it with |
| nightly backups, 7 kept |
| generated bearer token + encryption keys. Never in |
| encrypted MCP client registrations |
Files are owned by PUID:PGID (default 10001). Set PUID=$(id -u) and PGID=$(id -g) in .env so your own user
owns them, then restart the container.
If your nginx runs in Docker itself, put both containers on one network and use proxy_pass http://fitbit-mcp:8000.
3. Connect your AI clients
MCP URL: https://YOUR_DOMAIN/mcp. /setup shows ready-to-paste snippets with your token.
Client | Auth | How |
Claude web / desktop / mobile | Google login | Settings → Connectors → Add custom connector → URL |
ChatGPT | Google login | Settings → Apps & Connectors → Advanced → Developer mode → Create → URL, OAuth |
Claude Code | bearer |
|
Codex CLI | bearer |
|
Cursor / VS Code / Windsurf | Google login or bearer |
|
Gemini CLI | bearer |
|
n8n / LangChain / Agents SDK / scripts | bearer | any MCP client with Streamable HTTP + header |
stdio-only clients | bearer |
|
The server speaks Streamable HTTP only. Clients that only support the legacy SSE transport can connect through
mcp-remote. To allow another OAuth client's redirect URI, add it to OAUTH_REDIRECT_ALLOWLIST in .env.
4. Tools
Tool | What it returns |
| connection, freshness, device battery/last sync, backfill progress, which types have data |
| every type with counts, date coverage, sync status, value fields |
| SQLite schema + example queries / read-only SQL over everything (5000-row cap, 15 s timeout) |
| exact API JSON, cursor-paginated (any type, any view) |
| live read-only Google Health API call (list / reconcile / rollUp / dailyRollUp) |
| Google's daily records + daily rollups per local day |
| sessions, local bed/wake times, stages, short awakenings |
| per-sample or bucketed (1min…1h) heart rate in local time |
| any minute-level type (steps, SpO2, AZM, altitude…) |
| workouts / raw TCX (GPS route) |
| UTC offset per local day as reported by the data (travel) |
| account resources |
| CSV inline (+ a 15-minute download link over HTTP) |
| fetch from Google immediately |
Not available from Google's API: Fitbit's sleep score, readiness score and cardio load. The write-only types (menstrual cycle, moods, ovulation tests, symptoms) can't be read either.
5. Local development (no Docker needed)
Windows PowerShell shown; on macOS/Linux use python3.11 -m venv .venv && source .venv/bin/activate.
py -3.11 -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements-dev.txt # pinned, tested versions
pip install -e . --no-deps
pre-commit install
copy .env.example .env # set LOCAL_MODE=1, GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET
fitbit-mcp auth # browser consent → http://localhost:8765/callback
fitbit-mcp status
fitbit-mcp sync --days 14 # or: fitbit-mcp sync --backfill
fitbit-mcp serve # stdio, e.g. claude mcp add fitbit -- <path>\.venv\Scripts\fitbit-mcp.exe serve
fitbit-mcp serve --transport http --port 8000 # bearer-only HTTP (fitbit-mcp token prints the token)
npx @modelcontextprotocol/inspector .venv\Scripts\fitbit-mcp.exe serve
pytestLocal Docker mode (Claude Code running in a container next to it): use the same image with
fitbit-mcp serve --transport stdio and LOCAL_MODE=1, mounting the same ./data folder at /data.
Dependencies: declared in pyproject.toml; requirements.txt (runtime) and requirements-dev.txt are pinned
lock files generated from it. After changing dependencies, regenerate both:
pip-compile --strip-extras -o requirements.txt pyproject.toml
pip-compile --strip-extras --extra dev -o requirements-dev.txt pyproject.tomlWhen compiling on Windows, pip-compile pins Windows-only packages (pywin32) without a marker. Re-add
; sys_platform == "win32" to that line in both files, or the Linux Docker build fails.
6. Operations
Update:
git pull && docker compose up -d --buildLogs:
docker compose logs -f appStatus:
docker compose exec app fitbit-mcp statusBearer token:
docker compose exec app fitbit-mcp tokenBackups: nightly at 03:30 UTC into
./data/backups/(7 kept). Copy them anywhere, e.g.scp vps:fitbit-mcp/data/backups/* .Sync everything missing (full history, gaps):
docker compose exec app fitbit-mcp sync --missingRe-auth: if Google revokes the token,
data_statusreportsreauth_requiredand/setupshows Reconnect.Force older history:
docker compose exec app fitbit-mcp sync --backfill --since 2018-01-01 --types steps,heart-rate
7. Security model
The app binds to
127.0.0.1on the VPS. Only nginx (TLS via certbot) can reach it.OAuth 2.1 (DCR + CIMD, PKCE S256, RFC 9207
iss) via FastMCP's OAuth proxy. Login is delegated to Google, and the verifier rejects every account except the verifiedALLOWED_EMAIL. MCP client redirect URIs are allowlisted.Bearer token is generated randomly on first boot and compared in constant time.
Google refresh token is Fernet-encrypted at rest. The OAuth client store is encrypted too. Secrets live in
./data/secretswith mode 0600.run_sqluses a read-only connection,PRAGMA query_only, an authorizer that permits only SELECT/READ/FUNCTION, a 15 s progress-handler timeout and a row cap.Webhooks check the shared secret (constant time) and Google's ECDSA signature against the rotating public keyset. They acknowledge with 204 and process asynchronously.
No writes to Google: the server requests read-only scopes.
api_passthroughblocks write methods.Logs never contain health values or tokens.
Contributing
Issues and pull requests are welcome. Before opening a PR:
pip install -r requirements-dev.txt && pip install -e . --no-deps
pre-commit install # ruff + detect-secrets
pytestNever commit .env, anything under data/, or real health data. Tests use synthetic fixtures only.
Disclaimer
This is an independent project. It is not affiliated with, endorsed by, or supported by Google or Fitbit. "Fitbit" and "Google Health" are trademarks of Google LLC. The data it serves is not medical advice.
License
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Your Google Health data (Fitbit, Pixel Watch): sleep, HRV, readiness and biological age.
Your sleep, recovery, HRV, resting heart rate, activity and workouts from your watch, for any AI.
Your Garmin, Oura, WHOOP, Hevy and 35 more fitness apps, queryable from your own AI.
Garmin watch data for AI assistants: activities, sleep, HRV, recovery. Never writes to Garmin.
Related MCP Servers
- AlicenseBqualityBmaintenanceA local-first MCP server that enables AI agents to read user-authorized Google Health API v4 data from Fitbit, Pixel Watch, and partners via OAuth, with tokens never leaving the machine.26421 npm90MIT
- AlicenseBqualityBmaintenanceLocal-first MCP server that connects AI agents to your Fitbit activity, sleep, heart-rate, HRV, SpO2 and weight data.33132 npm5MIT
- AlicenseNot gradedqualityCmaintenanceExposes personal health data (recovery, sleep, strain, etc.) as MCP tools for AI agents to query and analyze.5MIT
- AlicenseAqualityDmaintenanceProvides read-only access to Fitbit health data (sleep, steps, heart rate, HRV) via local sync with Google Health API. Enables querying daily health summaries and trends through MCP tools without uploading data to cloud.6MIT