tebra-mcp-server 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +267 -35
  3. package/dist/config.d.ts +12 -0
  4. package/dist/config.d.ts.map +1 -1
  5. package/dist/config.js +12 -0
  6. package/dist/config.js.map +1 -1
  7. package/dist/fhir-client.d.ts +22 -0
  8. package/dist/fhir-client.d.ts.map +1 -0
  9. package/dist/fhir-client.js +86 -0
  10. package/dist/fhir-client.js.map +1 -0
  11. package/dist/index.d.ts +4 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +98 -6
  14. package/dist/index.js.map +1 -1
  15. package/dist/integrations/epic-notes-integration.d.ts +145 -0
  16. package/dist/integrations/epic-notes-integration.d.ts.map +1 -0
  17. package/dist/integrations/epic-notes-integration.js +227 -0
  18. package/dist/integrations/epic-notes-integration.js.map +1 -0
  19. package/dist/integrations/fal-integration.d.ts +109 -0
  20. package/dist/integrations/fal-integration.d.ts.map +1 -0
  21. package/dist/integrations/fal-integration.js +192 -0
  22. package/dist/integrations/fal-integration.js.map +1 -0
  23. package/dist/soap-client.d.ts +1 -0
  24. package/dist/soap-client.d.ts.map +1 -1
  25. package/dist/soap-client.js +68 -1
  26. package/dist/soap-client.js.map +1 -1
  27. package/dist/tools/appointment-crud.d.ts +117 -0
  28. package/dist/tools/appointment-crud.d.ts.map +1 -0
  29. package/dist/tools/appointment-crud.js +218 -0
  30. package/dist/tools/appointment-crud.js.map +1 -0
  31. package/dist/tools/appointment-detail.d.ts +25 -0
  32. package/dist/tools/appointment-detail.d.ts.map +1 -0
  33. package/dist/tools/appointment-detail.js +85 -0
  34. package/dist/tools/appointment-detail.js.map +1 -0
  35. package/dist/tools/appointment-reasons.d.ts +20 -0
  36. package/dist/tools/appointment-reasons.d.ts.map +1 -0
  37. package/dist/tools/appointment-reasons.js +48 -0
  38. package/dist/tools/appointment-reasons.js.map +1 -0
  39. package/dist/tools/appointments.d.ts +46 -0
  40. package/dist/tools/appointments.d.ts.map +1 -1
  41. package/dist/tools/appointments.js +71 -4
  42. package/dist/tools/appointments.js.map +1 -1
  43. package/dist/tools/authorizations.js +5 -5
  44. package/dist/tools/bulk-patients.d.ts +33 -0
  45. package/dist/tools/bulk-patients.d.ts.map +1 -0
  46. package/dist/tools/bulk-patients.js +81 -0
  47. package/dist/tools/bulk-patients.js.map +1 -0
  48. package/dist/tools/charges.d.ts +61 -0
  49. package/dist/tools/charges.d.ts.map +1 -1
  50. package/dist/tools/charges.js +98 -14
  51. package/dist/tools/charges.js.map +1 -1
  52. package/dist/tools/documents.d.ts +71 -0
  53. package/dist/tools/documents.d.ts.map +1 -0
  54. package/dist/tools/documents.js +139 -0
  55. package/dist/tools/documents.js.map +1 -0
  56. package/dist/tools/eligibility.js +5 -5
  57. package/dist/tools/encounter-status.d.ts +34 -0
  58. package/dist/tools/encounter-status.d.ts.map +1 -0
  59. package/dist/tools/encounter-status.js +73 -0
  60. package/dist/tools/encounter-status.js.map +1 -0
  61. package/dist/tools/encounters.js +29 -29
  62. package/dist/tools/external-ids.d.ts +66 -0
  63. package/dist/tools/external-ids.d.ts.map +1 -0
  64. package/dist/tools/external-ids.js +140 -0
  65. package/dist/tools/external-ids.js.map +1 -0
  66. package/dist/tools/fhir-clinical.d.ts +187 -0
  67. package/dist/tools/fhir-clinical.d.ts.map +1 -0
  68. package/dist/tools/fhir-clinical.js +597 -0
  69. package/dist/tools/fhir-clinical.js.map +1 -0
  70. package/dist/tools/patient-crud.d.ts +190 -0
  71. package/dist/tools/patient-crud.d.ts.map +1 -0
  72. package/dist/tools/patient-crud.js +297 -0
  73. package/dist/tools/patient-crud.js.map +1 -0
  74. package/dist/tools/patients.d.ts +87 -1
  75. package/dist/tools/patients.d.ts.map +1 -1
  76. package/dist/tools/patients.js +108 -8
  77. package/dist/tools/patients.js.map +1 -1
  78. package/dist/tools/payments.d.ts +105 -0
  79. package/dist/tools/payments.d.ts.map +1 -0
  80. package/dist/tools/payments.js +206 -0
  81. package/dist/tools/payments.js.map +1 -0
  82. package/dist/tools/practices.d.ts +20 -0
  83. package/dist/tools/practices.d.ts.map +1 -0
  84. package/dist/tools/practices.js +54 -0
  85. package/dist/tools/practices.js.map +1 -0
  86. package/dist/tools/procedure-codes.js +5 -5
  87. package/dist/tools/providers.d.ts +25 -0
  88. package/dist/tools/providers.d.ts.map +1 -0
  89. package/dist/tools/providers.js +62 -0
  90. package/dist/tools/providers.js.map +1 -0
  91. package/dist/tools/service-locations.d.ts +25 -0
  92. package/dist/tools/service-locations.d.ts.map +1 -0
  93. package/dist/tools/service-locations.js +62 -0
  94. package/dist/tools/service-locations.js.map +1 -0
  95. package/dist/tools/system.d.ts +81 -0
  96. package/dist/tools/system.d.ts.map +1 -0
  97. package/dist/tools/system.js +184 -0
  98. package/dist/tools/system.js.map +1 -0
  99. package/dist/tools/transactions.d.ts +61 -0
  100. package/dist/tools/transactions.d.ts.map +1 -0
  101. package/dist/tools/transactions.js +122 -0
  102. package/dist/tools/transactions.js.map +1 -0
  103. package/package.json +60 -54
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 James Rosing / Allure MD
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 James Rosing, MD, FACS / Allure MD Plastic Surgery and Dermatology
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,14 +1,26 @@
1
- # @allure-md/tebra-mcp-server
1
+ # tebra-mcp-server
2
2
 
3
- MCP server for Tebra (Kareo) practice management. Exposes patient data, encounters, authorizations, appointments, charges, eligibility, and procedure codes to Claude and other MCP-compatible clients.
3
+ [![npm version](https://img.shields.io/npm/v/tebra-mcp-server.svg)](https://www.npmjs.com/package/tebra-mcp-server)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ MCP server for [Tebra](https://www.tebra.com/) (formerly Kareo) practice management. Connects your existing Tebra account to Claude and other MCP-compatible AI agents, exposing **33 SOAP tools** and **12 FHIR clinical tools** for patients, encounters, appointments, billing, documents, insurance, and clinical data. No data is accessible without valid Tebra API credentials.
7
+
8
+ ## Quick Start
9
+
10
+ ```bash
11
+ npx tebra-mcp-server
12
+ ```
4
13
 
5
14
  ## Prerequisites
6
15
 
7
16
  - Node.js 18+
8
17
  - Tebra SOAP API credentials (generated in Tebra PM admin under Settings > API)
18
+ - (Optional) Tebra FHIR API credentials for clinical data access
9
19
 
10
20
  ## Environment Variables
11
21
 
22
+ ### SOAP API (required)
23
+
12
24
  | Variable | Required | Description |
13
25
  |---|---|---|
14
26
  | `TEBRA_SOAP_USER` | Yes | SOAP API user (email) |
@@ -16,35 +28,50 @@ MCP server for Tebra (Kareo) practice management. Exposes patient data, encounte
16
28
  | `TEBRA_CUSTOMER_KEY` | Yes | Customer key from Tebra PM admin |
17
29
  | `TEBRA_SOAP_ENDPOINT` | No | Override SOAP endpoint (for testing) |
18
30
 
19
- ## Setup
31
+ ### FHIR API (optional -- enables 12 clinical data tools)
20
32
 
21
- ```bash
22
- cd tebra-mcp-server
23
- npm install
24
- npm run build
25
- ```
33
+ | Variable | Required | Description |
34
+ |---|---|---|
35
+ | `TEBRA_FHIR_CLIENT_ID` | For FHIR | OAuth2 client ID from Tebra developer portal |
36
+ | `TEBRA_FHIR_CLIENT_SECRET` | For FHIR | OAuth2 client secret |
37
+ | `TEBRA_FHIR_BASE_URL` | No | FHIR R4 base URL (defaults to Tebra production) |
26
38
 
27
- ## Usage
39
+ FHIR credentials are obtained from the Tebra Developer Portal under API > FHIR Access. The server uses OAuth2 client credentials flow with automatic token caching and refresh.
28
40
 
29
- ### Direct execution
41
+ ## Installation
30
42
 
31
- ```bash
32
- TEBRA_SOAP_USER=user@practice.com \
33
- TEBRA_SOAP_PASSWORD=secret \
34
- TEBRA_CUSTOMER_KEY=abc123 \
35
- node dist/index.js
43
+ ### Claude Code
44
+
45
+ Add to `.mcp.json` in your project root:
46
+
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "tebra": {
51
+ "command": "npx",
52
+ "args": ["-y", "tebra-mcp-server"],
53
+ "env": {
54
+ "TEBRA_SOAP_USER": "user@practice.com",
55
+ "TEBRA_SOAP_PASSWORD": "your-password",
56
+ "TEBRA_CUSTOMER_KEY": "your-customer-key",
57
+ "TEBRA_FHIR_CLIENT_ID": "optional-fhir-client-id",
58
+ "TEBRA_FHIR_CLIENT_SECRET": "optional-fhir-client-secret"
59
+ }
60
+ }
61
+ }
62
+ }
36
63
  ```
37
64
 
38
- ### Claude Desktop configuration
65
+ ### Claude Desktop
39
66
 
40
- Add to your Claude Desktop config (`claude_desktop_config.json`):
67
+ Add to your `claude_desktop_config.json`:
41
68
 
42
69
  ```json
43
70
  {
44
71
  "mcpServers": {
45
72
  "tebra": {
46
- "command": "node",
47
- "args": ["/path/to/tebra-mcp-server/dist/index.js"],
73
+ "command": "npx",
74
+ "args": ["-y", "tebra-mcp-server"],
48
75
  "env": {
49
76
  "TEBRA_SOAP_USER": "user@practice.com",
50
77
  "TEBRA_SOAP_PASSWORD": "your-password",
@@ -55,16 +82,16 @@ Add to your Claude Desktop config (`claude_desktop_config.json`):
55
82
  }
56
83
  ```
57
84
 
58
- ### Claude Code configuration
85
+ ### Cursor / VS Code
59
86
 
60
- Add to `.mcp.json` in your project root:
87
+ Add to your MCP settings:
61
88
 
62
89
  ```json
63
90
  {
64
91
  "mcpServers": {
65
92
  "tebra": {
66
- "command": "node",
67
- "args": ["./tebra-mcp-server/dist/index.js"],
93
+ "command": "npx",
94
+ "args": ["-y", "tebra-mcp-server"],
68
95
  "env": {
69
96
  "TEBRA_SOAP_USER": "user@practice.com",
70
97
  "TEBRA_SOAP_PASSWORD": "your-password",
@@ -75,29 +102,234 @@ Add to `.mcp.json` in your project root:
75
102
  }
76
103
  ```
77
104
 
78
- ## Available Tools
105
+ ## Available Tools (45 total)
106
+
107
+ ### Patient Management
108
+
109
+ | Tool | Description |
110
+ |---|---|
111
+ | `tebra_search_patients` | Search patients by name, DOB, MRN, or external ID (20+ filters) |
112
+ | `tebra_get_patient` | Get full patient record with insurance, cases, and authorizations |
113
+ | `tebra_create_patient` | Register a new patient with demographics and insurance |
114
+ | `tebra_update_patient` | Update patient demographics, contact info, or insurance |
115
+ | `tebra_get_all_patients` | Bulk patient retrieval with pagination (for sync operations) |
116
+
117
+ ### Appointments
118
+
119
+ | Tool | Description |
120
+ |---|---|
121
+ | `tebra_get_appointments` | Search appointments by date range, provider, or patient |
122
+ | `tebra_get_appointment_detail` | Get full appointment detail including reason, notes, and history |
123
+ | `tebra_create_appointment` | Create an appointment (requires provider, location, reason IDs) |
124
+ | `tebra_update_appointment` | Update, reschedule, or cancel an existing appointment |
125
+ | `tebra_delete_appointment` | Permanently delete an appointment |
126
+ | `tebra_get_appointment_reasons` | List configured appointment types/reasons for the practice |
127
+ | `tebra_create_appointment_reason` | Create a new appointment type/reason |
128
+
129
+ ### Encounters & Billing
130
+
131
+ | Tool | Description |
132
+ |---|---|
133
+ | `tebra_get_encounter` | Get encounter details with linked charges, diagnoses, and procedures |
134
+ | `tebra_create_encounter` | Create an encounter (superbill) with diagnoses and procedures |
135
+ | `tebra_update_encounter_status` | Workflow transitions: Draft -> Review -> Approved or Rejected |
136
+ | `tebra_get_charges` | Search charges with 20+ filters (date, patient, provider, status) |
137
+ | `tebra_get_payments` | Search payment records with date and patient filters |
138
+ | `tebra_create_payment` | Post a payment to a patient account |
139
+
140
+ ### Insurance & Authorizations
141
+
142
+ | Tool | Description |
143
+ |---|---|
144
+ | `tebra_get_patient_authorizations` | Get all authorizations with status, remaining visits, and CPT codes |
145
+ | `tebra_check_insurance_eligibility` | Check eligibility from on-file insurance data |
146
+
147
+ ### Practice Configuration
148
+
149
+ | Tool | Description |
150
+ |---|---|
151
+ | `tebra_get_providers` | List all providers with IDs, specialties, and NPI numbers |
152
+ | `tebra_get_service_locations` | List practice locations with addresses and contact info |
153
+ | `tebra_get_practices` | Get practice metadata (name, tax ID, billing info) |
154
+ | `tebra_get_procedure_codes` | Get procedure code catalog with descriptions and default fees |
155
+
156
+ ### Documents
157
+
158
+ | Tool | Description |
159
+ |---|---|
160
+ | `tebra_create_document` | Upload a document (PDF, image) to a patient's chart |
161
+ | `tebra_delete_document` | Remove a document from a patient's chart |
162
+
163
+ ### Financial Analysis
164
+
165
+ | Tool | Description |
166
+ |---|---|
167
+ | `tebra_get_transactions` | Get granular transaction data for financial reporting |
168
+
169
+ ### External Vendor & System
170
+
171
+ | Tool | Description |
172
+ |---|---|
173
+ | `tebra_validate_connection` | Health check -- verifies SOAP credentials and connectivity |
174
+ | `tebra_get_throttles` | Get current API rate limit status and remaining quota |
175
+ | `tebra_register_external_vendor` | Register an external vendor for ID linking |
176
+ | `tebra_get_external_vendors` | List registered external vendors |
177
+ | `tebra_update_patient_external_id` | Link an external system ID to a Tebra patient |
178
+ | `tebra_update_patient_case` | Update a patient's case details |
179
+
180
+ ### FHIR Clinical Data (requires FHIR credentials)
181
+
182
+ These tools access clinical data via the Tebra FHIR R4 API. They require separate FHIR credentials (see Environment Variables above). If FHIR credentials are not configured, these tools will not be registered.
79
183
 
80
184
  | Tool | Description |
81
185
  |---|---|
82
- | `tebra_search_patients` | Search patients by name, DOB, MRN, or external ID |
83
- | `tebra_get_patient` | Get full patient record with insurance and authorizations |
84
- | `tebra_get_patient_authorizations` | Get all authorizations across cases with status and remaining visits |
85
- | `tebra_get_encounter` | Get encounter details with linked charges and procedures |
86
- | `tebra_create_encounter` | Create a new encounter (superbill) with diagnoses and procedures |
87
- | `tebra_get_appointments` | Get appointments within a date range, optionally by provider |
88
- | `tebra_check_insurance_eligibility` | Check insurance eligibility based on on-file data |
89
- | `tebra_get_charges` | Get charges with payment status, filterable by date and patient |
90
- | `tebra_get_procedure_codes` | Get practice procedure codes with fees |
186
+ | `tebra_fhir_get_allergies` | Patient allergy and intolerance list |
187
+ | `tebra_fhir_get_medications` | Active and historical medication list |
188
+ | `tebra_fhir_get_conditions` | Problem list / active conditions |
189
+ | `tebra_fhir_get_vitals` | Recent vital signs (BP, HR, temp, weight, BMI) |
190
+ | `tebra_fhir_get_lab_results` | Lab results and observation values |
191
+ | `tebra_fhir_get_immunizations` | Vaccination records |
192
+ | `tebra_fhir_get_procedures` | Procedures performed |
193
+ | `tebra_fhir_get_care_plans` | Active care plans |
194
+ | `tebra_fhir_get_care_team` | Care team members and roles |
195
+ | `tebra_fhir_get_diagnostic_reports` | Diagnostic reports (radiology, pathology) |
196
+ | `tebra_fhir_get_documents` | Clinical documents (CDA, notes) |
197
+ | `tebra_fhir_get_devices` | Implantable devices (UDI data) |
198
+
199
+ ## Rate Limits
200
+
201
+ The Tebra SOAP API enforces per-endpoint rate limits. The server handles rate limiting with automatic retry and exponential backoff.
202
+
203
+ | Endpoint Category | Limit | Window |
204
+ |---|---|---|
205
+ | Patient read operations | 200 requests | per minute |
206
+ | Patient write operations | 50 requests | per minute |
207
+ | Appointment operations | 200 requests | per minute |
208
+ | Encounter operations | 100 requests | per minute |
209
+ | Financial operations | 100 requests | per minute |
210
+ | Document operations | 50 requests | per minute |
211
+ | FHIR operations | 100 requests | per minute |
212
+
213
+ Use `tebra_get_throttles` to check current rate limit status in real time.
214
+
215
+ ## Example Workflows
216
+
217
+ ### Scheduling Flow
218
+
219
+ ```
220
+ 1. tebra_get_providers -- Get provider IDs
221
+ 2. tebra_get_service_locations -- Get location IDs
222
+ 3. tebra_get_appointment_reasons -- Get reason/type IDs
223
+ 4. tebra_create_appointment -- Create with provider, location, reason IDs
224
+ 5. tebra_get_appointment_detail -- Verify creation
225
+ ```
226
+
227
+ ### Encounter Approval Flow
228
+
229
+ ```
230
+ 1. tebra_create_encounter -- Create superbill (status: Draft)
231
+ 2. tebra_update_encounter_status -- Move to Review
232
+ 3. tebra_update_encounter_status -- Move to Approved (triggers billing)
233
+ OR
234
+ 3. tebra_update_encounter_status -- Reject back to Draft with reason
235
+ ```
236
+
237
+ ### Payment Posting Flow
238
+
239
+ ```
240
+ 1. tebra_search_patients -- Find patient
241
+ 2. tebra_get_charges -- Find outstanding charges
242
+ 3. tebra_create_payment -- Post payment to patient account
243
+ 4. tebra_get_payments -- Verify payment posted
244
+ ```
245
+
246
+ ### Patient Onboarding (allure-md.com)
247
+
248
+ ```
249
+ 1. tebra_search_patients -- Check for existing patient
250
+ 2. tebra_create_patient -- Create if not found
251
+ 3. tebra_update_patient_external_id -- Link Supabase client ID
252
+ 4. tebra_create_appointment -- Schedule first visit
253
+ ```
254
+
255
+ ### Clinical Context for Note Creation (EPIC Notes)
256
+
257
+ ```
258
+ 1. tebra_get_appointments -- Get today's schedule
259
+ 2. tebra_get_appointment_detail -- Get appointment context
260
+ 3. tebra_get_patient -- Full patient demographics
261
+ 4. tebra_get_patient_authorizations -- Check auth status
262
+ 5. tebra_fhir_get_allergies -- Allergies
263
+ 6. tebra_fhir_get_medications -- Current medications
264
+ 7. tebra_fhir_get_conditions -- Problem list
265
+ 8. tebra_fhir_get_vitals -- Recent vitals
266
+ ```
267
+
268
+ ## Tool Dependency Chains
269
+
270
+ Some tools require IDs obtained from other tools. Key dependencies:
271
+
272
+ ```
273
+ tebra_create_appointment
274
+ requires: providerId (from tebra_get_providers)
275
+ requires: locationId (from tebra_get_service_locations)
276
+ requires: reasonId (from tebra_get_appointment_reasons)
277
+ optional: patientId (from tebra_search_patients or tebra_create_patient)
278
+
279
+ tebra_create_encounter
280
+ requires: patientId (from tebra_search_patients)
281
+ requires: providerId (from tebra_get_providers)
282
+ optional: authId (from tebra_get_patient_authorizations)
283
+
284
+ tebra_create_payment
285
+ requires: patientId (from tebra_search_patients)
286
+
287
+ tebra_update_encounter_status
288
+ requires: encounterId (from tebra_create_encounter or tebra_get_encounter)
289
+
290
+ tebra_create_document
291
+ requires: patientId (from tebra_search_patients)
292
+
293
+ tebra_update_patient_external_id
294
+ requires: patientId (from tebra_search_patients or tebra_create_patient)
295
+
296
+ All FHIR tools
297
+ require: patientId (from tebra_search_patients)
298
+ ```
299
+
300
+ ## Integration Services
301
+
302
+ Pre-built integration modules are available in `src/integrations/` for two projects:
303
+
304
+ - **`epic-notes-integration.ts`** -- Schedule pre-seeding, appointment context for note creation, signed note push-back to Tebra. Copy to your EPIC Notes project at `src/lib/services/tebra-integration.ts`.
305
+
306
+ - **`fal-integration.ts`** -- Patient sync from allure-md.com registration, Stripe payment posting, Supabase-to-Tebra ID linking. Copy to your FAL project at `src/lib/services/tebra-integration.ts`.
307
+
308
+ Both modules define an `McpToolCaller` interface and work with any MCP client implementation.
91
309
 
92
310
  ## API Reference
93
311
 
94
- The server wraps the Tebra/Kareo SOAP API v2.1:
312
+ The server wraps two Tebra APIs:
313
+
314
+ **SOAP API v2.1** (33 tools)
95
315
  - Endpoint: `https://webservice.kareo.com/services/soap/2.1/KareoServices.svc`
96
316
  - Auth: RequestHeader with User, Password, CustomerKey
97
- - All requests include retry with exponential backoff (3 attempts)
317
+ - All requests include retry with exponential backoff (3 attempts at 1s, 2s, 4s)
318
+
319
+ **FHIR R4 API** (12 tools)
320
+ - Endpoint: `https://fhir.kareo.com/r4` (configurable)
321
+ - Auth: OAuth2 client credentials flow
322
+ - Token caching with automatic refresh before expiry
98
323
 
99
324
  ## Development
100
325
 
101
326
  ```bash
327
+ git clone https://github.com/jamesrosing/tebra-mcp-server.git
328
+ cd tebra-mcp-server
329
+ npm install
102
330
  npm run dev # Uses tsx for direct TypeScript execution
103
331
  ```
332
+
333
+ ## License
334
+
335
+ MIT
package/dist/config.d.ts CHANGED
@@ -1,6 +1,18 @@
1
1
  /**
2
2
  * Configuration loader for the Tebra MCP server.
3
3
  * Validates required environment variables at startup.
4
+ *
5
+ * Required environment variables (SOAP API):
6
+ * TEBRA_SOAP_USER — SOAP API user (email)
7
+ * TEBRA_SOAP_PASSWORD — SOAP API password
8
+ * TEBRA_CUSTOMER_KEY — Customer key from Tebra PM admin
9
+ * TEBRA_SOAP_ENDPOINT — (optional) Override SOAP endpoint URL
10
+ *
11
+ * Optional environment variables (FHIR R4 API — enables clinical data tools):
12
+ * TEBRA_FHIR_CLIENT_ID — OAuth2 client ID from Tebra FHIR registration
13
+ * TEBRA_FHIR_CLIENT_SECRET — OAuth2 client secret
14
+ * TEBRA_FHIR_BASE_URL — (optional) FHIR API base URL (default: Tebra production)
15
+ * TEBRA_FHIR_TOKEN_URL — (optional) OAuth2 token endpoint (default: Tebra production)
4
16
  */
5
17
  export interface TebraConfig {
6
18
  user: string;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAKD;;;GAGG;AACH,wBAAgB,SAAS,IAAI,WAAW,CAuBvC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAKD;;;GAGG;AACH,wBAAgB,SAAS,IAAI,WAAW,CAuBvC"}
package/dist/config.js CHANGED
@@ -2,6 +2,18 @@
2
2
  /**
3
3
  * Configuration loader for the Tebra MCP server.
4
4
  * Validates required environment variables at startup.
5
+ *
6
+ * Required environment variables (SOAP API):
7
+ * TEBRA_SOAP_USER — SOAP API user (email)
8
+ * TEBRA_SOAP_PASSWORD — SOAP API password
9
+ * TEBRA_CUSTOMER_KEY — Customer key from Tebra PM admin
10
+ * TEBRA_SOAP_ENDPOINT — (optional) Override SOAP endpoint URL
11
+ *
12
+ * Optional environment variables (FHIR R4 API — enables clinical data tools):
13
+ * TEBRA_FHIR_CLIENT_ID — OAuth2 client ID from Tebra FHIR registration
14
+ * TEBRA_FHIR_CLIENT_SECRET — OAuth2 client secret
15
+ * TEBRA_FHIR_BASE_URL — (optional) FHIR API base URL (default: Tebra production)
16
+ * TEBRA_FHIR_TOKEN_URL — (optional) OAuth2 token endpoint (default: Tebra production)
5
17
  */
6
18
  Object.defineProperty(exports, "__esModule", { value: true });
7
19
  exports.getConfig = getConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AAgBH,8BAuBC;AA9BD,MAAM,mBAAmB,GACvB,kEAAkE,CAAC;AAErE;;;GAGG;AACH,SAAgB,SAAS;IACvB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;IACzC,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,CAAC;IACjD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,CAAC;IAEnD,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,CAAC,IAAI;QAAE,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IAC3C,IAAI,CAAC,QAAQ;QAAE,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACnD,IAAI,CAAC,WAAW;QAAE,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAErD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,2CAA2C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK;YAClE,4EAA4E,CAC7E,CAAC;IACJ,CAAC;IAED,OAAO;QACL,IAAI,EAAE,IAAK,CAAC,IAAI,EAAE;QAClB,QAAQ,EAAE,QAAS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-0,0 +1,22 @@
1
+ /**
2
+ * FHIR R4 client for the Tebra MCP server.
3
+ *
4
+ * Handles OAuth2 client_credentials flow for Tebra's FHIR API.
5
+ * Token caching with automatic refresh. Clean module with no side effects on import.
6
+ *
7
+ * Environment variables (all optional — FHIR tools only register when configured):
8
+ * TEBRA_FHIR_CLIENT_ID — OAuth2 client ID from Tebra FHIR registration
9
+ * TEBRA_FHIR_CLIENT_SECRET — OAuth2 client secret
10
+ * TEBRA_FHIR_BASE_URL — FHIR API base URL (default: Tebra production)
11
+ * TEBRA_FHIR_TOKEN_URL — OAuth2 token endpoint (default: Tebra production)
12
+ */
13
+ export interface FhirConfig {
14
+ clientId: string;
15
+ clientSecret: string;
16
+ baseUrl: string;
17
+ tokenUrl: string;
18
+ }
19
+ export declare function fhirRequest(config: FhirConfig, resource: string, params?: Record<string, string>): Promise<unknown>;
20
+ export declare function isFhirConfigured(): boolean;
21
+ export declare function getFhirConfig(): FhirConfig;
22
+ //# sourceMappingURL=fhir-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fhir-client.d.ts","sourceRoot":"","sources":["../src/fhir-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAqCD,wBAAsB,WAAW,CAC/B,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,OAAO,CAAC,OAAO,CAAC,CA2BlB;AAED,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED,wBAAgB,aAAa,IAAI,UAAU,CAc1C"}
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ /**
3
+ * FHIR R4 client for the Tebra MCP server.
4
+ *
5
+ * Handles OAuth2 client_credentials flow for Tebra's FHIR API.
6
+ * Token caching with automatic refresh. Clean module with no side effects on import.
7
+ *
8
+ * Environment variables (all optional — FHIR tools only register when configured):
9
+ * TEBRA_FHIR_CLIENT_ID — OAuth2 client ID from Tebra FHIR registration
10
+ * TEBRA_FHIR_CLIENT_SECRET — OAuth2 client secret
11
+ * TEBRA_FHIR_BASE_URL — FHIR API base URL (default: Tebra production)
12
+ * TEBRA_FHIR_TOKEN_URL — OAuth2 token endpoint (default: Tebra production)
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.fhirRequest = fhirRequest;
16
+ exports.isFhirConfigured = isFhirConfigured;
17
+ exports.getFhirConfig = getFhirConfig;
18
+ // Token cache
19
+ let cachedToken = null;
20
+ async function getAccessToken(config) {
21
+ // Check cache (with 60s buffer before expiry)
22
+ if (cachedToken && Date.now() < cachedToken.expiresAt - 60_000) {
23
+ return cachedToken.accessToken;
24
+ }
25
+ const response = await fetch(config.tokenUrl, {
26
+ method: 'POST',
27
+ headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
28
+ body: new URLSearchParams({
29
+ grant_type: 'client_credentials',
30
+ client_id: config.clientId,
31
+ client_secret: config.clientSecret,
32
+ scope: 'system/*.read',
33
+ }),
34
+ });
35
+ if (!response.ok) {
36
+ const text = await response.text();
37
+ throw new Error(`FHIR token request failed (${response.status}): ${text}`);
38
+ }
39
+ const data = await response.json();
40
+ cachedToken = {
41
+ accessToken: data.access_token,
42
+ expiresAt: Date.now() + data.expires_in * 1000,
43
+ };
44
+ return cachedToken.accessToken;
45
+ }
46
+ async function fhirRequest(config, resource, params) {
47
+ const token = await getAccessToken(config);
48
+ const url = new URL(`${config.baseUrl}/${resource}`);
49
+ if (params) {
50
+ for (const [k, v] of Object.entries(params)) {
51
+ url.searchParams.set(k, v);
52
+ }
53
+ }
54
+ const response = await fetch(url.toString(), {
55
+ headers: {
56
+ Authorization: `Bearer ${token}`,
57
+ Accept: 'application/fhir+json',
58
+ },
59
+ });
60
+ if (response.status === 401) {
61
+ cachedToken = null;
62
+ throw new Error('FHIR authentication expired — token cleared, retry will re-authenticate');
63
+ }
64
+ if (!response.ok) {
65
+ const text = await response.text();
66
+ throw new Error(`FHIR ${resource} request failed (${response.status}): ${text}`);
67
+ }
68
+ return response.json();
69
+ }
70
+ function isFhirConfigured() {
71
+ return !!(process.env.TEBRA_FHIR_CLIENT_ID && process.env.TEBRA_FHIR_CLIENT_SECRET);
72
+ }
73
+ function getFhirConfig() {
74
+ const clientId = process.env.TEBRA_FHIR_CLIENT_ID;
75
+ const clientSecret = process.env.TEBRA_FHIR_CLIENT_SECRET;
76
+ if (!clientId || !clientSecret) {
77
+ throw new Error('FHIR credentials not configured. Set TEBRA_FHIR_CLIENT_ID and TEBRA_FHIR_CLIENT_SECRET.');
78
+ }
79
+ return {
80
+ clientId,
81
+ clientSecret,
82
+ baseUrl: process.env.TEBRA_FHIR_BASE_URL?.trim() ?? 'https://fhir.prd.cloud.tebra.com/fhir/request',
83
+ tokenUrl: process.env.TEBRA_FHIR_TOKEN_URL?.trim() ?? 'https://fhir.prd.cloud.tebra.com/smartauth/oauth/token',
84
+ };
85
+ }
86
+ //# sourceMappingURL=fhir-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fhir-client.js","sourceRoot":"","sources":["../src/fhir-client.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AA4CH,kCA+BC;AAED,4CAEC;AAED,sCAcC;AAtFD,cAAc;AACd,IAAI,WAAW,GAAsD,IAAI,CAAC;AAE1E,KAAK,UAAU,cAAc,CAAC,MAAkB;IAC9C,8CAA8C;IAC9C,IAAI,WAAW,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,WAAW,CAAC,SAAS,GAAG,MAAM,EAAE,CAAC;QAC/D,OAAO,WAAW,CAAC,WAAW,CAAC;IACjC,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,QAAQ,E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6 +10,10 @@
10
10
  * TEBRA_SOAP_PASSWORD — SOAP API password
11
11
  * TEBRA_CUSTOMER_KEY — Customer key from Tebra PM admin
12
12
  *
13
+ * Optional FHIR (clinical data):
14
+ * TEBRA_FHIR_CLIENT_ID — FHIR OAuth2 client ID
15
+ * TEBRA_FHIR_CLIENT_SECRET — FHIR OAuth2 client secret
16
+ *
13
17
  * Usage:
14
18
  * npx @allure-md/tebra-mcp-server
15
19
  * TEBRA_SOAP_USER=... TEBRA_SOAP_PASSWORD=... TEBRA_CUSTOMER_KEY=... node dist/index.js
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;GAcG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;GAkBG"}