Guide

Apple Health in VS Code

GitHub Copilot in VS Code can read your Apple Health data through HealthAPI's MCP server, so its agent can build a dashboard, a notebook or an app feature on your real numbers. Add the server, sign in, and approve it on your iPhone.

  • Remote MCP, OAuth
  • 8 read-only tools
  • Updated 22 October 2026

HealthAPI: Free for 2 days, no card needed. Then an optional 7-day free trial when you subscribe.

.vscode/mcp.json
{
  "servers": {
    "healthapi": {
      "type": "http",
      "url": "https://healthapi.app/mcp"
    }
  }
}

Copilot Chat

What was my average resting heart rate each week this month?

Ran get_trend · healthapi

Week by week: 57, 56, 55 and 55 bpm so far. That's 2 bpm lower than in September.

HealthAPI on your iPhone

“Visual Studio Code” wants to read your health data

We can't confirm who runs this app. Only approve it if you set it up yourself and trust it.

Approve

What you need

  • An iPhone on iOS 15 or later with Apple Health. Apple Watch data comes along too.
  • The HealthAPI app. Free for 2 days, no card needed. Then an optional 7-day free trial when you subscribe. The preview includes 25 requests a day. When the 2 days are up, AI apps and the API stop reading your data until you choose a plan in the app. Your synced data is kept for about 5 weeks, so subscribing picks up where you left off. Pro is $4.99 a month or $49.99 a year (100 requests a day); Developer is $9.99 a month or $99.99 a year (1,000 a day). Cancel anytime in the App Store.
  • VS Code with GitHub Copilot. If your organization manages Copilot, it can limit which MCP servers you can add.

Set it up in 4 steps

  1. Install HealthAPI and sync

    Get HealthAPI from the App Store, open it and allow Apple Health. Your history uploads, then new data keeps syncing.
  2. Add the server

    In VS Code, run MCP: Add Server from the Command Palette. Choose HTTP, paste https://healthapi.app/mcp, name it healthapi, then choose Global and Copilot Global to have it in every workspace.
  3. Sign in and approve on your iPhone

    When VS Code asks you to sign in, allow it. A HealthAPI page opens in your browser with a short code. Scan its QR code with your iPhone, or enter the code in HealthAPI under Connect, check it matches, and tap Approve.
  4. Ask Copilot

    In Copilot Chat, ask for something that needs your data, such as “Use HealthAPI to get my sleep for the last two weeks.” Approve the tool calls when Copilot asks.

The sign-in page labels the request an unverified app called Visual Studio Code. In a local window VS Code receives the answer on 127.0.0.1, so the page also notes that it returns to a program on this computer. In some setups, such as a remote window, it goes through vscode.dev instead, and your browser asks to open VS Code afterwards. Either way, approve it if you started it and the codes match.

Run MCP: List Servers to start, stop or restart HealthAPI. To turn single tools on or off, use Configure Tools in the chat input, or Chat: Open Customizations, then Tools.

The config files

MCP: Add Server writes the file for you. Copilot Global uses the portable format, shared with other Copilot tools:

~/.copilot/mcp-config.jsonJSON
{
  "mcpServers": {
    "healthapi": {
      "type": "http",
      "url": "https://healthapi.app/mcp"
    }
  }
}

A workspace's .vscode/mcp.json and your user-profile mcp.json use VS Code's own format, with servers at the top. VS Code still reads them, though the Add Server flow marks them deprecated. Choose one of them if Copilot Global isn't offered:

.vscode/mcp.jsonJSON
{
  "servers": {
    "healthapi": {
      "type": "http",
      "url": "https://healthapi.app/mcp"
    }
  }
}

From a terminal, this adds the same server to your user profile:

Shell
code --add-mcp '{"name":"healthapi","type":"http","url":"https://healthapi.app/mcp"}'

With an API key instead

Rather not sign in? Send your API key as a header (copy it in the app under Connect, then Other tools). In VS Code's format, an input makes VS Code ask for the key the first time the server starts and store it securely, so the file stays free of secrets. Copilot Global files can't use inputs.

.vscode/mcp.jsonJSON
{
  "inputs": [
    {
      "type": "promptString",
      "id": "healthapi-key",
      "description": "HealthAPI API key",
      "password": true
    }
  ],
  "servers": {
    "healthapi": {
      "type": "http",
      "url": "https://healthapi.app/mcp",
      "headers": { "Authorization": "Bearer ${input:healthapi-key}" }
    }
  }
}

What to build with it

  • A notebook. “Use HealthAPI to get 90 days of steps, sleep and resting heart rate, save them to health.csv, and create a Jupyter notebook that charts them.”
  • A feature on real data. “Fetch one weekly summary from HealthAPI and use it to build the weekly card component in this project, with the response as a test fixture.”
  • A check on a hunch. “Do I sleep less on days with evening workouts? Use the last 60 nights and show the numbers.”
  • Quick questions while you code. “What was my resting heart rate this morning?”

For code that runs by itself, call the REST API with your key; the JavaScript and Python guides have starting points. All eight tools are on the MCP server page, and Cursor has its own guide.

Questions

Why does the sign-in page say “Unverified app”?

VS Code signs in through a program on your own computer, and HealthAPI can't prove from the outside which program that is. The name Visual Studio Code comes from the details VS Code publishes. If you just added HealthAPI yourself and the codes match, approve it.

Which file should I use?

Copilot Global (~/.copilot/mcp-config.json) for yourself, in every workspace. .vscode/mcp.json for one project; it holds only the address, so it's safe to commit, and everyone signs in with their own iPhone. Use the VS Code format if you want VS Code to prompt for an API key.

Will it follow me to my other computers?

Settings Sync carries the user-profile mcp.json (where code --add-mcp writes), not the Copilot Global file or workspace files.

How many requests does it use?

Each tool call is one request. A question usually takes one to three; an agent task may take more. Pro allows 100 a day and Developer 1,000, reset at 00:00 UTC.

Can Copilot change my health data?

No. All eight tools are read only. Nothing in Apple Health or HealthAPI changes. Disconnect VS Code any time in the HealthAPI app under Settings, Connected apps.

The HealthAPI app icon

Your Health data, in VS Code.

Get HealthAPI for iPhone, add the server, and approve it on your phone.