原型 · 预览版:收录官方注册中心里的全部服务器,每 30 分钟同步一次。评价和账户功能将在后续阶段推出。
PopNx MCP为使用 AI 的人准备的 MCP 服务器 · 用大白话讲清楚

Polar Health Data (self-hosted)

作者:StuMason版本 1.6.2i★ –i在你的电脑上运行
注册名称io.github.StuMason/polar-flow-server

安装

概览

作者提供的说明(英文原文)

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

PopNx MCP 的三大支柱

这三项永远不会合并成一个分数:意见、测量和人气是不同的东西。

它能帮你做什么

我们还没有为它写通俗的介绍。下面是我们从注册中心读取到的事实。

  • 连接方式: 在你的电脑上运行
  • 传输方式: Streamable HTTP
  • 分类: 诊所与健康
  • 你需要填写:DATABASE_URL, POLAR_CLIENT_ID, POLAR_CLIENT_SECRET

安装

选择你使用的 AI 应用,然后复制设置。

安装之前

  • 基础检查:1 项中通过 1 项
  • 在你的电脑上运行,拥有你的用户账户的权限(文件、网络、应用)。
  • 需要你自己填写: DATABASE_URL, POLAR_CLIENT_ID, POLAR_CLIENT_SECRET, BASE_URL

标为机密的值是你账户的钥匙。千万不要分享给别人,也不要粘贴到聊天里。

你需要

你用的是哪个应用?

在上方选择你的应用。我们会记住它,下次按钮会显示“安装到 …”。

打开 Claude Desktop → Settings → Developer → Edit Config,把下面的内容粘贴到 claude_desktop_config.json

{
  "mcpServers": {
    "polar-flow": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DATABASE_URL",
        "-e",
        "POLAR_CLIENT_ID",
        "-e",
        "POLAR_CLIENT_SECRET",
        "-e",
        "BASE_URL",
        "docker.io/stumason/polar-flow-server:1.6.2"
      ],
      "env": {
        "DATABASE_URL": "your-value",
        "POLAR_CLIENT_ID": "your-value",
        "POLAR_CLIENT_SECRET": "your-value",
        "BASE_URL": "your-value"
      }
    }
  }
}

在终端中运行这条命令

claude mcp add polar-flow --env DATABASE_URL=your-value --env POLAR_CLIENT_ID=your-value --env POLAR_CLIENT_SECRET=your-value --env BASE_URL=your-value -- docker run -i --rm -e DATABASE_URL -e POLAR_CLIENT_ID -e POLAR_CLIENT_SECRET -e BASE_URL docker.io/stumason/polar-flow-server:1.6.2

运行前请先填写空着的值。

在 Cursor 中打开

或者自己复制设置

粘贴到项目中的 .cursor/mcp.json,或 ~/.cursor/mcp.json

{
  "mcpServers": {
    "polar-flow": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DATABASE_URL",
        "-e",
        "POLAR_CLIENT_ID",
        "-e",
        "POLAR_CLIENT_SECRET",
        "-e",
        "BASE_URL",
        "docker.io/stumason/polar-flow-server:1.6.2"
      ],
      "env": {
        "DATABASE_URL": "your-value",
        "POLAR_CLIENT_ID": "your-value",
        "POLAR_CLIENT_SECRET": "your-value",
        "BASE_URL": "your-value"
      }
    }
  }
}

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

在 VS Code 中打开

或者自己复制设置

粘贴到项目中的 .vscode/mcp.json

{
  "servers": {
    "polar-flow": {
      "type": "stdio",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "DATABASE_URL",
        "-e",
        "POLAR_CLIENT_ID",
        "-e",
        "POLAR_CLIENT_SECRET",
        "-e",
        "BASE_URL",
        "docker.io/stumason/polar-flow-server:1.6.2"
      ],
      "env": {
        "DATABASE_URL": "your-value",
        "POLAR_CLIENT_ID": "your-value",
        "POLAR_CLIENT_SECRET": "your-value",
        "BASE_URL": "your-value"
      }
    }
  }
}

浏览器会先询问是否打开应用,然后应用会显示设置并请你确认。密钥的值会留空,由你自己填写。

这个服务器在你的电脑上运行,而 ChatGPT 只能连接互联网上的服务器。请选择其他应用。

你的选择通过 Cookie 保存在这台设备上,无需账户。

需要你填写的值

  • DATABASE_URL 机密 必填 env
    PostgreSQL connection string, e.g. postgresql+asyncpg://user:pass@host:5432/polar
  • POLAR_CLIENT_ID 必填 env
    Polar AccessLink OAuth client id (register at admin.polaraccesslink.com)
  • POLAR_CLIENT_SECRET 机密 必填 env
    Polar AccessLink OAuth client secret
  • BASE_URL env
    Public HTTPS base URL of this deployment; enables OAuth sign-in for MCP connectors

这些设置是根据作者在注册中心的条目生成的。如果 README 的写法不同,请以 README 为准。

它能做什么

它在你的电脑上运行;安装后,工具列表会显示在你的 AI 应用中。

基础检查i

我们检查的是任何人都能看到的信息;我们没有阅读代码。不适用的检查项不计入总数。 · 检查于 2026年11月7日

  • ✓ 通过

    作者与仓库一致

    注册名称已通过 GitHub 账户 StuMason 验证,该账户拥有此仓库

  • … 尚未检查

    仍在维护

    我们还没有从 GitHub 读取这个仓库

  • … 尚未检查

    有许可证

    我们还没有从 GitHub 读取这个仓库

  • – 不适用

    端点有响应

    它在你的电脑上运行,没有互联网端点

  • – 不适用

    使用 OAuth 登录

    在你的电脑上运行,改用本地设置

  • … 尚未检查

    工具描述中没有隐藏指令

    它在你的电脑上运行;我们只能读取互联网端点的工具列表

与“诊所与健康”中的其他服务器比较i

  • 星标数多于此分类中其他 1022 个服务器的 0%
  • 发布到注册中心的时间比此分类中其他 1022 个服务器的 59% 更新
  • 基础检查结果等于或优于此分类中其他 1022 个服务器的 100%

与注册中心里这个分类中所有活跃的服务器比较。只有当发布者拥有该仓库时,星标数才计入。

常见问题

Polar Health Data (self-hosted) 安全吗?

它在 1 项适用的基础检查中通过了 1 项。我们没有阅读代码。在添加密钥或令牌之前,请先看看这个服务器要求哪些权限,并使用只具备所需权限的密钥。

它需要哪些密钥或代码?

你需要填写:DATABASE_URL, POLAR_CLIENT_ID, POLAR_CLIENT_SECRET

它在我的电脑上运行还是在云端?

它在你的电脑上运行。你的 AI 应用会在需要时启动它,数据不会经过作者的服务器(除非它自己调用在线服务)。

它还在维护吗?

GitHub 仓库最后更新于–,最新版本(1.6.2)于19天前进入注册中心。

哪些应用可以使用它?

支持 MCP 的应用,例如 Claude Desktop、Claude Code、Cursor 和 VS Code。你的电脑上还需要有 Docker。

有什么可以替代它?

同一分类中有:Mirobody, FHIR MCP Server, Google Health MCP

替代选择

同一分类中其他作者的服务器,按星标数排序。

如何看卡片:★ GitHub 星标i三大支柱:评价 · 检查 · 使用情况i更新 = 最新版本发布到注册中心的时间i

Mirobody

作者:thetahealth

Lab results to LOINC codes and UCUM units, symptoms and diagnoses to ICPC-3. Offline, no API key.

在你的电脑上运行★ 1,408Apache-2.0今天更新
安装

FHIR MCP Server

作者:wso2

MCP server providing seamless access to FHIR APIs for AI tools and healthcare applications

在你的电脑上运行★ 137Apache-2.09天前更新
安装

Google Health MCP

作者:davidmosiah

Privacy-first unofficial Google Health API v4 MCP server for health, sleep, activity, HR agents

在你的电脑上运行★ 79MIT4个月前更新
安装

作者的 README

打开 README

按原文从作者的仓库复制。PopNx MCP 没有审查或背书其内容。HTML、图片和脚本已被移除。链接会离开本站。

polar-flow-server

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](https://stumason.github.io/polar-flow-server/) · MCP Server · Integration Guide · API Reference

What This Does

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:

  1. Syncs all 13 Polar API endpoints automatically — sleep, HRV, activity, workouts, SpO2, ECG, skin temperature, the lot
  2. Stores everything in PostgreSQL. Your data, your server, no cloud between you and it
  3. Computes personal baselines (rolling averages, IQR anomaly bounds) so "is this normal?" means normal *for you*
  4. Ships a built-in MCP server with OAuth sign-in — ask Claude "should I train hard today?" and it answers from your overnight HRV vs your baseline
  5. Admin dashboard (HTMX), REST API, per-user API keys, multi-user ready

Ask Your AI About Your Body (MCP)

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:

claude mcp add polar-health https://your-server.example.com/mcp \

--transport http \ --header "X-API-Key: pfk_your_key_here"

Full setup in the MCP docs.

Architecture

Polar API → polar-flow SDK → Sync Service → PostgreSQL

↓ Admin Dashboard (HTMX) ↓ REST API

Stack:

  • Litestar (async web framework)
  • SQLAlchemy 2.0 (async ORM)
  • PostgreSQL
  • HTMX + Tailwind (admin UI)
  • polar-flow SDK v1.5.0

Don't fancy running a server? A hosted version is in the works — join the waitlist. Self-hosting stays free forever.

Quick Start

Option 1: Docker (Recommended)
# Pull and run

curl -O https://raw.githubusercontent.com/StuMason/polar-flow-server/main/docker-compose.prod.yml docker-compose -f docker-compose.prod.yml up -d

That's it. Open http://localhost:8000/admin

Option 2: From Source
git clone https://github.com/StuMason/polar-flow-server.git

cd polar-flow-server docker-compose up -d

Setup
  1. Open http://localhost:8000/admin
  2. Get Polar credentials from admin.polaraccesslink.com (set redirect URI to http://localhost:8000/admin/oauth/callback)
  3. Enter credentials and click "Connect with Polar"
  4. Hit "Sync Now" to pull your data

The server syncs data every hour automatically.

Dashboard

The admin panel at /admin/dashboard is organised into tabs (with a floating tab bar on mobile):

  • Overview - stat tiles (HRV, resting HR, SpO2, skin temp, steps, strain, sleep score, alertness...), Today's Readiness recommendations, and "Today at a Glance" mini-charts (sleep stages, heart rate, steps)
  • Trends & Baselines - personal baselines and detected patterns
  • Sleep - sleep score and stage-duration charts
  • Heart Rate - daily HR, HRV and ANS charge charts, biosensing panel
  • Training Load - activity and cardio load charts

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.

Data Synced (13 Endpoints)

EndpointData
SleepScore, stages (light/deep/REM), duration
Nightly RechargeHRV, ANS charge, recovery status
Daily ActivitySteps, distance, calories, active time
ExercisesSport, duration, HR zones, training load
Cardio LoadStrain, tolerance, load ratio, status
SleepWise AlertnessHourly alertness predictions
SleepWise BedtimeOptimal sleep timing recommendations
Activity SamplesMinute-by-minute step data
Continuous HRAll-day heart rate (5-min intervals)
SpO2Blood oxygen tests (compatible devices)
ECGElectrocardiogram tests (compatible devices)
Body TemperatureContinuous body temperature
Skin TemperatureNightly skin temperature with baseline deviation

Configuration

Required Environment Variables
VariableDescriptionRequired
DATABASE_URLPostgreSQL connection stringYes
ENCRYPTION_KEY32-byte Fernet key for token encryptionYes (production)

Generate an encryption key:

python -c "from cryptography.fernet import Fernet; print(Fernet.generate_key().decode())"
Optional Environment Variables
VariableDescriptionDefault
DEPLOYMENT_MODEself_hosted or saasself_hosted
SYNC_INTERVAL_HOURSAuto-sync frequency1
SYNC_ON_STARTUPSync when server startsfalse
SYNC_DAYS_LOOKBACKDays of history to sync28
LOG_LEVELLogging verbosityINFO
API_KEYMaster API key (bypasses rate limits)None

API Authentication

API endpoints require authentication. Health data should never be publicly accessible.

Authentication Methods
  1. Per-User API Keys (recommended) - Create from the admin dashboard or via OAuth flow
  2. Master API Key - Set API_KEY env var for full access (bypasses rate limits)
Using API Keys
# With per-user API key (includes rate limit headers)

curl -H "X-API-Key: pfk_your_api_key_here" \ http://localhost:8000/api/v1/users/{user_id}/sleep?days=7

Response headers include:

X-RateLimit-Limit: 1000

X-RateLimit-Remaining: 999

X-RateLimit-Reset: 1704067200

Rate Limiting
  • Default: 1000 requests per hour per API key
  • Rate limits reset hourly
  • Master API key (API_KEY env var) bypasses rate limiting
  • Rate limit info returned in response headers

OAuth Integration (SaaS / Multi-User)

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

OAuth Flow
┌─────────────────┐     ┌─────────────────────┐     ┌─────────────────┐

│ Your App │────▶│ polar-flow-server │────▶│ Polar Flow │ │ (Laravel etc) │ │ │ │ (OAuth) │ │ │◀────│ │◀────│ │ └─────────────────┘ └─────────────────────┘ └─────────────────┘

Step 1: Redirect user to start OAuth

GET /oauth/start?callback_url=https://yourapp.com/callback&client_id=your-app-name
ParameterRequiredDescription
callback_urlYesWhere to redirect after OAuth (your app's callback endpoint)
client_idNoIdentifier 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

https://yourapp.com/callback?code=TEMP_CODE_HERE

Step 4: Exchange temp code for API key (server-to-server)

POST /oauth/exchange

Content-Type: application/json

{ "code": "TEMP_CODE_HERE", "client_id": "your-app-name" }

Response:

{

"api_key": "pfk_abc123...", "polar_user_id": "12345678", "expires_at": null }

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:

curl -H "X-API-Key: pfk_abc123..." \

"https://your-polar-server.com/api/v1/users/12345678/sleep?days=7"

Polar Admin Setup

In admin.polaraccesslink.com, set your app's redirect URI to:

https://your-polar-server.com/oauth/callback
Key Management
# Get key info

GET /api/v1/users/{user_id}/api-key/info X-API-Key: pfk_...

Regenerate key (invalidates old key)

POST /api/v1/users/{user_id}/api-key/regenerate X-API-Key: pfk_...

Revoke key

POST /api/v1/users/{user_id}/api-key/revoke X-API-Key: pfk_...

API Endpoints

# Health check (no auth required)

curl http://localhost:8000/health

Get sleep data (last 7 days)

curl -H "X-API-Key: pfk_..." \ "http://localhost:8000/api/v1/users/{user_id}/sleep?days=7"

Get activity data

curl -H "X-API-Key: pfk_..." \ "http://localhost:8000/api/v1/users/{user_id}/activity?days=7"

Get nightly recharge (HRV)

curl -H "X-API-Key: pfk_..." \ "http://localhost:8000/api/v1/users/{user_id}/recharge?days=7"

Get exercises

curl -H "X-API-Key: pfk_..." \ "http://localhost:8000/api/v1/users/{user_id}/exercises?days=30"

Export summary

curl -H "X-API-Key: pfk_..." \ "http://localhost:8000/api/v1/users/{user_id}/export/summary?days=30"

Development

# Install dependencies

uv sync --all-extras

Start PostgreSQL

docker-compose up -d postgres

Run server with hot reload

uv run uvicorn polar_flow_server.app:app --reload

Run tests

uv run pytest

Type check

uv run mypy src/polar_flow_server

Lint

uv run ruff check src/

Production Deployment

Deploy anywhere that runs Docker:

# Download and run

curl -O https://raw.githubusercontent.com/StuMason/polar-flow-server/main/docker-compose.prod.yml docker-compose -f docker-compose.prod.yml up -d

Coolify, Railway, Render, etc. - Point at the GitHub repo, it builds from the Dockerfile.

Required for production:

  • Set ENCRYPTION_KEY environment variable (tokens won't persist across restarts otherwise)
  • Set DATABASE_URL to your PostgreSQL instance

Database migrations run automatically on startup.

Multi-Tenancy

The server supports multiple users out of the box:

  • Every table includes user_id column
  • All queries scoped by user_id
  • Per-user API keys ensure users can only access their own data
  • Self-hosted: typ

只显示了开头部分;其余内容请在仓库中阅读

问 PopNx