medical-terminologies-mcp 4.3.1 → 4.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +48 -40
  2. package/package.json +4 -2
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: "4.3.1",
33
+ version: "4.3.3",
34
34
  description: "Unified MCP server for seven medical terminologies (ICD-11, ICF, LOINC, RxNorm, MeSH, ATC, CID-10) with authoritative WHO ICD-10\u2192ICD-11 mapping. 37 tools, hosted endpoint available, MIT.",
35
35
  author: "Sidney da Silva Pereira Bissoli",
36
36
  license: "MIT",
@@ -84,7 +84,9 @@ var package_default = {
84
84
  typecheck: "tsc --noEmit",
85
85
  prepublishOnly: "npm run build",
86
86
  "build:worker-lib": 'esbuild src/worker-lib.ts --bundle --platform=browser --target=es2022 --format=esm --outfile=dist/worker-lib.js --tree-shaking=false --conditions=workerd,browser --define:process.env.NODE_ENV=\\"production\\" --external:node:* --external:cloudflare:* --external:@modelcontextprotocol/* --external:zod --alias:events=node:events --alias:stream=node:stream --alias:buffer=node:buffer --alias:util=node:util --alias:path=node:path --alias:os=node:os --alias:fs=node:fs --alias:url=node:url --alias:crypto=node:crypto',
87
- "manifest:lhm": "node scripts/gen-lhm-manifest.mjs"
87
+ "manifest:lhm": "node scripts/gen-lhm-manifest.mjs",
88
+ "fixtures:record": "tsx scripts/record-tool-fixtures.ts",
89
+ "eval:answers": "tsx src/evals/run-answers.ts"
88
90
  },
89
91
  dependencies: {
90
92
  "@modelcontextprotocol/server": "^2.0.0",
@@ -4096,7 +4098,8 @@ var RxNormClient = class {
4096
4098
  }
4097
4099
  }
4098
4100
  }
4099
- return ingredients;
4101
+ const singleIngredient = ingredients.filter((i) => i.tty === "IN").length <= 1;
4102
+ return singleIngredient ? ingredients.filter((i) => i.tty !== "MIN") : ingredients;
4100
4103
  },
4101
4104
  DEFAULT_TTL.LOOKUP
4102
4105
  );
@@ -5105,21 +5108,21 @@ var MeSHClient = class {
5105
5108
  async fetchTermLabel(uri, language) {
5106
5109
  const lang = language ?? "en";
5107
5110
  const cacheKey = `mesh:term:label:${uri}:${lang}`;
5108
- return cache.getOrSet(
5109
- CACHE_PREFIX.MESH,
5110
- cacheKey,
5111
- async () => {
5112
- try {
5113
- const path = uriToPath(uri);
5114
- if (!path) return "";
5111
+ const path = uriToPath(uri);
5112
+ if (!path) return "";
5113
+ try {
5114
+ return await cache.getOrSet(
5115
+ CACHE_PREFIX.MESH,
5116
+ cacheKey,
5117
+ async () => {
5115
5118
  const raw = await this.request(path, {}, language);
5116
5119
  return this.extractValue(raw?.prefLabel, language) || this.extractValue(raw?.label, language);
5117
- } catch {
5118
- return "";
5119
- }
5120
- },
5121
- DEFAULT_TTL.STATIC
5122
- );
5120
+ },
5121
+ DEFAULT_TTL.STATIC
5122
+ );
5123
+ } catch {
5124
+ return "";
5125
+ }
5123
5126
  }
5124
5127
  /**
5125
5128
  * Fetches a tree number resource. The "label" of a tree number IS the
@@ -5129,21 +5132,22 @@ var MeSHClient = class {
5129
5132
  async fetchTreeNumberLabel(uri, language) {
5130
5133
  const lang = language ?? "en";
5131
5134
  const cacheKey = `mesh:tree:label:${uri}:${lang}`;
5132
- return cache.getOrSet(
5133
- CACHE_PREFIX.MESH,
5134
- cacheKey,
5135
- async () => {
5136
- try {
5137
- const path = uriToPath(uri);
5138
- if (!path) return "";
5135
+ const path = uriToPath(uri);
5136
+ if (!path) return "";
5137
+ try {
5138
+ const label = await cache.getOrSet(
5139
+ CACHE_PREFIX.MESH,
5140
+ cacheKey,
5141
+ async () => {
5139
5142
  const raw = await this.request(path, {}, language);
5140
5143
  return this.extractValue(raw?.label, language);
5141
- } catch {
5142
- return "";
5143
- }
5144
- },
5145
- DEFAULT_TTL.STATIC
5146
- );
5144
+ },
5145
+ DEFAULT_TTL.STATIC
5146
+ );
5147
+ return label || treeNumberFromUri(uri);
5148
+ } catch {
5149
+ return treeNumberFromUri(uri);
5150
+ }
5147
5151
  }
5148
5152
  /**
5149
5153
  * Fetches a qualifier's label. STATIC TTL — qualifiers are part of
@@ -5153,23 +5157,23 @@ var MeSHClient = class {
5153
5157
  async fetchQualifierLabel(qualifierId, language) {
5154
5158
  const lang = language ?? "en";
5155
5159
  const cacheKey = `mesh:qlabel:${qualifierId}:${lang}`;
5156
- return cache.getOrSet(
5157
- CACHE_PREFIX.MESH,
5158
- cacheKey,
5159
- async () => {
5160
- try {
5160
+ try {
5161
+ return await cache.getOrSet(
5162
+ CACHE_PREFIX.MESH,
5163
+ cacheKey,
5164
+ async () => {
5161
5165
  const raw = await this.request(
5162
5166
  `/${qualifierId}.json`,
5163
5167
  {},
5164
5168
  language
5165
5169
  );
5166
5170
  return this.extractValue(raw?.label, language);
5167
- } catch {
5168
- return "";
5169
- }
5170
- },
5171
- DEFAULT_TTL.STATIC
5172
- );
5171
+ },
5172
+ DEFAULT_TTL.STATIC
5173
+ );
5174
+ } catch {
5175
+ return "";
5176
+ }
5173
5177
  }
5174
5178
  // ===========================================================================
5175
5179
  // Internal: resolvers (fan-out across multiple sub-resources in parallel)
@@ -5263,6 +5267,10 @@ function toUriArray(v) {
5263
5267
  if (Array.isArray(v)) return v.filter((x) => typeof x === "string");
5264
5268
  return [];
5265
5269
  }
5270
+ function treeNumberFromUri(uri) {
5271
+ const tail = uri.replace(/^https?:\/\/id\.nlm\.nih\.gov\/mesh\//, "");
5272
+ return /^[A-Z]\d{2}(\.\d{3})*$/.test(tail) ? tail : "";
5273
+ }
5266
5274
  function uriToPath(uri) {
5267
5275
  if (!uri) return "";
5268
5276
  const stripped = uri.replace(/^https?:\/\/id\.nlm\.nih\.gov\/mesh/, "");
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": "4.3.1",
4
+ "version": "4.3.3",
5
5
  "description": "Unified MCP server for seven medical terminologies (ICD-11, ICF, LOINC, RxNorm, MeSH, ATC, CID-10) with authoritative WHO ICD-10→ICD-11 mapping. 37 tools, hosted endpoint available, MIT.",
6
6
  "author": "Sidney da Silva Pereira Bissoli",
7
7
  "license": "MIT",
@@ -55,7 +55,9 @@
55
55
  "typecheck": "tsc --noEmit",
56
56
  "prepublishOnly": "npm run build",
57
57
  "build:worker-lib": "esbuild src/worker-lib.ts --bundle --platform=browser --target=es2022 --format=esm --outfile=dist/worker-lib.js --tree-shaking=false --conditions=workerd,browser --define:process.env.NODE_ENV=\\\"production\\\" --external:node:* --external:cloudflare:* --external:@modelcontextprotocol/* --external:zod --alias:events=node:events --alias:stream=node:stream --alias:buffer=node:buffer --alias:util=node:util --alias:path=node:path --alias:os=node:os --alias:fs=node:fs --alias:url=node:url --alias:crypto=node:crypto",
58
- "manifest:lhm": "node scripts/gen-lhm-manifest.mjs"
58
+ "manifest:lhm": "node scripts/gen-lhm-manifest.mjs",
59
+ "fixtures:record": "tsx scripts/record-tool-fixtures.ts",
60
+ "eval:answers": "tsx src/evals/run-answers.ts"
59
61
  },
60
62
  "dependencies": {
61
63
  "@modelcontextprotocol/server": "^2.0.0",