Fitbit Mcp

io.github.partymola由 GitHub 帳號 partymola 發布v0.6.0更新於 Oct 28, 2026

Retired, superseded by google-health-mcp. Fitbit Web API shuts down 30 Sept 2026.

概覽

AI 產生的概覽

已停用的 Fitbit Web API MCP 伺服器,將個人健康資料快取到本機 SQLite 供查詢與趨勢分析,已由 google-health-mcp 取代。

可以做什麼
  • 把 Fitbit 資料同步到本機 SQLite 快取,支援增量同步或指定日期區間
  • 查詢快取中的心率、活動、運動紀錄、睡眠、體重、血氧、心率變異、活躍區間分鐘、呼吸頻率、體溫、心肺適能和飲食紀錄
  • 取得僅能即時查詢的資料:配對裝置、歷史累計統計和活動目標
  • 依週、月或季彙總趨勢,並比較兩個期間
  • 透過命令列完成 OAuth 授權、同步、診斷和 JSON 匯入
適用情境
只適合已安裝並完成授權、想在 API 關閉前繼續查詢本機快取歷史資料的人。新使用者應改用 google-health-mcp,因為 Fitbit 已不再接受新的應用程式註冊。
執行需求
需要本機 Python 3.13+ 程序,從 PyPI 安裝或以 uvx 執行。需要一個已註冊個人應用程式的 Fitbit 開發者帳號及其 Client ID,並透過瀏覽器完成 OAuth PKCE 登入,權杖儲存在設定目錄。可選環境變數 FITBIT_MCP_CONFIG_DIR、FITBIT_MCP_DB_PATH 和 FITBIT_MCP_OFFLINE。除非啟用離線模式,否則需要連線 Fitbit API 的網路。
安裝前請注意
此伺服器已停用,Fitbit Web API 將於 2026 年 9 月 30 日關閉,之後無法再取得資料。它申請較廣的 OAuth 權限,涵蓋活動、心率、睡眠、體重、血氧、個人檔案、體溫、營養、位置和設定,會讀取敏感的健康與 GPS 資料。權杖儲存在本機權杖檔中;輪替式更新權杖應只由一台主機持有。若需要 Google 未提供的欄位,請在關閉前備份本機資料庫。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Fitbit Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

fitbit-mcp

[CI] [License: GPL v3] [Python 3.13+] [PyPI] [Glama MCP Server]

Retired. Use google-health-mcp instead.

The Fitbit Web API shuts down on 30 September 2026. Fitbit has also stopped accepting new app registrations, so this package can no longer be set up from scratch: step 2 below needs a registered personal app and there is no longer a way to create one. An existing install keeps working until the shutdown date.

google-health-mcp covers the same measurements through the Google Health API, and adds ECG and irregular-rhythm notifications. It reads history from Google rather than from this package's cache, so there is nothing to migrate: install it and run one backfill.

Not everything carries over. Fitbit's activity goals and its server-side lifetime totals have no equivalent there, and among the fields Google does not serve are heart rate zones, the active-minutes breakdown, VO2 max as a range rather than a single number, sleep efficiency, SpO2 high and low, and BMI. After 30 September this package can no longer fetch them either, so copy your fitbit.db before then if you want to keep them.

MCP server for the Fitbit Web API with OAuth PKCE, local SQLite cache, and trend analysis.

Designed for Claude Code and other MCP clients. Syncs your Fitbit data to a local database for fast, offline queries - no API calls needed after the initial sync.

Features

  • OAuth 2.0 PKCE - Secure auth flow, no client secret needed
  • Local SQLite cache - Sync once, query instantly
  • Incremental sync - Only fetches new data since last sync
  • MCP tools - Sync, query (cached data types plus live-only devices/lifetime/goals), and trend analysis
  • Live mode - Bypass cache and query the API directly
  • CLI - Auth setup, sync, and JSON import from the command line
  • Rate limit handling - Activity and food log syncs sleep and retry on 429; other data types report rate_limited and resume on the next sync

Data types

ToolData
fitbit_get_heart_rateResting HR, HR zones
fitbit_get_activitySteps, calories, active minutes, distance
fitbit_get_exercisesExercise sessions (name, duration, HR, calories)
fitbit_get_sleepDuration, efficiency, sleep stages
fitbit_get_weightWeight, BMI, body fat %
fitbit_get_spo2Blood oxygen saturation (avg/min/max)
fitbit_get_hrvHeart rate variability (RMSSD)
fitbit_get_azmActive Zone Minutes with per-zone breakdown
fitbit_get_breathing_rateNightly breaths per minute
fitbit_get_skin_temperatureNightly skin temperature variation (degrees C from baseline)
fitbit_get_core_temperatureManually-logged core (body) temperature readings (degrees C)
fitbit_get_cardio_fitnessVO2 Max / Cardio Fitness Score
fitbit_get_food_logDaily food calories + water intake
fitbit_get_devicesPaired devices, battery level, last sync (live)
fitbit_get_lifetime_statsAll-time totals and personal best records (live)
fitbit_get_goalsUser-set daily/weekly activity goals (live)
fitbit_trendsAggregated averages (weekly/monthly/quarterly)

Requirements

Setup

1. Install

bash
pip install fitbit-mcp

Or run it without installing:

bash
uvx fitbit-mcp

For development from a clone:

bash
pip install -e ".[dev]"

2. Register a Fitbit app

  1. Go to dev.fitbit.com/apps and create a new app
  2. Set OAuth 2.0 Application Type to Personal
  3. Set Redirect URL to http://localhost:8080
  4. Note your Client ID (you won't need the client secret - PKCE doesn't use one)

3. Authenticate

bash
fitbit-mcp auth

This opens your browser for Fitbit login, exchanges the auth code via PKCE, and saves tokens locally.

Tokens are stored in ~/.config/fitbit-mcp/fitbit_tokens.json with 0600 permissions. Access tokens expire in 8 hours and are refreshed automatically. Refresh tokens expire after 90 days of inactivity.

4. Register with Claude Code

bash
claude mcp add -s user fitbit -- fitbit-mcp

5. First sync (optional)

Query tools auto-sync on first use, so you can skip this step. To pre-populate the cache or sync a longer history, run:

bash
fitbit-mcp sync --days 30

CLI usage

fitbit-mcp              Start the MCP server (stdio transport)fitbit-mcp -V, --version  Print the installed package versionfitbit-mcp auth         Interactive OAuth setupfitbit-mcp doctor       Check the setup and report what needs fixingfitbit-mcp sync         Sync data to local cache  --days N              Days of history for first sync (default: 30)  --types TYPE,...      Data types to sync (default: all)  --since YYYY-MM-DD    Backfill from this date, overriding the incremental                        resume-from-last-sync cursor and --days  --until YYYY-MM-DD    Inclusive end date for a --since backfill; together                        they re-fetch exactly that window (e.g. to repair a                        gap in the middle of the cache)fitbit-mcp import       Import existing JSON data files  --data-dir PATH       Directory containing JSON files

MCP tool reference

Query tools auto-sync on the first query of each day per data type. Use live=True to bypass the cache entirely and fetch directly from the API.

All query tools accept these common parameters:

  • start_date - Start date as YYYY-MM-DD, YYYY-MM, or 30d (relative). Default: last 30 days.
  • end_date - End date as YYYY-MM-DD. Default: today.
  • live - If true, fetch from Fitbit API instead of cache (bypasses auto-sync).

fitbit_get_exercises also accepts:

  • exercise_type - Filter by activity name (case-insensitive substring match), e.g. "cycling", "walk", "run". Default: all types.

fitbit_sync

Syncs data from the Fitbit API to the local SQLite cache. Query tools call this automatically on first use of the day, so explicit calls are only needed for longer history or forced refresh.

  • data_types - What to sync: all, heart_rate, activity, exercises, sleep, weight, spo2, hrv, azm, breathing_rate, skin_temperature, core_temperature, cardio_fitness, food_log. Comma-separated. Default: all.
  • days - Days of history for first sync (default: 30). Subsequent syncs are incremental.
  • since - Optional YYYY-MM-DD. Backfill from this date regardless of what is already cached, overriding incremental resume and days.
  • until - Optional YYYY-MM-DD inclusive end date; requires since. Together they re-fetch and upsert exactly the since..until window - use to repair a gap in the middle of the cache without re-pulling everything up to today.

fitbit_trends

Aggregated trend analysis from cached data.

  • data_type - What to analyse: heart_rate, activity, exercises, sleep, weight, spo2, hrv, azm, breathing_rate, skin_temperature, core_temperature, cardio_fitness, food_log. Default: activity.
  • period - Aggregation: weekly, monthly, quarterly. Default: monthly.
  • start_date - Start date. Default: last 12 months (365 days).
  • end_date - End date. Default: today.
  • compare - Compare two periods: last_30d vs previous_30d, 2026-03 vs 2026-02, 2026-Q1 vs 2025-Q4. When set, period/start_date/end_date are ignored.

OAuth scopes

The following Fitbit API scopes are requested during setup:

ScopeData accessed
activitySteps, calories, active minutes, distance, AZM, lifetime stats, goals
heartrateResting HR, HR zones, HRV
sleepSleep duration and stages
weightWeight, BMI, body fat %
oxygen_saturationSpO2 (blood oxygen)
profileUser profile (user ID, display name)
respiratory_rateNightly breathing rate
temperatureSkin temperature variation and manually-logged core temperature
cardio_fitnessVO2 Max / Cardio Fitness Score
nutritionDaily food calorie and water log
locationGPS data on logged exercises
settingsPaired devices (battery, last sync)

These are the scopes needed for all tools. If you only need a subset, edit FITBIT_SCOPES in config.py before setup. After upgrading from a smaller scope set, re-run fitbit-mcp auth to re-authorise.

Configuration

Paths are overridable via environment variables:

VariableDefaultDescription
FITBIT_MCP_CONFIG_DIR~/.config/fitbit-mcp/Directory for OAuth credentials
FITBIT_MCP_DB_PATH~/.local/share/fitbit-mcp/fitbit.dbSQLite database path
FITBIT_MCP_OFFLINEunsetIf truthy (1, true, yes, on), run as a cache-only reader: no credentials required, no live API calls. See below.

Offline / cache-only mode

By default the server auto-syncs on demand, so query tools fetch fresh data without a cron job. Set FITBIT_MCP_OFFLINE=1 to run as a pure cache reader instead:

  • No Fitbit credentials are required - the server never touches the token file.
  • No live API calls are made. Auto-sync is disabled, and live=True, the live-only tools (fitbit_get_devices, fitbit_get_lifetime_stats, fitbit_get_goals), and fitbit_sync return a clear "offline mode" message instead of calling the API.
  • Query tools serve whatever is in the local SQLite cache. Responses are tagged with "offline_mode": true.

Typical uses:

  • Multi-device setups - one host runs fitbit-mcp sync (via cron/systemd) against a shared database; other hosts set FITBIT_MCP_OFFLINE=1 and point FITBIT_MCP_DB_PATH at the same cache, and only read. This keeps the Fitbit OAuth token (single-use, rotating) owned by exactly one host, avoiding refresh collisions.
  • CI and privacy - run queries with no network access and no credentials.

Keeping the cache fresh is then the syncing host's job. Unset FITBIT_MCP_OFFLINE to return to on-demand auto-sync.

Rate limits

The Fitbit API allows 150 requests per hour. Activity and food log syncs sleep and retry automatically on a 429; the date-range data types instead mark that sync as rate_limited and pick up again on the next run. Be aware:

  • Activity and food log syncs use 1 API call per day (no date-range endpoint available)
  • A 30-day initial sync of either uses ~30 of your 150/hour quota
  • Heart rate, sleep, weight, SpO2, HRV, AZM, breathing rate, skin temperature, core temperature, and cardio fitness use date-range endpoints and are much more efficient

Use live=False (the default) to query from cache and avoid API calls entirely.

Data safety

This project includes a pre-commit hook (scripts/check-no-data.sh) that prevents accidentally committing:

  • Database files (*.db, *.db-journal, *.db-wal)
  • Config/credentials (config/*.json)
  • Large files (>100KB)

Install it after cloning:

bash
ln -sf ../../scripts/check-no-data.sh .git/hooks/pre-commit

Importing existing data

If you have existing Fitbit data as JSON files (e.g. from a previous export or script), you can bulk-import them:

bash
fitbit-mcp import --data-dir /path/to/json/files/

Expected file names: heart_rate.json, activity.json, exercises.json, sleep.json, weight.json, spo2.json, hrv.json. See src/fitbit_mcp/importer.py for the expected JSON format. Import currently covers these seven types only; the newer types (AZM, breathing rate, skin/core temperature, cardio fitness, food log) are populated via sync, not import.

Contributing

See CONTRIBUTING.md for development setup, the test workflow, and the pre-commit hook. Changes are tracked in CHANGELOG.md.

License

GPL-3.0-or-later

來源:README.md,提交 f4815b6

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.6.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分