openfda-mcp-server 1.0.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.
@@ -0,0 +1,422 @@
1
+ //#region src/types/fda.d.ts
2
+ /**
3
+ * FDA API Types
4
+ * Type definitions for FDA OpenAPI responses
5
+ */
6
+ type FDAResponse<T> = {
7
+ meta?: {
8
+ disclaimer?: string;
9
+ terms?: string;
10
+ license?: string;
11
+ last_updated?: string;
12
+ results?: {
13
+ skip: number;
14
+ limit: number;
15
+ total: number;
16
+ };
17
+ };
18
+ results?: T[];
19
+ error?: {
20
+ code: string;
21
+ message: string;
22
+ };
23
+ };
24
+ type OpenFDAFields = {
25
+ application_number?: string[];
26
+ brand_name?: string[];
27
+ generic_name?: string[];
28
+ manufacturer_name?: string[];
29
+ product_ndc?: string[];
30
+ product_type?: string[];
31
+ route?: string[];
32
+ substance_name?: string[];
33
+ rxcui?: string[];
34
+ spl_id?: string[];
35
+ spl_set_id?: string[];
36
+ pharm_class_epc?: string[];
37
+ pharm_class_cs?: string[];
38
+ pharm_class_pe?: string[];
39
+ pharm_class_moa?: string[];
40
+ nui?: string[];
41
+ unii?: string[];
42
+ };
43
+ type DrugAdverseEvent = {
44
+ safetyreportid?: string;
45
+ safetyreportversion?: string;
46
+ receivedate?: string;
47
+ receivedateformat?: string;
48
+ receiptdate?: string;
49
+ receiptdateformat?: string;
50
+ serious?: string;
51
+ seriousnesscongenitalanomali?: string;
52
+ seriousnessdeath?: string;
53
+ seriousnessdisabling?: string;
54
+ seriousnesshospitalization?: string;
55
+ seriousnesslifethreatening?: string;
56
+ seriousnessother?: string;
57
+ transmissiondate?: string;
58
+ transmissiondateformat?: string;
59
+ duplicate?: string;
60
+ companynumb?: string;
61
+ occurcountry?: string;
62
+ primarysourcecountry?: string;
63
+ primarysource?: {
64
+ qualification?: string;
65
+ reportercountry?: string;
66
+ };
67
+ reporttype?: string;
68
+ sender?: {
69
+ sendertype?: string;
70
+ senderorganization?: string;
71
+ };
72
+ receiver?: {
73
+ receivertype?: string;
74
+ receiverorganization?: string;
75
+ };
76
+ patient?: {
77
+ patientonsetage?: string;
78
+ patientonsetageunit?: string;
79
+ patientsex?: string;
80
+ patientweight?: string;
81
+ patientdeath?: {
82
+ patientdeathdate?: string;
83
+ patientdeathdateformat?: string;
84
+ };
85
+ drug?: Array<{
86
+ actiondrug?: string;
87
+ activesubstance?: {
88
+ activesubstancename?: string;
89
+ };
90
+ drugadditional?: string;
91
+ drugadministrationroute?: string;
92
+ drugauthorizationnumb?: string;
93
+ drugbatchnumb?: string;
94
+ drugcharacterization?: string;
95
+ drugcumulativedosagenumb?: string;
96
+ drugcumulativedosageunit?: string;
97
+ drugdosageform?: string;
98
+ drugdosagetext?: string;
99
+ drugenddate?: string;
100
+ drugenddateformat?: string;
101
+ drugindication?: string;
102
+ drugintervaldosagedefinition?: string;
103
+ drugintervaldosageunitnumb?: string;
104
+ drugrecurreadministration?: string;
105
+ drugseparatedosagenumb?: string;
106
+ drugstartdate?: string;
107
+ drugstartdateformat?: string;
108
+ drugstructuredosagenumb?: string;
109
+ drugstructuredosageunit?: string;
110
+ drugtreatmentduration?: string;
111
+ drugtreatmentdurationunit?: string;
112
+ medicinalproduct?: string;
113
+ openfda?: OpenFDAFields;
114
+ }>;
115
+ reaction?: Array<{
116
+ reactionmeddrapt?: string;
117
+ reactionmeddraversionpt?: string;
118
+ reactionoutcome?: string;
119
+ }>;
120
+ };
121
+ };
122
+ type DrugLabel = {
123
+ effective_time?: string;
124
+ id?: string;
125
+ set_id?: string;
126
+ version?: string;
127
+ spl_product_data_elements?: string[];
128
+ active_ingredient?: string[];
129
+ inactive_ingredient?: string[];
130
+ purpose?: string[];
131
+ indications_and_usage?: string[];
132
+ warnings?: string[];
133
+ do_not_use?: string[];
134
+ ask_doctor?: string[];
135
+ ask_doctor_or_pharmacist?: string[];
136
+ stop_use?: string[];
137
+ pregnancy_or_breast_feeding?: string[];
138
+ keep_out_of_reach_of_children?: string[];
139
+ dosage_and_administration?: string[];
140
+ storage_and_handling?: string[];
141
+ questions?: string[];
142
+ package_label_principal_display_panel?: string[];
143
+ description?: string[];
144
+ clinical_pharmacology?: string[];
145
+ mechanism_of_action?: string[];
146
+ pharmacodynamics?: string[];
147
+ pharmacokinetics?: string[];
148
+ contraindications?: string[];
149
+ warnings_and_cautions?: string[];
150
+ adverse_reactions?: string[];
151
+ drug_interactions?: string[];
152
+ use_in_specific_populations?: string[];
153
+ overdosage?: string[];
154
+ how_supplied?: string[];
155
+ information_for_patients?: string[];
156
+ clinical_studies?: string[];
157
+ openfda?: OpenFDAFields;
158
+ };
159
+ type DrugNDC = {
160
+ product_id?: string;
161
+ product_ndc?: string;
162
+ spl_id?: string;
163
+ product_type?: string;
164
+ finished?: string;
165
+ brand_name?: string;
166
+ brand_name_base?: string;
167
+ brand_name_suffix?: string;
168
+ generic_name?: string;
169
+ dosage_form?: string;
170
+ route?: string[];
171
+ marketing_start_date?: string;
172
+ marketing_end_date?: string;
173
+ marketing_category?: string;
174
+ application_number?: string;
175
+ labeler_name?: string;
176
+ active_ingredients?: Array<{
177
+ name?: string;
178
+ strength?: string;
179
+ }>;
180
+ packaging?: Array<{
181
+ package_ndc?: string;
182
+ description?: string;
183
+ marketing_start_date?: string;
184
+ marketing_end_date?: string;
185
+ sample?: string;
186
+ }>;
187
+ pharm_class?: string[];
188
+ openfda?: OpenFDAFields;
189
+ };
190
+ type DrugEnforcement = {
191
+ classification?: string;
192
+ center_classification_date?: string;
193
+ report_date?: string;
194
+ postal_code?: string;
195
+ termination_date?: string;
196
+ recall_initiation_date?: string;
197
+ recall_number?: string;
198
+ city?: string;
199
+ more_code_info?: string;
200
+ event_id?: string;
201
+ distribution_pattern?: string;
202
+ recalling_firm?: string;
203
+ voluntary_mandated?: string;
204
+ state?: string;
205
+ reason_for_recall?: string;
206
+ initial_firm_notification?: string;
207
+ status?: string;
208
+ product_type?: string;
209
+ country?: string;
210
+ product_description?: string;
211
+ code_info?: string;
212
+ address_1?: string;
213
+ address_2?: string;
214
+ product_quantity?: string;
215
+ openfda?: OpenFDAFields;
216
+ };
217
+ type DrugShortage = {
218
+ generic_name?: string;
219
+ proprietary_name?: string;
220
+ status?: string;
221
+ description?: string;
222
+ presentation?: string;
223
+ resolved_shortage_date?: string;
224
+ initial_posting_date?: string;
225
+ };
226
+ type DrugsFDA = {
227
+ application_number?: string;
228
+ sponsor_name?: string;
229
+ products?: Array<{
230
+ product_number?: string;
231
+ reference_drug?: string;
232
+ brand_name?: string;
233
+ active_ingredients?: Array<{
234
+ name?: string;
235
+ strength?: string;
236
+ }>;
237
+ reference_standard?: string;
238
+ dosage_form?: string;
239
+ route?: string;
240
+ marketing_status?: string;
241
+ }>;
242
+ submissions?: Array<{
243
+ submission_type?: string;
244
+ submission_number?: string;
245
+ submission_status?: string;
246
+ submission_status_date?: string;
247
+ review_priority?: string;
248
+ submission_class_code?: string;
249
+ submission_class_code_description?: string;
250
+ application_docs?: Array<{
251
+ id?: string;
252
+ url?: string;
253
+ date?: string;
254
+ type?: string;
255
+ }>;
256
+ }>;
257
+ openfda?: OpenFDAFields;
258
+ };
259
+ type Device510K = {
260
+ k_number?: string;
261
+ applicant?: string;
262
+ contact?: string;
263
+ address_1?: string;
264
+ address_2?: string;
265
+ city?: string;
266
+ state?: string;
267
+ zip_code?: string;
268
+ country_code?: string;
269
+ postal_code?: string;
270
+ date_received?: string;
271
+ decision_date?: string;
272
+ decision_code?: string;
273
+ decision_description?: string;
274
+ product_code?: string;
275
+ statement_or_summary?: string;
276
+ clearance_type?: string;
277
+ third_party_flag?: string;
278
+ expedited_review_flag?: string;
279
+ device_name?: string;
280
+ openfda?: {
281
+ device_name?: string;
282
+ device_class?: string;
283
+ medical_specialty_description?: string;
284
+ regulation_number?: string;
285
+ fei_number?: string[];
286
+ };
287
+ };
288
+ type DeviceClassification = {
289
+ device_name?: string;
290
+ device_class?: string;
291
+ definition?: string;
292
+ gmp_exempt_flag?: string;
293
+ implant_flag?: string;
294
+ life_sustain_support_flag?: string;
295
+ medical_specialty?: string;
296
+ medical_specialty_description?: string;
297
+ product_code?: string;
298
+ regulation_number?: string;
299
+ review_code?: string;
300
+ review_panel?: string;
301
+ submission_type_id?: string;
302
+ third_party_flag?: string;
303
+ unclassified_reason?: string;
304
+ openfda?: {
305
+ fei_number?: string[];
306
+ k_number?: string[];
307
+ pma_number?: string[];
308
+ registration_number?: string[];
309
+ };
310
+ };
311
+ type DeviceAdverseEvent = {
312
+ adverse_event_flag?: string;
313
+ product_problem_flag?: string;
314
+ date_of_event?: string;
315
+ date_report?: string;
316
+ date_received?: string;
317
+ date_facility_aware?: string;
318
+ report_number?: string;
319
+ report_source_code?: string;
320
+ health_professional?: string;
321
+ reporter_occupation_code?: string;
322
+ initial_report_to_fda?: string;
323
+ reprocessed_and_reused_flag?: string;
324
+ manufacturer_name?: string;
325
+ manufacturer_address_1?: string;
326
+ manufacturer_city?: string;
327
+ manufacturer_state?: string;
328
+ manufacturer_zip_code?: string;
329
+ manufacturer_country?: string;
330
+ event_type?: string;
331
+ type_of_report?: string[];
332
+ device?: Array<{
333
+ brand_name?: string;
334
+ generic_name?: string;
335
+ manufacturer_d_name?: string;
336
+ manufacturer_d_address_1?: string;
337
+ manufacturer_d_city?: string;
338
+ manufacturer_d_state?: string;
339
+ manufacturer_d_zip_code?: string;
340
+ manufacturer_d_country?: string;
341
+ device_operator?: string;
342
+ model_number?: string;
343
+ catalog_number?: string;
344
+ lot_number?: string;
345
+ other_id_number?: string;
346
+ device_availability?: string;
347
+ device_evaluated_by_manufacturer?: string;
348
+ device_report_product_code?: string;
349
+ openfda?: {
350
+ device_name?: string;
351
+ device_class?: string;
352
+ medical_specialty_description?: string;
353
+ regulation_number?: string;
354
+ };
355
+ }>;
356
+ patient?: Array<{
357
+ patient_sequence_number?: string;
358
+ date_received?: string;
359
+ sequence_number_treatment?: string;
360
+ sequence_number_outcome?: string[];
361
+ }>;
362
+ mdr_text?: Array<{
363
+ mdr_text_key?: string;
364
+ text_type_code?: string;
365
+ patient_sequence_number?: string;
366
+ text?: string;
367
+ }>;
368
+ };
369
+ type DeviceEnforcement = {
370
+ classification?: string;
371
+ center_classification_date?: string;
372
+ report_date?: string;
373
+ postal_code?: string;
374
+ termination_date?: string;
375
+ recall_initiation_date?: string;
376
+ recall_number?: string;
377
+ city?: string;
378
+ event_id?: string;
379
+ distribution_pattern?: string;
380
+ recalling_firm?: string;
381
+ voluntary_mandated?: string;
382
+ state?: string;
383
+ reason_for_recall?: string;
384
+ initial_firm_notification?: string;
385
+ status?: string;
386
+ product_type?: string;
387
+ country?: string;
388
+ product_description?: string;
389
+ code_info?: string;
390
+ product_quantity?: string;
391
+ openfda?: {
392
+ device_name?: string;
393
+ device_class?: string;
394
+ medical_specialty_description?: string;
395
+ regulation_number?: string;
396
+ k_number?: string[];
397
+ pma_number?: string[];
398
+ fei_number?: string[];
399
+ registration_number?: string[];
400
+ };
401
+ };
402
+ type SearchParams = {
403
+ search?: string;
404
+ count?: string;
405
+ limit?: number;
406
+ skip?: number;
407
+ };
408
+ type FDAToolResponse<T> = {
409
+ success: boolean;
410
+ data?: T;
411
+ error?: string;
412
+ searchParams?: SearchParams;
413
+ totalResults?: number;
414
+ displayedResults?: number;
415
+ apiUsage?: {
416
+ authenticated: boolean;
417
+ rateLimit: string;
418
+ };
419
+ };
420
+ //#endregion
421
+ export { Device510K, DeviceAdverseEvent, DeviceClassification, DeviceEnforcement, DrugAdverseEvent, DrugEnforcement, DrugLabel, DrugNDC, DrugShortage, DrugsFDA, FDAResponse, FDAToolResponse, OpenFDAFields, SearchParams };
422
+ //# sourceMappingURL=fda.d.ts.map
@@ -0,0 +1 @@
1
+ export{};
@@ -0,0 +1,38 @@
1
+ import { Device510K, DeviceAdverseEvent, DeviceClassification, DeviceEnforcement, DrugAdverseEvent, DrugEnforcement, DrugLabel, DrugNDC, DrugShortage, DrugsFDA, FDAResponse, SearchParams } from "../types/fda.js";
2
+
3
+ //#region src/utils/api-client.d.ts
4
+
5
+ declare class FDAAPIClient {
6
+ private apiKey;
7
+ private baseUrl;
8
+ constructor();
9
+ /**
10
+ * Build URL search parameters for the FDA API
11
+ */
12
+ private buildSearchParams;
13
+ /**
14
+ * Make a request to an FDA API endpoint
15
+ */
16
+ private request;
17
+ /**
18
+ * Get rate limit info based on authentication status
19
+ */
20
+ getRateLimitInfo(): {
21
+ authenticated: boolean;
22
+ rateLimit: string;
23
+ };
24
+ searchDrugAdverseEvents(params: SearchParams): Promise<FDAResponse<DrugAdverseEvent>>;
25
+ searchDrugLabels(params: SearchParams): Promise<FDAResponse<DrugLabel>>;
26
+ searchDrugNDC(params: SearchParams): Promise<FDAResponse<DrugNDC>>;
27
+ searchDrugEnforcement(params: SearchParams): Promise<FDAResponse<DrugEnforcement>>;
28
+ searchDrugsFDA(params: SearchParams): Promise<FDAResponse<DrugsFDA>>;
29
+ searchDrugShortages(params: SearchParams): Promise<FDAResponse<DrugShortage>>;
30
+ searchDevice510K(params: SearchParams): Promise<FDAResponse<Device510K>>;
31
+ searchDeviceClassifications(params: SearchParams): Promise<FDAResponse<DeviceClassification>>;
32
+ searchDeviceAdverseEvents(params: SearchParams): Promise<FDAResponse<DeviceAdverseEvent>>;
33
+ searchDeviceEnforcement(params: SearchParams): Promise<FDAResponse<DeviceEnforcement>>;
34
+ }
35
+ declare const fdaAPIClient: FDAAPIClient;
36
+ //#endregion
37
+ export { FDAAPIClient, fdaAPIClient };
38
+ //# sourceMappingURL=api-client.d.ts.map
@@ -0,0 +1 @@
1
+ import"./logger.js";import{n as e,t}from"../api-client-BGnUXMwX.js";export{t as FDAAPIClient,e as fdaAPIClient};
@@ -0,0 +1,14 @@
1
+ import debug from "debug";
2
+
3
+ //#region src/utils/logger.d.ts
4
+
5
+ declare const loggers: {
6
+ core: debug.Debugger;
7
+ api: debug.Debugger;
8
+ tools: debug.Debugger;
9
+ main: debug.Debugger;
10
+ fastmcp: debug.Debugger;
11
+ };
12
+ //#endregion
13
+ export { loggers };
14
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1,2 @@
1
+ import e from"debug";const t={core:e(`openfda-mcp:core`),api:e(`openfda-mcp:api`),tools:e(`openfda-mcp:tools`),main:e(`openfda-mcp:main`),fastmcp:e(`openfda-mcp:fastmcp`)};export{t as loggers};
2
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","names":[],"sources":["../../src/utils/logger.ts"],"sourcesContent":["/**\n * Logger utility for OpenFDA MCP Server\n * Uses debug module for namespace-based logging\n *\n * Enable with: DEBUG=openfda-mcp:* <command>\n */\n\nimport debug from \"debug\"\n\nexport const loggers = {\n core: debug(\"openfda-mcp:core\"),\n api: debug(\"openfda-mcp:api\"),\n tools: debug(\"openfda-mcp:tools\"),\n main: debug(\"openfda-mcp:main\"),\n fastmcp: debug(\"openfda-mcp:fastmcp\"),\n}\n"],"mappings":"qBASA,MAAa,EAAU,CACrB,KAAM,EAAM,mBAAmB,CAC/B,IAAK,EAAM,kBAAkB,CAC7B,MAAO,EAAM,oBAAoB,CACjC,KAAM,EAAM,mBAAmB,CAC/B,QAAS,EAAM,sBAAsB,CACtC"}
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "openfda-mcp-server",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for querying U.S. FDA public datasets - drugs, devices, adverse events, recalls, and more",
5
+ "keywords": [
6
+ "mcp",
7
+ "model-context-protocol",
8
+ "fda",
9
+ "openfda",
10
+ "drugs",
11
+ "medical-devices",
12
+ "typescript"
13
+ ],
14
+ "author": "jordan.burke@gmail.com",
15
+ "license": "MIT",
16
+ "homepage": "https://github.com/jordanburke/openfda-mcp-server",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/jordanburke/openfda-mcp-server"
20
+ },
21
+ "dependencies": {
22
+ "@jordanburke/fastmcp": "^3.26.700",
23
+ "commander": "^14.0.2",
24
+ "debug": "^4.4.3",
25
+ "zod": "^3.25.76"
26
+ },
27
+ "devDependencies": {
28
+ "@types/debug": "^4.1.12",
29
+ "@types/node": "^24.10.4",
30
+ "ts-builds": "^2.1.0",
31
+ "tsdown": "^0.18.4",
32
+ "tsx": "^4.21.0"
33
+ },
34
+ "type": "module",
35
+ "bin": {
36
+ "openfda-mcp-server": "./dist/index.js"
37
+ },
38
+ "main": "./dist/index.js",
39
+ "module": "./dist/index.js",
40
+ "types": "./dist/index.d.ts",
41
+ "exports": {
42
+ ".": {
43
+ "types": "./dist/index.d.ts",
44
+ "import": "./dist/index.js"
45
+ },
46
+ "./lib": {
47
+ "types": "./dist/lib.d.ts",
48
+ "import": "./dist/lib.js"
49
+ }
50
+ },
51
+ "files": [
52
+ "lib",
53
+ "dist"
54
+ ],
55
+ "prettier": "ts-builds/prettier",
56
+ "scripts": {
57
+ "validate": "ts-builds validate",
58
+ "format": "ts-builds format",
59
+ "format:check": "ts-builds format:check",
60
+ "lint": "ts-builds lint",
61
+ "lint:check": "ts-builds lint:check",
62
+ "typecheck": "ts-builds typecheck",
63
+ "test": "ts-builds test",
64
+ "test:watch": "ts-builds test:watch",
65
+ "test:coverage": "ts-builds test:coverage",
66
+ "build": "ts-builds build",
67
+ "dev": "ts-builds dev",
68
+ "serve:test": "tsx src/index.ts",
69
+ "serve:test:http": "tsx src/index.ts --transport http"
70
+ }
71
+ }