google-health-mcp-server: Instructions file for Claude Code

CLAUDE.md

google-health-mcp-server CLAUDE.md is an instructions file for Claude Code from madfreakz/google-health-mcp-server. It costs 2,209 tokens per session, scanned A, original, MIT.

Project instructions for AI assistants working on a Google Health MCP server, a service that lets assistants access Google Health data through the MCP protocol. They describe the code layout, commands, authentication behavior, and known limitations.

In plain words
What is it for?
Building and testing the server, running OAuth login again when needed, understanding token refresh errors, using scheduled synchronization, and avoiding crash loops when authentication has expired.
Why use it?
They warn developers about an important Google Health restriction: refresh tokens expire after seven days while the app remains in testing. They also explain how the project handles re-authentication and scheduled sync failures.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md.

This is madfreakz/google-health-mcp-server's own configuration. It tells Claude Code how to work on google-health-mcp-server itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything google-health-mcp-server configures →

Reuse

Borrowing it

Nothing to install: this file belongs to madfreakz/google-health-mcp-server. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/madfreakz/google-health-mcp-server/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/madfreakz/google-health-mcp-server

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for google-health-mcp-server CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/madfreakz/google-health-mcp-server/claude-md/github.svg)](https://agentmods.dev/instructions/madfreakz/google-health-mcp-server/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/madfreakz/google-health-mcp-server/claude-md"><img src="https://agentmods.dev/badge/instructions/madfreakz/google-health-mcp-server/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for google-health-mcp-server CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/madfreakz/google-health-mcp-server/claude-md"><img src="https://agentmods.dev/badge/instructions/madfreakz/google-health-mcp-server/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,209 This file is loaded in full into every session.
When invoked 2,209 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.02209 $0.02209
Opus 5 $0.01104 $0.01104
Sonnet 5 $0.00442 $0.00442
Haiku 4.5 $0.00221 $0.00221

Measured 10d ago against content hash d210eff63706, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

google-health-mcp-server CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 127 lines

How it starts

The opening of the file, as written. The whole thing — 127 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Working notes for AI assistants

Operational context for Claude/Cursor/etc. when modifying this repo. Built mirroring the sibling strava-mcp-server conventions (same axios + dotenv + zod + MCP SDK stack, same OAuth-bootstrap / atomic-token-write / in-memory-cache / retry idioms).

Known pitfalls

  • Refresh tokens expire after 7 days, and you can't easily fix it. Google Health scopes are Restricted, so publishing the OAuth app to Production (the usual "long-lived token" fix) triggers a mandatory security verification (CASA) with no click-through bypass — impractical for one user. So the app stays in Testing and the 7-day expiry is permanent. Design around it, don't fight it: src/client.ts:refreshTokens throws a clear "re-run npm run oauth" message on expiry; interactive use re-auths lazily (the assistant runs npm run oauth when a call reports expiry); the launchd sync (every 4 days, see launchd/) is best-effortsrc/cli/sync.ts logs "re-auth needed", fires a macOS notification via osascript, and exits 0 if the token lapsed (no crash-loop, no proactive re-auth). The 4-day cadence only narrows the staleness window; it can't extend the refresh token's life (only an interactive npm run oauth does that), so don't "fix" empty data by tightening the interval further — there's a hard floor set by how often Mark is willing to click through a browser consent screen.
  • buildDailySummary's per-metric catch must re-throw auth failures (fixed 2026-06-29). src/tools/summary.ts swallows per-metric errors so one unavailable dataType (e.g. AZM on an Apple Watch) doesn't sink the whole summary — but a blanket catch { points = [] } was also swallowing "Token refresh failed", so an expired token silently rendered as "no data" instead of surfacing the real error. This broke re-auth detection everywhere: get_daily_summary looked like an empty range instead of erroring, and the launchd cron's "re-auth needed" branch in sync.ts never fired because the error never escaped buildDailySummary. Fixed by client.ts:isReauthError(err) — checked first in the catch, re-thrown if true, only genuine per-metric gaps are swallowed. If you touch this catch again, keep that check first.
  • Google does NOT rotate the refresh_token on refresh (unlike Strava). The refresh response usually omits refresh_token; refreshTokens keeps the existing one (data.refresh_token ?? current.refresh_token). A refresh_token is only issued on the first consent, which is why the authorize URL sets access_type=offline and prompt=consent. If a user re-auths and gets no refresh_token, they must revoke at https://myaccount.google.com/permissions first.
  • The published v4 docs were WRONG on several points — these were verified against the live API on 2026-06-03 (see DATA_TYPES in src/constants.ts):
    • dataType IDs are kebab-case and not the obvious names: active calories = active-energy-burned, active minutes = active-zone-minutes, resting HR = daily-resting-heart-rate. steps/distance are as-named. A wrong ID 400s with "Invalid data type ID referenced…". Other verified types: heart-rate (rollup → avg/max/min), floors, total-calories, sleep.
    • active-zone-minutes is per-heart-zone, not a single sum: the value object is {sumInFatBurnHeartZone, sumInCardioHeartZone, sumInPeakHeartZone} (strings). DATA_TYPES marks it combine:'azm' and lib/civil.ts:metricValue reduces to Fitbit's weighted total (fatBurn×1 + cardio×2 + peak×2). It's a Fitbit/Pixel metric — empty from Apple Watch.
    • DO NOT use total-calories for "calories burned". From the Apple Watch import it carries only basal/resting energy — a flat near-constant (~1704 kcal/day, identical to 4 decimals across days; verified) with NO active component. Use active-energy-burned, which varies with movement (key activeCalories). total-calories is rollup-only (no list).
    • :dailyRollUp range.start/range.end are nested CivilDateTime{date:{year,month,day}, time:{hours,minutes,seconds,nanos}} — NOT a flat {year,month,day} (the doc example is wrong; a flat date 400s with "Unknown name 'year' at 'range.start'"). Built by client.ts:civilDateTime.
    • Do NOT send pageSize to :dailyRollUp — it 400s with "Invalid argument in request". (List endpoint accepts pageSize fine.)
    • dataSourceFamily: users/me/dataSourceFamilies/all-sources is what surfaces the Apple Watch (HEALTH_KIT) import. google-wearables is Fitbit/Pixel only.
    • Values come back camelCase, and int64s are STRINGS (steps.countSum:"8034", distance.millimetersSum:"…" — note millimetres). kcalSum is a real number. civilStartTime.date is nested. lib/civil.ts:extractValue coerces strings; civilFromPath reads the embedded date. The raw point is ALWAYS returned alongside — never drop it.
  • Resting HR and sleep do NOT support :dailyRollUp (the API says use list/get/reconcile). DATA_TYPES[].method is 'rollup' or 'list'; summary.ts:buildDailySummary dispatches on it. List-method metrics carry their own embedded date (e.g. dailyRestingHeartRate.date), so we list recent points and clip to the window. Sleep is not modeled yet (empty until a device logs it — re-check the shape against live data once the Fitbit Air syncs).
  • The list-endpoint filter grammar is unknown. endTime >= "…" 400s with INVALID_DATA_POINT_FILTER_RESTRICTION_COMPARABLE. list_data_points lists most-recent and exposes a raw filter passthrough only. For date windows, use the rollup-based summary.
  • Civil date math lives in src/lib/civil.ts, host-timezone-local (matches the watch's notion of "a day"), and is unit-tested. Keep it that way.
  • MCP SDK deep-instantiation. registerTool trips TS2589 when a raw zod shape contains z.array()/z.boolean(), and the error hops between calls as TS's depth budget shifts. Fixed by casting those inputSchema refs as any in src/index.ts (compile-time only — the real schema still validates at runtime). Handlers keep explicit return types (ToolResult) and strict arg types. npm run build uses --noCheck regardless.

Read the full file on GitHub · 127 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 127 lines · 2,209 tokens per session scan A d210eff63706

Subscribe to this mod's changes

google-health-mcp-server CLAUDE.md is an instructions file published in the GitHub repository madfreakz/google-health-mcp-server (0 stars, last pushed 2mo ago), licensed MIT. It adds 2,209 tokens to every session, about $0.0110 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,153 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens