Skip to main content
Glama
Apple Health MCP Server

Apple Health MCP Server

by the-momentum

Contact us Visit Momentum MIT License

NOTE

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

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 tools
get_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

    A4/5.0

    Scored across 7 tools

    Disambiguation4/5

    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 Consistency4/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      A 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
    • A
      license
      A
      quality
      B
      maintenance
      Open-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.
      22
      412 npm
      11
      MIT
    • A
      license
      A
      quality
      A
      maintenance
      Read-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.
      9
      32
      Apache 2.0