medical-terminologies-mcp 2.2.0 → 2.4.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/NOTICE.md +2 -2
- package/README.md +1 -1
- package/dist/index.js +207 -186
- package/package.json +5 -4
package/NOTICE.md
CHANGED
|
@@ -104,8 +104,8 @@ channel as well.
|
|
|
104
104
|
|
|
105
105
|
MeSH content is a U.S. government work served under the
|
|
106
106
|
[NLM Terms and Conditions](https://www.nlm.nih.gov/databases/download/terms_and_conditions.html),
|
|
107
|
-
free of charge.
|
|
108
|
-
|
|
107
|
+
free of charge. The NLM statement in section 5 applies to this channel as
|
|
108
|
+
well; no endorsement by NLM is implied.
|
|
109
109
|
|
|
110
110
|
## 8. SNOMED CT (SNOMED International) — retired in 2.0.0
|
|
111
111
|
|
package/README.md
CHANGED
|
@@ -466,7 +466,7 @@ ATC classification © WHO Collaborating Centre for Drug Statistics Methodology (
|
|
|
466
466
|
|
|
467
467
|
### MeSH
|
|
468
468
|
|
|
469
|
-
MeSH is a U.S. government work served under the [NLM Terms and Conditions](https://www.nlm.nih.gov/databases/download/terms_and_conditions.html).
|
|
469
|
+
MeSH is a U.S. government work served free of charge under the [NLM Terms and Conditions](https://www.nlm.nih.gov/databases/download/terms_and_conditions.html). The NLM statement above (RxNorm) applies to this channel as well.
|
|
470
470
|
|
|
471
471
|
## Surface fingerprint, checkable from the registry
|
|
472
472
|
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ function unknownCursorError(message) {
|
|
|
30
30
|
var package_default = {
|
|
31
31
|
name: "medical-terminologies-mcp",
|
|
32
32
|
mcpName: "io.github.SidneyBissoli/medical-terminologies-mcp",
|
|
33
|
-
version: "2.
|
|
33
|
+
version: "2.4.0",
|
|
34
34
|
description: "Unified MCP server for six medical terminologies (ICD-11, LOINC, RxNorm, MeSH, ATC, CID-10) with authoritative WHO ICD-10\u2192ICD-11 mapping. 33 tools, hosted endpoint available, MIT.",
|
|
35
35
|
author: "Sidney da Silva Pereira Bissoli",
|
|
36
36
|
license: "MIT",
|
|
@@ -90,17 +90,18 @@ var package_default = {
|
|
|
90
90
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
91
91
|
"@sbissoli/mcp-provenance": "^0.4.0",
|
|
92
92
|
"@sbissoli/mcp-search": "^0.9.0",
|
|
93
|
-
"@sbissoli/mcp-upstream": "^0.
|
|
93
|
+
"@sbissoli/mcp-upstream": "^0.5.1",
|
|
94
94
|
pino: "^10.2.1",
|
|
95
95
|
zod: "^4.5.4"
|
|
96
96
|
},
|
|
97
97
|
devDependencies: {
|
|
98
98
|
"@modelcontextprotocol/client": "^2.0.0",
|
|
99
99
|
"@sbissoli/mcp-evals": "^0.2.1",
|
|
100
|
-
"@sbissoli/mcp-
|
|
100
|
+
"@sbissoli/mcp-live-source": "^0.5.0",
|
|
101
|
+
"@sbissoli/mcp-surface": "^0.6.0",
|
|
101
102
|
"@types/node": "^26.5.1",
|
|
102
103
|
esbuild: "^0.28.2",
|
|
103
|
-
nock: "^
|
|
104
|
+
nock: "^15.0.1",
|
|
104
105
|
"pino-pretty": "^13.1.3",
|
|
105
106
|
tsx: "^4.23.13",
|
|
106
107
|
typescript: "^7.0.2",
|
|
@@ -573,8 +574,8 @@ var ICD11MatchingPVSchema = z.object({
|
|
|
573
574
|
important: z.boolean().optional()
|
|
574
575
|
});
|
|
575
576
|
var ICD11SearchOutputSchema = z.object({
|
|
576
|
-
query: z.string(),
|
|
577
|
-
total_count: z.number().int(),
|
|
577
|
+
query: z.string().describe("The search text as submitted."),
|
|
578
|
+
total_count: z.number().int().describe("Number of entities the WHO search returned, before the max_results cap."),
|
|
578
579
|
entities: z.array(
|
|
579
580
|
z.object({
|
|
580
581
|
code: z.string().nullable(),
|
|
@@ -584,31 +585,31 @@ var ICD11SearchOutputSchema = z.object({
|
|
|
584
585
|
is_leaf: z.boolean(),
|
|
585
586
|
matching_pvs: z.array(ICD11MatchingPVSchema)
|
|
586
587
|
})
|
|
587
|
-
)
|
|
588
|
+
).describe("Matching ICD-11 MMS entities in WHO relevance order, at most max_results.")
|
|
588
589
|
});
|
|
589
590
|
var ICD11LabelRefSchema = z.object({
|
|
590
591
|
uri: z.string(),
|
|
591
592
|
label: z.string()
|
|
592
593
|
});
|
|
593
594
|
var ICD11LookupOutputSchema = z.object({
|
|
594
|
-
code: z.string().nullable(),
|
|
595
|
-
code_range: z.string().nullable(),
|
|
596
|
-
uri: z.string(),
|
|
597
|
-
title: z.string(),
|
|
598
|
-
class_kind: z.string().nullable(),
|
|
599
|
-
block_id: z.string().nullable(),
|
|
600
|
-
definition: z.string().nullable(),
|
|
601
|
-
long_definition: z.string().nullable(),
|
|
602
|
-
diagnostic_criteria: z.string().nullable(),
|
|
603
|
-
coding_note: z.string().nullable(),
|
|
604
|
-
exclusions: z.array(ICD11LabelRefSchema),
|
|
605
|
-
inclusions: z.array(ICD11LabelRefSchema),
|
|
606
|
-
index_terms: z.array(ICD11LabelRefSchema),
|
|
607
|
-
browser_url: z.string().nullable()
|
|
595
|
+
code: z.string().nullable().describe('ICD-11 MMS code (e.g. "BA00"); null for blocks and chapters, which have a code_range instead.'),
|
|
596
|
+
code_range: z.string().nullable().describe('Code range of a block or chapter (e.g. "BA00-BA0Z"); null for coded categories.'),
|
|
597
|
+
uri: z.string().describe("WHO ICD-11 entity URI."),
|
|
598
|
+
title: z.string().describe('Official title in the requested language ("Unknown" when the WHO returns none).'),
|
|
599
|
+
class_kind: z.string().nullable().describe('WHO class kind (e.g. "chapter", "block", "category"); null when the WHO does not state it.'),
|
|
600
|
+
block_id: z.string().nullable().describe("WHO block identifier for blocks; null otherwise."),
|
|
601
|
+
definition: z.string().nullable().describe("Official short definition; null when the WHO publishes none."),
|
|
602
|
+
long_definition: z.string().nullable().describe("Official detailed description; null when the WHO publishes none."),
|
|
603
|
+
diagnostic_criteria: z.string().nullable().describe("Official diagnostic criteria text; null when the WHO publishes none."),
|
|
604
|
+
coding_note: z.string().nullable().describe("Official coding note; null when the WHO publishes none."),
|
|
605
|
+
exclusions: z.array(ICD11LabelRefSchema).describe("Exclusion entries (conditions coded elsewhere), each with its URI and label."),
|
|
606
|
+
inclusions: z.array(ICD11LabelRefSchema).describe("Inclusion entries (synonyms and terms included under this entity), each with its URI and label."),
|
|
607
|
+
index_terms: z.array(ICD11LabelRefSchema).describe("Index terms that lead to this entity, each with its URI and label."),
|
|
608
|
+
browser_url: z.string().nullable().describe("Link to the entity in the WHO ICD-11 browser; null when the WHO returns none.")
|
|
608
609
|
});
|
|
609
610
|
var ICD11HierarchyOutputSchema = z.object({
|
|
610
|
-
code: z.string(),
|
|
611
|
-
direction: z.enum(["parents", "children"]),
|
|
611
|
+
code: z.string().describe("The code, block range or URI the walk started from, as submitted."),
|
|
612
|
+
direction: z.enum(["parents", "children"]).describe("Direction walked: parents (ancestors) or children (subtypes)."),
|
|
612
613
|
entities: z.array(
|
|
613
614
|
z.object({
|
|
614
615
|
code: z.string().nullable(),
|
|
@@ -616,7 +617,7 @@ var ICD11HierarchyOutputSchema = z.object({
|
|
|
616
617
|
title: z.string(),
|
|
617
618
|
uri: z.string()
|
|
618
619
|
})
|
|
619
|
-
)
|
|
620
|
+
).describe("Direct parents or children of the entity; empty when it has none. Entries the WHO failed to return are left out.")
|
|
620
621
|
});
|
|
621
622
|
var ICD11ChaptersOutputSchema = z.object({
|
|
622
623
|
chapters: z.array(
|
|
@@ -628,10 +629,10 @@ var ICD11ChaptersOutputSchema = z.object({
|
|
|
628
629
|
title: z.string().nullable(),
|
|
629
630
|
error: z.string().nullable()
|
|
630
631
|
})
|
|
631
|
-
)
|
|
632
|
+
).describe("Top-level ICD-11 MMS chapters in WHO order; a chapter the WHO failed to return keeps its number and URI, with error set and the other fields null.")
|
|
632
633
|
});
|
|
633
634
|
var ICD11PostcoordinationOutputSchema = z.object({
|
|
634
|
-
code: z.string(),
|
|
635
|
+
code: z.string().describe("The ICD-11 code as submitted."),
|
|
635
636
|
axes: z.array(
|
|
636
637
|
z.object({
|
|
637
638
|
axis_name: z.string(),
|
|
@@ -639,7 +640,7 @@ var ICD11PostcoordinationOutputSchema = z.object({
|
|
|
639
640
|
allow_multiple: z.boolean(),
|
|
640
641
|
value_count: z.number().int().nullable()
|
|
641
642
|
})
|
|
642
|
-
)
|
|
643
|
+
).describe("Postcoordination axes the WHO allows for this code; empty when it has none or the WHO has no postcoordination info for it.")
|
|
643
644
|
});
|
|
644
645
|
var LOINCSearchParamsSchema = z.object({
|
|
645
646
|
query: z.string().min(1).describe("Search term (test name, keyword, or partial LOINC code)"),
|
|
@@ -649,32 +650,32 @@ var LOINCByCodeParamsSchema = z.object({
|
|
|
649
650
|
loinc_num: LOINCNumberSchema.describe('LOINC number (e.g., "2339-0")')
|
|
650
651
|
}).strict();
|
|
651
652
|
var LOINCItemOutputSchema = z.object({
|
|
652
|
-
loinc_num: z.string(),
|
|
653
|
-
long_common_name: z.string(),
|
|
654
|
-
short_name: z.string(),
|
|
655
|
-
component: z.string(),
|
|
656
|
-
property: z.string(),
|
|
657
|
-
time_aspect: z.string(),
|
|
658
|
-
system: z.string(),
|
|
659
|
-
scale_type: z.string(),
|
|
660
|
-
method_type: z.string(),
|
|
661
|
-
class: z.string(),
|
|
662
|
-
status: z.string(),
|
|
653
|
+
loinc_num: z.string().describe('LOINC number (e.g. "2339-0").'),
|
|
654
|
+
long_common_name: z.string().describe("LOINC Long Common Name, the full human-readable name of the term."),
|
|
655
|
+
short_name: z.string().describe("LOINC short name; empty when the source has none."),
|
|
656
|
+
component: z.string().describe('LOINC axis 1, Component: what is measured or observed (e.g. "Glucose").'),
|
|
657
|
+
property: z.string().describe('LOINC axis 2, Property: the kind of quantity (e.g. "MCnc" = mass concentration).'),
|
|
658
|
+
time_aspect: z.string().describe('LOINC axis 3, Time: point in time or interval of the observation (e.g. "Pt", "24H").'),
|
|
659
|
+
system: z.string().describe('LOINC axis 4, System: the specimen or thing observed (e.g. "Bld", "Ser/Plas").'),
|
|
660
|
+
scale_type: z.string().describe("LOINC axis 5, Scale: Qn (quantitative), Ord, Nom, Nar, etc."),
|
|
661
|
+
method_type: z.string().describe("LOINC axis 6, Method; empty when the term specifies none."),
|
|
662
|
+
class: z.string().describe('LOINC class the term is grouped under (e.g. "CHEM").'),
|
|
663
|
+
status: z.string().describe('LOINC term status (e.g. "ACTIVE", "DEPRECATED"); empty when the source omits it.'),
|
|
663
664
|
// LOINC License §10 pass-through: some LOINC terms carry third-party
|
|
664
665
|
// copyright (e.g. survey instruments like PHQ-9). When Clinical Tables
|
|
665
666
|
// exposes EXTERNAL_COPYRIGHT_NOTICE for a term, it is served verbatim
|
|
666
667
|
// alongside the term; null when the term carries none.
|
|
667
|
-
external_copyright_notice: z.string().nullable()
|
|
668
|
+
external_copyright_notice: z.string().nullable().describe("Third-party copyright notice the term carries, served verbatim (LOINC License \xA710); null when it carries none.")
|
|
668
669
|
});
|
|
669
670
|
var LOINCSearchOutputSchema = z.object({
|
|
670
|
-
query: z.string(),
|
|
671
|
-
total_count: z.number().int(),
|
|
672
|
-
shown_count: z.number().int(),
|
|
673
|
-
items: z.array(LOINCItemOutputSchema)
|
|
671
|
+
query: z.string().describe("The search term as submitted."),
|
|
672
|
+
total_count: z.number().int().describe("Total number of LOINC terms matching the query at the source, which may exceed the items returned."),
|
|
673
|
+
shown_count: z.number().int().describe("Number of terms returned in items (at most max_results)."),
|
|
674
|
+
items: z.array(LOINCItemOutputSchema).describe("Matching LOINC terms in source relevance order.")
|
|
674
675
|
});
|
|
675
676
|
var LOINCDetailsOutputSchema = LOINCItemOutputSchema;
|
|
676
677
|
var LOINCAnswersOutputSchema = z.object({
|
|
677
|
-
loinc_num: z.string(),
|
|
678
|
+
loinc_num: z.string().describe("The LOINC number as submitted."),
|
|
678
679
|
answers: z.array(
|
|
679
680
|
z.object({
|
|
680
681
|
sequence: z.number().int().describe("Display order in the answer list (1-based)."),
|
|
@@ -682,7 +683,7 @@ var LOINCAnswersOutputSchema = z.object({
|
|
|
682
683
|
answer_string: z.string(),
|
|
683
684
|
score: z.number().nullable().describe("Numeric score for scored instruments (PHQ-9 items: 0-3); null when the answer list carries none.")
|
|
684
685
|
})
|
|
685
|
-
)
|
|
686
|
+
).describe("Answer list of the question in display order; empty when the code exists but has no answer list.")
|
|
686
687
|
});
|
|
687
688
|
var LOINCPanelOutputSchema = z.object({
|
|
688
689
|
loinc_num: z.string(),
|
|
@@ -697,8 +698,8 @@ var LOINCPanelOutputSchema = z.object({
|
|
|
697
698
|
)
|
|
698
699
|
});
|
|
699
700
|
var LOINCPanelsOutputSchema = z.object({
|
|
700
|
-
loinc_num: z.string(),
|
|
701
|
-
panel: LOINCPanelOutputSchema.nullable()
|
|
701
|
+
loinc_num: z.string().describe("The LOINC number as submitted."),
|
|
702
|
+
panel: LOINCPanelOutputSchema.nullable().describe("Panel/form definition with its member items; null when no panel structure is found for the code (not a panel, or no definition available).")
|
|
702
703
|
});
|
|
703
704
|
var RxNormSearchParamsSchema = z.object({
|
|
704
705
|
query: z.string().min(1).describe("Drug name to search (brand or generic)"),
|
|
@@ -725,28 +726,28 @@ var RxNormDrugOutputSchema = z.object({
|
|
|
725
726
|
language: z.string()
|
|
726
727
|
});
|
|
727
728
|
var RxNormSearchOutputSchema = z.object({
|
|
728
|
-
query: z.string(),
|
|
729
|
-
total_count: z.number().int(),
|
|
729
|
+
query: z.string().describe("The drug name as submitted."),
|
|
730
|
+
total_count: z.number().int().describe("Number of concepts RxNav returned for the name, before the max_results cap."),
|
|
730
731
|
// tty === 'APPROX' on items signals the search used the approximate-match
|
|
731
732
|
// fallback rather than an exact name match.
|
|
732
|
-
drugs: z.array(RxNormDrugOutputSchema)
|
|
733
|
+
drugs: z.array(RxNormDrugOutputSchema).describe('Matching RxNorm concepts, at most max_results. tty "APPROX" marks results of the approximate-match fallback, used when the name matched nothing exactly.')
|
|
733
734
|
});
|
|
734
735
|
var RxNormConceptOutputSchema = z.object({
|
|
735
|
-
rxcui: z.string(),
|
|
736
|
+
rxcui: z.string().describe("The RxCUI looked up."),
|
|
736
737
|
// An RxCUI that RxNorm does not have is an ANSWER, not an error (since
|
|
737
738
|
// 1.16.0; the siblings already say so: rxnorm_search with total_count 0,
|
|
738
739
|
// rxnorm_ingredients/classes/ndc with an empty list, atc_lookup with
|
|
739
740
|
// found:false). found=false ⇒ every concept field below is null,
|
|
740
741
|
// remapped_to is [] and related_groups is null.
|
|
741
742
|
found: z.boolean().describe("false when RxNorm has no concept with this RxCUI (the lookup answered; the fields below are null)"),
|
|
742
|
-
name: z.string().nullable(),
|
|
743
|
-
synonym: z.string().nullable(),
|
|
744
|
-
tty: z.string().nullable(),
|
|
745
|
-
language: z.string().nullable(),
|
|
746
|
-
suppress: z.string().nullable(),
|
|
747
|
-
umlscui: z.string().nullable(),
|
|
748
|
-
status: z.string().nullable(),
|
|
749
|
-
remapped_to: z.array(z.string()),
|
|
743
|
+
name: z.string().nullable().describe("RxNorm normalized name of the concept; null when found=false."),
|
|
744
|
+
synonym: z.string().nullable().describe("RxNorm synonym (may be empty); null when found=false."),
|
|
745
|
+
tty: z.string().nullable().describe('RxNorm term type (e.g. "IN" ingredient, "SCD" clinical drug, "SBD" branded drug); null when found=false.'),
|
|
746
|
+
language: z.string().nullable().describe('Language of the concept name as RxNav reports it (e.g. "ENG"); null when found=false.'),
|
|
747
|
+
suppress: z.string().nullable().describe('RxNorm suppress flag ("N" = not suppressed, the default when RxNav omits it); null when found=false.'),
|
|
748
|
+
umlscui: z.string().nullable().describe("UMLS Concept Unique Identifier linked to the concept (empty when none); null when found=false."),
|
|
749
|
+
status: z.string().nullable().describe('RxNorm history status (e.g. "Active", "Remapped", "Obsolete"); "Active" when RxNav does not report one; null when found=false.'),
|
|
750
|
+
remapped_to: z.array(z.string()).describe("RxCUIs a remapped concept was replaced by; empty otherwise."),
|
|
750
751
|
// Populated only when include_related=true; null when the caller didn't
|
|
751
752
|
// ask for related concepts so the field's absence vs emptiness is
|
|
752
753
|
// unambiguous.
|
|
@@ -755,10 +756,10 @@ var RxNormConceptOutputSchema = z.object({
|
|
|
755
756
|
tty: z.string(),
|
|
756
757
|
concepts: z.array(RxNormDrugOutputSchema)
|
|
757
758
|
})
|
|
758
|
-
).nullable()
|
|
759
|
+
).nullable().describe("Related concepts (ingredients, brands, dose forms) grouped by term type; null unless include_related=true.")
|
|
759
760
|
});
|
|
760
761
|
var RxNormIngredientsOutputSchema = z.object({
|
|
761
|
-
rxcui: z.string(),
|
|
762
|
+
rxcui: z.string().describe("The RxCUI as submitted."),
|
|
762
763
|
ingredients: z.array(
|
|
763
764
|
z.object({
|
|
764
765
|
rxcui: z.string(),
|
|
@@ -766,10 +767,10 @@ var RxNormIngredientsOutputSchema = z.object({
|
|
|
766
767
|
tty: z.string(),
|
|
767
768
|
is_multiple: z.boolean()
|
|
768
769
|
})
|
|
769
|
-
)
|
|
770
|
+
).describe("Ingredient concepts (term types IN and MIN) RxNav relates to the RxCUI; empty when none.")
|
|
770
771
|
});
|
|
771
772
|
var RxNormClassesOutputSchema = z.object({
|
|
772
|
-
rxcui: z.string(),
|
|
773
|
+
rxcui: z.string().describe("The RxCUI as submitted."),
|
|
773
774
|
classes: z.array(
|
|
774
775
|
z.object({
|
|
775
776
|
class_id: z.string(),
|
|
@@ -777,15 +778,15 @@ var RxNormClassesOutputSchema = z.object({
|
|
|
777
778
|
class_type: z.string(),
|
|
778
779
|
source: z.string()
|
|
779
780
|
})
|
|
780
|
-
)
|
|
781
|
+
).describe("Drug classes NLM RxClass links to the RxCUI (one entry per class and relationship); empty when none.")
|
|
781
782
|
});
|
|
782
783
|
var RxNormNDCOutputSchema = z.object({
|
|
783
784
|
// 'ndcs_for_rxcui': rxcui populated, ndc null, ndcs = list.
|
|
784
785
|
// 'rxcui_for_ndc': ndc populated, rxcui = found ID or null, ndcs = [].
|
|
785
|
-
query_mode: z.enum(["ndcs_for_rxcui", "rxcui_for_ndc"]),
|
|
786
|
-
rxcui: z.string().nullable(),
|
|
787
|
-
ndc: z.string().nullable(),
|
|
788
|
-
ndcs: z.array(z.object({ ndc: z.string() }))
|
|
786
|
+
query_mode: z.enum(["ndcs_for_rxcui", "rxcui_for_ndc"]).describe("Which lookup ran: ndcs_for_rxcui (rxcui given, list its NDCs) or rxcui_for_ndc (ndc given, find its RxCUI)."),
|
|
787
|
+
rxcui: z.string().nullable().describe("ndcs_for_rxcui: the RxCUI as submitted. rxcui_for_ndc: the RxCUI the NDC belongs to, or null when RxNorm has none for it."),
|
|
788
|
+
ndc: z.string().nullable().describe("rxcui_for_ndc: the NDC as submitted; null in ndcs_for_rxcui mode."),
|
|
789
|
+
ndcs: z.array(z.object({ ndc: z.string() })).describe("ndcs_for_rxcui: NDC codes RxNorm lists for the RxCUI (empty when none); always empty in rxcui_for_ndc mode.")
|
|
789
790
|
});
|
|
790
791
|
var MeSHSearchParamsSchema = z.object({
|
|
791
792
|
query: z.string().min(1).describe('Search term (e.g., "diabetes", "heart failure")'),
|
|
@@ -810,23 +811,23 @@ var MeSHQualifierOutputSchema = z.object({
|
|
|
810
811
|
label: z.string()
|
|
811
812
|
});
|
|
812
813
|
var MeSHSearchOutputSchema = z.object({
|
|
813
|
-
query: z.string(),
|
|
814
|
-
match: z.enum(["exact", "contains", "startswith"]),
|
|
815
|
-
total_count: z.number().int(),
|
|
814
|
+
query: z.string().describe("The search term as submitted."),
|
|
815
|
+
match: z.enum(["exact", "contains", "startswith"]).describe("Match type applied to descriptor labels."),
|
|
816
|
+
total_count: z.number().int().describe("Number of descriptors returned (the NLM lookup is capped at max_results, so this is not a total count of all matches)."),
|
|
816
817
|
descriptors: z.array(
|
|
817
818
|
z.object({
|
|
818
819
|
id: z.string(),
|
|
819
820
|
uri: z.string(),
|
|
820
821
|
label: z.string()
|
|
821
822
|
})
|
|
822
|
-
)
|
|
823
|
+
).describe('Matching MeSH descriptors, each with its ID (e.g. "D003920"), URI and label.')
|
|
823
824
|
});
|
|
824
825
|
var MeSHDescriptorOutputSchema = z.object({
|
|
825
|
-
id: z.string(),
|
|
826
|
-
uri: z.string(),
|
|
827
|
-
label: z.string(),
|
|
828
|
-
scope_note: z.string(),
|
|
829
|
-
tree_numbers: z.array(MeSHTreeNumberOutputSchema),
|
|
826
|
+
id: z.string().describe('MeSH descriptor ID (e.g. "D003920").'),
|
|
827
|
+
uri: z.string().describe("NLM MeSH RDF URI of the descriptor."),
|
|
828
|
+
label: z.string().describe("Descriptor heading, in the requested language when NLM publishes that translation."),
|
|
829
|
+
scope_note: z.string().describe("Scope note (definition) of the descriptor's preferred concept; empty when it has none."),
|
|
830
|
+
tree_numbers: z.array(MeSHTreeNumberOutputSchema).describe('Tree numbers placing the descriptor in the MeSH hierarchy (e.g. "C18.452.394.750").'),
|
|
830
831
|
concepts: z.array(
|
|
831
832
|
z.object({
|
|
832
833
|
uri: z.string(),
|
|
@@ -834,16 +835,16 @@ var MeSHDescriptorOutputSchema = z.object({
|
|
|
834
835
|
is_preferred: z.boolean(),
|
|
835
836
|
terms: z.array(z.string())
|
|
836
837
|
})
|
|
837
|
-
),
|
|
838
|
-
qualifiers: z.array(MeSHQualifierOutputSchema)
|
|
838
|
+
).describe("The preferred concept with its entry terms (synonyms); non-preferred concepts are not retrieved. Empty when the descriptor names no preferred concept."),
|
|
839
|
+
qualifiers: z.array(MeSHQualifierOutputSchema).describe("Allowable qualifiers (subheadings) for the descriptor.")
|
|
839
840
|
});
|
|
840
841
|
var MeSHTreeOutputSchema = z.object({
|
|
841
|
-
mesh_id: z.string(),
|
|
842
|
-
tree_numbers: z.array(MeSHTreeNumberOutputSchema)
|
|
842
|
+
mesh_id: z.string().describe("The MeSH descriptor ID as submitted."),
|
|
843
|
+
tree_numbers: z.array(MeSHTreeNumberOutputSchema).describe("Tree numbers placing the descriptor in the MeSH hierarchy; a descriptor can sit in several branches.")
|
|
843
844
|
});
|
|
844
845
|
var MeSHQualifiersOutputSchema = z.object({
|
|
845
|
-
mesh_id: z.string(),
|
|
846
|
-
qualifiers: z.array(MeSHQualifierOutputSchema)
|
|
846
|
+
mesh_id: z.string().describe("The MeSH descriptor ID as submitted."),
|
|
847
|
+
qualifiers: z.array(MeSHQualifierOutputSchema).describe("Allowable qualifiers (subheadings) for the descriptor, each with its ID, URI and label.")
|
|
847
848
|
});
|
|
848
849
|
var MapICD10ToICD11ParamsSchema = z.object({
|
|
849
850
|
icd10_code: z.string().min(1).describe("ICD-10 code to query in the ICD-11 search index (e.g., E11, I21.0, J18.9)")
|
|
@@ -876,12 +877,12 @@ var FindEquivalentItemSchema = z.object({
|
|
|
876
877
|
rank: z.number().int().min(1)
|
|
877
878
|
});
|
|
878
879
|
var FindEquivalentTerminologyResultSchema = z.object({
|
|
879
|
-
found: z.boolean(),
|
|
880
|
+
found: z.boolean().describe("True when this terminology returned at least one candidate."),
|
|
880
881
|
// Populated when the upstream call failed (timeout, server error).
|
|
881
|
-
error: z.string().nullable(),
|
|
882
|
+
error: z.string().nullable().describe("Failure message when the search in this terminology failed (timeout, server error); null when it answered."),
|
|
882
883
|
// Sorted by match_score descending (i.e. by global rank) since v1.7.0;
|
|
883
884
|
// before that the order was whatever the upstream returned.
|
|
884
|
-
items: z.array(FindEquivalentItemSchema)
|
|
885
|
+
items: z.array(FindEquivalentItemSchema).describe("Candidates from this terminology, best first (by global rank), at most limit.")
|
|
885
886
|
});
|
|
886
887
|
var FindEquivalentGroupMemberSchema = z.object({
|
|
887
888
|
terminology: TerminologyEnum,
|
|
@@ -897,27 +898,27 @@ var FindEquivalentGroupSchema = z.object({
|
|
|
897
898
|
members: z.array(FindEquivalentGroupMemberSchema)
|
|
898
899
|
});
|
|
899
900
|
var FindEquivalentOutputSchema = z.object({
|
|
900
|
-
term: z.string(),
|
|
901
|
-
source_terminology: TerminologyEnum.nullable(),
|
|
902
|
-
searched_terminologies: z.array(TerminologyEnum),
|
|
901
|
+
term: z.string().describe("The medical term as submitted."),
|
|
902
|
+
source_terminology: TerminologyEnum.nullable().describe("Terminology excluded from the search; null when none was given."),
|
|
903
|
+
searched_terminologies: z.array(TerminologyEnum).describe("Terminologies actually searched: the targets minus source_terminology. Empty when nothing was left to search."),
|
|
903
904
|
// Each terminology key is present only if it was actually searched (i.e.
|
|
904
905
|
// it's in searched_terminologies). Absent keys mean "not requested",
|
|
905
906
|
// empty items+found:false means "searched, no hits".
|
|
906
907
|
results: z.object({
|
|
907
|
-
icd11: FindEquivalentTerminologyResultSchema.optional(),
|
|
908
|
-
loinc: FindEquivalentTerminologyResultSchema.optional(),
|
|
909
|
-
rxnorm: FindEquivalentTerminologyResultSchema.optional(),
|
|
910
|
-
mesh: FindEquivalentTerminologyResultSchema.optional()
|
|
911
|
-
}),
|
|
908
|
+
icd11: FindEquivalentTerminologyResultSchema.optional().describe("ICD-11 (WHO) candidates; present only when ICD-11 was searched."),
|
|
909
|
+
loinc: FindEquivalentTerminologyResultSchema.optional().describe("LOINC candidates; present only when LOINC was searched."),
|
|
910
|
+
rxnorm: FindEquivalentTerminologyResultSchema.optional().describe("RxNorm candidates; present only when RxNorm was searched."),
|
|
911
|
+
mesh: FindEquivalentTerminologyResultSchema.optional().describe("MeSH candidates; present only when MeSH was searched.")
|
|
912
|
+
}).describe("Per-terminology results, keyed by terminology. A key is absent when that terminology was not searched; found=false with empty items and error null means searched, no hits."),
|
|
912
913
|
// Groups of lexically identical candidates across terminologies, sorted
|
|
913
914
|
// by best member match_score. Empty when nothing groups.
|
|
914
|
-
groups: z.array(FindEquivalentGroupSchema),
|
|
915
|
+
groups: z.array(FindEquivalentGroupSchema).describe("Candidates from different terminologies whose normalized titles are identical, grouped as likely the same concept; best match_score first. Empty when nothing groups (not evidence of non-equivalence)."),
|
|
915
916
|
// Self-description of the server-side ranking so consumers know the
|
|
916
917
|
// scores are derived here, not upstream relevance.
|
|
917
918
|
ranking: z.object({
|
|
918
|
-
method: z.literal("lexical"),
|
|
919
|
-
note: z.string()
|
|
920
|
-
})
|
|
919
|
+
method: z.literal("lexical").describe("Ranking method: lexical similarity computed by this server."),
|
|
920
|
+
note: z.string().describe("How match_score and rank are computed.")
|
|
921
|
+
}).describe("Self-description of the ranking: match_score, rank and groups are computed by this server, not upstream relevance.")
|
|
921
922
|
});
|
|
922
923
|
var ICD10SourceSchema = z.object({
|
|
923
924
|
code: z.string(),
|
|
@@ -946,7 +947,7 @@ var MapICD10ToICD11OutputSchema = z.object({
|
|
|
946
947
|
publisher: z.string().describe('Authoritative publisher (e.g. "WHO").'),
|
|
947
948
|
version: z.string().describe('Transition table release identifier (e.g. "2025-01").'),
|
|
948
949
|
release_date: z.string().describe("ISO date string for the release.")
|
|
949
|
-
})
|
|
950
|
+
}).describe("The bundled WHO ICD-10 \u2192 ICD-11 transition table release this answer comes from.")
|
|
950
951
|
});
|
|
951
952
|
var ValidateCodesTerminologyEnum = z.enum([
|
|
952
953
|
"icd11",
|
|
@@ -987,7 +988,7 @@ var ValidateCodesOutputSchema = z.object({
|
|
|
987
988
|
valid_count: z.number().int().describe("How many were confirmed valid."),
|
|
988
989
|
invalid_count: z.number().int().describe("How many were not found."),
|
|
989
990
|
error_count: z.number().int().describe("How many couldn't be validated due to upstream/network errors."),
|
|
990
|
-
results: z.array(ValidateCodesResultSchema)
|
|
991
|
+
results: z.array(ValidateCodesResultSchema).describe("One entry per submitted code, in request order.")
|
|
991
992
|
});
|
|
992
993
|
var HARMONIZE_MAX_TERMS = 50;
|
|
993
994
|
var HarmonizeDomainEnum = z.enum(["diagnosis", "drug", "lab"]).describe(
|
|
@@ -1035,20 +1036,20 @@ var HarmonizeTermsOutputSchema = z.object({
|
|
|
1035
1036
|
total: z.number().int().describe("Terms submitted."),
|
|
1036
1037
|
unique_lookups: z.number().int().describe("Distinct term+domain pairs actually looked up."),
|
|
1037
1038
|
counts: z.object({
|
|
1038
|
-
exact: z.number().int(),
|
|
1039
|
-
strong: z.number().int(),
|
|
1040
|
-
needs_review: z.number().int(),
|
|
1041
|
-
no_candidates: z.number().int(),
|
|
1042
|
-
error: z.number().int()
|
|
1043
|
-
}),
|
|
1039
|
+
exact: z.number().int().describe("Terms whose best candidate is an exact match."),
|
|
1040
|
+
strong: z.number().int().describe("Terms whose best candidate is a strong match."),
|
|
1041
|
+
needs_review: z.number().int().describe("Terms whose best candidate needs review."),
|
|
1042
|
+
no_candidates: z.number().int().describe("Terms the source answered with no candidates."),
|
|
1043
|
+
error: z.number().int().describe("Terms whose lookup failed.")
|
|
1044
|
+
}).describe("Submitted terms tallied by outcome (best-candidate match_type, no candidates, or error); the five counts add up to total."),
|
|
1044
1045
|
results: z.array(HarmonizeResultSchema).describe("One entry per submitted term, in request order."),
|
|
1045
1046
|
// Same self-description as find_equivalent: match_score and match_type are
|
|
1046
1047
|
// computed here, not upstream relevance (the concise provenance block does
|
|
1047
1048
|
// not carry `derived`, so the method travels in the payload).
|
|
1048
1049
|
ranking: z.object({
|
|
1049
|
-
method: z.literal("lexical"),
|
|
1050
|
-
note: z.string()
|
|
1051
|
-
})
|
|
1050
|
+
method: z.literal("lexical").describe("Ranking method: lexical similarity computed by this server."),
|
|
1051
|
+
note: z.string().describe("How match_score and match_type are computed.")
|
|
1052
|
+
}).describe("Self-description of the ranking: match_score and match_type are computed by this server, not upstream relevance.")
|
|
1052
1053
|
});
|
|
1053
1054
|
var TerminologyVersionsParamsSchema = z.object({
|
|
1054
1055
|
terminology: ValidateCodesTerminologyEnum.optional().describe("Filter to a single terminology. Omit to return all 7.")
|
|
@@ -1068,8 +1069,8 @@ var TerminologyVersionEntrySchema = z.object({
|
|
|
1068
1069
|
});
|
|
1069
1070
|
var TerminologyVersionsOutputSchema = z.object({
|
|
1070
1071
|
generated: z.string().describe("Date this snapshot was generated."),
|
|
1071
|
-
total: z.number().int(),
|
|
1072
|
-
terminologies: z.array(TerminologyVersionEntrySchema)
|
|
1072
|
+
total: z.number().int().describe("Number of terminologies listed."),
|
|
1073
|
+
terminologies: z.array(TerminologyVersionEntrySchema).describe("Release this server queries for each terminology (all 7, or the one requested): publisher, current version, release date, update cadence, source and changelog links, and whether the data is bundled in the server.")
|
|
1073
1074
|
});
|
|
1074
1075
|
var TerminologyDiffParamsSchema = z.object({
|
|
1075
1076
|
terminology: ValidateCodesTerminologyEnum.describe("Which terminology to report on."),
|
|
@@ -1083,15 +1084,15 @@ var CrossRevisionSummarySchema = z.object({
|
|
|
1083
1084
|
avg_alternatives_when_split: z.number()
|
|
1084
1085
|
});
|
|
1085
1086
|
var TerminologyDiffOutputSchema = z.object({
|
|
1086
|
-
terminology: ValidateCodesTerminologyEnum,
|
|
1087
|
-
from_version: z.string().nullable(),
|
|
1088
|
-
to_version: z.string().nullable(),
|
|
1087
|
+
terminology: ValidateCodesTerminologyEnum.describe("The terminology reported on, as submitted."),
|
|
1088
|
+
from_version: z.string().nullable().describe("The from_version requested (for icd10, the bundled ICD-10 release when not given); null when not given."),
|
|
1089
|
+
to_version: z.string().nullable().describe("The to_version requested; null when not given."),
|
|
1089
1090
|
diff_available: z.boolean().describe(
|
|
1090
1091
|
"True when this server has the data to compute a real diff for the requested terminology. False = guidance-only response."
|
|
1091
1092
|
),
|
|
1092
|
-
message: z.string(),
|
|
1093
|
-
changelog_url: z.string().nullable(),
|
|
1094
|
-
bundled_versions: z.array(z.string()),
|
|
1093
|
+
message: z.string().describe("Explanation of the answer: what was computed, or why no diff is available and where to look instead."),
|
|
1094
|
+
changelog_url: z.string().nullable().describe("Publisher's official changelog for the terminology; null when none is known."),
|
|
1095
|
+
bundled_versions: z.array(z.string()).describe("Versions of this terminology bundled in the server; empty when the server queries the live upstream."),
|
|
1095
1096
|
cross_revision_summary: CrossRevisionSummarySchema.nullable().describe(
|
|
1096
1097
|
'Populated only for terminology="icd10" today \u2014 the bundled WHO ICD-10 \u2192 ICD-11 transition tables let us surface a real structural diff between the two WHO revisions.'
|
|
1097
1098
|
)
|
|
@@ -1119,7 +1120,7 @@ var ATCClassEntrySchema = z.object({
|
|
|
1119
1120
|
atc_level_type: z.string()
|
|
1120
1121
|
});
|
|
1121
1122
|
var ATCClassifyOutputSchema = z.object({
|
|
1122
|
-
drug_name: z.string(),
|
|
1123
|
+
drug_name: z.string().describe("The drug name as submitted."),
|
|
1123
1124
|
matches: z.array(
|
|
1124
1125
|
z.object({
|
|
1125
1126
|
rxcui: z.string(),
|
|
@@ -1129,17 +1130,17 @@ var ATCClassifyOutputSchema = z.object({
|
|
|
1129
1130
|
atc_name: z.string(),
|
|
1130
1131
|
atc_level_type: z.string()
|
|
1131
1132
|
})
|
|
1132
|
-
)
|
|
1133
|
+
).describe("ATC classes NLM RxClass assigns to the drug, one entry per RxNorm concept and ATC class pair; empty when the drug is unknown or has no ATC mapping.")
|
|
1133
1134
|
});
|
|
1134
1135
|
var ATCLookupOutputSchema = z.object({
|
|
1135
|
-
atc_code: z.string(),
|
|
1136
|
-
found: z.boolean(),
|
|
1136
|
+
atc_code: z.string().describe("The ATC code as submitted."),
|
|
1137
|
+
found: z.boolean().describe("Whether RxClass knows the code at level 1-4; false for unknown and for 7-character substance codes."),
|
|
1137
1138
|
// Populated when found=true. Null when the code is unknown or
|
|
1138
1139
|
// substance-level (RxClass byId doesn't expose the 7-char codes).
|
|
1139
|
-
details: ATCClassEntrySchema.nullable()
|
|
1140
|
+
details: ATCClassEntrySchema.nullable().describe("The ATC class (code, name, level type); null when found=false.")
|
|
1140
1141
|
});
|
|
1141
1142
|
var ATCMembersOutputSchema = z.object({
|
|
1142
|
-
atc_code: z.string(),
|
|
1143
|
+
atc_code: z.string().describe("The ATC code as submitted."),
|
|
1143
1144
|
members: z.array(
|
|
1144
1145
|
z.object({
|
|
1145
1146
|
rxcui: z.string(),
|
|
@@ -1149,7 +1150,7 @@ var ATCMembersOutputSchema = z.object({
|
|
|
1149
1150
|
// When the queried class is at level 5, this matches atc_code.
|
|
1150
1151
|
source_atc_code: z.string()
|
|
1151
1152
|
})
|
|
1152
|
-
)
|
|
1153
|
+
).describe("RxNorm drug concepts in the ATC class (all member substances for levels 1-4); empty when the code is unknown or has no RxNorm-mapped members.")
|
|
1153
1154
|
});
|
|
1154
1155
|
var CID10CodeSchema = z.string().regex(
|
|
1155
1156
|
/^[A-Z]\d{2}(\.?\d)?$/i,
|
|
@@ -1200,36 +1201,36 @@ var CID10HitSchema = z.object({
|
|
|
1200
1201
|
group_range: z.string().nullable()
|
|
1201
1202
|
});
|
|
1202
1203
|
var CID10SearchOutputSchema = z.object({
|
|
1203
|
-
query: z.string(),
|
|
1204
|
-
level: z.enum(["categories", "subcategories", "all"]),
|
|
1205
|
-
total_count: z.number().int(),
|
|
1206
|
-
shown_count: z.number().int(),
|
|
1207
|
-
hits: z.array(CID10HitSchema),
|
|
1204
|
+
query: z.string().describe("The search terms as submitted."),
|
|
1205
|
+
level: z.enum(["categories", "subcategories", "all"]).describe("Code level searched: 3-char categories, 4-char subcategories, or all."),
|
|
1206
|
+
total_count: z.number().int().describe("Number of CID-10 codes matching the query, before the max_results cap."),
|
|
1207
|
+
shown_count: z.number().int().describe("Number of codes returned in hits (at most max_results)."),
|
|
1208
|
+
hits: z.array(CID10HitSchema).describe("Matching CID-10 V2008 codes with their Portuguese titles, chapter and group."),
|
|
1208
1209
|
// Present only when a query word was translated to the CID-10's own wording
|
|
1209
1210
|
// ("câncer" → "neoplasia maligna"); says which (src/clients/cid10-vocabulary.ts).
|
|
1210
|
-
vocabulary_notes: z.array(z.string()).optional()
|
|
1211
|
+
vocabulary_notes: z.array(z.string()).optional().describe(`Present only when a query word was translated to the CID-10's own wording (e.g. "c\xE2ncer" \u2192 "neoplasia maligna"); says which.`)
|
|
1211
1212
|
});
|
|
1212
1213
|
var CID10LookupOutputSchema = z.object({
|
|
1213
|
-
code: z.string(),
|
|
1214
|
-
found: z.boolean(),
|
|
1214
|
+
code: z.string().describe("The CID-10 code as submitted."),
|
|
1215
|
+
found: z.boolean().describe("Whether the code exists in CID-10 V2008."),
|
|
1215
1216
|
// Populated when found=true; null otherwise.
|
|
1216
|
-
hit: CID10HitSchema.nullable()
|
|
1217
|
+
hit: CID10HitSchema.nullable().describe("The CID-10 entry (Portuguese title, chapter, group, restrictions); null when found=false.")
|
|
1217
1218
|
});
|
|
1218
1219
|
var CID10ChaptersOutputSchema = z.object({
|
|
1219
|
-
chapters: z.array(CID10ChapterEntrySchema)
|
|
1220
|
+
chapters: z.array(CID10ChapterEntrySchema).describe("The 22 chapters of CID-10 V2008, each with its number, code range and Portuguese title.")
|
|
1220
1221
|
});
|
|
1221
1222
|
var CID10ChapterDetailOutputSchema = z.object({
|
|
1222
|
-
num: z.number().int(),
|
|
1223
|
-
found: z.boolean(),
|
|
1224
|
-
chapter: CID10ChapterEntrySchema.nullable(),
|
|
1225
|
-
groups: z.array(CID10GroupEntrySchema)
|
|
1223
|
+
num: z.number().int().describe("The chapter number as submitted."),
|
|
1224
|
+
found: z.boolean().describe("Whether the chapter exists in CID-10 V2008."),
|
|
1225
|
+
chapter: CID10ChapterEntrySchema.nullable().describe("The chapter (number, code range, Portuguese title); null when found=false."),
|
|
1226
|
+
groups: z.array(CID10GroupEntrySchema).describe("Groups (code-range blocks) of the chapter, each with its range and Portuguese title; empty when found=false.")
|
|
1226
1227
|
});
|
|
1227
1228
|
var CID10ChapterParamsSchema = z.object({
|
|
1228
1229
|
num: z.number().int().min(1).max(22).describe("Chapter number (1-22). CID-10 V2008 has 22 chapters.")
|
|
1229
1230
|
}).strict();
|
|
1230
1231
|
var ApiError = class extends Error {
|
|
1231
|
-
constructor(message, code, statusCode, details) {
|
|
1232
|
-
super(message);
|
|
1232
|
+
constructor(message, code, statusCode, details, options) {
|
|
1233
|
+
super(message, options?.cause === void 0 ? void 0 : { cause: options.cause });
|
|
1233
1234
|
this.code = code;
|
|
1234
1235
|
this.statusCode = statusCode;
|
|
1235
1236
|
this.details = details;
|
|
@@ -1332,16 +1333,23 @@ import { UpstreamError } from "@sbissoli/mcp-upstream";
|
|
|
1332
1333
|
var HttpError = class extends Error {
|
|
1333
1334
|
status;
|
|
1334
1335
|
data;
|
|
1336
|
+
/**
|
|
1337
|
+
* `cause` is the package's `UpstreamError` (since piece 4 of
|
|
1338
|
+
* `mcp:fonte-indisponivel-nao-e-deriva`, 2026-10-22): the live contract
|
|
1339
|
+
* test reads the origin's `kind` through the `cause` chain
|
|
1340
|
+
* (`@sbissoli/mcp-live-source`) to tell "the source is down" (test
|
|
1341
|
+
* skipped, warning) from "the source changed" (red). The clients keep the
|
|
1342
|
+
* chain by passing this error as `cause` of their `ApiError`.
|
|
1343
|
+
*/
|
|
1335
1344
|
constructor(message, opts = {}) {
|
|
1336
|
-
super(message);
|
|
1345
|
+
super(message, opts.cause === void 0 ? void 0 : { cause: opts.cause });
|
|
1337
1346
|
this.name = "HttpError";
|
|
1338
1347
|
this.status = opts.status;
|
|
1339
1348
|
this.data = opts.data;
|
|
1340
1349
|
}
|
|
1341
1350
|
};
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
if (text.length === 0) {
|
|
1351
|
+
function parseBody(text) {
|
|
1352
|
+
if (text === void 0 || text.length === 0) {
|
|
1345
1353
|
return void 0;
|
|
1346
1354
|
}
|
|
1347
1355
|
try {
|
|
@@ -1367,19 +1375,20 @@ function describeFetchFailure(error) {
|
|
|
1367
1375
|
async function translateUpstreamError(error, timeoutMs) {
|
|
1368
1376
|
if (!(error instanceof UpstreamError)) return error;
|
|
1369
1377
|
const after = error.attempts > 1 ? ` (after ${error.attempts} attempts)` : "";
|
|
1378
|
+
const cause = error;
|
|
1370
1379
|
switch (error.kind) {
|
|
1371
1380
|
case "timeout":
|
|
1372
|
-
return new HttpError(`timeout of ${timeoutMs}ms exceeded${after}
|
|
1381
|
+
return new HttpError(`timeout of ${timeoutMs}ms exceeded${after}`, { cause });
|
|
1373
1382
|
case "network":
|
|
1374
|
-
return new HttpError(`${describeFetchFailure(error.cause)}${after}
|
|
1383
|
+
return new HttpError(`${describeFetchFailure(error.cause)}${after}`, { cause });
|
|
1375
1384
|
case "aborted":
|
|
1376
|
-
return new HttpError(`request aborted${after}
|
|
1385
|
+
return new HttpError(`request aborted${after}`, { cause });
|
|
1377
1386
|
case "malformed_body":
|
|
1378
|
-
return new HttpError(`malformed upstream response${after}`, { status: error.status });
|
|
1387
|
+
return new HttpError(`malformed upstream response${after}`, { status: error.status, cause });
|
|
1379
1388
|
default: {
|
|
1380
1389
|
const status = error.status ?? error.response?.status;
|
|
1381
|
-
const data =
|
|
1382
|
-
return new HttpError(`Request failed with status code ${status}${after}`, { status, data });
|
|
1390
|
+
const data = parseBody(error.body);
|
|
1391
|
+
return new HttpError(`Request failed with status code ${status}${after}`, { status, data, cause });
|
|
1383
1392
|
}
|
|
1384
1393
|
}
|
|
1385
1394
|
}
|
|
@@ -1409,9 +1418,9 @@ var HttpClient = class {
|
|
|
1409
1418
|
const fullUrl = this.buildUrl(url, options.params);
|
|
1410
1419
|
const timeout = options.timeout ?? this.config.timeout ?? UPSTREAM_POLICY.timeoutMs[this.config.source];
|
|
1411
1420
|
const headers = { ...this.config.headers, ...options.headers };
|
|
1412
|
-
let
|
|
1421
|
+
let text;
|
|
1413
1422
|
try {
|
|
1414
|
-
|
|
1423
|
+
text = await upstreamCallFor(this.config.source).text(fullUrl, {
|
|
1415
1424
|
method,
|
|
1416
1425
|
headers,
|
|
1417
1426
|
body,
|
|
@@ -1420,7 +1429,7 @@ var HttpClient = class {
|
|
|
1420
1429
|
} catch (error) {
|
|
1421
1430
|
throw await translateUpstreamError(error, timeout);
|
|
1422
1431
|
}
|
|
1423
|
-
return { data:
|
|
1432
|
+
return { data: parseBody(text) };
|
|
1424
1433
|
}
|
|
1425
1434
|
};
|
|
1426
1435
|
|
|
@@ -1735,7 +1744,7 @@ var WHOClient = class {
|
|
|
1735
1744
|
}
|
|
1736
1745
|
});
|
|
1737
1746
|
const duration = Date.now() - startTime;
|
|
1738
|
-
log.debug({
|
|
1747
|
+
log.debug({ duration }, "HTTP response OK");
|
|
1739
1748
|
return response.data;
|
|
1740
1749
|
} catch (error) {
|
|
1741
1750
|
if (error instanceof HttpError) {
|
|
@@ -1745,19 +1754,20 @@ var WHOClient = class {
|
|
|
1745
1754
|
log.error({ status, data: responseData }, "HTTP error response");
|
|
1746
1755
|
if (status === 401) {
|
|
1747
1756
|
cache.delete(CACHE_PREFIX.TOKEN, TOKEN_CACHE_KEY);
|
|
1748
|
-
throw new ApiError("Authentication failed - token expired", "AUTH_EXPIRED", status);
|
|
1757
|
+
throw new ApiError("Authentication failed - token expired", "AUTH_EXPIRED", status, void 0, { cause: error });
|
|
1749
1758
|
}
|
|
1750
1759
|
if (status === 404) {
|
|
1751
|
-
throw new ApiError(`Resource not found: ${path}`, "NOT_FOUND", status);
|
|
1760
|
+
throw new ApiError(`Resource not found: ${path}`, "NOT_FOUND", status, void 0, { cause: error });
|
|
1752
1761
|
}
|
|
1753
1762
|
if (status === 429) {
|
|
1754
|
-
throw new ApiError("Rate limit exceeded", "RATE_LIMIT", status);
|
|
1763
|
+
throw new ApiError("Rate limit exceeded", "RATE_LIMIT", status, void 0, { cause: error });
|
|
1755
1764
|
}
|
|
1756
1765
|
throw new ApiError(
|
|
1757
1766
|
`WHO API error: ${message}`,
|
|
1758
1767
|
"API_ERROR",
|
|
1759
1768
|
status,
|
|
1760
|
-
error.data
|
|
1769
|
+
error.data,
|
|
1770
|
+
{ cause: error }
|
|
1761
1771
|
);
|
|
1762
1772
|
}
|
|
1763
1773
|
throw error;
|
|
@@ -2021,11 +2031,14 @@ var provenanceContext = createProvenanceContext({
|
|
|
2021
2031
|
locale: "en",
|
|
2022
2032
|
timezone: "utc",
|
|
2023
2033
|
defaultMode: "concise",
|
|
2024
|
-
// Contract 1.
|
|
2025
|
-
//
|
|
2026
|
-
//
|
|
2027
|
-
//
|
|
2028
|
-
|
|
2034
|
+
// Contract 1.3 since step two of it (the imported schema accepted 1.3 since
|
|
2035
|
+
// 2.2.0): the concise block carries `revision` always (every preset sets
|
|
2036
|
+
// it), `notices` when the source has a caveat about the DATA, and `derived`
|
|
2037
|
+
// + `derivation_note` when this server computed — absent, not empty, when
|
|
2038
|
+
// there is nothing to say. License statements are NOT notices: they live in
|
|
2039
|
+
// NOTICE.md, the README and `info://licenses`. This server never passes
|
|
2040
|
+
// `field_sources` (1.2) — multi-source responses carry one block per source.
|
|
2041
|
+
contractVersion: "1.3"
|
|
2029
2042
|
});
|
|
2030
2043
|
var PROVENANCE_META_KEY = provenanceContext.metaKeys.provenance;
|
|
2031
2044
|
var ATTRIBUTION_META_KEY = provenanceContext.metaKeys.attribution;
|
|
@@ -2049,9 +2062,10 @@ var MEDICAL_SOURCES = {
|
|
|
2049
2062
|
// §1.3 of the ICD-11 license fixes this citation; the retrieval clause
|
|
2050
2063
|
// is additive (marked as ours per §1.2.5).
|
|
2051
2064
|
citation: (date) => `International Classification of Diseases, Eleventh Revision (ICD-11), World Health Organization (WHO) 2019. https://icd.who.int/browse11. Licensed under the Creative Commons Attribution-NoDerivatives 3.0 IGO licence (CC BY-ND 3.0 IGO). Retrieved via the WHO ICD-API on ${date}.`,
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2065
|
+
// Verbatim service with code, title and URI (license §1.2.2–1.2.3) is how
|
|
2066
|
+
// this server complies with the license — stated in `info://licenses`, not
|
|
2067
|
+
// a caveat about the data.
|
|
2068
|
+
notices: [],
|
|
2055
2069
|
cachePrefixes: ["icd11"],
|
|
2056
2070
|
defaultVintage: () => getEnv("WHO_ICD11_RELEASE_ID") ?? WHO_ICD11_DEFAULT_RELEASE,
|
|
2057
2071
|
revision: { status: "current", note: "WHO publishes a new ICD-11 release annually (usually Jan-Feb); this server queries one pinned release." }
|
|
@@ -2111,7 +2125,7 @@ var MEDICAL_SOURCES = {
|
|
|
2111
2125
|
verified_at: VERIFIED_AT
|
|
2112
2126
|
},
|
|
2113
2127
|
citation: (date) => `RxNorm, U.S. National Library of Medicine. Retrieved via the NLM RxNav API on ${date}.`,
|
|
2114
|
-
notices: [
|
|
2128
|
+
notices: [],
|
|
2115
2129
|
cachePrefixes: ["rxnorm"],
|
|
2116
2130
|
defaultVintage: () => null,
|
|
2117
2131
|
revision: { status: "current", note: "RxNorm is released monthly (first Monday); concepts update with each release." }
|
|
@@ -2130,7 +2144,7 @@ var MEDICAL_SOURCES = {
|
|
|
2130
2144
|
verified_at: VERIFIED_AT
|
|
2131
2145
|
},
|
|
2132
2146
|
citation: (date) => `ATC classification \xA9 WHO Collaborating Centre for Drug Statistics Methodology, served via NLM RxClass. Retrieved on ${date}.`,
|
|
2133
|
-
notices: [
|
|
2147
|
+
notices: [],
|
|
2134
2148
|
// ATC shares the RxNorm client/host, so its accesses land on the same
|
|
2135
2149
|
// cache prefix; the aggregation is per-host, which is honest here.
|
|
2136
2150
|
cachePrefixes: ["rxnorm"],
|
|
@@ -2145,13 +2159,13 @@ var MEDICAL_SOURCES = {
|
|
|
2145
2159
|
sourceUrl: () => "https://id.nlm.nih.gov/mesh",
|
|
2146
2160
|
license: {
|
|
2147
2161
|
id: null,
|
|
2148
|
-
name:
|
|
2162
|
+
name: "NLM Terms and Conditions \u2014 MeSH is a U.S. government work, free of charge",
|
|
2149
2163
|
url: null,
|
|
2150
2164
|
terms_url: "https://www.nlm.nih.gov/databases/download/terms_and_conditions.html",
|
|
2151
2165
|
verified_at: VERIFIED_AT
|
|
2152
2166
|
},
|
|
2153
|
-
citation: (date) => `MeSH (Medical Subject Headings)
|
|
2154
|
-
notices: [
|
|
2167
|
+
citation: (date) => `MeSH (Medical Subject Headings), U.S. National Library of Medicine. Retrieved via the MeSH Linked Data API on ${date}.`,
|
|
2168
|
+
notices: [],
|
|
2155
2169
|
cachePrefixes: ["mesh"],
|
|
2156
2170
|
defaultVintage: () => null,
|
|
2157
2171
|
revision: { status: "current", note: "MeSH is released annually (November)." }
|
|
@@ -2170,7 +2184,7 @@ var MEDICAL_SOURCES = {
|
|
|
2170
2184
|
verified_at: VERIFIED_AT
|
|
2171
2185
|
},
|
|
2172
2186
|
citation: (date) => `LOINC content retrieved via the NLM Clinical Tables API on ${date}. ${LOINC_NOTICE}`,
|
|
2173
|
-
notices: [
|
|
2187
|
+
notices: [],
|
|
2174
2188
|
cachePrefixes: ["loinc"],
|
|
2175
2189
|
defaultVintage: () => null,
|
|
2176
2190
|
revision: { status: "current", note: "LOINC is released bi-annually; the release served varies by NLM update cycle." }
|
|
@@ -2256,7 +2270,7 @@ var BLOCK_DESCRIPTIONS = {
|
|
|
2256
2270
|
citation: "Ready-to-use citation/attribution string",
|
|
2257
2271
|
license: "License / legal regime of the data",
|
|
2258
2272
|
field_sources: "Present only when the response joins parts from different origins or extraction instants: for each group of fields, its URL, extraction instant and whether it came from cache. Absent in single-origin responses",
|
|
2259
|
-
notices: "
|
|
2273
|
+
notices: "Caveats the source publishes about the data, verbatim (license statements are not repeated here; see the info://licenses resource). Absent when there is none",
|
|
2260
2274
|
derived: "Present (true) only when this server computed the value (e.g. a ranking or summary statistics) instead of passing on what the source returned",
|
|
2261
2275
|
derivation_note: "What this server computed; present together with derived",
|
|
2262
2276
|
revision: "Whether the data can still change at the source: current = the version in force, the source may revise it; provisional = preliminary; final = will not change. Absent when unknown"
|
|
@@ -2760,16 +2774,17 @@ var NLMClient = class {
|
|
|
2760
2774
|
const status = error.status;
|
|
2761
2775
|
const message = extractErrorMessage(error);
|
|
2762
2776
|
if (status === 404) {
|
|
2763
|
-
throw new ApiError(`Resource not found`, "NOT_FOUND", status);
|
|
2777
|
+
throw new ApiError(`Resource not found`, "NOT_FOUND", status, void 0, { cause: error });
|
|
2764
2778
|
}
|
|
2765
2779
|
if (status === 429) {
|
|
2766
|
-
throw new ApiError("Rate limit exceeded", "RATE_LIMIT", status);
|
|
2780
|
+
throw new ApiError("Rate limit exceeded", "RATE_LIMIT", status, void 0, { cause: error });
|
|
2767
2781
|
}
|
|
2768
2782
|
throw new ApiError(
|
|
2769
2783
|
`NLM API error: ${message}`,
|
|
2770
2784
|
"API_ERROR",
|
|
2771
2785
|
status,
|
|
2772
|
-
error.data
|
|
2786
|
+
error.data,
|
|
2787
|
+
{ cause: error }
|
|
2773
2788
|
);
|
|
2774
2789
|
}
|
|
2775
2790
|
throw error;
|
|
@@ -3300,16 +3315,17 @@ var RxNormClient = class {
|
|
|
3300
3315
|
const status = error.status;
|
|
3301
3316
|
const message = extractErrorMessage(error);
|
|
3302
3317
|
if (status === 404) {
|
|
3303
|
-
throw new ApiError(`Resource not found`, "NOT_FOUND", status);
|
|
3318
|
+
throw new ApiError(`Resource not found`, "NOT_FOUND", status, void 0, { cause: error });
|
|
3304
3319
|
}
|
|
3305
3320
|
if (status === 429) {
|
|
3306
|
-
throw new ApiError("Rate limit exceeded", "RATE_LIMIT", status);
|
|
3321
|
+
throw new ApiError("Rate limit exceeded", "RATE_LIMIT", status, void 0, { cause: error });
|
|
3307
3322
|
}
|
|
3308
3323
|
throw new ApiError(
|
|
3309
3324
|
`RxNorm API error: ${message}`,
|
|
3310
3325
|
"API_ERROR",
|
|
3311
3326
|
status,
|
|
3312
|
-
error.data
|
|
3327
|
+
error.data,
|
|
3328
|
+
{ cause: error }
|
|
3313
3329
|
);
|
|
3314
3330
|
}
|
|
3315
3331
|
throw error;
|
|
@@ -4189,16 +4205,17 @@ var MeSHClient = class {
|
|
|
4189
4205
|
const status = error.status;
|
|
4190
4206
|
const message = extractErrorMessage(error);
|
|
4191
4207
|
if (status === 404) {
|
|
4192
|
-
throw new ApiError("Resource not found", "NOT_FOUND", status);
|
|
4208
|
+
throw new ApiError("Resource not found", "NOT_FOUND", status, void 0, { cause: error });
|
|
4193
4209
|
}
|
|
4194
4210
|
if (status === 429) {
|
|
4195
|
-
throw new ApiError("Rate limit exceeded", "RATE_LIMIT", status);
|
|
4211
|
+
throw new ApiError("Rate limit exceeded", "RATE_LIMIT", status, void 0, { cause: error });
|
|
4196
4212
|
}
|
|
4197
4213
|
throw new ApiError(
|
|
4198
4214
|
`MeSH API error: ${message}`,
|
|
4199
4215
|
"API_ERROR",
|
|
4200
4216
|
status,
|
|
4201
|
-
error.data
|
|
4217
|
+
error.data,
|
|
4218
|
+
{ cause: error }
|
|
4202
4219
|
);
|
|
4203
4220
|
}
|
|
4204
4221
|
throw error;
|
|
@@ -7311,7 +7328,8 @@ with the server** (CID-10 V2008 and the WHO ICD-10 \u2192 ICD-11 transition
|
|
|
7311
7328
|
tables), which are NOT covered by the MIT license. Every successful tool
|
|
7312
7329
|
response carries a provenance block (source, URL, data vintage,
|
|
7313
7330
|
extraction instant, citation, license); this resource is the
|
|
7314
|
-
consolidated notice for the hosted service
|
|
7331
|
+
consolidated notice for the hosted service \u2014 the license statements below
|
|
7332
|
+
are not repeated in each response's notices. The full text ships as
|
|
7315
7333
|
NOTICE.md in the npm package.
|
|
7316
7334
|
|
|
7317
7335
|
## ICD-11 (WHO)
|
|
@@ -7369,12 +7387,15 @@ NOTICE.md in the npm package.
|
|
|
7369
7387
|
- ATC classification \xA9 WHO Collaborating Centre for Drug Statistics
|
|
7370
7388
|
Methodology (https://atcddd.fhi.no/); retrieved via NLM RxClass and
|
|
7371
7389
|
served verbatim. This server never redistributes the WHOCC ATC/DDD
|
|
7372
|
-
index itself.
|
|
7390
|
+
index itself. The NLM statement in the RxNorm section applies to the
|
|
7391
|
+
RxClass channel as well.
|
|
7373
7392
|
- No authentication required to query.
|
|
7374
7393
|
|
|
7375
7394
|
## MeSH (US National Library of Medicine)
|
|
7376
|
-
- U.S. government work under the NLM Terms and Conditions
|
|
7377
|
-
|
|
7395
|
+
- U.S. government work under the NLM Terms and Conditions
|
|
7396
|
+
(https://www.nlm.nih.gov/databases/download/terms_and_conditions.html),
|
|
7397
|
+
free of charge. The NLM statement in the RxNorm section applies to this
|
|
7398
|
+
channel as well; no endorsement by NLM is implied.
|
|
7378
7399
|
- No authentication required.
|
|
7379
7400
|
|
|
7380
7401
|
## Important caveat for LLM use
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "medical-terminologies-mcp",
|
|
3
3
|
"mcpName": "io.github.SidneyBissoli/medical-terminologies-mcp",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.0",
|
|
5
5
|
"description": "Unified MCP server for six medical terminologies (ICD-11, LOINC, RxNorm, MeSH, ATC, CID-10) with authoritative WHO ICD-10→ICD-11 mapping. 33 tools, hosted endpoint available, MIT.",
|
|
6
6
|
"author": "Sidney da Silva Pereira Bissoli",
|
|
7
7
|
"license": "MIT",
|
|
@@ -61,17 +61,18 @@
|
|
|
61
61
|
"@modelcontextprotocol/server": "^2.0.0",
|
|
62
62
|
"@sbissoli/mcp-provenance": "^0.4.0",
|
|
63
63
|
"@sbissoli/mcp-search": "^0.9.0",
|
|
64
|
-
"@sbissoli/mcp-upstream": "^0.
|
|
64
|
+
"@sbissoli/mcp-upstream": "^0.5.1",
|
|
65
65
|
"pino": "^10.2.1",
|
|
66
66
|
"zod": "^4.5.4"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@modelcontextprotocol/client": "^2.0.0",
|
|
70
70
|
"@sbissoli/mcp-evals": "^0.2.1",
|
|
71
|
-
"@sbissoli/mcp-
|
|
71
|
+
"@sbissoli/mcp-live-source": "^0.5.0",
|
|
72
|
+
"@sbissoli/mcp-surface": "^0.6.0",
|
|
72
73
|
"@types/node": "^26.5.1",
|
|
73
74
|
"esbuild": "^0.28.2",
|
|
74
|
-
"nock": "^
|
|
75
|
+
"nock": "^15.0.1",
|
|
75
76
|
"pino-pretty": "^13.1.3",
|
|
76
77
|
"tsx": "^4.23.13",
|
|
77
78
|
"typescript": "^7.0.2",
|