# LibreLink Up B2B (CGM clínica) — how to use (mcp.ai)

Para equipas que acompanham vários pacientes (clínica, familiar): lista os pacientes com partilha ativa e lê glicemia, gráfico, logbook e estatísticas (apenas leitura). Credenciais encriptadas no servidor; ligação segura.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_librelink_business?ms=1781045700000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `librelink_business_get_current_glucose`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/librelink_business`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/librelink_business/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/librelink_business/get/current/glucose` — Latest glucose reading for a patient (value, trend, flags). For history use librelink_business_get_glucose_graph. Read-only CGM data — clinic/follower account; not for medical decisions without clinic
  - body: { patient_id: string, patient_ids?: string[] }
- `POST https://api.mcp.ai/api/librelink_business/get/glucose/graph` — ~12h high-resolution glucose graph (graphData). Read-only CGM data — clinic/follower account; not for medical decisions without clinician review.
  - body: { patient_id: string, patient_ids?: string[] }
- `POST https://api.mcp.ai/api/librelink_business/get/glucose/logbook` — Manual-scan logbook (~14 days). For continuous graph use librelink_business_get_glucose_graph. Read-only CGM data — clinic/follower account; not for medical decisions without clinician review.
  - body: { patient_id: string, patient_ids?: string[] }
- `POST https://api.mcp.ai/api/librelink_business/get/glucose/stats` — Time-in-range, avg, min/max from current graph window (~12h). Default target 70–180 mg/dL. Read-only CGM data — clinic/follower account; not for medical decisions without clinician review.
  - body: { patient_id: string, target_low?: number, target_high?: number, patient_ids?: string[] }
- `POST https://api.mcp.ai/api/librelink_business/get/last/hours` — Last N hours of normalized points from the current graph window (max ~12h available). Read-only CGM data — clinic/follower account; not for medical decisions without clinician review.
  - body: { patient_id: string, hours?: integer, patient_ids?: string[] }
- `POST https://api.mcp.ai/api/librelink_business/get/latest/reading` — Normalized latest reading: { mg_dl, trend_arrow, timestamp, minutes_ago, has_active_sensor }. Read-only CGM data — clinic/follower account; not for medical decisions without clinician review.
  - body: { patient_id: string, patient_ids?: string[] }
- `POST https://api.mcp.ai/api/librelink_business/get/patient` — Get one connection by patient_id (target range, sensor, latest glucose envelope). Read-only CGM data — clinic/follower account; not for medical decisions without clinician review.
  - body: { patient_id: string, patient_ids?: string[] }
- `POST https://api.mcp.ai/api/librelink_business/get/today/summary` — Like glucose stats but filtered to "today" in an IANA timezone; includes hypo/hyper event counts. Read-only CGM data — clinic/follower account; not for medical decisions without clinician review.
  - body: { patient_id: string, timezone?: string, target_low?: number, target_high?: number, patient_ids?: string[] }
- `POST https://api.mcp.ai/api/librelink_business/list/patients` — List all patients whose CGM data is visible to this LibreLink Up follower account (same as /llu/connections). Use patientId from each row for other tools. Read-only CGM data — clinic/follower account;

## Example prompts
- "Liste meus pacientes com partilha ativa e a glicose atual"
- "Quem está fora do alvo nas últimas 24 horas?"
- "Mostre o tempo no alvo dos últimos 7 dias do paciente X"

## More
- Page: https://mcp.ai/librelink_business
- Agent spec (llms.txt): https://mcp.ai/librelink_business/llms.txt
- Postman collection: https://mcp.ai/librelink_business/postman.json
