Google Health MCP Bridge
Provides read-only access to Google Health API v4 data, with tools for querying daily steps, sleep sessions, heart rate, HRV, exercises, and arbitrary health data types via custom filters.
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.
Google Health MCP Bridge (Cloud Run Template)
A self-hosted, read-only Model Context Protocol (MCP) bridge that connects your Google Health API v4 data (Fitbit, Pixel Watch, and cloud-synced Google Health metrics) to Gemini (web and mobile) over Streamable HTTP—running on Google Cloud Run + Firestore within Google Cloud's Always Free tier ($0/month for personal use).
Architecture
Gemini (Web & Mobile)
│ Stateless Streamable HTTP + OAuth 2.0 Bearer Token
▼
Google Cloud Run (your-service.run.app)
├── FilterOAuthScopesMiddleware → strips client-internal scopes on /authorize
├── GracefulGoogleProvider → FastMCP OAuth 2.0 proxy + 30d access token, 5m proactive upstream refresh, & 5m idempotent refresh grace window
├── FirestoreStore (default) → persists OAuth client registrations, tokens, & encrypted grace records across cold starts
└── Health Tools → queries/logs https://health.googleapis.com/v4/users/me/dataTypes/*Cold-Start & OAuth Resilience (Always Free Tier)
30-day FastMCP access tokens + proactive upstream refresh:
GracefulGoogleProviderissues 30-day FastMCP access tokens (fastmcp_access_token_expiry_seconds=2592000) and transparently refreshes Google's 1-hour upstream token 5 minutes before expiry (token_expiry_threshold_seconds=300,cache_ttl_seconds=300), eliminating routine/tokencalls during cold starts.5-minute idempotent refresh grace window: Rotated refresh tokens remain valid for 5 minutes (stored Fernet-encrypted in Firestore) so if a client times out during a cold start and retries
/tokenwith the previous refresh token, it receives the already-minted token set instead of401 invalid_grant.Faster cold starts:
Dockerfilepre-compiles.pycbytecode during build andrequirements.txtpinsfastmcp-slim[server]==4.2.2andpy-key-value-aio[firestore,wrappers-encryption]==0.5.0.
Exposed MCP Tools
Tool | Google Health v4 Data Type | Access / Default Window |
|
| Read · Last 7 days (reconciled, local-timezone daily totals) |
|
| Read · Last 7 days (sessions) |
|
| Read · Last 3 days (daily min/max/avg BPM) |
|
| Read · Last 14 days |
|
| Read · Last 14 days |
|
| Read · Last 2 days |
|
| Read · Last 2 days (daily mL & fl oz) |
|
| Read · Last 14 days (merged daily) |
|
| Read · Last 7 days (TDEE & AZM) |
|
| Read · Last 30 days (lbs/kg, EWMA trend, body fat %, auto-attached profile & goals) |
| Env physiology + Firestore | Read · Base profile, North Star + Phase Milestones, computed athletic bands & pace |
| Firestore | Write · Update North Star, |
| Combined TDEE + meals + hydration + weight + recovery + glucose + supplements | Read · Last 7 days (1-call net deficit with completeness gate, EWMA weight, RHR delta, sleep debt, cycle context & CGM summary) |
| LibreLinkUp → Firestore | Read · Last 7 days (live reading + trend, TIR 70–140 & 70–180, Mean, %CV, GMI, fasting, 2h post-meal spikes) |
|
| Write · Log food, calories, macros, meal type |
|
| Write · Log water intake (mL) |
| Firestore | Write · Log vitamins, supplements, or medications (dose, unit, timing) |
| Firestore | Read · Last 14 days supplement/medication logs & adherence counts |
| Firestore | Delete · Remove a supplement/medication log by |
| Firestore | Write · Log straight or pyramid sets (reps, weight, RPE) |
| Firestore | Read · Last 14 days (filter by exercise, volume, top weight & Epley e1RM) |
| Firestore | Delete · Remove a mistyped strength log by |
| Firestore | Write · Log meditation/mindfulness (duration, Calm %, Stillness %, HR) |
| Firestore | Read · Last 14 days (total minutes, avg Calm/Stillness %) |
| Firestore | Delete · Remove a mindfulness log by |
|
| Delete · Remove duplicate/mistyped meals by resource |
|
| Delete · Remove duplicate/mistyped water logs by resource |
| Firestore | Write · Daily soreness (0-10), |
| Firestore | Read · Last 30 days readiness check-ins, latest waist & derived |
| Any v4 | Read · Custom filter |
Related MCP server: Google Health Broker
Prerequisites
A Google account with health data synced to Google Health (e.g., Fitbit / Pixel Watch). (Note: Android Health Connect is on-device only and does not expose a cloud API.)
A Google Cloud project with an active billing account (required for Cloud Run; stays $0/month under Always Free limits).
Step-by-Step Deployment
1. Select Your GCP Project & Enable APIs
export PROJECT_ID="YOUR_PROJECT_ID"
gcloud config set project "$PROJECT_ID"
gcloud services enable \
run.googleapis.com \
cloudbuild.googleapis.com \
artifactregistry.googleapis.com \
firestore.googleapis.comAlso enable Google Health API in the Google Cloud Console under APIs & Services → Library.
2. Create a Free-Tier Firestore Database (Persists Sessions Across Cold Starts)
gcloud firestore databases create \
--location=us-central1 \
--type=firestore-native
PROJECT_NUMBER=$(gcloud projects describe "$PROJECT_ID" --format="value(projectNumber)")
gcloud projects add-iam-policy-binding "$PROJECT_ID" \
--member="serviceAccount:${PROJECT_NUMBER}-compute@developer.gserviceaccount.com" \
--role="roles/datastore.user"3. Configure Google OAuth
Open Google Cloud Console → Google Auth Platform → Branding (or APIs & Services → OAuth consent screen) and fill in:
App name, User support email, Application home page, Privacy policy link, and Developer contact email.
Under Data Access / Scopes, add:
openidhttps://www.googleapis.com/auth/userinfo.emailhttps://www.googleapis.com/auth/googlehealth.activity_and_fitness.readonlyhttps://www.googleapis.com/auth/googlehealth.health_metrics_and_measurements.readonlyhttps://www.googleapis.com/auth/googlehealth.sleep.readonlyhttps://www.googleapis.com/auth/googlehealth.nutrition.readonlyhttps://www.googleapis.com/auth/googlehealth.nutrition.writeonly
Under Audience, switch Publishing status from Testing to In production (personal apps under 100 users do not need public verification, and In production prevents Google's 7-day refresh token expiration).
Under Clients → Create Client → Web application, create an OAuth 2.0 Web Client and save your Client ID and Client Secret in a password manager.
4. Deploy to Cloud Run
Generate a stable signing key so tokens stay valid across container restarts:
JWT_SIGNING_KEY=$(python3 -c "import secrets; print(secrets.token_hex(32))")Deploy to us-central1 with scale-to-zero (--min-instances 0, --max-instances 1) to stay inside the Always Free tier:
gcloud run deploy google-health-mcp \
--source . \
--region us-central1 \
--allow-unauthenticated \
--min-instances 0 \
--max-instances 1 \
--memory 512Mi \
--set-env-vars "GOOGLE_CLIENT_ID=YOUR_CLIENT_ID,GOOGLE_CLIENT_SECRET=YOUR_CLIENT_SECRET,JWT_SIGNING_KEY=${JWT_SIGNING_KEY},BASE_URL=https://placeholder.run.app,ALLOWED_EMAIL=you@example.com,USE_FIRESTORE=true"Copy the Service URL printed by gcloud (e.g., https://google-health-mcp-xxxxx-uc.a.run.app), then update BASE_URL:
export SERVICE_URL="https://google-health-mcp-xxxxx-uc.a.run.app"
gcloud run services update google-health-mcp \
--region us-central1 \
--update-env-vars "BASE_URL=${SERVICE_URL}"5. Add the Authorized Redirect URI
Back in Google Cloud Console → Google Auth Platform → Clients → your OAuth Web Client, add this Authorized redirect URI:
https://google-health-mcp-xxxxx-uc.a.run.app/auth/callbackClick Save.
6. Connect to Gemini
Open gemini.google.com → Settings → Connected Apps → Add Custom MCP Connector (ensure Keep Activity is enabled).
Set:
Name:
Google HealthMCP Server URL:
https://google-health-mcp-xxxxx-uc.a.run.app/mcp
Complete the Google sign-in prompt (click Advanced → Go to … once if your app is unverified).
(Optional) In Gemini Settings → Saved info, add a rule telling Gemini to always use your
Google Healthconnected app whenever you ask about steps, sleep, heart rate, HRV, or workouts.
7. Optional ($0/month): Cloud Scheduler Keep-Warm Ping
Cloud Run scales to zero after ~15 minutes of inactivity. You can optionally create 1 free Cloud Scheduler job (3 jobs/month Always Free per billing account; under request-based billing, idle time between pings is not billed) to keep the container warm most of the time:
gcloud services enable cloudscheduler.googleapis.com
gcloud scheduler jobs create http google-health-mcp-keepwarm \
--location=us-central1 \
--schedule="*/10 * * * *" \
--uri="${SERVICE_URL}/.well-known/oauth-authorization-server" \
--http-method=GET \
--attempt-deadline=30s8. Optional: Base Physiology Profile & Dynamic Goals
Set optional environment variables on Cloud Run so Gemini automatically receives your timezone, BMI, Mifflin-St Jeor BMR, Waist-to-Height Ratio (WHtR), athletic recomp anchors, and safe pace guardrails:
gcloud run services update google-health-mcp \
--region us-central1 \
--update-env-vars "USER_TIMEZONE=America/Toronto,USER_SEX=female,USER_HEIGHT_CM=166,USER_BIRTH_YEAR=1990"Mutable goals (target_weight_mode: optimal | custom, pace_mode: optimal | slow | normal | medium_fast | fast | by_date, nutrition_phase: cut | refeed | diet_break, and Phase milestones) are persisted in Firestore (user_profile/goals) and editable via Gemini (update_user_goals) or the companion local dashboard.
9. Optional ($0/month): FreeStyle Libre 3 / 3 Plus CGM via LibreLinkUp
FreeStyle Libre 3 apps do not sync natively to Google Health, so the bridge pulls live readings from Abbott's LibreLinkUp follower API and archives 5-minute points into daily Firestore buckets (glucose_days/YYYY-MM-DD, ~15 KB/day):
In your official FreeStyle Libre 3 app → Menu → Connected Apps → LibreLinkUp → Manage → Add Connection, invite a follower email (a Gmail
+llualias works great).Install the LibreLinkUp app (must match the same country/region as your Libre 3 account), create the follower account with that invited email, and tap Accept on the connection invite.
Add the follower credentials and a random
CRON_SECRETto Cloud Run:CRON_SECRET=$(openssl rand -hex 24) gcloud run services update google-health-mcp \ --region us-central1 \ --update-env-vars "LLU_EMAIL=you+llu@example.com,LLU_PASSWORD=YOUR_LLU_PASSWORD,LLU_VERSION=4.16.0,CRON_SECRET=${CRON_SECRET}"Create a free 15-minute Cloud Scheduler job (uses 2 of 3 free jobs/month) so history is archived 24/7 past LibreLinkUp's 12-hour window:
gcloud scheduler jobs create http google-health-mcp-glucose-sync \ --location=us-central1 \ --schedule="*/15 * * * *" \ --uri="${SERVICE_URL}/cron/sync-glucose" \ --http-method=POST \ --headers="X-Cron-Secret=${CRON_SECRET}"
(The bridge caches the LibreLinkUp JWT token + SHA-256 Account-Id header in Firestore user_profile/llu_session to avoid Abbott login rate limits.)
10. Recommended ($0/month): Auto-Prune Old Artifact Registry Images & Budget Alert
Keep Artifact Registry container storage under the 500 MB Always Free limit by retaining only the 2 most recent deploys:
cat << 'EOF' > /tmp/ar-cleanup-policy.json
[
{"name": "keep-latest-2", "action": {"type": "Keep"}, "mostRecentVersions": {"keepCount": 2}},
{"name": "delete-old", "action": {"type": "Delete"}, "condition": {"tagState": "ANY", "olderThan": "86400s"}}
]
EOF
gcloud artifacts repositories set-cleanup-policies cloud-run-source-deploy \
--location=us-central1 --policy=/tmp/ar-cleanup-policy.json --no-dry-runSet a monthly budget alert as a safety net:
BILLING_ACCOUNT=$(gcloud billing projects describe "$PROJECT_ID" --format="value(billingAccountName)" | cut -d/ -f2)
gcloud services enable billingbudgets.googleapis.com
gcloud billing budgets create \
--billing-account="$BILLING_ACCOUNT" \
--display-name="Health MCP Monthly Alert" \
--budget-amount=5USD \
--filter-projects="projects/${PROJECT_NUMBER}" \
--threshold-rule=percent=0.5 \
--threshold-rule=percent=0.8 \
--threshold-rule=percent=1.0 \
--threshold-rule=percent=1.0,basis=forecasted-spend(Replace 5USD with your billing account's currency code if different.)
Troubleshooting & Agent Instructions
See AGENTS.md for deployment tips, Google Health API v4 filter gotchas, and troubleshooting steps.
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.
Read wearables and lab health data — sleep, activity, workouts, timeseries, lab tests and orders.
Multi-tenant hosted MCP server for Oura Ring — 21 read-only tools, OAuth per user.
Ask Claude, ChatGPT or Cursor about your Apple Health data: workouts, sleep, food. Read-only.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to read Apple Health data through three tools: current stats, detailed metrics, and trends. Deployable to Cloudflare with a one-click phone setup, exposing only read-only access.MIT
- AlicenseNot gradedqualityCmaintenanceSelf-hosted multi-user Google Health OAuth broker and read-only Agent API with remote MCP support. Enables users to connect their Google account and grant agents secure access to activity, sleep, heart, HRV, SpO2, and other health metrics via revocable per-token authentication.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to query personal health data collected by any wearable or phone fitness app through Android Health Connect or Apple Health, exposing read-only tools for metrics like heart rate, sleep stages, VO2 max, and body composition. It can run locally over USB with nothing stored, or be self-hosted on Cloudflare Workers with D1 to retain history beyond Health Connect's 30-day limit.20 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI apps to query a user's Google Health data—such as sleep, heart rate, HRV, activity, and paired devices—through read-only tools deployed privately in the user's own Firebase project.1AGPL 3.0