Skip to content

Connect drchrono to ChatGPT: Sync Patient Records and Lab Workflows

Learn how to build a secure drchrono MCP server for ChatGPT. Automate patient records, lab workflows, and medical scheduling with AI agents.

Yuvraj Muley Yuvraj Muley · · 9 min read

If you need to connect drchrono to ChatGPT to automate clinical workflows, manage lab results, or orchestrate patient scheduling, you need a Model Context Protocol (MCP) server. This server acts as the secure translation layer between ChatGPT's tool calls and drchrono's REST API. You can either build and maintain this HIPAA-compliant infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL.

If your team uses Claude, check out our guide on connecting drchrono to Claude or explore our broader architectural overview on connecting drchrono to AI Agents.

Giving a Large Language Model (LLM) read and write access to an Electronic Health Record (EHR) system is a massive engineering and compliance challenge. You have to handle complex relational patient data, map dynamic custom demographic fields to MCP tool definitions, and deal with multi-stage lab ordering workflows. Every time the provider adds a new custom field or updates an office schedule in drchrono, your custom server code must be updated, redeployed, and tested to prevent agent hallucinations.

This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for drchrono, connect it natively to ChatGPT, and execute complex clinical and administrative workflows using natural language.

The Engineering Reality of the drchrono API

A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, implementing it against drchrono's highly specific medical API surface is exceptionally painful.

If you decide to build a custom MCP server for drchrono, you own the entire API lifecycle. Here are the specific integration challenges that break standard CRUD assumptions when working with drchrono:

Disjointed Lab Order Workflows

In a standard SaaS API, creating a lab order might be a single POST request. In drchrono, the lab workflow requires a multi-stage orchestration sequence. You must first create a lab_order linking the patient, doctor, and sublab. Then, you must separately attach the requisition PDF via the lab_documents endpoint. Finally, incoming results update the order via the lab_results endpoint. Expecting an LLM to accurately execute this multi-endpoint orchestration natively without highly curated, schema-defined tools usually results in orphaned records and clinical errors.

Custom Demographics vs Standard Demographics

Every medical practice tracks unique data - from specialized risk factors to specific referral sources. drchrono splits this data into standard patients fields and custom_demographics. Your MCP server must dynamically read the practice's custom demographic schemas, merge them logically, and present a unified interface to the LLM. If your agent tries to update a patient's custom risk score using the standard patients endpoint, the API will silently ignore it or throw a validation error.

Strict Rate Limits and Error Handling

EHR APIs heavily throttle requests to protect the underlying clinical databases. When connecting an AI agent that might rapidly loop through patient records, rate limiting is a critical concern.

A factual note on how Truto handles rate limits: Truto does not retry, throttle, or apply backoff on rate limit errors. When the upstream drchrono API returns an HTTP 429 Too Many Requests, Truto passes that error directly to the caller. However, Truto normalizes the upstream rate limit information into standardized headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) per the IETF specification. The caller (your AI agent or LangChain framework) is fully responsible for reading these headers and implementing its own retry or backoff logic. Truto does not automatically absorb rate limit errors.

How to Generate a drchrono MCP Server with Truto

Truto automatically generates an MCP server for any connected integrated account. The server derives its tool definitions directly from the integration's documented API schemas, ensuring the LLM always has the correct parameters for drchrono.

You can generate the MCP server URL in two ways: via the Truto UI or programmatically via the API.

Method 1: Via the Truto UI

If you are setting up a workspace for an internal team, the UI is the fastest path:

  1. Navigate to the Integrated Accounts page in your Truto dashboard and select your connected drchrono account.
  2. Click the MCP Servers tab.
  3. Click Create MCP Server.
  4. Select your desired configuration (e.g., name, allowed methods like read/write, and specific tags like patients or lab_orders).
  5. Copy the generated MCP server URL. Treat this URL as a secure credential.

Method 2: Via the Truto API

For B2B SaaS companies provisioning AI agents for multiple clinics, you can generate MCP servers programmatically.

Make a POST request to /integrated-account/:id/mcp with your filtering configuration. This ensures the generated server is strictly scoped.

curl -X POST https://api.truto.one/integrated-account/$DRCHRONO_ACCOUNT_ID/mcp \
  -H "Authorization: Bearer $TRUTO_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "drchrono Clinical Agent",
    "config": {
      "methods": ["read", "write"],
      "tags": ["patients", "appointments", "lab_orders"]
    },
    "expires_at": "2026-12-31T23:59:59Z"
  }'

The response returns a secure URL:

{
  "id": "mcp_abc123",
  "name": "drchrono Clinical Agent",
  "url": "https://api.truto.one/mcp/a1b2c3d4e5f6..."
}

Connecting the drchrono MCP Server to ChatGPT

Once you have your Truto MCP URL, you need to register it with ChatGPT so the LLM can discover the drchrono tools.

Method A: Via the ChatGPT UI

If you are using ChatGPT Pro, Plus, Business, Enterprise, or Education, you can add the connector directly in the interface:

  1. Open ChatGPT and go to Settings -> Apps -> Advanced settings.
  2. Enable Developer mode.
  3. Under MCP servers / Custom connectors, click Add.
  4. Provide a name (e.g., "drchrono Clinical Sync").
  5. Paste the Truto MCP URL into the Server URL field and click Save.

ChatGPT will immediately ping the server, run the initialize handshake, and populate its context window with the available drchrono tools.

Method B: Via Configuration File (SSE Transport)

If you are running a custom ChatGPT interface or an external agent framework that relies on configuration files, you can map the remote Truto MCP URL using the official Server-Sent Events (SSE) proxy wrapper.

Add the following to your MCP client configuration JSON:

{
  "mcpServers": {
    "drchrono_truto": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "--url",
        "https://api.truto.one/mcp/a1b2c3d4e5f6..."
      ]
    }
  }
}

Hero Tools for drchrono AI Automation

Truto exposes dozens of drchrono endpoints as MCP tools. By filtering your server configuration, you can constrain ChatGPT to only the tools necessary for the job. Here are the highest-leverage tools for clinical and administrative automation.

1. list_all_drchrono_patients

Searching for patients is the prerequisite for almost all EHR workflows. This tool allows the LLM to query the patient database by name, date of birth, or assigned provider to retrieve the exact patient ID needed for subsequent operations.

"Find the patient record for John Doe, who had his first appointment last month with Dr. Smith, and retrieve his patient ID and emergency contact phone number."

2. list_all_drchrono_appointments

Checking a provider's schedule requires querying the appointments endpoint. This tool handles the pagination and date-range filtering required to return blocks of time, telehealth sessions, and in-office visits.

"Check Dr. Smith's calendar for next Tuesday and list all confirmed appointments and scheduled breaks."

3. create_a_drchrono_appointment

Booking a patient involves creating a new appointment record. The LLM must supply the required office, scheduled_time, doctor, patient, and exam_room parameters to successfully block the calendar.

"Schedule a follow-up appointment for patient ID 84920 with Dr. Smith at the Downtown Office next Thursday at 2:00 PM in Exam Room 3."

4. create_a_drchrono_lab_order

This is the entry point for the complex diagnostic workflow. The LLM creates the base order linking the patient to the requested sublab, making the order visible in the doctor's clinical dashboard.

"Draft a new lab order for patient ID 84920, assigning it to Dr. Smith and routing it to the Quest Diagnostics sublab for a complete metabolic panel."

5. list_all_drchrono_lab_results

To automate clinical triaging, an AI agent can monitor incoming lab results. This tool retrieves diagnostic data, flagging abnormal results and associated LOINC codes for the provider to review.

"Retrieve all lab results received in the last 24 hours. Identify any results marked with an abnormal flag and list the specific observation descriptions."

6. create_a_drchrono_patient_message

Patient communication must be tracked securely within the EHR. This tool allows the agent to draft messages to the patient portal on behalf of the provider.

"Send a secure patient message to patient ID 84920 on behalf of Dr. Smith, letting them know their recent lab results are normal and no further action is needed."

To view the complete inventory of available endpoints, schemas, and return types, visit the drchrono integration page.

Workflows in Action

Connecting tools is just the foundation. The real value of an MCP server is orchestrating complex, multi-step EHR operations. Here are two real-world workflows your AI agent can execute.

Workflow 1: Lab Result Triage and Patient Notification

Clinical teams spend hours reviewing normal lab results and drafting standard follow-up messages. An AI agent can safely automate the administrative overhead of normal results.

"Check all recent lab results. If a result is completely normal, draft a secure message to the patient letting them know everything looks good, and close the task."

  1. list_all_drchrono_lab_results: The agent queries the endpoint, filtering for recently received results.
  2. Analyze Data: The LLM reviews the payload, specifically checking the is_abnormal flag across the returned array.
  3. get_single_drchrono_patient_by_id: For normal results, the agent retrieves the patient's demographic record using the linked patient ID.
  4. create_a_drchrono_patient_message: The agent constructs a professional, empathetic message and posts it to the patient's secure portal.
sequenceDiagram
    participant ChatGPT as ChatGPT
    participant Truto as Truto MCP Server
    participant drchrono as drchrono API

    ChatGPT->>Truto: Call list_all_drchrono_lab_results<br>(recent=true)
    Truto->>drchrono: GET /api/lab_results
    drchrono-->>Truto: Return lab results array
    Truto-->>ChatGPT: Return JSON payload
    
    Note over ChatGPT: Identify normal result<br>Extract patient_id
    
    ChatGPT->>Truto: Call get_single_drchrono_patient_by_id<br>(id=84920)
    Truto->>drchrono: GET /api/patients/84920
    drchrono-->>Truto: Return patient profile
    Truto-->>ChatGPT: Return JSON payload
    
    ChatGPT->>Truto: Call create_a_drchrono_patient_message<br>(subject="Lab Results")
    Truto->>drchrono: POST /api/patient_messages
    drchrono-->>Truto: Return 201 Created
    Truto-->>ChatGPT: Confirm message sent

Workflow 2: Clinical Intake and Scheduling

Front desk staff often juggle phone calls while trying to match patient availability with a provider's complex schedule. An AI agent can parse the request, verify the schedule, and book the slot instantly.

"Find the next available 30-minute slot for Dr. Smith next week and book a follow-up appointment for existing patient Sarah Connor."

  1. list_all_drchrono_patients: The agent searches for "Sarah Connor" to secure her internal id.
  2. list_all_drchrono_appointments: The agent queries Dr. Smith's calendar for the requested week to identify open time blocks.
  3. Analyze Data: The LLM compares the scheduled appointments against the provider's known office hours to calculate a valid 30-minute opening.
  4. create_a_drchrono_appointment: The agent submits the POST payload, mapping the office, doctor, patient, and calculated scheduled_time.
flowchart TD
    A["User Prompt:<br>Book Sarah Connor"] --> B["list_all_drchrono_patients<br>(search: Sarah Connor)"]
    B --> C{"Patient Found?"}
    C -->|Yes| D["list_all_drchrono_appointments<br>(doctor: Smith, date: next week)"]
    C -->|No| E["Prompt User:<br>Patient not in system"]
    D --> F["LLM calculates<br>available time slot"]
    F --> G["create_a_drchrono_appointment<br>(patient_id, doctor_id, time)"]
    G --> H["Return Success<br>to User"]

Security and Access Control

Exposing an EHR system to an AI agent requires strict guardrails. Truto's MCP architecture provides multiple layers of security at the token level, ensuring the LLM cannot access unauthorized PHI.

  • Method Filtering (config.methods): Restrict the agent's capabilities by HTTP verb. You can create a read-only agent by restricting the server to get and list operations, physically preventing the LLM from writing data to drchrono.
  • Tag Filtering (config.tags): Scope access to specific clinical domains. For example, passing tags: ["appointments", "offices"] completely hides the patients and lab_results endpoints from the LLM.
  • API Token Authentication (require_api_token_auth): Enable this flag to require the client to pass a valid Truto API token in the Authorization header, preventing unauthorized access if the MCP URL is leaked in internal logs.
  • Server Expiration (expires_at): Set a strict time-to-live for the MCP server. Cloudflare KV and durable objects automatically revoke access and clean up the server configuration at the exact timestamp, perfect for temporary audit agents.

Moving Past Boilerplate Integration Code

Connecting ChatGPT to drchrono natively transforms how clinical and administrative teams operate. Instead of navigating dozens of dense UI screens to check lab statuses or book follow-ups, staff can interact with the EHR conversationally.

However, building the infrastructure to translate LLM intent into drchrono's complex, multi-stage API payloads is a massive distraction from building your core product. By leveraging auto-generated MCP servers, you can provide secure, documented tools to your AI agents without writing a single line of API mapping code.

Ready to give your AI agents secure access to drchrono?

FAQ

Does Truto automatically retry failed drchrono API requests if the rate limit is hit?
No. Truto strictly passes through HTTP 429 errors from drchrono and normalizes the rate limit information into standard IETF headers. Your AI agent or client framework must implement its own retry and backoff logic.
Can I prevent ChatGPT from modifying patient data in drchrono?
Yes. When creating the MCP server in Truto, you can use the `config.methods` array to restrict the server to 'read' operations (like 'get' and 'list'), physically blocking the LLM from creating or updating records.
How do I map custom patient demographics in drchrono to the LLM?
Truto dynamically derives tool schemas from the integration's documentation and configuration. The MCP server automatically parses standard and custom demographic endpoints, presenting them as structured JSON-RPC tools to the LLM.
Is the Truto MCP server URL secure?
Yes. The URL contains a cryptographically hashed token scoped to a specific integrated account. You can optionally enable `require_api_token_auth` to force the client to provide a valid API token on top of the URL validation.

More from our Blog