Leyr
MCP Servers

Clinical MCP

Let your AI assistant make real Leyr API calls - book appointments, manage patients, write notes, and more - directly from your IDE.

Leyr Clinical MCP Server

Give your AI assistant the ability to execute live Leyr API calls - not just read docs, but actually book appointments, look up patients, write clinical notes, and more.

Requires a Leyr account and API credentials.


Prerequisites: Create a Leyr account

The Clinical MCP calls the live Leyr API on your behalf. You need a Leyr account and an application with API credentials before you can use it.

Create your account

Register at leyr.io/auth/register - free Sandbox access is available to anyone.

Create an application

In the Developer Portal, register an application. This gives you a Client ID and lets you generate a Client Secret.

Save your credentials

You will need:

  • LEYR_CLIENT_ID - the Client ID from your application
  • LEYR_CLIENT_SECRET - the Client Secret generated for that application

Keep the secret private. Never commit it to source control.

Create a Leyr account

Setup

Providing credentials

The Clinical MCP supports two ways to pass credentials to every tool call:

Option A - Environment variables (recommended)

Set these in your shell or IDE environment before starting the MCP client:

export LEYR_CLIENT_ID=your_client_id
export LEYR_CLIENT_SECRET=your_client_secret

When both env vars are set, you never have to include credentials in individual tool calls.

Option B - Inline per call

Pass client_id and client_secret directly as parameters on each tool call. Useful for quickly testing with different accounts or in environments where env vars are not available.


Add to your IDE

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "leyr-health": {
      "url": "https://api.leyr.io/mcp",
      "env": {
        "LEYR_CLIENT_ID": "your_client_id",
        "LEYR_CLIENT_SECRET": "your_client_secret"
      }
    }
  }
}

Restart your IDE after saving the config.


Available tools

Care Units & Scheduling

ToolWhat it does
leyr_get_care_unitsList all care units (clinic locations) for an EHR
leyr_get_healthcare_servicesList healthcare services available at a care unit
leyr_get_resourcesList schedulable resources - doctors, nurses, rooms - at a care unit
leyr_get_resourceGet details of a single resource by ID
leyr_get_timeslotsGet available booking slots; filter by date range, service, or resource

Appointments

ToolWhat it does
leyr_get_appointmentsList appointments; filter by patient, resource, service, or date range
leyr_get_appointmentGet a single appointment by ID
leyr_create_appointmentBook a new appointment for a patient
leyr_patch_appointmentReschedule, reassign, add a comment, or cancel an appointment
leyr_bulk_patch_appointmentsUpdate multiple appointments at once by ID list

Patients

ToolWhat it does
leyr_get_patientsSearch patients by name, birth date, phone, or email
leyr_get_patientFetch a single patient record by ID
leyr_create_patientRegister a new patient (upserts if the patient already exists)

Clinical Records

ToolWhat it does
leyr_get_medical_notesList medical notes for a patient (paginated)
leyr_get_medical_noteFetch a single note with full content
leyr_create_medical_noteCreate an unsigned clinical note (signed later by a clinician)
leyr_get_documentsList documents attached to a patient (paginated)
leyr_get_documentFetch a single document with full content
leyr_create_documentAttach a base64-encoded document (PDF, image, report) to a patient
leyr_get_measurementsList clinical measurements for a patient (paginated)
leyr_get_measurementFetch a single measurement by ID
leyr_create_measurementRecord a new clinical measurement for a patient

Tool parameters reference

Every tool accepts two optional credential parameters:

ParameterDescription
client_idYour Leyr Client ID. Omit if LEYR_CLIENT_ID env var is set.
client_secretYour Leyr Client Secret. Omit if LEYR_CLIENT_SECRET env var is set.

If neither the env var nor the inline parameter is provided, the tool call will fail with a clear error message.

Most tools also require emr (the EHR identifier, e.g. webdoc, epic) and care_unit_id (from leyr_get_care_units).


Example prompts

Once connected, try asking your AI:

"List all care units for Webdoc and show their IDs"

"Find a patient named Anna Svensson born 1985-03-12 in Webdoc"

"Show available timeslots for Dr. Eriksson next Monday and book the first one for patient 42"

"Cancel appointment abc123 in care unit xyz"

"Write a short unstructured clinical note for patient 99 - the patient reported mild headache, no fever"

"Attach the lab result PDF (base64 string) to patient 77's record"


Typical workflow

The tools follow a natural dependency chain:

leyr_get_care_units
  └─ leyr_get_resources / leyr_get_healthcare_services
       └─ leyr_get_timeslots
            └─ leyr_create_appointment (needs patient_id)
                     ↑
               leyr_get_patients / leyr_create_patient

Your AI assistant will walk through this chain automatically when you describe what you want in plain language.


Questions, requests, or suggestions? Reach out at contact@leyr.io.
Leyr © 2026