Apple Health MCP Server
The Apple Health MCP Server is a robust tool for managing, searching, and analyzing Apple Health data from XML exports through natural language queries and LLM-based agents.
Core Capabilities:
Data Import & Indexing: Efficiently imports and parses Apple Health XML exports, indexing them into Elasticsearch for scalable storage and retrieval
Natural Language Querying: Interact with health data using natural language prompts without needing to know underlying data formats or Elasticsearch queries
Advanced Search & Filtering: Perform flexible searches using parameters like date ranges, value ranges, record types, and source devices
Statistical Analysis & Trends: Generate comprehensive statistics (min, max, average, sum) and analyze temporal trends with daily, weekly, monthly, or yearly aggregations
Data Summaries: Provide overviews of all indexed data with total record counts and breakdowns by record types and data sources
XML Analysis Tools: Analyze raw XML structure, search XML content directly, and extract type-specific records
LLM Integration: Built on FastMCP framework for seamless integration with MCP clients like Claude Desktop
Docker Support: Container-ready for easy deployment and scaling with extensive configuration via environment variables
Processes Apple Health data exported from iPhones, enabling search, analysis, and management of personal health records, workouts, and other health metrics.
Indexes and searches Apple Health data, providing advanced querying, filtering, and aggregation capabilities for efficient health data analytics and trend analysis.
Parses and analyzes Apple Health XML exports, extracting structured health data for search, filtering, and statistical analysis.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Apple Health MCP Server summarize my running workouts from the past month"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
This project has evolved into Open Wearables - self-hosted platform to unify wearable health data from multiple devices, including Apple Health. Open Wearables also provides an MCP server and a companion app for continuous Apple Health data sync, eliminating the need for manual XML exports. Check it out: github.com/the-momentum/open-wearables
Connect your Apple Health data with any LLM that supports MCP. Talk to your data and get personalised insights.
π‘ Demo
This demo shows how Claude uses the apple-health-mcp-server to answer questions about your data. Example prompts from the demo:
I would like you to help me analyze my Apple Health data. Let's start by analyzing the data types - check what data is available and how much of it there is.
What can you tell me about my activity in the last week? How did my daily statistics look?
Please also summarise my running workouts in July and June. Do you see anything interesting?
https://github.com/user-attachments/assets/93ddbfb9-6da9-42c1-9872-815abce7e918
Want to try it out? π Getting Started
Related MCP server: Apple Health MCP Server
π Why to use Apple Health MCP Server?
π§© Fit your data everywhere: using this software you can import data exported from Apple devices into any DBMS, base importer is already prepared for extensions
π― Simplify complex data access: you don't need to know data structure or use any structured query language, like SQL, simple access is just granted with natural language
ποΈ Find hidden trends: use LLM as a gate to flexible auto-generated queries which will be able to find data trends not so easy to detect manually
β¨ Key Features
π FastMCP Framework: Built on FastMCP for high-performance MCP server capabilities
π Apple Health Data Exploration: Import, parse, and analyze Apple Health XML exports
π Powerful Search & Filtering: Query and filter health records using natural language and advanced parameters
π¦ Elasticsearch, ClickHouse or DuckDB Integration: Index and search health data efficiently at scale
π οΈ Modular MCP Tools: Tools for structure analysis, record search, type-based extraction, and more
π Data Summaries & Trends: Generate statistics and trend analyses from your health data
π³ Container Ready: Docker support for easy deployment and scaling
π§ Configurable: Extensive
.env-based configuration options
π Documentation
π Getting Started - Complete setup guide
π About - Detailed description & architecture
π§ Configuration - Environment variables and settings
π οΈ MCP Tools - All available tools
πΊοΈ Roadmap - Upcoming features and roadmap
Need help? Looking for guidance on use cases or implementation? Don't hesitate to ask your question in our GitHub discussion forum! You'll also find interesting use cases, tips, and community insights there.
π₯ Contributors
πΌ About Momentum
This project is part of Momentumβs open-source ecosystem, where we make healthcare technology more secure, interoperable, and AI-ready. Our goal is to help HealthTech teams adopt standards such as FHIR safely and efficiently. We are healthcare AI development experts, recognized by FT1000, Deloitte Fast 50, and Forbes for building scalable, HIPAA-compliant solutions that power next-generation healthcare innovation.
π Want to learn from our experience? Read our insights β themomentum.ai/blog. Interested? Let's talk!
Available Tools
7 toolsget_health_summary_esA
Get a summary of Apple Health data from Elasticsearch. The function returns total record count, record type breakdown, and (optionally) a date range aggregation.
Notes for LLM:
IMPORTANT - Do not guess, auto-fill, or assume any missing data.
When asked for medical advice, try to use my data from ElasticSearch first.
Inputs: no named parameters. Returns: object
get_statistics_by_type_esA
Get comprehensive statistics for a specific health record type from Elasticsearch.
Parameters:
record_type: The type of health record to analyze. Use RecordType for most frequent types. Use str if that type is beyond RecordType scope.
Returns:
record_type: The analyzed record type
total_count: Total number of records of this type in the index
value_statistics: Statistical summary of the 'value' field including:
count: Number of records with values
min: Minimum value recorded
max: Maximum value recorded
avg: Average value across all records
sum: Sum of all values
sources: Breakdown of records by source device/app (e.g., "Rob's iPhone", "Polar Flow")
Notes for LLMs:
This function provides comprehensive statistical analysis for any health record type.
The value_statistics object contains all basic statistics (count, min, max, avg, sum) for the 'value' field.
The sources breakdown shows which devices/apps contributed data for this record type.
Example types: "HKQuantityTypeIdentifierStepCount", "HKQuantityTypeIdentifierBodyMassIndex", "HKQuantityTypeIdentifierHeartRate", etc.
Use this function to understand the distribution, range, and trends of specific health metrics.
The function is useful for health analysis, identifying outliers, and understanding data quality.
date_range key for query is commented, since it contained hardcoded from date, but you can use it anyway if you replace startDate with your data.
IMPORTANT - Do not guess, auto-fill, or assume any missing data.
When asked for medical advice, try to use my data from ElasticSearch first.
Inputs: record_type (required). Returns: object
get_trend_data_esA
Get trend data for a specific health record type over time using Elasticsearch date histogram aggregation.
Parameters:
record_type: The type of health record to analyze (e.g., "HKQuantityTypeIdentifierStepCount")
interval: Time interval for aggregation.
date_from, date_to: Optional ISO8601 date strings for filtering date range
Returns:
record_type: The analyzed record type
interval: The time interval used
trend_data: List of time buckets with statistics for each period:
date: The time period (ISO string)
avg_value: Average value for the period
min_value: Minimum value for the period
max_value: Maximum value for the period
count: Number of records in the period
Notes for LLMs:
Use this to analyze trends, patterns, and seasonal variations in health data
The function automatically handles date filtering if date_from/date_to are provided
IMPORTANT - interval must be one of: "day", "week", "month", or "year". Do not use other values.
Do not guess, auto-fill, or assume any missing data.
When asked for medical advice, try to use my data from ElasticSearch first.
Inputs: record_type (required), date_from, date_to, interval. Returns: object
get_xml_by_typeA
Get all records of a specific health record type from the Apple Health XML file.
Parameters:
record_type: The type of health record to retrieve (use RecordType for most frequent types, or any string for custom/rare types)
limit: Maximum number of records to return (default: 20)
Returns:
A string containing up to limit XML elements of the specified type, or a message if no records are found.
Notes for LLMs:
Use this to extract all records of a given type for further analysis or conversion
RecordType contains only the most frequent types; other types may appear as strings
This function streams the file for memory efficiency and does not load the entire file into memory.
If filename is not provided, the file set by set_xml_file will be used.
Do not guess, auto-fill, or assume any missing data.
When asked for medical advice, try to use my data from ElasticSearch first.
Inputs: limit, record_type. Returns: result
get_xml_structureA
Analyze the structure and metadata of an Apple Health XML export file without loading the entire content.
Returns:
file_size_mb: Size of the file in megabytes
root_elements: List of unique root-level XML tags
record_types: List of unique health record types (see RecordType for most frequent types, but may include others)
workout_types: List of unique workout types
sources: List of unique data sources (device/app names)
Notes for LLMs:
Use this to quickly understand the contents and structure of a health XML file
RecordType contains only the most frequent types; other types may appear as strings
Do not guess, auto-fill, or assume any missing data.
When asked for medical advice, try to use my data from ElasticSearch first.
Inputs: no named parameters. Returns: object
search_health_records_esA
Search health records in Elasticsearch with flexible query building.
Parameters:
params: HealthRecordSearchParams object containing all search/filter parameters.
Notes for LLMs:
This function should return a list of health record documents (dicts) matching the search criteria.
Each document in the list should represent a single health record as stored in Elasticsearch.
If an error occurs, the function should return a list with a single dict containing an 'error' key and the error message.
Use this to retrieve structured health data for further analysis, filtering, or display.
Example source_name: "Robβs iPhone", "Polar Flow", "Sync Solver".
Example date_from/date_to: "2020-01-01T00:00:00+00:00"
Example value_min/value_max: "10", "100.5"
IMPORTANT - Do not guess, auto-fill, or assume any missing data.
When asked for medical advice, try to use my data from ElasticSearch first.
Inputs: params (required). Returns: result
search_xml_contentA
Search for specific content in the Apple Health XML file and return matching records as XML text.
Parameters:
query: Text to search for in any attribute value
max_results: Maximum number of matching records to return (default: 50)
Returns:
A string containing up to max_results XML elements that match the query, or a message if no matches are found.
Notes for LLMs:
Searches both Record and Workout elements
Useful for finding all records containing a specific value, device, or type
This function streams the file for memory efficiency and does not load the entire file into memory.
If filename is not provided, the file set by set_xml_file will be used.
Do not guess, auto-fill, or assume any missing data.
When asked for medical advice, try to use my data from ElasticSearch first.
Inputs: max_results, query. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 7 tools
The tools are mostly distinct, with clear separation between Elasticsearch-based analytics (get_health_summary_es, get_statistics_by_type_es, get_trend_data_es, search_health_records_es) and XML file operations (get_xml_by_type, get_xml_structure, search_xml_content). However, there is some potential overlap between get_statistics_by_type_es and get_trend_data_es, as both analyze specific record types over time, which could cause confusion in tool selection.
Naming follows a consistent snake_case pattern throughout, with most tools using a clear verb_noun structure (e.g., get_health_summary_es, search_health_records_es). The only minor deviation is get_xml_structure, which uses 'get' instead of a more descriptive verb like 'analyze', but overall the naming is highly predictable and readable.
With 7 tools, the count is well-scoped for an Apple Health data analysis server. This number provides comprehensive coverage for both Elasticsearch analytics and XML file operations without being overwhelming, and each tool appears to serve a distinct purpose that justifies its inclusion.
The toolset covers key operations for health data analysis, including summary retrieval, statistical analysis, trend visualization, and search capabilities across both Elasticsearch and XML sources. A minor gap exists in the lack of explicit update or delete tools, but given the server's focus on read-only data analysis from Apple Health exports, this is reasonable and agents can work effectively with the provided tools.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yoβ¦
Hosted Apple Health MCP: workouts, sleep and HRV in ChatGPT, Claude, Gemini, Grok. Free, no export.
Hosted MCP server exposing US hospital procedure cost data to AI assistants
Your Apple Health data, food diary and lifts, for ChatGPT, Claude and Gemini. Approved on iPhone.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides health data from the Senechal API to LLM applications, enabling AI assistants to access, analyze, and respond to personal health information.GPL 3.0
- AlicenseAqualityAmaintenanceAn MCP server that allows users to query and analyze their Apple Health data using SQL and natural language, utilizing DuckDB for fast and efficient health data analysis.391 npm574MIT
- AlicenseAqualityBmaintenanceOpen-source MCP server for MetricBridge (formerly Health Export AI). 16 tools and 22 prompts let any MCP agent query 190 Apple Health metrics from files on your own machine. The server is read-only, has zero dependencies and makes zero network calls.22412 npm11MIT
- AlicenseAqualityAmaintenanceRead-only MCP server that exposes Apple Health data (steps, workouts, sleep, etc.) from a local SQLite store, allowing AI agents to query health metrics without sending data to hosted services.932Apache 2.0