# Polar Health Data (self-hosted)

> Polar Health Data (self-hosted) is an open-source MCP server for health and science. Self-hosted Polar watch data with baselines, anomaly alerts and an MCP endpoint. It runs as a hosted remote server, so there is nothing to install locally.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** self-hosted, API
- **Website:** https://stumason.github.io/polar-flow-server/
- **Repository:** https://github.com/stumason/polar-flow-server
- **MCP Registry name:** io.github.StuMason/polar-flow-server
- **Categories:** health and science, analytics and data
- **Listing updated:** 2026-11-14

## About

Polar's own API only serves roughly the last 28 to 30 days of data. This server syncs all 13 Polar AccessLink endpoints into your own PostgreSQL database, so the history stays with you instead of expiring.

On top of the stored sleep, Nightly Recharge, daily activity and workout records it computes personal baselines with IQR-based anomaly detection, 7, 30 and 90-day rolling averages, a Spearman sleep and HRV correlation, a training load ratio and a composite overtraining risk score. The built-in MCP server uses OAuth sign-in, so an assistant can answer a question such as whether to train hard today by comparing last night's HRV with your own baseline.

It runs as a Docker image with Litestar and SQLAlchemy underneath. A single-user self-hosted mode and a multi-user mode are described, and every table carries a user_id column.

## Features

- **Full Polar history:** Syncs all 13 Polar API endpoints and keeps the records beyond Polar's 28 to 30 day window.
- **Personal baselines:** Flags anomalies against your own IQR-based baselines with warning and critical severity.
- **Recovery analytics:** Includes sleep and HRV correlation, training load ratio, trend detection and an overtraining risk score.
- **Built-in MCP server:** Exposes the data to assistants over streamable HTTP with OAuth sign-in.
- **REST API:** Serves sleep, baselines, patterns, anomalies and insights endpoints for dashboards.
- **Docker deployment:** Runs from one image against your own PostgreSQL database.

## Good for

- Ask an assistant whether today suits a hard session based on overnight HRV
- Keep years of Polar sleep and workout history instead of a month
- Spot unusual resting metrics before they turn into an overtraining problem
- Feed your own dashboard from a local REST API

## Install

### Claude Code (Terminal)

```sh
claude mcp add polar-flow-server --env DATABASE_URL='<DATABASE_URL>' --env POLAR_CLIENT_ID='<POLAR_CLIENT_ID>' --env POLAR_CLIENT_SECRET='<POLAR_CLIENT_SECRET>' -- docker run -i --rm -e DATABASE_URL -e POLAR_CLIENT_ID -e POLAR_CLIENT_SECRET docker.io/stumason/polar-flow-server:1.6.3
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "polar-flow-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DATABASE_URL",
        "-e",
        "POLAR_CLIENT_ID",
        "-e",
        "POLAR_CLIENT_SECRET",
        "docker.io/stumason/polar-flow-server:1.6.3"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>",
        "POLAR_CLIENT_ID": "<POLAR_CLIENT_ID>",
        "POLAR_CLIENT_SECRET": "<POLAR_CLIENT_SECRET>"
      }
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "polar-flow-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DATABASE_URL",
        "-e",
        "POLAR_CLIENT_ID",
        "-e",
        "POLAR_CLIENT_SECRET",
        "docker.io/stumason/polar-flow-server:1.6.3"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>",
        "POLAR_CLIENT_ID": "<POLAR_CLIENT_ID>",
        "POLAR_CLIENT_SECRET": "<POLAR_CLIENT_SECRET>"
      }
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "polar-flow-server": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DATABASE_URL",
        "-e",
        "POLAR_CLIENT_ID",
        "-e",
        "POLAR_CLIENT_SECRET",
        "docker.io/stumason/polar-flow-server:1.6.3"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>",
        "POLAR_CLIENT_ID": "<POLAR_CLIENT_ID>",
        "POLAR_CLIENT_SECRET": "<POLAR_CLIENT_SECRET>"
      }
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "polar-flow-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DATABASE_URL",
        "-e",
        "POLAR_CLIENT_ID",
        "-e",
        "POLAR_CLIENT_SECRET",
        "docker.io/stumason/polar-flow-server:1.6.3"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>",
        "POLAR_CLIENT_ID": "<POLAR_CLIENT_ID>",
        "POLAR_CLIENT_SECRET": "<POLAR_CLIENT_SECRET>"
      }
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "polar-flow-server": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DATABASE_URL",
        "-e",
        "POLAR_CLIENT_ID",
        "-e",
        "POLAR_CLIENT_SECRET",
        "docker.io/stumason/polar-flow-server:1.6.3"
      ],
      "env": {
        "DATABASE_URL": "<DATABASE_URL>",
        "POLAR_CLIENT_ID": "<POLAR_CLIENT_ID>",
        "POLAR_CLIENT_SECRET": "<POLAR_CLIENT_SECRET>"
      }
    }
  }
}
```

## FAQ

### What do I need to run it?

A PostgreSQL connection string, a Polar AccessLink client id and secret, and the Docker image. BASE_URL is optional and enables OAuth sign-in for MCP connectors.

### Does my data go to a cloud service?

The README says everything is stored in your local PostgreSQL database with no cloud between you and your data.

### Which Polar data does it store?

Sleep with HRV and stages, Nightly Recharge, daily activity and exercises with detailed metrics.

### Does it support more than one user?

Yes. Every table has a user_id column, with a single-user self-hosted mode and a multi-user mode.

### Is Polar Health Data (self-hosted) free?

Yes. Polar Health Data (self-hosted) is open source, so you can use and self-host it for free.

### How do I add Polar Health Data (self-hosted) to Claude Code?

Run this command in your terminal: claude mcp add polar-flow-server --env DATABASE_URL='<DATABASE_URL>' --env POLAR_CLIENT_ID='<POLAR_CLIENT_ID>' --env POLAR_CLIENT_SECRET='<POLAR_CLIENT_SECRET>' -- docker run -i --rm -e DATABASE_URL -e POLAR_CLIENT_ID -e POLAR_CLIENT_SECRET docker.io/stumason/polar-flow-server:1.6.3

### What are the best alternatives to Polar Health Data (self-hosted)?

The closest alternatives to Polar Health Data (self-hosted) are Agent-Native Analytics, Google Ads + Meta Ads + SEO/GEO MCP, Tooluniverse, Oya Browser and Tapetide - Indian Stock Market MCP.

## Alternatives

- [Agent-Native Analytics](https://ai-powered.com/mcp/agent-native-analytics): Agent-Native Analytics is an open-source MCP server for analytics and data.
- [Google Ads + Meta Ads + SEO/GEO MCP](https://ai-powered.com/mcp/google-ads-meta-ads-seo-geo-mcp): Google Ads + Meta Ads + SEO/GEO MCP is a freemium MCP server for marketing and seo.
- [Tooluniverse](https://ai-powered.com/mcp/tooluniverse): Tooluniverse is an open-source MCP server for health and science.
- [Oya Browser](https://ai-powered.com/mcp/oya-browser): Oya Browser is a freemium MCP server for browser automation.
- [Tapetide - Indian Stock Market MCP](https://ai-powered.com/mcp/tapetide-indian-stock-market-mcp): Tapetide - Indian Stock Market MCP is a freemium MCP server for finance and payments.
- [World Monitor](https://ai-powered.com/mcp/world-monitor): World Monitor is a freemium MCP server for analytics and data.
- [CompanyData](https://ai-powered.com/mcp/companydata): CompanyData is a paid MCP server for analytics and data.
- [ChartAnt](https://ai-powered.com/mcp/chartant): ChartAnt is a freemium MCP server for design and media.

---
Source: https://ai-powered.com/mcp/polar-health-data-self-hosted
