google-health-mcp

google-health-mcp

An MCP server that connects AI clients to the Google Health API, enabling natural language queries about health and fitness data such as steps, sleep, heart rate, and exercise sessions.

Category
访问服务器

README

Google Health MCP

CI License: MIT Deploy time: ~10 min

Ask your AI assistant about your own health data — steps, sleep, runs, heart rate, weight and more. Self-host in ~10 minutes on Cloudflare's free tier.

Works with Claude, Cursor, Windsurf, Zed, VS Code (Copilot), Continue.dev, and any other MCP-compatible client.


See it in action

Monthly exercise recap

You:    Summarise my exercise sessions for May

AI:     You logged 39 sessions in May — 2 runs and 37 walks.

        Highlights:
        • May 9  — Long run: 21.4 km in 2h 56m (looks like a half marathon effort!)
        • May 5  — Run: 5.1 km in 39 min
        • May 25 — Most active day: 7 walks, ~6.5 km total

        You were most active in the last week of May (May 22–31),
        with activity on 8 out of 10 days.

Sleep check-in

You:    How did I sleep last week?

AI:     Here's your sleep for Jun 16–22:

        Mon  7h 42m  ██████████████████░░░░
        Tue  6h 55m  ████████████████░░░░░░
        Wed  8h 03m  ████████████████████░░
        Thu  7h 20m  ██████████████████░░░░
        Fri  6h 30m  ███████████████░░░░░░░
        Sat  8h 45m  █████████████████████░
        Sun  7h 55m  ████████████████████░░

        Average: 7h 36m. Saturday was your best night.
        Tuesday and Friday were slightly under 7 hours.

Progress towards a goal

You:    Am I hitting 10,000 steps a day this month?

AI:     Over the last 30 days your daily average is 8,340 steps —
        about 83% of your 10,000-step target.

        You hit the goal on 11 out of 30 days.
        Best day: June 20 with 14,200 steps.
        Weekends tend to be stronger than weekdays for you.

Heart rate during a run

You:    What was my heart rate during my run on June 24?

AI:     During your 27-minute run on June 24 (3.76 km):

        Average heart rate: 180 bpm
        That puts it firmly in Zone 4 (threshold/hard effort).
        Your resting HR that day was 58 bpm — roughly 3× baseline.

More things you can ask

  • "How has my resting heart rate changed over the last 3 months?"
  • "Did I average more than 7 hours of sleep in June?"
  • "Compare my step counts this week vs last week."
  • "What's my average SpO2 at night?"
  • "How much have I walked vs run this year?"
  • "Show me my weight trend since January."
  • "Which day of the week am I most active?"

Available tools

Activity & Fitness

Tool Description
get_daily_summary Steps, calories and distance for a date range
get_steps_history Daily step counts for trend analysis
get_exercise_sessions Logged workouts with duration, distance, type
get_active_energy Daily active calories burned (excludes BMR)
get_active_minutes Daily active minutes and active zone minutes
get_floors Daily floors climbed
get_altitude Altitude readings
get_sedentary_periods Inactive/sedentary periods
get_activity_level Activity level classifications (sedentary → intense)
get_swim_sessions Swim sessions with lengths and stroke data

Cardio & Heart

Tool Description
get_heart_rate Raw heart rate samples + daily resting HR
get_heart_rate_variability HRV samples and daily HRV
get_heart_rate_zones Time and calories in each heart rate zone
get_vo2_max VO2 max, run VO2 max, and daily VO2 max
get_irregular_rhythm_notifications AFib / irregular rhythm alerts
get_ecg Electrocardiogram recordings

Health Metrics

Tool Description
get_spo2 Blood oxygen saturation (SpO2) readings
get_weight Weight measurements over time
get_body_composition Body fat percentage and height
get_blood_glucose Blood glucose readings
get_temperature Core body temperature and sleep temperature derivations
get_respiratory_rate Daily respiratory rate and sleep respiratory summary

Sleep

Tool Description
get_sleep Sleep sessions and stages

Nutrition

Tool Description
get_nutrition Daily hydration and nutrition log summaries
get_food Logged food entries

Utilities

Tool Description
get_raw_data_points Query any Google Health data type by its raw ID
check_progress_vs_target Compare your recent daily average against a target
health_connection_status Check token health / debug connection issues

Prerequisites


Setup

7 steps, ~10 minutes.

1. Clone and install

git clone https://github.com/akshaygoyal/google-health-mcp.git
cd google-health-mcp
npm install

2. Enable the Google Health API

  1. Go to Google Cloud Console → APIs & Services → Enable APIs
  2. Search for and enable Google Health API
  3. Go to Credentials → Create OAuth 2.0 Client ID (type: Web application)
  4. Add http://127.0.0.1:8765/callback as an authorised redirect URI
  5. Note your Client ID and Client Secret

3. Create a Cloudflare KV namespace

npm run kv:create

Copy the returned id and paste it into wrangler.toml under [[kv_namespaces]].

4. Set secrets in Cloudflare

# A long random string — becomes part of your private connector URL
wrangler secret put MCP_SHARED_SECRET

# From your Google Cloud OAuth client
wrangler secret put GOOGLE_CLIENT_ID
wrangler secret put GOOGLE_CLIENT_SECRET

5. Get your Google refresh token

GOOGLE_CLIENT_ID=your-id GOOGLE_CLIENT_SECRET=your-secret npm run token:setup

This opens a browser for Google consent. After approving, copy the printed command and run it:

wrangler kv key put --binding=HEALTH_TOKENS google_refresh_token "your-refresh-token"

6. Deploy

npm run deploy

Your MCP server is now live at:

https://google-health-mcp.<your-workers-subdomain>.workers.dev/mcp/<MCP_SHARED_SECRET>

7. Connect your MCP client

Add the URL above as a custom MCP server in your AI client:

  • Claude.ai → Customize → Integrations → Add integration URL
  • Cursor → Settings → MCP → Add server URL
  • Windsurf → Settings → MCP Servers → Add
  • VS Code (Copilot).vscode/mcp.json → add server entry
  • Continue.devconfig.jsonmcpServers array

Local development

cp .dev.vars.example .dev.vars
# Fill in .dev.vars with your credentials
npm run dev

Data types

All 38 Google Health API data types have dedicated tools. The get_raw_data_points tool is also available for querying any type by its raw identifier — see the Google Health data types reference for the full list.


Security

  • The MCP endpoint is only accessible via a secret URL — treat it like a password
  • This server is read-only: it never writes data back to Google Health
  • Your refresh token is stored in Cloudflare KV, encrypted at rest

Staying up to date

To pull the latest changes and redeploy your instance:

git pull origin main
npm install   # only needed if dependencies changed
npm run deploy

No re-setup of secrets or KV is needed — those persist across deployments.

If new tools aren't showing up in your AI client after a deployment, disconnect and reconnect the integration — most MCP clients cache the tool list from when you first connected.

If a release changes the Google OAuth scopes (check the CHANGELOG), you'll need to re-run npm run token:setup to get a new refresh token with the updated permissions.


Changelog

See CHANGELOG.md for a full history of releases and what changed in each version.


Feedback & contributions

Tried it? Found a bug? Want a new data type added?

👉 Open an issue — feedback of any kind is very welcome, especially from first-time users.

If you'd like to contribute, please read the contributing guide first.


License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选