health-relay

health-relay

Enables AI agents to query locally stored Samsung Health data—such as heart rate, sleep, steps, and workouts—through MCP tools for samples, daily summaries, and trend analysis while keeping everything on your own network.

Category
访问服务器

README

health-relay

Self-hosted bridge between your Samsung Watch → Sync2Ra1 phone app and your Hermes AI agent. The app pushes health readings here over your LAN; the data is stored locally (SQLite) and exposed via REST and MCP so your agent can query it.

Galaxy Watch ─▶ Samsung Health ─▶ Sync2Ra1 (phone) ──push──▶ health-relay ──MCP/REST──▶ Hermes

All data stays on your network. Nothing is sent anywhere else.


Quick start (Docker or Podman)

echo "HR_AUTH_TOKEN=<choose-a-secret>" > .env
docker compose up -d          # or: podman compose up -d
curl http://localhost:8790/healthz     # -> {"ok":true}

Data persists in ./data/ledger.db (SQLite, WAL mode).

Run without Docker

python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
HR_AUTH_TOKEN=<secret> ./run.sh

Point the phone app at it

In Sync2Ra1 → Data tab → Relay (Hermes bridge):

Field Value
Relay URL http://<this-machine-ip>:8790
Token same secret as HR_AUTH_TOKEN

Tap Save → Sync now. Readings arrive within seconds.


Connectivity

phone (Sync2Ra1) ──HTTP :8790──▶ health-relay ◀──MCP stdio / HTTP── Hermes
        same LAN · or Tailscale for anywhere-access
Rule Detail
Direction Phone → relay (outbound from phone; nothing connects into the phone)
Port TCP 8790 inbound to the machine running the relay — open it in that host's firewall
Protocol Plain HTTP + Authorization: Bearer <token>. Keep it LAN-only, or front with a reverse proxy (Caddy/nginx) for TLS
Anywhere-access Install Tailscale on the box and phone; point the app at the Tailscale IP (http://100.x.y.z:8790) — encrypted, works over mobile data, no ports exposed to the internet
Cadence App auto-syncs hourly + on app launch + manual Sync now
Offline Phone buffers everything in local SQLite; on reconnect it pushes the full backlog (oldest first) and re-syncs the last 48 h so Samsung's revisions propagate
Duplicates Impossible to double-count — every reading has a unique key; replays are ignored server-side
Hermes location Same machine (MCP runs as a local subprocess reading the SQLite file) or remote (use the REST endpoints instead of MCP)

REST API (bearer auth)

Endpoint Purpose
GET /healthz liveness (no auth)
POST /api/v1/health/samples batch ingest — idempotent, replays are no-ops
GET /api/v1/health/samples?type=&from_ms=&to_ms=&limit=&offset= raw readings
GET /api/v1/health/daily-summary?date=YYYY-MM-DD&tz=Europe/London per-metric min/max/avg/count
GET /api/v1/health/trends?type=X&days=N&tz=Europe/London daily rollups
GET /api/v1/health/status totals per type
curl -H "Authorization: Bearer <secret>" \
  "http://localhost:8790/api/v1/health/daily-summary?date=$(date +%F)&tz=Europe/London"

Plug into Hermes (MCP)

The MCP server reads the same SQLite file — run it from this repo:

python3 -m venv .venv-mcp
.venv-mcp/bin/pip install fastmcp

Add to your agent's MCP config:

{
  "mcpServers": {
    "health-relay": {
      "command": "<repo-path>/.venv-mcp/bin/python",
      "args": ["<repo-path>/mcp_server.py"],
      "env": { "HR_DATA_DIR": "<repo-path>/data" }
    }
  }
}

Tools your agent gets

Tool Answers questions like
list_streams() "what health data do you have?"
get_samples(type, from_ms, to_ms) "show my heart rate this morning"
daily_summary(date, tz) "how active was I yesterday?"
sleep_breakdown(nights) "how did I sleep this week?"

Day boundaries respect your timezone (tz="Europe/London" etc., DST handled).


Recorded streams

Heart rate · SpO₂ · skin temperature · respiration · resting HR · VO₂max · sleep duration/score/stages · steps & floors (hourly + daily) · workouts · activity calories/time/distance · body composition (BIA) · energy score · blood pressure · glucose · hydration · meals.


Configuration

Env var Default
HR_AUTH_TOKEN (empty = auth off) set this in production
HR_PORT 8790
HR_HOST 0.0.0.0 keep on trusted LAN
HR_DATA_DIR ~/health-relay-data SQLite lives here

Tests

.venv/bin/python -m pytest tests/ -q

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选