
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.
概览
已停用的 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 的网络连接。
安装
在 SourceWeft 中
- 打开 控制台中的 Fitbit Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
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-mcpcovers 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.dbbefore 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_limitedand resume on the next sync
Data types
Requirements
- Python 3.13+ (tested on 3.13 and 3.14 in CI)
- A Fitbit developer account with a registered personal app
Setup
1. Install
Or run it without installing:
For development from a clone:
2. Register a Fitbit app
- Go to dev.fitbit.com/apps and create a new app
- Set OAuth 2.0 Application Type to Personal
- Set Redirect URL to
http://localhost:8080 - Note your Client ID (you won't need the client secret - PKCE doesn't use one)
3. Authenticate
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
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:
CLI usage
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 asYYYY-MM-DD,YYYY-MM, or30d(relative). Default: last 30 days.end_date- End date asYYYY-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- OptionalYYYY-MM-DD. Backfill from this date regardless of what is already cached, overriding incremental resume anddays.until- OptionalYYYY-MM-DDinclusive end date; requiressince. Together they re-fetch and upsert exactly thesince..untilwindow - 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_dateare ignored.
OAuth scopes
The following Fitbit API scopes are requested during setup:
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:
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), andfitbit_syncreturn 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 setFITBIT_MCP_OFFLINE=1and pointFITBIT_MCP_DB_PATHat 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:
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:
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
来源:README.md,提交 f4815b6
工具
0版本历史
1- v0.6.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分