This is really cool - I recently worked on a tool that I installed on my iPhone, which extracts all health data nightly to CSV and then to a cloud database.
This was quite straightforward once you understand the permissions. I wonder why the OP didn’t do this and was instead using a simple health export CSV?
The main concern I had with releasing this or turning it into a tool was data security.
I have been swimming 1500m x 365 days of the year for the last 7 years. My use case was to build a personalised dashboard for my daily swimming and heart rate data to track detailed progress beyond what Apple offers. Having the ability to query this data with AI could be quite useful, rather than relying on manual reports.
Simple Health Export CSV was just the fastest route to proving to myself that the idea would work. I really considered making an app but decided that was one nerd snipe too many for the given task.
But I'd like to revisit it because it would be a natural fit to just put the personal trainer flow directly in an app.
This is awesome! I’ve been working on and off for the last few months on an AI running coach app. Would love to compare notes of effectively prompting Claude or O3 to analyze workouts / build workout plans. In my experience it still requires a lot of hand holding (sudden mileage increases w/w, inconsistent intervals, etc)
Hey - if you're interested in prototyping with real data, we've built a platform for stuff like this -- Fulcra Context (https://www.fulcradynamics.com/). We have an iOS app that collects Apple Health data, and you can then share it with a coach/trainer/doctor/etc.
I haven't gone deep on prompting around health data specifically, but I've built some other data agents. Agree that there isn't always an easy path, depending on the domain. It might be worth exploring multiple subagents with different focuses. I.e., have one subagent that is going to focus on writing window function queries in order to find interval variations.
My general belief around data agents is to offload as much as possible to SQL.
i am trying todo same with glue-ing mcp servers together and as a bonus try get my CHO rates and overall KCAL for the week with the proposed schedule and all palnned intake based on mets. Analyzing my workouts is something that works great at the moment if the data in is correct. i mostly use intervals.icu for this.
Would love to chip in on the discussion around this topic.
Very cool indeed. I started building something similar - relying on Auto Export [https://apps.apple.com/us/app/health-auto-export-json-csv/id...] to export my health data to an endpoint which stores it in a sqlite database. I never got as far as building an MCP server around the data but that's certainly the direction I was heading. The initial idea was to use my health data to provide context to a health/fitness agent that would recommend workouts, check-in on things, etc.
it is wild to me that products like this don’t allow you to easily export all data into sqlite (or duckdb) natively. it’s 2025 and you frequently have to page through hundreds or thousands of API calls to get a trivial amount of data (or use 3p services)
This isn’t some bespoke API/format that they made up to make it harder for you to get your data. Apple did the right thing here and implemented HL7 standards like CDA and FHIR. This is a win for interoperability. There are already a wealth of tools available for dealing with these standards.
Why would a malicious actor not be willing to setup the same infra as you, with an app on the iOS store to mine data once consented? I don’t see how api usage difficulty is a real security feature…
I haven't experimented with MCP too much because I have some reservations about it, but I decided to go MCP-first for this to see how it feels to prototype around it. My typical flow would have been to go sqlite+sveltekit.
There is a native export function in Health but it generates about 1-2 GB of XML per year, since the schema is extremely verbose, so it takes a while. On the other hand, it’s very literally self-describing. But no need for handing access to Health to more or less dubious apps. I also think you can „export“ select data points to „CSV“ using a ten step Shortcut. Might be quicker.
I actually started with this but the export always had the appearance of stalling unless I left it for long periods. For a first version, the CSV export app was much quicker. And actually, the author of the app (Eric Wolter) has a nice site that will convert the xml format to csv using the FileReader api, etc.
I would like to go back to this though and add it as an integration option.
> But no need for handing access to Health to more or less dubious apps
I mean, it's been vetted by Apple, right? If they did their job then it should be fine. This isn't the Play Store you're dealing with; it's the App Store. I kinda dig the "simple utility app that does one job well" format, tbh.
Super cool. An iPhone + Apple Watch generate about 40 distinct biomarkers of your data (resting heart rate, VO2max, workouts, sleep stages, sleep apnea risk, ECGs, and so on), but the ability to interpret them is very limited.
I work on an iOS health app, and I'd love to try integrating this. It'd help eliminate the step of having to manually export to a CSV every Sunday.
Feel free to shoot me an email if you want to collaborate!
we've built a wrapper around Apple Health to simplify data extraction and synchronization. If you think this might be useful, feel free to drop me a message.
One could pretty easily wrap an MCP server around the ScreenTime activity SQLite database file on MacOS. You could use DuckDB like this server does.
I’ve found good value in making purpose-build MCP servers like that with the general model:
Data<>DuckDB<>MCP<>LLM
With verbose description for the LLM of an “sql” tool endpoint for it to use to explore.
It's pretty crazy what it can do! I'll put examples once I can scrub personal info. But it has browsing history too. Sensitive data, so please be careful!!
I agree entirely. It's especially frustrating since the DeviceActivity framework comes close, but doesn't provide enough detail for users to allow apps to track this info.
The best approach we've found to tracking specific app use time is to have our app publish App Intents, and then tell users to trigger those intents with shortcuts. It's fairly effective, but very clunky to set up and has to be done app by app..
What Apple health actually is? It’s Apple Watch. My data coming from Oura and Withings, I wonder maybe those would have better ways to integrate with actual API.
It would work with those devices since it all funnels into apple health. I have a Withings scale as well so it’s part of my export. But you’re right, there may be easier integration with Oura.
This was quite straightforward once you understand the permissions. I wonder why the OP didn’t do this and was instead using a simple health export CSV?
The main concern I had with releasing this or turning it into a tool was data security.
I have been swimming 1500m x 365 days of the year for the last 7 years. My use case was to build a personalised dashboard for my daily swimming and heart rate data to track detailed progress beyond what Apple offers. Having the ability to query this data with AI could be quite useful, rather than relying on manual reports.
But I'd like to revisit it because it would be a natural fit to just put the personal trainer flow directly in an app.
For getting Apple Health data into duckdb, I’ve used this in the past: https://github.com/dogsheep/healthkit-to-sqlite. (You can load the SQLite database directly in duckdb.)
We have a REST API with python client lib (https://fulcradynamics.github.io/developer-docs/), an MCP server (https://fulcradynamics.github.io/developer-docs/mcp-server/), and did some experiments with ChatGPT actions as well (https://www.fulcradynamics.com/chatgpt).
It doesn't have the simplicity of a plain export to duckdb/sqlite, but it definitely helps solve a lot of the sharing/collaboration problems.
My general belief around data agents is to offload as much as possible to SQL.
Would love to chip in on the discussion around this topic.
People use it to track sensitive information, like reproductive and mental health data, that should only be exported very intentionally.
I haven't experimented with MCP too much because I have some reservations about it, but I decided to go MCP-first for this to see how it feels to prototype around it. My typical flow would have been to go sqlite+sveltekit.
if RubyLLM.with_tools(...).ask("Do my health metrics indicate I am stressed?") model = 'claude-4-opus' else model = 'claude-4-sonnet' end
I would like to go back to this though and add it as an integration option.
I mean, it's been vetted by Apple, right? If they did their job then it should be fine. This isn't the Play Store you're dealing with; it's the App Store. I kinda dig the "simple utility app that does one job well" format, tbh.
I work on an iOS health app, and I'd love to try integrating this. It'd help eliminate the step of having to manually export to a CSV every Sunday.
Feel free to shoot me an email if you want to collaborate!
I’ve found good value in making purpose-build MCP servers like that with the general model: Data<>DuckDB<>MCP<>LLM With verbose description for the LLM of an “sql” tool endpoint for it to use to explore.
https://github.com/AgentDank/screentime-mcp
It's pretty crazy what it can do! I'll put examples once I can scrub personal info. But it has browsing history too. Sensitive data, so please be careful!!
The best approach we've found to tracking specific app use time is to have our app publish App Intents, and then tell users to trigger those intents with shortcuts. It's fairly effective, but very clunky to set up and has to be done app by app..
Does it include health records (eg from Epic)?