# Polar Health Data (self-hosted) [Health: Active]

**Category:** 🏃 Sports  
**Repository:** https://github.com/StuMason/polar-flow-server  
**GitHub Stars:** 27  
**Views:** 7  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/polar-health-data-self-hosted

## Description
Self-hosted Polar health analytics with a built-in MCP server: sleep, HRV, workouts, baselines.

## Claude Desktop Quick Installation
Remote MCP endpoint (confidence: high). Install path detected from listing signals. Add as a URL/SSE server in your client:

```json
"mcpServers": {
  "polar-health-data-self-hosted": {
    "url": "https://your-server/mcp"
  }
}
```

## Documentation

## What Polar Health Data (self-hosted) MCP server does

Polar Health Data (self-hosted) collects health and training data from Polar devices through the Polar API, stores it in PostgreSQL, and makes it available to analytics interfaces and AI assistants. The sync covers sleep, nightly recovery, daily activity, exercises, cardio load, SleepWise predictions, activity samples, continuous heart rate, SpO2, ECG, body temperature, and skin temperature.

Its analytics are based on the individual user rather than only population-wide reference values. Rolling averages and interquartile-range bounds support personal baselines, pattern detection, and anomaly checks. The included dashboard presents readiness, sleep, heart-rate, biosensing, activity, and training-load views, with selectable seven-, fourteen-, and thirty-day chart ranges and CSV export.

## How it works

Polar credentials are connected through the administration interface, after which the application pulls data into PostgreSQL. Automatic synchronization runs hourly by default, and a manual sync can be started from the dashboard or through MCP. The default history window is 28 days, while the service is designed to retain synchronized data locally beyond Polar API's roughly 28- to 30-day access window.

The MCP endpoint is served by the main application at `/mcp` using streamable HTTP. With `BASE_URL` configured, it can act as an OAuth 2.1 authorization server: users sign in on the self-hosted instance, approve access, and receive user-scoped tokens. Tokens expire hourly and refresh automatically. Headless clients can instead send a per-user API key or the configured master API key.

## Setup and configuration

Docker Compose is the documented deployment path. Download the production Compose file and start it, or clone the repository and run its development Compose configuration. The administration interface is available at `/admin`; after deployment, configure Polar credentials and set the redirect URI to the server's `/admin/oauth/callback` endpoint.

Required configuration includes:

- `DATABASE_URL`, pointing to PostgreSQL.
- `ENCRYPTION_KEY`, a Fernet key used to encrypt tokens and required for production deployments.

Optional settings control deployment mode, synchronization frequency, startup synchronization, lookback duration, logging, and a master API key. `SYNC_INTERVAL_HOURS` defaults to one hour, `SYNC_ON_STARTUP` defaults to false, and `SYNC_DAYS_LOOKBACK` defaults to 28 days. Generate the encryption key with Python's `cryptography.fernet.Fernet.generate_key()`.

Protect API endpoints with per-user API keys or a master key. Per-user keys are available in the administration dashboard and are subject to a default limit of 1,000 requests per hour; the master key bypasses that limit.

## Tools and capabilities

The built-in MCP interface provides ten curated tools covering these areas:

- One-shot health assessment.
- Sleep and recovery information.
- Daily activity and workout data.
- Seven biosensing streams, including heart rate, HRV, SpO2, ECG, body temperature, and skin temperature.
- Personal baseline queries.
- Pattern and anomaly analysis.
- Synchronization control.

MCP Apps support is included for clients that render the extension, including Claude.ai, Claude Desktop, and VS Code. In those clients, a health-assessment request can produce a card in the conversation. The REST API remains available for applications that need direct data access rather than MCP.

## Limitations and notes

Data availability depends on the Polar API and the connected device. SpO2 and ECG records require compatible devices. Health data is sensitive, so the deployment should not expose unauthenticated API endpoints. OAuth connections are revocable from settings, and the self-hosted deployment keeps the database and application under the operator's control.

The project is designed for self-hosting and uses PostgreSQL, an asynchronous Litestar application, SQLAlchemy, and an HTMX/Tailwind administration interface. Dashboard assets are vendored, allowing the interface to work on a local network without external CDNs.

_Full upstream README: https://allmcps.com/mcp/polar-health-data-self-hosted/readme_

