Skip to main content
Glama
nnishad
by nnishad

health-relay

자체 호스팅 브리지: Samsung Watch → Sync2Ra1 휴대폰 앱Hermes AI 에이전트를 연결합니다. 앱이 건강 측정값을 LAN을 통해 이 브리지로 보내면, 데이터는 로컬(SQLite)에 저장되고 REST MCP로 노출되어 에이전트가 조회할 수 있습니다.

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

모든 데이터는 여러분의 네트워크 안에만 머뭅니다. 다른 곳으로 전송되지 않습니다.


빠른 시작 (Docker 또는 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/ledger.db(SQLite, WAL 모드)에 저장됩니다.

Docker 없이 실행

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

휴대폰 앱을 연결하기

**Sync2Raw1 → 데이터 탭 → Relay (Hermes bridge)**에서:

필드

Relay URL

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

토큰

HR_AUTH_TOKEN과 동일한 비밀 값

저장 → 지금 동기화를 누르세요. 몇 초 안에 측정값이 도착합니다.


연결성

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

규칙

세부내용

방향

휴대폰 → 릴레이(아웃바운드; 휴대폰으로 들어오는 연결 없음)

포트

릴레이가 실행되는 머신으로 TCP 8790 인바운드 — 해당 호스트의 방화벽에서 열어두세요

프로토콜

일반 HTTP + Authorization: Bearer <token>. LAN 전용으로 유지하거나, TLS를 위해 리버스 프록시(Caddy/nginx)를 앞에 두세요

어디서나 접속

서버와 휴대폰에 Tailscale을 설치하고 앱을 Tailscale IP(http://100.x.y.z:8790)로 지정 — 암호화되고, 모바일 데이터에서도 작동하며, 인터넷에 포트가 노출되지 않습니다

주기

앱은 매시간 + 앱 시작 시 + 수동 지금 동기화로 자동 동기화됩니다

오프라인

휴대폰은 모든 것을 로컬 SQLite에 버퍼링합니다. 재연결 시 전체 백로그(가장 오래된 것부터)를 전송하고, Samsung의 수정사항이 전파되도록 마지막 전문 48시간을 재동기화합니다

중복

이중 집계가 불가능합니다. 모든 측정값은 고유 키를 가지며, 서버는 재전송을 무시합니다

Hermes 위치

동일 머신(MCP가 SQLite 파일을 읽는 로컬 하위 프로세스로 실행) 또는 원격(REST 엔드포인트 사용)


REST API (bearer 인증)

엔드포인트

목적

GET /healthz

Liveness (인증 불필요)

POST /api/v1/health/samples

일괄 수집 — 멱등, 재전송은 무시됨

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

원시 측정값 조회

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

메트릭별 최소/최대/평균/갯수

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

일별 요약

GET /api/v1/health/status

유형별 합계

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

Hermes에 연결 (MCP)

MCP 서버는 동일한 SQLite 파일을 읽습니다. 이 저장소에서 실행하세요:

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

에이전트의 MCP 설정에 추가하세요:

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

에이전트에 제공되는 도구

도구

설명하는 질문

list_subscriptions()

"어떤 건강 데이터가지고 있나요?"

get_facility(type, from_ms, to_ms)

"오늘 오전 심박수를 보여줘"

daily_summary(date, tz)

"어제 하루는 얼마나 활동적이었나요?"

sleep_breakdown(nights)

"이번 주 수면은 어땠나요?"

일 리미트는 시간대(tz="Europe/London" 등)를 존중하며, DST(서머타임)도 처리됩니다.


기록된 데이터 스트림

심박수 · SpO₂ · 피부 온도 · 호흡수 · 안정 시 심박수 · VO₂max · 수면 기간/점수/단계 · 걸음 수 및 층수(시간별 + 일별) · 운동 · 활동 칼로리/시간/거리 · 체성분(BIA) · 에너지 점수 · 혈압 · 혈당 · 수분 섭취 · 식사


설정

환경 변수

기본값

HR_AUTH_TOKEN

(비어 있음 = 인증 없음)

프로덕션에서 설정하세요

HR_PORT

8790

HR_HOST

0.0.0.0

신뢰할 수 있는 LAN에서 유지

HR_DATA_DIR

~/health-relay-data

SQLite가 이 곳에 저장됩니다

테스트

.venv/bin/python -m pytest tests/ -q
-
license - not tested
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • Self-hosted MCP gateway: turn any API, database or MCP server into AI connectors — no code.

  • MCP server for Withings health data — sleep, activity, heart, and body metrics.

  • 63 tools for Apple Health, Fitbit, Oura & Health Connect data in Claude, ChatGPT, Grok & Mistral.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nnishad/health-relay'

If you have feedback or need assistance with the MCP directory API, please join our Discord server