Apple Health MCP Server

Apple Health MCP Server

An 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.

Category
Visit Server

README

Apple Health MCP Server

npm version License: MIT

An MCP (Model Context Protocol) server for querying Apple Health data using SQL. Built with DuckDB for fast, efficient health data analysis.

[!NOTE]
This project currently relies on the Simple Health Export CSV app by Eric Wolter. See Exporting Data below for more info on how best to use the app.

This is currently the easiest way I could find to quickly and reliably get Apple Health data exported in CSV format. If you have ideas of better ways to import data, please submit an issue.

Features

  • Natural language querying: Your MCP client translates your questions to database queries
  • SQL Query Execution: Direct SQL queries against your Apple Health data
  • Automated Reports: Generate weekly/monthly health summaries
  • Efficient Data Loading: Lazy loading with configurable time windows
  • Smart Caching: Query result caching with TTL

Installation

No installation required! Use directly with npx via Claude Desktop or other MCP clients.

Usage with Claude Desktop

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "apple-health": {
      "command": "npx",
      "args": ["@neiltron/apple-health-mcp"],
      "env": {
        "HEALTH_DATA_DIR": "/path/to/your/health/export"
      }
    }
  }
}

Environment Variables

  • HEALTH_DATA_DIR (required): Path to your Apple Health CSV export directory
  • MAX_MEMORY_MB (optional): Maximum memory usage in MB (default: 1024)
  • CACHE_SIZE (optional): Number of cached query results (default: 100)

Example Configuration

{
  "mcpServers": {
    "apple-health": {
      "command": "npx",
      "args": ["@neiltron/apple-health-mcp"],
      "env": {
        "HEALTH_DATA_DIR": "/Users/yourname/Downloads/HealthAll_2025-07-202_01-04-39_SimpleHealthExportCSV",
        "MAX_MEMORY_MB": "2048"
      }
    }
  }
}

Exporting Data

To use get your data:

  • Download the Simple Health Export CSV app for iOS.
  • Tap the All button in the app to download all data for your desired time range (default 1 month).
  • When prompted, Airdrop it to your computer or transfer it some other way.
  • Unzip the file to your desired location
  • Set the HEALTH_DATA_DIR value in your MCP config. See Example Configuration above.

Available Tools

  1. health_schema: Get information about available tables and their structure
  2. health_query: Execute SQL queries directly on your health data
  3. health_report: Generate comprehensive health reports

Data Structure

The server expects Apple Health data exported as CSV files with the following naming pattern:

  • HKQuantityTypeIdentifier*.csv - Quantitative health metrics
  • HKCategoryTypeIdentifier*.csv - Categorical health data
  • HKWorkoutActivityType*.csv - Workout and activity data

Each CSV file should have these columns:

  • type: The specific health metric type
  • sourceName: Source device/app
  • startDate: Start timestamp (UTC)
  • endDate: End timestamp (UTC)
  • value: The measurement value
  • unit: Unit of measurement

Development

For local development:

# Clone and install dependencies
git clone https://github.com/neiltron/apple-health-mcp.git
cd apple-health-mcp
npm install

# Build the project
npm run build

# Type checking
npm run typecheck

Troubleshooting

Common Issues

  1. "No data found": Check that your CSV files are in the correct directory
  2. Memory errors: Reduce MAX_MEMORY_MB or use shorter time windows
  3. Slow queries: Ensure you're filtering by date ranges
  4. Missing tables: Table names are lowercase (e.g., hkquantitytypeidentifierheartrate)

Contributing

Contributions are welcome! Please ensure:

  • Code follows existing patterns
  • TypeScript types are properly defined
  • Error handling is comprehensive
  • Performance impact is considered

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured