google-health-mcp-server

google-health-mcp-server

MCP server to read daily activity, sleep, heart rate, and body metrics from Google Health API, allowing AI assistants like Claude to access your health data. Optionally syncs health metrics to an Obsidian vault.

Category
访问服务器

README

🩺 google-health-mcp-server

Hand your whole-body health data to your AI — steps, distance, heart rate, and more from Apple Watch, Fitbit, or Pixel Watch, unified through Google Health.

MCP Google Health API v4 License: MIT

An MCP server for the Google Health API v4 — read your daily activity, sleep, heart rate, and body metrics from any source connected to Google Health (Apple Watch import, Fitbit Air, Pixel Watch, ...) in Claude or any MCP client, and optionally sync them into an Obsidian vault.

Self-hosted and local-first: it uses your own Google Cloud OAuth app, tokens are stored on your machine at mode 0600, and no health data leaves your control.

Beta notice. The Google Health API v4 is new (public beta; legacy Fitbit Web API turns down September 2026). Field shapes may still shift. This server normalizes daily values best-effort and always returns the raw rollup points alongside, so nothing is lost if a field mapping in src/constants.ts needs a tweak against live data.

Tools

Tool What it does
get_daily_summary Per-day table of steps, distance, active calories, active minutes, resting HR, sleep over a date range (or trailing days). Start here.
list_data_points Raw, un-rolled-up points for one dataType — intraday HR, sleep stages, or any type not in the summary.
list_paired_devices Devices paired to the account — confirm a new device (e.g. Fitbit Air) has connected.
connection_status Health-check: token works? which scopes granted? which metrics actually return data over the last 7 days? Run this first after setup.
sync_health_to_obsidian Daily markdown notes under {vault}/Lifestyle/Health/ + a rolling 7/30-day dashboard.

One-time setup

1. Google Cloud project + API

  1. Create or pick a project at https://console.cloud.google.com/.
  2. Enable the Google Health API: https://console.cloud.google.com/apis/library/health.googleapis.com

2. OAuth consent screen

  1. Go to APIs & Services → OAuth consent screen. User type External.
  2. Fill in the app name and your email.
  3. Under Audience → Test users, add your own Google account.
  4. On the Data access page, add these scopes (search "Google Health"):
    • …/auth/googlehealth.profile.readonly
    • …/auth/googlehealth.settings.readonly
    • …/auth/googlehealth.activity_and_fitness.readonly
    • …/auth/googlehealth.health_metrics_and_measurements.readonly
    • …/auth/googlehealth.sleep.readonly
    • …/auth/googlehealth.nutrition.readonly

⚠️ 7-day token caveat (and why you should stay in Testing). While the consent screen is in Testing status, Google issues refresh tokens that expire after 7 days. You might expect to fix this by publishing to Production — but the Google Health scopes are Google's Restricted tier, and Restricted scopes in Production require a full security verification (CASA assessment). There is no "click through the unverified warning" bypass for Restricted scopes (that bypass only exists for Sensitive scopes). Verification is impractical for a single-user personal tool, so the recommended setup is: keep the app in Testing, add yourself as a Test user, and accept the 7-day expiry. Re-authorize lazily — only when you actually use the data and a call reports the token has lapsed — by re-running npm run oauth (a ~10s browser approve). Don't bother re-authing in weeks you don't touch the data.

3. OAuth credentials

  1. APIs & Services → Credentials → Create credentials → OAuth client ID.
  2. Application type: Web application.
  3. Under Authorized redirect URIs, add exactly:
    http://localhost:47813/callback
    
    (Must match GOOGLE_HEALTH_OAUTH_PORT. Change both together if 47813 is taken.)
  4. Copy the Client ID and Client secret.

4. Configure + authorize

npm install
cp .env.example .env          # then paste your client ID + secret into .env
npm run oauth                 # opens a browser; approve access. Tokens saved to
                              # ~/.config/google-health-mcp/tokens.json (mode 0600)
npm run build

Verify it works:

node dist/index.js            # should print "Google Health MCP server running on stdio"

…or call connection_status once registered in your MCP client.

Register in Claude

Add to ~/Library/Application Support/Claude/claude_desktop_config.json and restart Claude:

{
  "mcpServers": {
    "google-health": {
      "command": "node",
      "args": ["/Users/<you>/projects/google-health-mcp-server/dist/index.js"],
      "env": {
        "GOOGLE_HEALTH_TOKENS_PATH": "/Users/<you>/.config/google-health-mcp/tokens.json",
        "OBSIDIAN_VAULT_PATH": "/Users/<you>/Documents/Obsidian Vault"
      }
    }
  }
}

The runtime reads the client ID/secret back from the tokens file, so they don't need to be in the MCP env block — only the token path and (optionally) the vault path.

Obsidian sync (optional)

Interactive queries via the MCP tools are always live and pull on demand. The Obsidian notes + dashboard only need a periodic refresh, so set OBSIDIAN_VAULT_PATH and either call sync_health_to_obsidian from Claude or run the CLI:

npm run sync                  # incremental sync since last run

For an automated monthly refresh, a launchd template is in launchd/. Copy it to ~/Library/LaunchAgents/, replace __USERNAME__, and launchctl bootstrap gui/$(id -u) <plist>. It runs on the 1st of each month and is best-effort: if the 7-day token has lapsed it logs a "re-auth needed" note and exits cleanly (no crash-loop), and you re-auth lazily next time you use the data. A daily cron isn't worth it given the token expiry — monthly + on-demand is the pragmatic cadence.

Develop

npm run build       # tsc --noCheck → dist/
npm run typecheck   # strict type check (excludes tests)
npm test            # vitest — pure logic (civil-date math, value extraction)
npm run dev         # build + run the server on stdio

See CLAUDE.md for architecture notes and known pitfalls.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选