Self-hosted Polar health analytics with a built-in MCP server: sleep, HRV, workouts, baselines.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
Self-hosted health analytics for Polar devices β own your data, analyze it against your own baselines, and let your AI assistant read it.

Full Documentation Β· MCP Server Β· Integration Guide Β· API Reference
Your watch knows more about you than you do β and Polar's API only lets you see the last 28-30 days of it. This server syncs everything, keeps it forever, and turns it into answers:
A built-in Model Context Protocol server β protocol revision 2026-07-28, streamable HTTP β runs inside the main server at /mcp. Ten curated tools cover the one-shot health assessment, sleep, recovery, activity, workouts, seven biosensing streams, personal baselines, patterns/anomalies, and sync control.
In clients that render MCP Apps (claude.ai, Claude Desktop, VS Code), asking "how am I doing?" draws an actual card in the conversation:

Connecting is a sign-in, not a paste. With BASE_URL set, the server is its own OAuth 2.1 authorization server: add https://your-server/mcp as a custom connector in Claude Desktop or claude.ai, click Connect, log in on your server, approve the consent screen. Tokens are user-scoped, expire hourly, refresh automatically, and every connected app is revocable from Settings. API keys still work for headless clients:
Full setup in the MCP docs.
Stack:
Don't fancy running a server? A hosted version is in the works β join the waitlist. Self-hosting stays free forever.
http://localhost:8000/admin/oauth/callback)The server syncs data every hour automatically.
The admin panel at /admin/dashboard is organised into tabs (with a
floating tab bar on mobile):

Charts have a selectable 7/14/30-day range and CSV export. API keys are managed from the settings page, with rate limit tracking. All frontend assets are vendored - the dashboard works offline and on a LAN with no CDNs.
| Endpoint | Data |
|---|---|
| Sleep | Score, stages (light/deep/REM), duration |
| Nightly Recharge | HRV, ANS charge, recovery status |
| Daily Activity | Steps, distance, calories, active time |
| Exercises | Sport, duration, HR zones, training load |
| Cardio Load | Strain, tolerance, load ratio, status |
| SleepWise Alertness | Hourly alertness predictions |
| SleepWise Bedtime | Optimal sleep timing recommendations |
| Activity Samples | Minute-by-minute step data |
| Continuous HR | All-day heart rate (5-min intervals) |
| SpO2 | Blood oxygen tests (compatible devices) |
| ECG | Electrocardiogram tests (compatible devices) |
| Body Temperature | Continuous body temperature |
| Skin Temperature | Nightly skin temperature with baseline deviation |
| Variable | Description | Required |
|---|---|---|
DATABASE_URL | PostgreSQL connection string | Yes |
ENCRYPTION_KEY | 32-byte Fernet key for token encryption | Yes (production) |
Generate an encryption key:
| Variable | Description | Default |
|---|---|---|
DEPLOYMENT_MODE | self_hosted or saas | self_hosted |
SYNC_INTERVAL_HOURS | Auto-sync frequency | 1 |
SYNC_ON_STARTUP | Sync when server starts | false |
SYNC_DAYS_LOOKBACK | Days of history to sync | 28 |
LOG_LEVEL | Logging verbosity | INFO |
API_KEY | Master API key (bypasses rate limits) | None |
API endpoints require authentication. Health data should never be publicly accessible.
API_KEY env var for full access (bypasses rate limits)API_KEY env var) bypasses rate limitingFor applications that need to integrate with polar-flow-server (e.g., Laravel, mobile apps, web frontends).
This allows any Polar user to connect their account to your application.
Step 1: Redirect user to start OAuth
| Parameter | Required | Description |
|---|---|---|
callback_url | Yes | Where to redirect after OAuth (your app's callback endpoint) |
client_id | No | Identifier for your app (validated during exchange) |
Step 2: User authorizes on Polar
User is redirected to Polar, logs in with their credentials, and authorizes your app.
Step 3: User redirected to your callback
Step 4: Exchange temp code for API key (server-to-server)
Response:
Step 5: Store and use the API key
Store api_key and polar_user_id for this user. Use the API key for all data requests:
In admin.polaraccesslink.com, set your app's redirect URI to:
Deploy anywhere that runs Docker:
Coolify, Railway, Render, etc. - Point at the GitHub repo, it builds from the Dockerfile.
Required for production:
ENCRYPTION_KEY environment variable (tokens won't persist across restarts otherwise)DATABASE_URL to your PostgreSQL instanceDatabase migrations run automatically on startup.
The server supports multiple users out of the box:
user_id columnuser_idMIT
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/polar-health-data-self-hosted)<a href="https://allmcps.com/mcp/polar-health-data-self-hosted"><img src="https://allmcps.com/api/badge/polar-health-data-self-hosted?style=directory" alt="Polar Health Data (self Hosted) on AllMCPs" /></a>