KC

kkarsyline/collar_watch

Developer tools

This page was translated automatically. Technical details may differ from the original. View the original

54 stars 9 forks Quality 71 Trend 9NOASSERTION

Enable AI to read your health data. Complete chain from data collection to MCP reading, as well as more real-time and stable health data collection and upload. Update 2026-07-26: AI can proactively initiate real-time heart rate measurement.

Overview

Previously, the link was "watch scheduled reporting, server passively receiving messages." This time, a reversed message was added: The wearer only needs to open the app on the iWatch — the app will automatically start a 15-second notification process after opening, then the wrist will give a light shake after testing. - GET /command → executor fetch_pending_command(). A command returns {"command": "measure_heart_rate", "command_id": "...", "duration_seconds": 30, ...}, but no {"command": null} - POST /command/result ← Watch sent {"command_id": "...", "result": {"heart_rate_average": 83, ...}}, executor complete_command() : CommandFetcher.swift (order collection / receipt / local anti-retest accounting), WorkoutMeasurer.swift (measurement body, discardWorkout closure—training records are not stored in the database, fitness tricycle is not contaminated, heart rate samples are still reported via HealthKit via the original link); Scheduler / CollarWatchApp wiring (front desk conducts light polling every 15s + measurement interface). After installation, health authorization will pop up once again for workout write permission; just allow it. : Since everyone uses different push methods, here the MCP tool only issues commands and does not send notifications (after the command is issued, you can wait up to 90 seconds; if you don't return pending, the result is health_now). When the app is open, it will start the process automatically; If you need to receive notifications, you can connect to your own push channel on your ingest. Adjustable parameters (environment variables): HEALTH_MEASURE_DURATION_S (measured seconds, default 30), HEALTH_COMMAND_TTL_MIN (command validity period, default 30 minutes). ⚠️ :HealthKit will appear in **. NSHealthUpdateUsageDescription Writes placeholder perfunctory comments (for example, in the old version of this project, "Only test environment writes simulation data." "), when requesting write permissions, it directly throws NSInvalidArgumentException and crashes, reporting the error because the original message is The string "...

Overview (machine translated)

Update on 2026-07-26: On-demand real-time heart rate measurement

Previously, the process was “watch reporting at a scheduled time, server passively receiving it.” This time, a reverse approach has been added: The AI side can actively call an MCP tool, and the watch can immediately start a 30-second workout session, measure the real-time heart rate, and send it back. The wearer only needs to open the app on the iWatch — after opening the app, it automatically pulls up a 15-second notification process, and after testing, the wrist flicks lightly.

The two new ports to be added on the ingest side (the data layer function is already in health_store.py, and the HTTP shell is still provided as before):

  • GET /command → executor fetch_pending_command(). Instructions return {"command": "measure_heart_rate", "command_id": "...", "duration_seconds": 30, ...}, but no {"command": null}
  • POST /command/result ← Watch delivered {"command_id": "...", "result": {"heart_rate_average": 83, ...}}, executor complete_command()

Watch side newly added: CommandFetcher.swift (Receipt / Receipt / Local Anti-Repeat Tracking), WorkoutMeasurer.swift (Measurement body, discardWorkout Closing — training records are not stored in the database, fitness three rings remain untainted, heart rate samples are still reported via HealthKit via the original link); Scheduler / CollarWatchApp wiring (front desk conducts light polling every 15s + measurement interface). After installation, health authorization will pop up once again for workout write permission; just allow it.

Notifications: Since everyone uses different push methods, here the MCP tool only issues commands and does not send notifications (after issuing a command, you can wait up to 90 seconds; if you don’t wait for pending, it will end up health_now). When the app is open, it will automatically start the process; If you need to receive notifications, you can connect to your own push channel on your ingest.

Adjustable parameters (environment variables): HEALTH_MEASURE_DURATION_S (measured seconds, default 30), HEALTH_COMMAND_TTL_MIN (command validity period, default 30 minutes).

⚠️ > A pitfall worth mentioning: HealthKit reviews the quality of permission description copy at runtime**. NSHealthUpdateUsageDescription Write placeholder perfunctory phrases (for example, the old version of this project “Only test environment writes simulation data.” "), when requesting permissions, it will directly throw NSInvalidArgumentException crash, and the error is the original message being 'The string "…

This page was translated automatically. Technical details may differ from the original.

Install

This server does not publish a one-line install command.

Open the repository installation guide New to MCP? Start with the mcpskill.org guide →

Configuration

{ "mcpServers": { "health-collar": { "command": "python", "args": ["/absolute/path/to/health-collar/mcp_server/server.py"], "env": { "HEALTH_DATA_DIR": "/absolute/path/to/health-collar/data/health", "HEALTH_TZ_OFFSET_HOURS": "8" } } } }