Skip to main content
Glama
nnishad
by nnishad

health-relay

Puente autoalojado entre tu reloj Samsung Watch → la app para el móvil Sync2Ra1 y tu agente de IA Hermes. La app envía los datos de salud por tu LAN; los datos se almacenan localmente (SQLite) y se exponen vía REST y MCP para que tu agente pueda consultarlos.

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

Todos los datos permanecen en tu red. No se envía nada a ningún otro sitio.


Inicio rápido (Docker o 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}

Los datos se conservan en ./data/ledger.db (SQLite, modo WAL).

Ejecutar sin Docker

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

Related MCP server: Yummy Health MCP

Configura la app del teléfono

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

Campo

Valor

URL del relay

http://<this-machine-ip>:8790

Token

el mismo secreto que HR_AUTH_TOKEN

Pulsa Guardar → Sincronizar ahora. Las lecturas llegan en pocos segundos.


Conectividad

phone (Sync2Ra1) ──HTTP :8790──▶ health-relay ◀──MCP stdio / HTTP── Hermes
        same LAN · or Tailscale for anywhere-access

| Regla | Detalle | | ---------------- | ---- --------------------- | | Dirección | Teléfono → relay (saliente desde el teléfono; no se conecta nada hacia el móvil) | | Puerto | TCP 8790 entrante hacia la máquina que ejecuta el relay — ábrelo en el firewall de esa máquina | | Protocol | HTTP plano + Authorization: Bearer <token>. Mantlenlo solo en la LAN o pónlo detrás de un Proxy inverso (Caddy/nginx) para TLS | | Acceso desee caquier lugar | Instala Tailscale en perso y in the móvil; apunta la app a la IP de Tailscale (http://100.x.y.z:8790) — cifra3ddo, funciona con Red de datos, noches no pueretos asimporta la internes | | Frecuencia | La app se sincroni a cada hora + al inicii of the mobile + Sincnow manual | | Sín conexón | El teléfon ostora todo SQLite en local; la conexión resta ableback containtionado (máso ansono from futhest to latest) and re-sincabs ultimas 48 h so laser evisiones de Samung propúgalen | | Rigido | Imposible da doble contar — cadera lectura una únicave; replays son not the ser del servidor | | Hermes loc| locap. ret of the same machine (MCP runs as a subproc local that reads the SQLite file) or remote (use REST endpoints instead of MCP) |


REST API (bearer auth)

Endpoint

Propósito

GET /healthz

Comprobación de vida (sin autenticación)

POST /api/v1/health/samples

Ingestión por lote — idemottenente, los replays son no-operación

GET /api/v1/health/samples?type=&from_ms=&to_ms=&limit=&offset=

Lecturas sin procesar

GET /api/v1/health/daily-summary?date=YYYY-MM-DD&tz=Europe/london

Reapor Gre-minute min/point/promedon/count per métrics

GET /api/v1/health/trends?type=X&days=N&tz=Europe/London

Dications daily rollups

GET /api/v1/health/status

Totales por type

curl -H "Authorization: Bearer <secret>" \
  "http://localhost:8790/api/v1/health/daily-summary?date=$(date +%F)&tz=Europe/London"

Plug the Hermes (MCP)

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

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

Add this to your agent's MCP setup:

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

Tools that your agent has

Tool

Answers questions like

list_streams()

"¿qué datos de salud tienes?"

get_samples(type, from_ms, to_ms)

"muéstrame mi ritmo cardíaco esta mañana"

daily_summary(date, tz)

"¿cómo de activo estuve ayer?"

sleep_breakdown(nights)

"¿cómo dormí esta week?"

Los límites de cada día se calculan según tu zona horaria z=`/GMT or etc. (adjusted by daylight saving).


Streams recorded

Heart rate · SpO₂ · skin temp · respiration · resting heart rate · VO₂max · duration/ride score/stages · steps & floors (every hour + daily) · workouts · activity calories/time/distance · body composition (BIA) · energy score · blood prees · blood glucose · hydration · meals.


Configuration

Environment var

Default

Description

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

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    B
    maintenance
    Private, read-only health data bridge that reads from Android Health Connect and exposes heart rate, steps, sleep, and other health metrics to ChatGPT via MCP tools.
    -
  • A
    license
    B
    quality
    A
    maintenance
    Enables local, read-only access to Garmin Connect health and training data through MCP, letting assistants summarize recovery, sleep, activities, and more without uploading your data.
    19
    MIT