Skip to content

Connect Tebra to ChatGPT: Access Patient Records and Clinical Data

Learn how to build a Tebra MCP server using Truto to give your ChatGPT agents secure access to FHIR R4 patient records, clinical summaries, and care plans.

Roopendra Talekar Roopendra Talekar · · 10 min read

If you need to connect Tebra to ChatGPT to automate clinical intake, audit patient records, or summarize care plans, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between ChatGPT's tool calling capabilities and Tebra's complex healthcare APIs. You can either build and maintain this infrastructure yourself - dealing with strict security requirements, FHIR data models, and pagination logic - 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 Tebra to Claude or explore our broader architectural overview on connecting Tebra to AI Agents.

Giving a Large Language Model (LLM) read and write access to a clinical system like Tebra is a massive engineering challenge. You have to handle complex nested FHIR R4 resources, manage authentication lifecycles without leaking credentials, and translate natural language into very specific US Core / USCDI v1 compliant search parameters. Every time the API evolves, your custom server code must be updated, redeployed, and tested.

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

The Engineering Reality of the Tebra API

A custom Tebra 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 Tebra's highly specialized healthcare API is exceptionally painful.

If you decide to build a custom Tebra ChatGPT integration in-house, you own the entire API lifecycle. Here are the specific integration challenges that break standard CRUD assumptions when working with Tebra:

The FHIR R4 Searchset Bundle Abstraction

Unlike standard SaaS platforms that return flat JSON arrays when you query a list endpoint, Tebra's FHIR API returns a searchset Bundle. When an LLM queries for a patient by name, the response is a deeply nested object where the actual patient data lives inside entry [].resource.

If you pass raw FHIR bundles to an LLM without strict schema definitions, the LLM will struggle to consistently extract the logical id required for subsequent API calls. Your MCP server must define clear query_schema and body_schema instructions so ChatGPT understands how to parse the Tebra searchset, extract the resourceType, and utilize the FHIR logical ID for follow-up requests.

Dual API Surfaces: FHIR vs. Clinical REST

Tebra exposes two distinct API surfaces: the standard FHIR R4 API and the Clinical REST API. They have completely different mental models.

The FHIR API is globally scoped; almost every search requires a patient parameter (e.g., searching for observations or conditions). The Clinical REST API, however, is scoped to the patient who owns the API key. In the Clinical API, the patient is fixed, so you cannot pass a patient ID - you simply query /patient/problems or /patient/vitalSigns and narrow by startDate and endDate.

Building an MCP server that correctly routes LLM intents to the right API surface requires mapping dozens of endpoints and explicitly documenting the parameter rules for each. Without this, ChatGPT will hallucinate query parameters that the Clinical API rejects, or forget to include the mandatory patient parameter for the FHIR API.

Rate Limits and Header Normalization

Tebra enforces rate limits to ensure system stability. When you hit these limits, Tebra returns an HTTP 429 Too Many Requests error.

A critical architectural note: Truto does not automatically retry, throttle, or apply exponential backoff on your behalf when an upstream API like Tebra returns a 429. Instead, Truto acts as a transparent, predictable proxy. It normalizes Tebra's upstream rate limit information into standardized IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) and passes the 429 error directly back to the caller.

The caller - your ChatGPT agent or the integration middleware - is entirely responsible for reading these headers and executing the retry and backoff logic. This design ensures your agent maintains complete control over execution flow and avoids hidden timeout issues caused by middleware silently stalling requests.

Step 1: Generate a Tebra MCP Server

Instead of writing custom JSON-RPC handlers to deal with Tebra's FHIR schemas, you can use Truto to dynamically generate a Tebra MCP server.

Truto derives tool definitions directly from the integration's resource schema and documentation records. This means the MCP server is always up-to-date with the latest Tebra API specifications. You can create this server through the Truto UI or programmatically via the Truto API.

Method A: Via the Truto UI

If you prefer a visual interface, you can generate the MCP server directly from your dashboard:

  1. Log into your Truto account and navigate to your connected Tebra Integrated Account page.
  2. Click on the MCP Servers tab.
  3. Click the Create MCP Server button.
  4. Configure your server. Give it a descriptive name (e.g., "Tebra Clinical Agent"), and optionally filter the tools. For example, you can select only read methods to ensure ChatGPT cannot accidentally modify patient records.
  5. Click Create and copy the generated MCP server URL. (It will look something like https://api.truto.one/mcp/a1b2c3d4e5f6...).

Method B: Via the Truto API

For teams building automated deployment pipelines, you can provision the MCP server programmatically. Make a POST request to the Truto API using your integrated_account_id.

curl -X POST https://api.truto.one/integrated-account/<INTEGRATED_ACCOUNT_ID>/mcp \
  -H "Authorization: Bearer $TRUTO_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "ChatGPT Tebra Connector",
    "config": {
      "methods": ["read"],
      "tags": ["clinical", "fhir"]
    }
  }'

The Truto API will validate that tools exist for your configuration and return a secure, hashed token URL. This single URL contains all the routing and authentication needed to connect to Tebra - do not commit this URL to version control.

Step 2: Connect the MCP Server to ChatGPT

Once you have your Truto MCP server URL, you need to register it with ChatGPT. You can do this through the ChatGPT application interface or via a local MCP configuration file if you are running a custom agent architecture.

Method A: Via the ChatGPT UI

If you are using a ChatGPT Pro, Plus, Business, Enterprise, or Education account, you can add custom connectors directly in the application:

  1. Open ChatGPT and navigate to Settings -> Apps -> Advanced settings.
  2. Toggle on Developer mode (MCP support requires this feature flag).
  3. Under the MCP servers / Custom connectors section, click to add a new server.
  4. Enter a recognizable name (e.g., "Tebra Medical Records").
  5. Paste the Truto MCP server URL into the Server URL field.
  6. Click Save.

ChatGPT will immediately perform an initialization handshake, calling tools/list to discover all available Tebra resources.

Method B: Via Local Configuration File (CLI / Desktop)

If you are integrating ChatGPT via a local agent framework, Claude Desktop, or another MCP-compatible client, you can connect using the standard SSE transport provided by the MCP specification.

Create or update your MCP configuration file (e.g., mcp_config.json) to invoke the generic SSE server wrapper:

{
  "mcpServers": {
    "tebra-prod": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-sse",
        "--url",
        "https://api.truto.one/mcp/<YOUR_SECURE_TOKEN>"
      ]
    }
  }
}

When your agent boots up, it will connect to the SSE endpoint, retrieve the FHIR schemas, and inject them into the LLM's system prompt.

Architecture Flow

Here is how data flows when you ask ChatGPT a question about a Tebra patient:

sequenceDiagram
    participant User as User
    participant ChatGPT as ChatGPT (Client)
    participant MCP as Truto MCP Server
    participant Tebra as Tebra API
    User->>ChatGPT: "Find patient John Doe and check his active conditions."
    ChatGPT->>MCP: JSON-RPC tools/call list_all_tebra_patients
    Note over MCP: Validates token<br>Extracts query args
    MCP->>Tebra: GET /Patient?name=John+Doe
    Tebra-->>MCP: 200 OK (FHIR searchset Bundle)
    MCP-->>ChatGPT: Tool Result (JSON payload)
    Note over ChatGPT: Parses logical ID<br>Plans next tool call
    ChatGPT->>MCP: JSON-RPC tools/call list_all_tebra_conditions
    MCP->>Tebra: GET /Condition?patient=12345
    Tebra-->>MCP: 200 OK (FHIR Conditions)
    MCP-->>ChatGPT: Tool Result (JSON payload)
    ChatGPT-->>User: "John Doe has the following active conditions..."

Hero Tools for Tebra

Truto maps Tebra's extensive API into discrete, well-documented tools. Here are 6 high-leverage hero tools that transform ChatGPT into a powerful clinical assistant.

1. list_all_tebra_patients

This tool searches patient records in Tebra using the FHIR R4 Patient standard (US Core / USCDI v1). It returns matching FHIR Patient resources from the searchset Bundle, including demographic data and identifiers.

Usage Note: Tebra requires specific parameter combinations for searches. You must send at least one of _id, identifier, name, birthdate with name, or gender with name. You cannot run an empty search.

"Find the Tebra patient record for Jane Smith born in 1985. I need her FHIR logical ID."

2. get_single_tebra_condition_by_id

Retrieves a specific condition (problem, health concern, or encounter diagnosis) by its FHIR logical ID.

Usage Note: The response includes clinicalStatus, category, and code. The code is typically mapped to standard ontologies like SNOMED CT or ICD-10.

"Fetch the details for condition ID 98765 to see if the clinical status is still active."

3. list_all_tebra_observations

Searches observation records, which include vital signs, laboratory results, and smoking status.

Usage Note: This endpoint requires the patient FHIR logical ID as a mandatory parameter. The response includes the valueQuantity and effectiveDateTime for plotting clinical trends.

"Pull the recent vital sign observations for patient ID 12345, specifically looking for their last recorded blood pressure."

4. list_all_tebra_care_plans

Searches care plan records in Tebra, which detail the planned actions and intent for a patient's treatment.

Usage Note: You must provide both the patient ID and the category parameter.

"Retrieve the active care plans for patient ID 12345 categorized under chronic care management."

5. list_all_tebra_medication_requests

Searches medication request records in Tebra (prescriptions). Returns the medicationCodeableConcept and dosageInstruction.

Usage Note: Requires both patient and intent parameters to fulfill the search criteria successfully.

"Get all active medication requests for patient ID 12345 to check their current dosage instructions."

6. list_all_tebra_clinical_summaries

Gets a C-CDA 2.1 summary document (Common Clinical Data Set) for the patient tied to the API key using the Clinical REST API.

Usage Note: The content is returned as a base64 encoded document. Your agent must decode this payload to read the raw clinical summary.

"Download the latest C-CDA clinical summary document for this patient covering the last 30 days."

To view the complete inventory of Tebra tools - including endpoints for allergies, goals, encounters, and immunizations - check out the full schema on the Tebra integration page.

Workflows in Action

By chaining these tools together, ChatGPT can execute multi-step clinical workflows that normally require navigating several different EHR screens.

Scenario 1: Medical Assistant Chart Prep

A medical assistant needs to prepare a chart summary before a patient arrives for an appointment.

"Find the Tebra patient record for Michael Scott. Once you have his ID, list his current active conditions and his recent medication requests."

  1. ChatGPT calls list_all_tebra_patients passing name: "Michael Scott".
  2. The MCP server returns the FHIR searchset. ChatGPT parses the JSON and extracts the logical id (e.g., pt-555).
  3. ChatGPT calls list_all_tebra_conditions passing patient: "pt-555" to retrieve the problem list.
  4. ChatGPT calls list_all_tebra_medication_requests passing patient: "pt-555" and intent: "order" to retrieve the active prescriptions.
  5. ChatGPT synthesizes the data into a plain-text briefing for the medical assistant.

Scenario 2: Chronic Care Vitals Review

A provider wants to analyze a patient's recent lab results against their established care plan.

"For patient ID pt-999, pull their current care plans. Then, pull their observation records from the last month to see if their vitals align with the plan's targets."

  1. ChatGPT calls list_all_tebra_care_plans passing patient: "pt-999" and the appropriate category.
  2. ChatGPT reads the activity and intent fields from the care plan resource.
  3. ChatGPT calls list_all_tebra_observations passing patient: "pt-999".
  4. ChatGPT cross-references the valueQuantity from the observations (e.g., HbA1c levels) against the goals outlined in the care plan, providing the clinician with a structured variance report.

Security and Access Control

When connecting an AI agent to a clinical system containing Protected Health Information (PHI), security is paramount. Truto MCP servers provide several layers of access control built directly into the token generation process:

  • Method Filtering: Limit the server to specific operations. By passing "methods": ["read"] during server creation, you ensure the LLM can only query data (GET/LIST) and cannot accidentally update or delete clinical records.
  • Tag Filtering: Restrict the toolset by domain. By passing "tags": ["clinical"], you prevent the LLM from accessing administrative or billing endpoints, limiting its context window to purely medical data.
  • Require API Token Auth: Set require_api_token_auth: true to mandate a second layer of authentication. With this flag enabled, possession of the MCP URL is not enough; the client must also send a valid Truto API token via a Bearer header to execute tools.
  • Expiration Controls: Use the expires_at property to create short-lived MCP servers. If you are generating a server for a temporary agent session or a third-party contractor, the server will automatically self-destruct at the specified ISO datetime, leaving no stale access behind.

Stop Building Boilerplate Healthcare Integrations

Connecting Tebra to ChatGPT requires navigating complex FHIR schemas, distinct API paradigms, and rigorous security boundaries. Building a custom MCP server means taking on the technical debt of parsing searchset bundles, managing OAuth credentials, and handling rate limits.

With Truto, you can bypass the boilerplate. By leveraging dynamically generated MCP servers, your engineering team can focus on building intelligent clinical agents and agentic workflows, while Truto handles the underlying infrastructure, schema mapping, and security controls.

Ready to give your AI agents secure access to Tebra? Talk to us today and see how Truto's SuperAI can accelerate your integration roadmap.

FAQ

Does Truto automatically retry Tebra API rate limits?
No, Truto acts as a transparent proxy. When Tebra returns a 429 Too Many Requests error, Truto normalizes the rate limit info into standard IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset) and passes the 429 back to the caller. Your ChatGPT agent must handle the retry and backoff logic.
Can I limit ChatGPT to only reading Tebra patient data?
Yes. When creating the Tebra MCP server in Truto, you can configure method filtering by passing 'methods': ['read']. This restricts the server to GET and LIST operations, preventing the LLM from modifying data.
How does Truto handle Tebra's FHIR API structures?
Truto maps Tebra's complex FHIR R4 endpoints (like searchset Bundles) into discrete tools using documentation-driven tool generation. Query and body schemas are automatically derived, instructing ChatGPT exactly how to extract data like logical IDs.
How do I secure my Tebra MCP server URL?
Treat the generated MCP server URL like a secret token. For added security, you can enable 'require_api_token_auth', which forces the connecting client to also provide a valid API token in the Authorization header.

More from our Blog