apple-health-mcp
AGENTS.md570 starsChanged 2 months agoMITView on GitHub
This package is a local stdio MCP server that queries Simple Health Export CSV files through an in-memory DuckDB database. The public npm package and MCP Registry entry are both named in package.json and server.json. Run all four checks before handing off code changes: Tests use Bun. The published runtime requires Node.js 22 or newer. - src/server.ts: configuration, MCP tool schemas, dispatch, and stdio startup - src/importers/: per-format ingestion (detection and loading) behind the FormatImporter interface, plus the single-format registry…
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
We split this AGENTS.md into the rules it gives an agent
7 rules. About 0 are common, 5 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 11
Run all four checks before handing off code changes:
- Distinctive: line 43
Never write logs or diagnostics to stdout while the MCP transport is active.
- Distinctive: line 48
Keep supported statements and rejected operations covered by tests.
- Distinctive: line 49
Do not call the query checks a security boundary or an OS sandbox.
- Very specific: line 51
Keep DuckDB file, external-access, configuration-lock, memory, and no-spill settings enabled.
- Distinctive: line 60
Never commit personal health exports, databases, logs, or local paths.
- Very specific: line 61
Keep versions synchronized across package.json, server.json (server and package versions), and the MCP implementation version in …
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Repository guidance
Project
This package is a local stdio MCP server that queries Simple Health Export
CSV files through an in-memory DuckDB database. The public npm package and MCP
Registry entry are both named in package.json and server.json.
Validate changes
Run all four checks before handing off code changes:
npm run lint
npm test
npm run typecheck
npm run buildTests use Bun. The published runtime requires Node.js 22 or newer.
Code map
src/server.ts: configuration, MCP tool schemas, dispatch, and stdio startupsrc/importers/: per-format ingestion (detection and loading) behind theFormatImporterinterface, plus the single-format registrysrc/db/: format-agnostic catalog, lazy table loader, and DuckDB wrappersrc/tools/: implementations ofhealth_schema,health_query, andhealth_reportsrc/core/: query caching, lazy-load coordination, and memory managementserver.json: MCP Registry metadatadocs/solutions/: documented solutions and decisions from past work (bugs, tooling choices, patterns), organized by category with YAML frontmatter (module,tags,problem_type) — relevant when working in documented areasCONCEPTS.md: shared domain vocabulary (entities, named processes, status concepts) — relevant when orienting to the codebase or discussing domain terms
See docs/architecture.md for the runtime flow and docs/querying.md for the
normalized data model.
Invariants
- Never write logs or diagnostics to stdout while the MCP transport is active; stdout is reserved for protocol messages.
- Preserve the
health_queryquery checks. The supported statements and restricted functions are listed indocs/architecture.mdunder "Query safeguards". Check queries before loading, cache lookup, or execution. Keep supported statements and rejected operations covered by tests. - Do not call the query checks a security boundary or an OS sandbox. Untrusted SQL requires process or OS isolation.
- Keep DuckDB file, external-access, configuration-lock, memory, and no-spill
settings enabled.
allowed_directoriespermits reads and writes insideHEALTH_DATA_DIR. - Preserve lazy loading unless a deliberate architecture change replaces it.
- Category labels such as sleep stages live in
valueText; their numericvalueisNULL. - Derive sleep and workout duration from
startDateandendDate; exported duration fields are not consistent across formats. - Workout exports may be one combined file or separate files per activity.
- Never commit personal health exports, databases, logs, or local paths.
- Keep versions synchronized across
package.json,server.json(server and package versions), and the MCP implementation version insrc/server.ts.
Local planning
ROADMAP.md is a local, intentionally uncommitted working plan excluded through
.git/info/exclude. Do not add it to commits unless the maintainer explicitly
changes that policy.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

