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.
- package/LICENSE +21 -21
- package/README.md +267 -35
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -1
- package/dist/fhir-client.d.ts +22 -0
- package/dist/fhir-client.d.ts.map +1 -0
- package/dist/fhir-client.js +86 -0
- package/dist/fhir-client.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +98 -6
- package/dist/index.js.map +1 -1
- package/dist/integrations/epic-notes-integration.d.ts +145 -0
- package/dist/integrations/epic-notes-integration.d.ts.map +1 -0
- package/dist/integrations/epic-notes-integration.js +227 -0
- package/dist/integrations/epic-notes-integration.js.map +1 -0
- package/dist/integrations/fal-integration.d.ts +109 -0
- package/dist/integrations/fal-integration.d.ts.map +1 -0
- package/dist/integrations/fal-integration.js +192 -0
- package/dist/integrations/fal-integration.js.map +1 -0
- package/dist/soap-client.d.ts +1 -0
- package/dist/soap-client.d.ts.map +1 -1
- package/dist/soap-client.js +68 -1
- package/dist/soap-client.js.map +1 -1
- package/dist/tools/appointment-crud.d.ts +117 -0
- package/dist/tools/appointment-crud.d.ts.map +1 -0
- package/dist/tools/appointment-crud.js +218 -0
- package/dist/tools/appointment-crud.js.map +1 -0
- package/dist/tools/appointment-detail.d.ts +25 -0
- package/dist/tools/appointment-detail.d.ts.map +1 -0
- package/dist/tools/appointment-detail.js +85 -0
- package/dist/tools/appointment-detail.js.map +1 -0
- package/dist/tools/appointment-reasons.d.ts +20 -0
- package/dist/tools/appointment-reasons.d.ts.map +1 -0
- package/dist/tools/appointment-reasons.js +48 -0
- package/dist/tools/appointment-reasons.js.map +1 -0
- package/dist/tools/appointments.d.ts +46 -0
- package/dist/tools/appointments.d.ts.map +1 -1
- package/dist/tools/appointments.js +71 -4
- package/dist/tools/appointments.js.map +1 -1
- package/dist/tools/authorizations.js +5 -5
- package/dist/tools/bulk-patients.d.ts +33 -0
- package/dist/tools/bulk-patients.d.ts.map +1 -0
- package/dist/tools/bulk-patients.js +81 -0
- package/dist/tools/bulk-patients.js.map +1 -0
- package/dist/tools/charges.d.ts +61 -0
- package/dist/tools/charges.d.ts.map +1 -1
- package/dist/tools/charges.js +98 -14
- package/dist/tools/charges.js.map +1 -1
- package/dist/tools/documents.d.ts +71 -0
- package/dist/tools/documents.d.ts.map +1 -0
- package/dist/tools/documents.js +139 -0
- package/dist/tools/documents.js.map +1 -0
- package/dist/tools/eligibility.js +5 -5
- package/dist/tools/encounter-status.d.ts +34 -0
- package/dist/tools/encounter-status.d.ts.map +1 -0
- package/dist/tools/encounter-status.js +73 -0
- package/dist/tools/encounter-status.js.map +1 -0
- package/dist/tools/encounters.js +29 -29
- package/dist/tools/external-ids.d.ts +66 -0
- package/dist/tools/external-ids.d.ts.map +1 -0
- package/dist/tools/external-ids.js +140 -0
- package/dist/tools/external-ids.js.map +1 -0
- package/dist/tools/fhir-clinical.d.ts +187 -0
- package/dist/tools/fhir-clinical.d.ts.map +1 -0
- package/dist/tools/fhir-clinical.js +597 -0
- package/dist/tools/fhir-clinical.js.map +1 -0
- package/dist/tools/patient-crud.d.ts +190 -0
- package/dist/tools/patient-crud.d.ts.map +1 -0
- package/dist/tools/patient-crud.js +297 -0
- package/dist/tools/patient-crud.js.map +1 -0
- package/dist/tools/patients.d.ts +87 -1
- package/dist/tools/patients.d.ts.map +1 -1
- package/dist/tools/patients.js +108 -8
- package/dist/tools/patients.js.map +1 -1
- package/dist/tools/payments.d.ts +105 -0
- package/dist/tools/payments.d.ts.map +1 -0
- package/dist/tools/payments.js +206 -0
- package/dist/tools/payments.js.map +1 -0
- package/dist/tools/practices.d.ts +20 -0
- package/dist/tools/practices.d.ts.map +1 -0
- package/dist/tools/practices.js +54 -0
- package/dist/tools/practices.js.map +1 -0
- package/dist/tools/procedure-codes.js +5 -5
- package/dist/tools/providers.d.ts +25 -0
- package/dist/tools/providers.d.ts.map +1 -0
- package/dist/tools/providers.js +62 -0
- package/dist/tools/providers.js.map +1 -0
- package/dist/tools/service-locations.d.ts +25 -0
- package/dist/tools/service-locations.d.ts.map +1 -0
- package/dist/tools/service-locations.js +62 -0
- package/dist/tools/service-locations.js.map +1 -0
- package/dist/tools/system.d.ts +81 -0
- package/dist/tools/system.d.ts.map +1 -0
- package/dist/tools/system.js +184 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/tools/transactions.d.ts +61 -0
- package/dist/tools/transactions.d.ts.map +1 -0
- package/dist/tools/transactions.js +122 -0
- package/dist/tools/transactions.js.map +1 -0
- package/package.json +60 -54
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tebra MCP Integration Service for FAL (allure-md.com)
|
|
3
|
+
*
|
|
4
|
+
* Wraps Tebra MCP tool calls for FAL use cases:
|
|
5
|
+
* - Syncing new patients from allure-md.com registration to Tebra
|
|
6
|
+
* - Posting payments to Tebra after Stripe payment succeeds
|
|
7
|
+
* - Linking Supabase client IDs to Tebra patient IDs
|
|
8
|
+
*
|
|
9
|
+
* DEPLOYMENT: Copy this file to your FAL project:
|
|
10
|
+
* /src/lib/services/tebra-integration.ts
|
|
11
|
+
* (or wherever services live in the FAL project)
|
|
12
|
+
*
|
|
13
|
+
* This module communicates with the Tebra MCP server via an McpToolCaller
|
|
14
|
+
* interface. Wire it to @modelcontextprotocol/sdk/client or any MCP-compatible
|
|
15
|
+
* transport.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* New client registration data from allure-md.com.
|
|
19
|
+
* Maps to Supabase client record fields.
|
|
20
|
+
*/
|
|
21
|
+
export interface NewClient {
|
|
22
|
+
firstName: string;
|
|
23
|
+
lastName: string;
|
|
24
|
+
dateOfBirth: string;
|
|
25
|
+
email: string;
|
|
26
|
+
phone: string;
|
|
27
|
+
gender?: 'Male' | 'Female' | 'Other';
|
|
28
|
+
address?: {
|
|
29
|
+
street1: string;
|
|
30
|
+
street2?: string;
|
|
31
|
+
city: string;
|
|
32
|
+
state: string;
|
|
33
|
+
zip: string;
|
|
34
|
+
};
|
|
35
|
+
supabaseClientId: string;
|
|
36
|
+
/** Optional: if known at registration time */
|
|
37
|
+
primaryProviderId?: string;
|
|
38
|
+
/** Optional: default service location */
|
|
39
|
+
serviceLocationId?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Payment record from Stripe webhook or checkout completion.
|
|
43
|
+
*/
|
|
44
|
+
export interface PaymentRecord {
|
|
45
|
+
/** Tebra patient ID (resolved from Supabase client ID) */
|
|
46
|
+
tebraPatientId: string;
|
|
47
|
+
/** Payment amount in dollars (e.g., 150.00) */
|
|
48
|
+
amount: number;
|
|
49
|
+
/** Date of payment (ISO 8601) */
|
|
50
|
+
paymentDate: string;
|
|
51
|
+
/** Stripe payment intent or charge ID for reference */
|
|
52
|
+
stripePaymentId: string;
|
|
53
|
+
/** Payment method description */
|
|
54
|
+
paymentMethod: 'Credit Card' | 'Debit Card' | 'Other';
|
|
55
|
+
/** Optional: service date the payment applies to */
|
|
56
|
+
serviceDate?: string;
|
|
57
|
+
/** Optional: Tebra provider ID */
|
|
58
|
+
providerId?: string;
|
|
59
|
+
/** Optional: specific charge ID to apply payment to */
|
|
60
|
+
chargeId?: string;
|
|
61
|
+
/** Optional: description/memo */
|
|
62
|
+
description?: string;
|
|
63
|
+
}
|
|
64
|
+
export interface McpToolCaller {
|
|
65
|
+
callTool(name: string, args: Record<string, unknown>): Promise<McpToolResult>;
|
|
66
|
+
}
|
|
67
|
+
export interface McpToolResult {
|
|
68
|
+
content: Array<{
|
|
69
|
+
type: string;
|
|
70
|
+
text: string;
|
|
71
|
+
}>;
|
|
72
|
+
isError?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Sync a new client from allure-md.com registration to Tebra.
|
|
76
|
+
*
|
|
77
|
+
* Flow:
|
|
78
|
+
* 1. Check if patient already exists in Tebra (by name + DOB)
|
|
79
|
+
* 2. If not found, create the patient
|
|
80
|
+
* 3. Link the Supabase client ID as an external ID on the Tebra patient
|
|
81
|
+
* 4. Return the Tebra patient ID
|
|
82
|
+
*
|
|
83
|
+
* @param mcp - MCP tool caller instance
|
|
84
|
+
* @param client - New client registration data from Supabase
|
|
85
|
+
* @returns Tebra patient ID (existing or newly created)
|
|
86
|
+
*/
|
|
87
|
+
export declare function syncNewPatientToTebra(mcp: McpToolCaller, client: NewClient): Promise<string>;
|
|
88
|
+
/**
|
|
89
|
+
* Post a payment to Tebra after a Stripe payment succeeds.
|
|
90
|
+
*
|
|
91
|
+
* Called from a Stripe webhook handler or after checkout completion.
|
|
92
|
+
* Maps the Stripe payment to a Tebra payment record.
|
|
93
|
+
*
|
|
94
|
+
* @param mcp - MCP tool caller instance
|
|
95
|
+
* @param payment - Payment details from Stripe
|
|
96
|
+
*/
|
|
97
|
+
export declare function postPaymentToTebra(mcp: McpToolCaller, payment: PaymentRecord): Promise<void>;
|
|
98
|
+
/**
|
|
99
|
+
* Link a Supabase client ID to a Tebra patient ID via the external ID system.
|
|
100
|
+
*
|
|
101
|
+
* Uses the tebra_update_patient_external_id tool to store the mapping.
|
|
102
|
+
* This enables bidirectional lookup between systems.
|
|
103
|
+
*
|
|
104
|
+
* @param mcp - MCP tool caller instance
|
|
105
|
+
* @param tebraPatientId - Tebra patient ID
|
|
106
|
+
* @param supabaseClientId - Supabase client UUID
|
|
107
|
+
*/
|
|
108
|
+
export declare function linkExternalId(mcp: McpToolCaller, tebraPatientId: string, supabaseClientId: string): Promise<void>;
|
|
109
|
+
//# sourceMappingURL=fal-integration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fal-integration.d.ts","sourceRoot":"","sources":["../../src/integrations/fal-integration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAgBH;;;GAGG;AACH,MAAM,WAAW,SAA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OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAiBD;;;;;;;;;;;;GAYG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,SAAS,GAChB,OAAO,CAAC,MAAM,CAAC,CAgDjB;AAED;;;;;;;;GAQG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,aAAa,GACrB,OAAO,CAAC,IAAI,CAAC,CA8Bf;AAED;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,aAAa,EAClB,cAAc,EAAE,MAAM,EACtB,gBAAgB,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Tebra MCP Integration Service for FAL (allure-md.com)
|
|
4
|
+
*
|
|
5
|
+
* Wraps Tebra MCP tool calls for FAL use cases:
|
|
6
|
+
* - Syncing new patients from allure-md.com registration to Tebra
|
|
7
|
+
* - Posting payments to Tebra after Stripe payment succeeds
|
|
8
|
+
* - Linking Supabase client IDs to Tebra patient IDs
|
|
9
|
+
*
|
|
10
|
+
* DEPLOYMENT: Copy this file to your FAL project:
|
|
11
|
+
* /src/lib/services/tebra-integration.ts
|
|
12
|
+
* (or wherever services live in the FAL project)
|
|
13
|
+
*
|
|
14
|
+
* This module communicates with the Tebra MCP server via an McpToolCaller
|
|
15
|
+
* interface. Wire it to @modelcontextprotocol/sdk/client or any MCP-compatible
|
|
16
|
+
* transport.
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.syncNewPatientToTebra = syncNewPatientToTebra;
|
|
20
|
+
exports.postPaymentToTebra = postPaymentToTebra;
|
|
21
|
+
exports.linkExternalId = linkExternalId;
|
|
22
|
+
// ─── MCP Tool Name Constants ────────────────────────────────────
|
|
23
|
+
const TOOL = {
|
|
24
|
+
CREATE_PATIENT: 'tebra_create_patient',
|
|
25
|
+
SEARCH_PATIENTS: 'tebra_search_patients',
|
|
26
|
+
UPDATE_PATIENT: 'tebra_update_patient',
|
|
27
|
+
UPDATE_PATIENT_EXTERNAL_ID: 'tebra_update_patient_external_id',
|
|
28
|
+
CREATE_PAYMENT: 'tebra_create_payment',
|
|
29
|
+
GET_PROVIDERS: 'tebra_get_providers',
|
|
30
|
+
GET_SERVICE_LOCATIONS: 'tebra_get_service_locations',
|
|
31
|
+
};
|
|
32
|
+
function parseToolResult(result) {
|
|
33
|
+
if (result.isError) {
|
|
34
|
+
const errorText = result.content[0]?.text ?? 'Unknown MCP tool error';
|
|
35
|
+
throw new Error(errorText);
|
|
36
|
+
}
|
|
37
|
+
const text = result.content[0]?.text ?? '{}';
|
|
38
|
+
try {
|
|
39
|
+
return JSON.parse(text);
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
throw new Error(`Unexpected non-JSON response from MCP tool: ${text}`);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
// ─── Service Functions ──────────────────────────────────────────
|
|
46
|
+
/**
|
|
47
|
+
* Sync a new client from allure-md.com registration to Tebra.
|
|
48
|
+
*
|
|
49
|
+
* Flow:
|
|
50
|
+
* 1. Check if patient already exists in Tebra (by name + DOB)
|
|
51
|
+
* 2. If not found, create the patient
|
|
52
|
+
* 3. Link the Supabase client ID as an external ID on the Tebra patient
|
|
53
|
+
* 4. Return the Tebra patient ID
|
|
54
|
+
*
|
|
55
|
+
* @param mcp - MCP tool caller instance
|
|
56
|
+
* @param client - New client registration data from Supabase
|
|
57
|
+
* @returns Tebra patient ID (existing or newly created)
|
|
58
|
+
*/
|
|
59
|
+
async function syncNewPatientToTebra(mcp, client) {
|
|
60
|
+
// Step 1: Check for existing patient to avoid duplicates
|
|
61
|
+
const existingId = await findExistingPatient(mcp, client);
|
|
62
|
+
if (existingId) {
|
|
63
|
+
// Patient already exists -- link external ID and return
|
|
64
|
+
await linkExternalId(mcp, existingId, client.supabaseClientId);
|
|
65
|
+
return existingId;
|
|
66
|
+
}
|
|
67
|
+
// Step 2: Create the patient in Tebra
|
|
68
|
+
const createArgs = {
|
|
69
|
+
firstName: client.firstName,
|
|
70
|
+
lastName: client.lastName,
|
|
71
|
+
dateOfBirth: client.dateOfBirth,
|
|
72
|
+
emailAddress: client.email,
|
|
73
|
+
homePhone: client.phone,
|
|
74
|
+
};
|
|
75
|
+
if (client.gender) {
|
|
76
|
+
createArgs.gender = client.gender;
|
|
77
|
+
}
|
|
78
|
+
if (client.address) {
|
|
79
|
+
createArgs.addressLine1 = client.address.street1;
|
|
80
|
+
if (client.address.street2) {
|
|
81
|
+
createArgs.addressLine2 = client.address.street2;
|
|
82
|
+
}
|
|
83
|
+
createArgs.city = client.address.city;
|
|
84
|
+
createArgs.state = client.address.state;
|
|
85
|
+
createArgs.zipCode = client.address.zip;
|
|
86
|
+
}
|
|
87
|
+
if (client.primaryProviderId) {
|
|
88
|
+
createArgs.primaryProviderId = client.primaryProviderId;
|
|
89
|
+
}
|
|
90
|
+
if (client.serviceLocationId) {
|
|
91
|
+
createArgs.serviceLocationId = client.serviceLocationId;
|
|
92
|
+
}
|
|
93
|
+
const result = await mcp.callTool(TOOL.CREATE_PATIENT, createArgs);
|
|
94
|
+
const created = parseToolResult(result);
|
|
95
|
+
if (!created.patientId) {
|
|
96
|
+
throw new Error('Tebra patient creation returned no patientId');
|
|
97
|
+
}
|
|
98
|
+
// Step 3: Link Supabase client ID as external ID
|
|
99
|
+
await linkExternalId(mcp, created.patientId, client.supabaseClientId);
|
|
100
|
+
return created.patientId;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Post a payment to Tebra after a Stripe payment succeeds.
|
|
104
|
+
*
|
|
105
|
+
* Called from a Stripe webhook handler or after checkout completion.
|
|
106
|
+
* Maps the Stripe payment to a Tebra payment record.
|
|
107
|
+
*
|
|
108
|
+
* @param mcp - MCP tool caller instance
|
|
109
|
+
* @param payment - Payment details from Stripe
|
|
110
|
+
*/
|
|
111
|
+
async function postPaymentToTebra(mcp, payment) {
|
|
112
|
+
const args = {
|
|
113
|
+
patientId: payment.tebraPatientId,
|
|
114
|
+
amount: payment.amount,
|
|
115
|
+
paymentDate: payment.paymentDate,
|
|
116
|
+
paymentMethod: payment.paymentMethod,
|
|
117
|
+
referenceNumber: payment.stripePaymentId,
|
|
118
|
+
};
|
|
119
|
+
if (payment.serviceDate) {
|
|
120
|
+
args.serviceDate = payment.serviceDate;
|
|
121
|
+
}
|
|
122
|
+
if (payment.providerId) {
|
|
123
|
+
args.providerId = payment.providerId;
|
|
124
|
+
}
|
|
125
|
+
if (payment.chargeId) {
|
|
126
|
+
args.chargeId = payment.chargeId;
|
|
127
|
+
}
|
|
128
|
+
if (payment.description) {
|
|
129
|
+
args.description = payment.description ?? `Stripe payment ${payment.stripePaymentId}`;
|
|
130
|
+
}
|
|
131
|
+
const result = await mcp.callTool(TOOL.CREATE_PAYMENT, args);
|
|
132
|
+
const parsed = parseToolResult(result);
|
|
133
|
+
if (!parsed.paymentId) {
|
|
134
|
+
throw new Error(`Payment posting to Tebra failed for Stripe payment ${payment.stripePaymentId}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Link a Supabase client ID to a Tebra patient ID via the external ID system.
|
|
139
|
+
*
|
|
140
|
+
* Uses the tebra_update_patient_external_id tool to store the mapping.
|
|
141
|
+
* This enables bidirectional lookup between systems.
|
|
142
|
+
*
|
|
143
|
+
* @param mcp - MCP tool caller instance
|
|
144
|
+
* @param tebraPatientId - Tebra patient ID
|
|
145
|
+
* @param supabaseClientId - Supabase client UUID
|
|
146
|
+
*/
|
|
147
|
+
async function linkExternalId(mcp, tebraPatientId, supabaseClientId) {
|
|
148
|
+
await mcp.callTool(TOOL.UPDATE_PATIENT_EXTERNAL_ID, {
|
|
149
|
+
patientId: tebraPatientId,
|
|
150
|
+
externalId: supabaseClientId,
|
|
151
|
+
externalVendorName: 'allure-md-supabase',
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
// ─── Internal Helpers ───────────────────────────────────────────
|
|
155
|
+
/**
|
|
156
|
+
* Search for an existing patient in Tebra by name.
|
|
157
|
+
* Returns the patient ID if a match is found with matching DOB, null otherwise.
|
|
158
|
+
*/
|
|
159
|
+
async function findExistingPatient(mcp, client) {
|
|
160
|
+
try {
|
|
161
|
+
const searchQuery = `${client.lastName}, ${client.firstName}`;
|
|
162
|
+
const result = await mcp.callTool(TOOL.SEARCH_PATIENTS, { query: searchQuery });
|
|
163
|
+
const text = result.content[0]?.text ?? '';
|
|
164
|
+
// Handle "No patients found" response
|
|
165
|
+
if (text.startsWith('No patients')) {
|
|
166
|
+
return null;
|
|
167
|
+
}
|
|
168
|
+
const patients = parseToolResult(result);
|
|
169
|
+
// Match by name AND DOB to avoid false positives
|
|
170
|
+
const match = patients.find((p) => p.firstName.toLowerCase() === client.firstName.toLowerCase() &&
|
|
171
|
+
p.lastName.toLowerCase() === client.lastName.toLowerCase() &&
|
|
172
|
+
normalizeDateString(p.dateOfBirth) === normalizeDateString(client.dateOfBirth));
|
|
173
|
+
return match?.patientId ?? null;
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
// Search failed -- safer to create a new patient than to skip
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Normalize a date string to YYYY-MM-DD for comparison.
|
|
182
|
+
*/
|
|
183
|
+
function normalizeDateString(dateStr) {
|
|
184
|
+
try {
|
|
185
|
+
const d = new Date(dateStr);
|
|
186
|
+
return d.toISOString().split('T')[0];
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return dateStr;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
//# sourceMappingURL=fal-integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fal-integration.js","sourceRoot":"","sources":["../../src/integrations/fal-integration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;GAeG;;AAyHH,sDAmDC;AAWD,gDAiCC;AAYD,wCAUC;AA5OD,mEAAmE;AAEnE,MAAM,IAAI,GAAG;IACX,cAAc,EAAE,sBAAsB;IACtC,eAAe,EAAE,uBAAuB;IACxC,cAAc,EAAE,sBAAsB;IACtC,0BAA0B,EAAE,kCAAkC;IAC9D,cAAc,EAAE,sBAAsB;IACtC,aAAa,EAAE,qBAAqB;IACpC,qBAAqB,EAAE,6BAA6B;CAC5C,CAAC;AAiFX,SAAS,eAAe,CAAI,MAAqB;IAC/C,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;QACnB,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,wBAAwB,CAAC;QACtE,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,IAAI,CAAC;IAC7C,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,+CAA+C,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC;AACH,CAAC;AAED,mEAAmE;AAEnE;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,qBAAqB,CACzC,GAAkB,EAClB,MAAiB;IAEjB,yDAAyD;IACzD,MAAM,UAAU,GAAG,MAAM,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IAC1D,IAAI,UAAU,EAAE,CAAC;QACf,wDAAwD;QACxD,MAAM,cAAc,CAAC,GAAG,EAAE,UAAU,EAAE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AAW,CAAC,KAAK,mBAAmB,CAAC,MAAM,CAAC,WAAW,CAAC,CACjF,CAAC;QAEF,OAAO,KAAK,EAAE,SAAS,IAAI,IAAI,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,8DAA8D;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,mBAAmB,CAAC,OAAe;IAC1C,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,OAAO,CAAC;IACjB,CAAC;AACH,CAAC"}
|
package/dist/soap-client.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Standalone version (no Next.js dependencies).
|
|
5
5
|
* Builds SOAP XML envelopes, sends via fetch, parses responses.
|
|
6
|
+
* Per-endpoint rate limiting from Tebra API Technical Guide.
|
|
6
7
|
* Retry with exponential backoff: 3 attempts at 1s, 2s, 4s.
|
|
7
8
|
*/
|
|
8
9
|
import type { TebraConfig } from './config.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soap-client.d.ts","sourceRoot":"","sources":["../src/soap-client.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"soap-client.d.ts","sourceRoot":"","sources":["../src/soap-client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AA0C/C,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAO7C;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAO/D;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAMrE;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAIlE;AAuED,wBAAsB,WAAW,CAC/B,MAAM,EAAE,WAAW,EACnB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CA2DjB"}
|
package/dist/soap-client.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Standalone version (no Next.js dependencies).
|
|
6
6
|
* Builds SOAP XML envelopes, sends via fetch, parses responses.
|
|
7
|
+
* Per-endpoint rate limiting from Tebra API Technical Guide.
|
|
7
8
|
* Retry with exponential backoff: 3 attempts at 1s, 2s, 4s.
|
|
8
9
|
*/
|
|
9
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -16,6 +17,35 @@ exports.soapRequest = soapRequest;
|
|
|
16
17
|
const MAX_RETRIES = 3;
|
|
17
18
|
const BASE_DELAY_MS = 1000;
|
|
18
19
|
const SOAP_NAMESPACE = 'http://www.kareo.com/api/schemas/';
|
|
20
|
+
// ─── Per-Endpoint Rate Limits (ms) from Tebra API Technical Guide ──
|
|
21
|
+
const ENDPOINT_RATE_LIMITS = {
|
|
22
|
+
GetAllPatients: 5000,
|
|
23
|
+
GetAppointment: 500,
|
|
24
|
+
GetAppointments: 1000,
|
|
25
|
+
GetAppointmentReasons: 1000,
|
|
26
|
+
GetCharges: 1000,
|
|
27
|
+
GetEncounterDetails: 500,
|
|
28
|
+
GetExternalVendors: 1000,
|
|
29
|
+
GetPatient: 250,
|
|
30
|
+
GetPatients: 1000,
|
|
31
|
+
GetPayments: 1000,
|
|
32
|
+
GetPractices: 500,
|
|
33
|
+
GetProcedureCodes: 500,
|
|
34
|
+
GetProviders: 500,
|
|
35
|
+
GetServiceLocations: 500,
|
|
36
|
+
GetThrottles: 5000,
|
|
37
|
+
GetTransactions: 1000,
|
|
38
|
+
CreateAppointment: 500,
|
|
39
|
+
CreateEncounter: 500,
|
|
40
|
+
CreatePatient: 500,
|
|
41
|
+
CreatePayments: 500,
|
|
42
|
+
UpdateAppointment: 500,
|
|
43
|
+
UpdateEncounterStatus: 500,
|
|
44
|
+
UpdatePatient: 1000,
|
|
45
|
+
DeleteAppointment: 500,
|
|
46
|
+
};
|
|
47
|
+
// Track last call time per endpoint
|
|
48
|
+
const lastCallTimestamps = {};
|
|
19
49
|
// ─── XML Helpers ────────────────────────────────────────────────
|
|
20
50
|
function escapeXml(str) {
|
|
21
51
|
return str
|
|
@@ -58,16 +88,51 @@ function buildEnvelope(config, action, bodyXml) {
|
|
|
58
88
|
</soap:Body>
|
|
59
89
|
</soap:Envelope>`;
|
|
60
90
|
}
|
|
61
|
-
// ───
|
|
91
|
+
// ─── SecurityResponse Check ─────────────────────────────────────
|
|
92
|
+
function checkSecurityResponse(responseXml, action) {
|
|
93
|
+
const securityBlock = extractTag(responseXml, 'SecurityResponse');
|
|
94
|
+
if (!securityBlock)
|
|
95
|
+
return; // Some responses may not include it
|
|
96
|
+
const authenticated = extractTag(securityBlock, 'Authenticated');
|
|
97
|
+
if (authenticated && authenticated.toLowerCase() === 'false') {
|
|
98
|
+
throw new Error(`Tebra authentication failed for ${action}. Check TEBRA_SOAP_USER and TEBRA_SOAP_PASSWORD.`);
|
|
99
|
+
}
|
|
100
|
+
const authorized = extractTag(securityBlock, 'Authorized');
|
|
101
|
+
if (authorized && authorized.toLowerCase() === 'false') {
|
|
102
|
+
const missing = extractTag(securityBlock, 'PermissionsMissing');
|
|
103
|
+
throw new Error(`Tebra authorization failed for ${action}. Missing permissions: ${missing || 'unknown'}. ` +
|
|
104
|
+
'Contact your Tebra administrator to grant API permissions.');
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// ─── SOAP Request with Rate Limiting & Retry ────────────────────
|
|
62
108
|
function sleep(ms) {
|
|
63
109
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
64
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* Enforce per-endpoint rate limiting before making a request.
|
|
113
|
+
* Waits if the minimum interval since the last call hasn't elapsed.
|
|
114
|
+
*/
|
|
115
|
+
async function enforceRateLimit(action) {
|
|
116
|
+
const minInterval = ENDPOINT_RATE_LIMITS[action];
|
|
117
|
+
if (!minInterval)
|
|
118
|
+
return; // Unknown endpoint — no rate limit enforced
|
|
119
|
+
const lastCall = lastCallTimestamps[action];
|
|
120
|
+
if (lastCall) {
|
|
121
|
+
const elapsed = Date.now() - lastCall;
|
|
122
|
+
if (elapsed < minInterval) {
|
|
123
|
+
await sleep(minInterval - elapsed);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
lastCallTimestamps[action] = Date.now();
|
|
127
|
+
}
|
|
65
128
|
async function soapRequest(config, action, bodyXml) {
|
|
66
129
|
const soapAction = `${SOAP_NAMESPACE}${action}`;
|
|
67
130
|
const envelope = buildEnvelope(config, action, bodyXml);
|
|
68
131
|
let lastError = null;
|
|
69
132
|
for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
|
|
70
133
|
try {
|
|
134
|
+
// Pre-emptive rate limiting
|
|
135
|
+
await enforceRateLimit(action);
|
|
71
136
|
const response = await fetch(config.endpoint, {
|
|
72
137
|
method: 'POST',
|
|
73
138
|
headers: {
|
|
@@ -93,6 +158,8 @@ async function soapRequest(config, action, bodyXml) {
|
|
|
93
158
|
throw new Error(`Tebra ${action} error: ${errorMsg || 'Unknown error'}`);
|
|
94
159
|
}
|
|
95
160
|
}
|
|
161
|
+
// Check SecurityResponse for auth/permission failures
|
|
162
|
+
checkSecurityResponse(responseText, action);
|
|
96
163
|
return responseText;
|
|
97
164
|
}
|
|
98
165
|
catch (error) {
|
package/dist/soap-client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"soap-client.js","sourceRoot":"","sources":["../src/soap-client.ts"],"names":[],"mappings":";A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C/D,CAAC;YAED,MAAM,aAAa,GAAG,UAAU,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;YAChE,IAAI,aAAa,EAAE,CAAC;gBAClB,MAAM,OAAO,GAAG,UAAU,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;gBACrD,IAAI,OAAO,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;oBACrC,MAAM,QAAQ,GAAG,UAAU,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;oBAC3D,MAAM,IAAI,KAAK,CAAC,SAAS,MAAM,WAAW,QAAQ,IAAI,eAAe,EAAE,CAAC,CAAC;gBAC3E,CAAC;YACH,CAAC;YAED,sDAAsD;YACtD,qBAAqB,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC;YAE5C,OAAO,YAAY,CAAC;QACtB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,SAAS,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YAEtE,IAAI,OAAO,GAAG,WAAW,EAAE,CAAC;gBAC1B,MAAM,OAAO,GAAG,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC;gBACzD,MAAM,KAAK,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;QACH,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CACb,QAAQ,MAAM,iBAAiB,WAAW,cAAc,SAAS,EAAE,OAAO,IAAI,eAAe,EAAE,CAChG,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tebra MCP tools: Appointment create, update, delete.
|
|
3
|
+
*/
|
|
4
|
+
import type { TebraConfig } from '../config.js';
|
|
5
|
+
export declare const appointmentCrudTools: ({
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
inputSchema: {
|
|
9
|
+
type: "object";
|
|
10
|
+
properties: {
|
|
11
|
+
patientId: {
|
|
12
|
+
type: string;
|
|
13
|
+
description: string;
|
|
14
|
+
};
|
|
15
|
+
providerId: {
|
|
16
|
+
type: string;
|
|
17
|
+
description: string;
|
|
18
|
+
};
|
|
19
|
+
serviceLocationId: {
|
|
20
|
+
type: string;
|
|
21
|
+
description: string;
|
|
22
|
+
};
|
|
23
|
+
appointmentReasonId: {
|
|
24
|
+
type: string;
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
startDate: {
|
|
28
|
+
type: string;
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
duration: {
|
|
32
|
+
type: string;
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
notes: {
|
|
36
|
+
type: string;
|
|
37
|
+
description: string;
|
|
38
|
+
};
|
|
39
|
+
confirmationStatus: {
|
|
40
|
+
type: string;
|
|
41
|
+
description: string;
|
|
42
|
+
};
|
|
43
|
+
appointmentId?: undefined;
|
|
44
|
+
cancellationReason?: undefined;
|
|
45
|
+
};
|
|
46
|
+
required: string[];
|
|
47
|
+
};
|
|
48
|
+
} | {
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
inputSchema: {
|
|
52
|
+
type: "object";
|
|
53
|
+
properties: {
|
|
54
|
+
appointmentId: {
|
|
55
|
+
type: string;
|
|
56
|
+
description: string;
|
|
57
|
+
};
|
|
58
|
+
startDate: {
|
|
59
|
+
type: string;
|
|
60
|
+
description: string;
|
|
61
|
+
};
|
|
62
|
+
duration: {
|
|
63
|
+
type: string;
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
providerId: {
|
|
67
|
+
type: string;
|
|
68
|
+
description: string;
|
|
69
|
+
};
|
|
70
|
+
confirmationStatus: {
|
|
71
|
+
type: string;
|
|
72
|
+
description: string;
|
|
73
|
+
};
|
|
74
|
+
notes: {
|
|
75
|
+
type: string;
|
|
76
|
+
description: string;
|
|
77
|
+
};
|
|
78
|
+
cancellationReason: {
|
|
79
|
+
type: string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
82
|
+
patientId?: undefined;
|
|
83
|
+
serviceLocationId?: undefined;
|
|
84
|
+
appointmentReasonId?: undefined;
|
|
85
|
+
};
|
|
86
|
+
required: string[];
|
|
87
|
+
};
|
|
88
|
+
} | {
|
|
89
|
+
name: string;
|
|
90
|
+
description: string;
|
|
91
|
+
inputSchema: {
|
|
92
|
+
type: "object";
|
|
93
|
+
properties: {
|
|
94
|
+
appointmentId: {
|
|
95
|
+
type: string;
|
|
96
|
+
description: string;
|
|
97
|
+
};
|
|
98
|
+
patientId?: undefined;
|
|
99
|
+
providerId?: undefined;
|
|
100
|
+
serviceLocationId?: undefined;
|
|
101
|
+
appointmentReasonId?: undefined;
|
|
102
|
+
startDate?: undefined;
|
|
103
|
+
duration?: undefined;
|
|
104
|
+
notes?: undefined;
|
|
105
|
+
confirmationStatus?: undefined;
|
|
106
|
+
cancellationReason?: undefined;
|
|
107
|
+
};
|
|
108
|
+
required: string[];
|
|
109
|
+
};
|
|
110
|
+
})[];
|
|
111
|
+
export declare function handleAppointmentCrudTool(name: string, args: Record<string, unknown>, config: TebraConfig): Promise<{
|
|
112
|
+
content: Array<{
|
|
113
|
+
type: string;
|
|
114
|
+
text: string;
|
|
115
|
+
}>;
|
|
116
|
+
}>;
|
|
117
|
+
//# sourceMappingURL=appointment-crud.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"appointment-crud.d.ts","sourceRoot":"","sources":["../../src/tools/appointment-crud.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAKhD,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAkGhC,CAAC;AAIF,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,MAAM,EAAE,WAAW,GAClB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA6H7D"}
|