Sapphire Wellness MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Sapphire Wellness MCP ServerWhat's my sleep quality for the past week?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Sapphire Wellness MCP Server
A Python Model Context Protocol (MCP) server that exposes health metrics from the Sapphire Wellness App to AI assistants.
Metrics Exposed
Metric | Tool | Data Points |
Activity |
| Steps, calories, distance, active minutes |
Blood Pressure |
| Systolic/diastolic (mmHg), AHA category |
Glucose |
| Blood glucose (mg/dL), meal context, time-in-range |
Heart Rate |
| BPM readings, avg/min/max, resting HR |
Sleep |
| Duration, deep/light/REM/awake stages, efficiency |
SpO2 |
| Oxygen saturation %, low-saturation event count |
Summary |
| All 6 metrics in a single call |
Related MCP server: Garmin MCP Server
Architecture
Agent Container
│ HTTP SSE
▼
sapphire-mcp:8000 ──asyncpg──▶ PostgreSQL:5432Transport: HTTP SSE — required for multi-container deployments (stdio only works when the agent spawns the MCP server as a child process)
Database: PostgreSQL with OpenTelemetry-style metric tables (
time,metric_name,metric_value,attributes JSONB, ...)Framework: FastMCP with Pydantic v2 response models
See Design.md for the full architecture document.
Project Structure
MCPServers/
├── sapphire_wellness/
│ ├── server.py # FastMCP app + SSE entry point
│ ├── config.py # Settings (DB_URL, HOST, PORT via env)
│ ├── models/ # Pydantic response models per metric
│ ├── db/ # asyncpg pool + shared base query
│ ├── repositories/ # DB → model mapping (one per metric)
│ └── tools/ # MCP tool definitions (one per metric)
├── Design.md # Architecture reference
├── pyproject.toml
├── Dockerfile
├── podman-compose.yml
└── .env.examplePrerequisites
Python 3.11+
PostgreSQL 14+ with the 6 wellness metric tables created
podman-compose or Docker Compose (for containerised deployment)
Quick Start
Local Development
# 1. Create and activate a virtual environment
python -m venv .venv
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
# 2. Install dependencies
pip install -e .
# 3. Configure environment
cp .env.example .env
# Edit .env — set DB_URL to your PostgreSQL connection string
# 4. Run the server
python -m sapphire_wellness.server
# Server starts at http://0.0.0.0:8000Containerised (podman-compose)
# Build and start all services (postgres + mcp server)
podman-compose up --build
# Tear down
podman-compose downThe MCP server will be available at http://localhost:10002/sse.
To connect your agent container, set:
MCP_SERVER_URL=http://sapphire-mcp:10002/sseConfiguration
All settings are read from environment variables (or a .env file):
Variable | Default | Description |
|
| PostgreSQL username |
|
| PostgreSQL password |
|
| PostgreSQL host ( |
|
| PostgreSQL port |
|
| PostgreSQL database name |
|
| MCP server bind address |
|
| MCP server bind port |
Tool Reference
All tools share these parameters:
Parameter | Type | Default | Description |
|
| — | User whose data to query |
|
|
| ISO date |
|
|
|
|
get_activity
Returns steps, calories, distance, and active minutes. Totals are summed across the period.
get_blood_pressure
Returns systolic/diastolic readings in mmHg. Each reading is classified using AHA categories:
Normal — systolic <120 and diastolic <80
Elevated — systolic 120–129 and diastolic <80
High Stage 1 — systolic 130–139 or diastolic 80–89
High Stage 2 — systolic ≥140 or diastolic ≥90
Hypertensive Crisis — systolic >180 or diastolic >120
get_glucose
Returns glucose readings in mg/dL with meal context (fasting, pre_meal, post_meal, bedtime, random) and statistics including time-in-range (target: 70–180 mg/dL).
get_heart_rate
Returns heart rate readings in BPM (active and resting) with average, min, max, and average resting BPM.
get_sleep
Returns sleep stage breakdown (deep, light, REM, awake) in minutes, total duration, and sleep efficiency percentage.
get_spo2
Returns SpO2 readings in %, with average, min, max, and a count of low-saturation events (below 95%).
get_health_summary
Calls all 6 metric repos concurrently and returns a single combined response — ideal for daily health briefings.
Inspecting Tools
Use the MCP Inspector to explore tool schemas and make test calls:
npx @modelcontextprotocol/inspector http://localhost:8000/sseConnecting to Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"sapphire-wellness": {
"url": "http://localhost:8000/sse"
}
}
}Then ask Claude: "What was my blood pressure this week?" and it will call get_blood_pressure with period="week".
Database Schema
All 6 tables (heartrate, bloodpressure, glucose, spo2, activity, sleep) share the same OpenTelemetry-style schema. The metric_name column distinguishes sub-metrics within each table (e.g. systolic and diastolic are separate rows in bloodpressure). See Design.md for the full DDL and sub-metric mapping.
Extending
Adding a new metric:
Create
sapphire_wellness/models/<metric>.py— Pydantic modelCreate
sapphire_wellness/repositories/<metric>_repo.py— DB query + mappingCreate
sapphire_wellness/tools/<metric>.py—@mcp.tool()definitionRegister in
server.py
Swapping the database:
Implement a new class that mirrors the method signatures in repositories/base.py (HealthRepository) and pass it to the register() functions in server.py.
Adding check_health_alerts:
This tool is planned for Phase 2. It will flag readings outside normal thresholds (e.g. BP >140/90, SpO2 <95%) and return structured alerts with severity levels.
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect your health, fitness, nutrition, sleep, and wearable data to your AI assistant.
- freddyOAuthcoach.freddy
Connect your wearables, rings and training apps, then ask your AI about your own health data.
Your own SLATE health data in your AI assistant: read, trend, plan and log. Never suggests a dose.
Read wearables and lab health data — sleep, activity, workouts, timeseries, lab tests and orders.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to access your Oura Ring health data through OAuth2-authenticated API calls.2 npm9MIT
- FlicenseBqualityDmaintenanceExposes Garmin Connect wellness and recovery metrics to MCP-compatible AI assistants for workload planning.3-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to query live Garmin Connect health and fitness data, including daily metrics, activities, sleep analysis, and trends via natural language.MIT
- FlicenseNot gradedqualityCmaintenanceExposes health metrics (activity, blood pressure, glucose, heart rate, sleep, SpO2) from the Sapphire Wellness App to AI assistants via the Model Context Protocol.-