@cyanheads/pubmed-mcp-server 2.1.5 → 2.1.6

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 +286 -316
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -135928,7 +135928,7 @@ config(en_default());
135928
135928
  // package.json
135929
135929
  var package_default = {
135930
135930
  name: "@cyanheads/pubmed-mcp-server",
135931
- version: "2.1.5",
135931
+ version: "2.1.6",
135932
135932
  mcpName: "io.github.cyanheads/pubmed-mcp-server",
135933
135933
  description: "MCP server for PubMed/NCBI E-utilities integration. Search articles, fetch metadata, generate citations, explore MeSH terms, and discover related research.",
135934
135934
  main: "dist/index.js",
@@ -136026,7 +136026,7 @@ var package_default = {
136026
136026
  depcheck: "^1.4.7",
136027
136027
  diff: "^8.0.3",
136028
136028
  execa: "^9.6.1",
136029
- "fast-check": "^4.5.3",
136029
+ "fast-check": "^4.6.0",
136030
136030
  husky: "^9.1.7",
136031
136031
  ignore: "^7.0.5",
136032
136032
  msw: "^2.12.10",
@@ -136093,7 +136093,7 @@ var package_default = {
136093
136093
  dotenv: "^17.3.1",
136094
136094
  "fast-xml-parser": "^5.4.2",
136095
136095
  hono: "^4.12.5",
136096
- jose: "^6.2.0",
136096
+ jose: "^6.2.1",
136097
136097
  "js-yaml": "^4.1.1",
136098
136098
  "node-cron": "^4.2.1",
136099
136099
  papaparse: "^5.5.3",
@@ -156618,12 +156618,7 @@ function createMcpToolHandler({
156618
156618
  });
156619
156619
  return {
156620
156620
  isError: true,
156621
- content: [{ type: "text", text: `Error: ${mcpError.message}` }],
156622
- structuredContent: {
156623
- code: mcpError.code,
156624
- message: mcpError.message,
156625
- data: mcpError.data
156626
- }
156621
+ content: [{ type: "text", text: `Error: ${mcpError.message}` }]
156627
156622
  };
156628
156623
  }
156629
156624
  };
@@ -160074,107 +160069,17 @@ function decode3(input) {
160074
160069
  }
160075
160070
  }
160076
160071
 
160077
- // node_modules/jose/dist/webapi/util/errors.js
160078
- class JOSEError extends Error {
160079
- static code = "ERR_JOSE_GENERIC";
160080
- code = "ERR_JOSE_GENERIC";
160081
- constructor(message, options) {
160082
- super(message, options);
160083
- this.name = this.constructor.name;
160084
- Error.captureStackTrace?.(this, this.constructor);
160085
- }
160086
- }
160087
-
160088
- class JWTClaimValidationFailed extends JOSEError {
160089
- static code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
160090
- code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
160091
- claim;
160092
- reason;
160093
- payload;
160094
- constructor(message, payload, claim = "unspecified", reason = "unspecified") {
160095
- super(message, { cause: { claim, reason, payload } });
160096
- this.claim = claim;
160097
- this.reason = reason;
160098
- this.payload = payload;
160099
- }
160100
- }
160101
-
160102
- class JWTExpired extends JOSEError {
160103
- static code = "ERR_JWT_EXPIRED";
160104
- code = "ERR_JWT_EXPIRED";
160105
- claim;
160106
- reason;
160107
- payload;
160108
- constructor(message, payload, claim = "unspecified", reason = "unspecified") {
160109
- super(message, { cause: { claim, reason, payload } });
160110
- this.claim = claim;
160111
- this.reason = reason;
160112
- this.payload = payload;
160113
- }
160114
- }
160115
-
160116
- class JOSEAlgNotAllowed extends JOSEError {
160117
- static code = "ERR_JOSE_ALG_NOT_ALLOWED";
160118
- code = "ERR_JOSE_ALG_NOT_ALLOWED";
160119
- }
160120
-
160121
- class JOSENotSupported extends JOSEError {
160122
- static code = "ERR_JOSE_NOT_SUPPORTED";
160123
- code = "ERR_JOSE_NOT_SUPPORTED";
160124
- }
160125
- class JWSInvalid extends JOSEError {
160126
- static code = "ERR_JWS_INVALID";
160127
- code = "ERR_JWS_INVALID";
160128
- }
160129
-
160130
- class JWTInvalid extends JOSEError {
160131
- static code = "ERR_JWT_INVALID";
160132
- code = "ERR_JWT_INVALID";
160133
- }
160134
- class JWKSInvalid extends JOSEError {
160135
- static code = "ERR_JWKS_INVALID";
160136
- code = "ERR_JWKS_INVALID";
160137
- }
160138
-
160139
- class JWKSNoMatchingKey extends JOSEError {
160140
- static code = "ERR_JWKS_NO_MATCHING_KEY";
160141
- code = "ERR_JWKS_NO_MATCHING_KEY";
160142
- constructor(message = "no applicable key found in the JSON Web Key Set", options) {
160143
- super(message, options);
160144
- }
160145
- }
160146
-
160147
- class JWKSMultipleMatchingKeys extends JOSEError {
160148
- [Symbol.asyncIterator];
160149
- static code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
160150
- code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
160151
- constructor(message = "multiple matching keys found in the JSON Web Key Set", options) {
160152
- super(message, options);
160153
- }
160154
- }
160155
-
160156
- class JWKSTimeout extends JOSEError {
160157
- static code = "ERR_JWKS_TIMEOUT";
160158
- code = "ERR_JWKS_TIMEOUT";
160159
- constructor(message = "request timed out", options) {
160160
- super(message, options);
160161
- }
160162
- }
160163
-
160164
- class JWSSignatureVerificationFailed extends JOSEError {
160165
- static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
160166
- code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
160167
- constructor(message = "signature verification failed", options) {
160168
- super(message, options);
160169
- }
160170
- }
160171
-
160172
160072
  // node_modules/jose/dist/webapi/lib/crypto_key.js
160173
160073
  var unusable = (name2, prop = "algorithm.name") => new TypeError(`CryptoKey does not support this operation, its ${prop} must be ${name2}`);
160174
160074
  var isAlgorithm = (algorithm, name2) => algorithm.name === name2;
160175
160075
  function getHashLength(hash2) {
160176
160076
  return parseInt(hash2.name.slice(4), 10);
160177
160077
  }
160078
+ function checkHashLength(algorithm, expected) {
160079
+ const actual = getHashLength(algorithm.hash);
160080
+ if (actual !== expected)
160081
+ throw unusable(`SHA-${expected}`, "algorithm.hash");
160082
+ }
160178
160083
  function getNamedCurve(alg) {
160179
160084
  switch (alg) {
160180
160085
  case "ES256":
@@ -160199,10 +160104,7 @@ function checkSigCryptoKey(key, alg, usage) {
160199
160104
  case "HS512": {
160200
160105
  if (!isAlgorithm(key.algorithm, "HMAC"))
160201
160106
  throw unusable("HMAC");
160202
- const expected = parseInt(alg.slice(2), 10);
160203
- const actual = getHashLength(key.algorithm.hash);
160204
- if (actual !== expected)
160205
- throw unusable(`SHA-${expected}`, "algorithm.hash");
160107
+ checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
160206
160108
  break;
160207
160109
  }
160208
160110
  case "RS256":
@@ -160210,10 +160112,7 @@ function checkSigCryptoKey(key, alg, usage) {
160210
160112
  case "RS512": {
160211
160113
  if (!isAlgorithm(key.algorithm, "RSASSA-PKCS1-v1_5"))
160212
160114
  throw unusable("RSASSA-PKCS1-v1_5");
160213
- const expected = parseInt(alg.slice(2), 10);
160214
- const actual = getHashLength(key.algorithm.hash);
160215
- if (actual !== expected)
160216
- throw unusable(`SHA-${expected}`, "algorithm.hash");
160115
+ checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
160217
160116
  break;
160218
160117
  }
160219
160118
  case "PS256":
@@ -160221,10 +160120,7 @@ function checkSigCryptoKey(key, alg, usage) {
160221
160120
  case "PS512": {
160222
160121
  if (!isAlgorithm(key.algorithm, "RSA-PSS"))
160223
160122
  throw unusable("RSA-PSS");
160224
- const expected = parseInt(alg.slice(2), 10);
160225
- const actual = getHashLength(key.algorithm.hash);
160226
- if (actual !== expected)
160227
- throw unusable(`SHA-${expected}`, "algorithm.hash");
160123
+ checkHashLength(key.algorithm, parseInt(alg.slice(2), 10));
160228
160124
  break;
160229
160125
  }
160230
160126
  case "Ed25519":
@@ -160282,6 +160178,101 @@ function message(msg, actual, ...types2) {
160282
160178
  var invalidKeyInput = (actual, ...types2) => message("Key must be ", actual, ...types2);
160283
160179
  var withAlg = (alg, actual, ...types2) => message(`Key for the ${alg} algorithm must be `, actual, ...types2);
160284
160180
 
160181
+ // node_modules/jose/dist/webapi/util/errors.js
160182
+ class JOSEError extends Error {
160183
+ static code = "ERR_JOSE_GENERIC";
160184
+ code = "ERR_JOSE_GENERIC";
160185
+ constructor(message2, options) {
160186
+ super(message2, options);
160187
+ this.name = this.constructor.name;
160188
+ Error.captureStackTrace?.(this, this.constructor);
160189
+ }
160190
+ }
160191
+
160192
+ class JWTClaimValidationFailed extends JOSEError {
160193
+ static code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
160194
+ code = "ERR_JWT_CLAIM_VALIDATION_FAILED";
160195
+ claim;
160196
+ reason;
160197
+ payload;
160198
+ constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
160199
+ super(message2, { cause: { claim, reason, payload } });
160200
+ this.claim = claim;
160201
+ this.reason = reason;
160202
+ this.payload = payload;
160203
+ }
160204
+ }
160205
+
160206
+ class JWTExpired extends JOSEError {
160207
+ static code = "ERR_JWT_EXPIRED";
160208
+ code = "ERR_JWT_EXPIRED";
160209
+ claim;
160210
+ reason;
160211
+ payload;
160212
+ constructor(message2, payload, claim = "unspecified", reason = "unspecified") {
160213
+ super(message2, { cause: { claim, reason, payload } });
160214
+ this.claim = claim;
160215
+ this.reason = reason;
160216
+ this.payload = payload;
160217
+ }
160218
+ }
160219
+
160220
+ class JOSEAlgNotAllowed extends JOSEError {
160221
+ static code = "ERR_JOSE_ALG_NOT_ALLOWED";
160222
+ code = "ERR_JOSE_ALG_NOT_ALLOWED";
160223
+ }
160224
+
160225
+ class JOSENotSupported extends JOSEError {
160226
+ static code = "ERR_JOSE_NOT_SUPPORTED";
160227
+ code = "ERR_JOSE_NOT_SUPPORTED";
160228
+ }
160229
+ class JWSInvalid extends JOSEError {
160230
+ static code = "ERR_JWS_INVALID";
160231
+ code = "ERR_JWS_INVALID";
160232
+ }
160233
+
160234
+ class JWTInvalid extends JOSEError {
160235
+ static code = "ERR_JWT_INVALID";
160236
+ code = "ERR_JWT_INVALID";
160237
+ }
160238
+ class JWKSInvalid extends JOSEError {
160239
+ static code = "ERR_JWKS_INVALID";
160240
+ code = "ERR_JWKS_INVALID";
160241
+ }
160242
+
160243
+ class JWKSNoMatchingKey extends JOSEError {
160244
+ static code = "ERR_JWKS_NO_MATCHING_KEY";
160245
+ code = "ERR_JWKS_NO_MATCHING_KEY";
160246
+ constructor(message2 = "no applicable key found in the JSON Web Key Set", options) {
160247
+ super(message2, options);
160248
+ }
160249
+ }
160250
+
160251
+ class JWKSMultipleMatchingKeys extends JOSEError {
160252
+ [Symbol.asyncIterator];
160253
+ static code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
160254
+ code = "ERR_JWKS_MULTIPLE_MATCHING_KEYS";
160255
+ constructor(message2 = "multiple matching keys found in the JSON Web Key Set", options) {
160256
+ super(message2, options);
160257
+ }
160258
+ }
160259
+
160260
+ class JWKSTimeout extends JOSEError {
160261
+ static code = "ERR_JWKS_TIMEOUT";
160262
+ code = "ERR_JWKS_TIMEOUT";
160263
+ constructor(message2 = "request timed out", options) {
160264
+ super(message2, options);
160265
+ }
160266
+ }
160267
+
160268
+ class JWSSignatureVerificationFailed extends JOSEError {
160269
+ static code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
160270
+ code = "ERR_JWS_SIGNATURE_VERIFICATION_FAILED";
160271
+ constructor(message2 = "signature verification failed", options) {
160272
+ super(message2, options);
160273
+ }
160274
+ }
160275
+
160285
160276
  // node_modules/jose/dist/webapi/lib/is_key_like.js
160286
160277
  var isCryptoKey = (key) => {
160287
160278
  if (key?.[Symbol.toStringTag] === "CryptoKey")
@@ -160295,7 +160286,31 @@ var isCryptoKey = (key) => {
160295
160286
  var isKeyObject = (key) => key?.[Symbol.toStringTag] === "KeyObject";
160296
160287
  var isKeyLike = (key) => isCryptoKey(key) || isKeyObject(key);
160297
160288
 
160298
- // node_modules/jose/dist/webapi/lib/is_disjoint.js
160289
+ // node_modules/jose/dist/webapi/lib/helpers.js
160290
+ var unprotected = Symbol();
160291
+ function decodeBase64url(value, label, ErrorClass) {
160292
+ try {
160293
+ return decode3(value);
160294
+ } catch {
160295
+ throw new ErrorClass(`Failed to base64url decode the ${label}`);
160296
+ }
160297
+ }
160298
+
160299
+ // node_modules/jose/dist/webapi/lib/type_checks.js
160300
+ var isObjectLike = (value) => typeof value === "object" && value !== null;
160301
+ function isObject3(input) {
160302
+ if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
160303
+ return false;
160304
+ }
160305
+ if (Object.getPrototypeOf(input) === null) {
160306
+ return true;
160307
+ }
160308
+ let proto = input;
160309
+ while (Object.getPrototypeOf(proto) !== null) {
160310
+ proto = Object.getPrototypeOf(proto);
160311
+ }
160312
+ return Object.getPrototypeOf(input) === proto;
160313
+ }
160299
160314
  function isDisjoint(...headers) {
160300
160315
  const sources = headers.filter(Boolean);
160301
160316
  if (sources.length === 0 || sources.length === 1) {
@@ -160317,24 +160332,12 @@ function isDisjoint(...headers) {
160317
160332
  }
160318
160333
  return true;
160319
160334
  }
160335
+ var isJWK = (key) => isObject3(key) && typeof key.kty === "string";
160336
+ var isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
160337
+ var isPublicJWK = (key) => key.kty !== "oct" && key.d === undefined && key.priv === undefined;
160338
+ var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
160320
160339
 
160321
- // node_modules/jose/dist/webapi/lib/is_object.js
160322
- var isObjectLike = (value) => typeof value === "object" && value !== null;
160323
- function isObject3(input) {
160324
- if (!isObjectLike(input) || Object.prototype.toString.call(input) !== "[object Object]") {
160325
- return false;
160326
- }
160327
- if (Object.getPrototypeOf(input) === null) {
160328
- return true;
160329
- }
160330
- let proto = input;
160331
- while (Object.getPrototypeOf(proto) !== null) {
160332
- proto = Object.getPrototypeOf(proto);
160333
- }
160334
- return Object.getPrototypeOf(input) === proto;
160335
- }
160336
-
160337
- // node_modules/jose/dist/webapi/lib/check_key_length.js
160340
+ // node_modules/jose/dist/webapi/lib/signing.js
160338
160341
  function checkKeyLength(alg, key) {
160339
160342
  if (alg.startsWith("RS") || alg.startsWith("PS")) {
160340
160343
  const { modulusLength } = key.algorithm;
@@ -160343,8 +160346,59 @@ function checkKeyLength(alg, key) {
160343
160346
  }
160344
160347
  }
160345
160348
  }
160349
+ function subtleAlgorithm(alg, algorithm) {
160350
+ const hash2 = `SHA-${alg.slice(-3)}`;
160351
+ switch (alg) {
160352
+ case "HS256":
160353
+ case "HS384":
160354
+ case "HS512":
160355
+ return { hash: hash2, name: "HMAC" };
160356
+ case "PS256":
160357
+ case "PS384":
160358
+ case "PS512":
160359
+ return { hash: hash2, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
160360
+ case "RS256":
160361
+ case "RS384":
160362
+ case "RS512":
160363
+ return { hash: hash2, name: "RSASSA-PKCS1-v1_5" };
160364
+ case "ES256":
160365
+ case "ES384":
160366
+ case "ES512":
160367
+ return { hash: hash2, name: "ECDSA", namedCurve: algorithm.namedCurve };
160368
+ case "Ed25519":
160369
+ case "EdDSA":
160370
+ return { name: "Ed25519" };
160371
+ case "ML-DSA-44":
160372
+ case "ML-DSA-65":
160373
+ case "ML-DSA-87":
160374
+ return { name: alg };
160375
+ default:
160376
+ throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
160377
+ }
160378
+ }
160379
+ async function getSigKey(alg, key, usage) {
160380
+ if (key instanceof Uint8Array) {
160381
+ if (!alg.startsWith("HS")) {
160382
+ throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
160383
+ }
160384
+ return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
160385
+ }
160386
+ checkSigCryptoKey(key, alg, usage);
160387
+ return key;
160388
+ }
160389
+ async function verify(alg, key, signature, data) {
160390
+ const cryptoKey = await getSigKey(alg, key, "verify");
160391
+ checkKeyLength(alg, cryptoKey);
160392
+ const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
160393
+ try {
160394
+ return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
160395
+ } catch {
160396
+ return false;
160397
+ }
160398
+ }
160346
160399
 
160347
160400
  // node_modules/jose/dist/webapi/lib/jwk_to_key.js
160401
+ var unsupportedAlg = 'Invalid or unsupported JWK "alg" (Algorithm) Parameter value';
160348
160402
  function subtleMapping(jwk) {
160349
160403
  let algorithm;
160350
160404
  let keyUsages;
@@ -160358,7 +160412,7 @@ function subtleMapping(jwk) {
160358
160412
  keyUsages = jwk.priv ? ["sign"] : ["verify"];
160359
160413
  break;
160360
160414
  default:
160361
- throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
160415
+ throw new JOSENotSupported(unsupportedAlg);
160362
160416
  }
160363
160417
  break;
160364
160418
  }
@@ -160387,22 +160441,19 @@ function subtleMapping(jwk) {
160387
160441
  keyUsages = jwk.d ? ["decrypt", "unwrapKey"] : ["encrypt", "wrapKey"];
160388
160442
  break;
160389
160443
  default:
160390
- throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
160444
+ throw new JOSENotSupported(unsupportedAlg);
160391
160445
  }
160392
160446
  break;
160393
160447
  }
160394
160448
  case "EC": {
160395
160449
  switch (jwk.alg) {
160396
160450
  case "ES256":
160397
- algorithm = { name: "ECDSA", namedCurve: "P-256" };
160398
- keyUsages = jwk.d ? ["sign"] : ["verify"];
160399
- break;
160400
160451
  case "ES384":
160401
- algorithm = { name: "ECDSA", namedCurve: "P-384" };
160402
- keyUsages = jwk.d ? ["sign"] : ["verify"];
160403
- break;
160404
160452
  case "ES512":
160405
- algorithm = { name: "ECDSA", namedCurve: "P-521" };
160453
+ algorithm = {
160454
+ name: "ECDSA",
160455
+ namedCurve: { ES256: "P-256", ES384: "P-384", ES512: "P-521" }[jwk.alg]
160456
+ };
160406
160457
  keyUsages = jwk.d ? ["sign"] : ["verify"];
160407
160458
  break;
160408
160459
  case "ECDH-ES":
@@ -160413,7 +160464,7 @@ function subtleMapping(jwk) {
160413
160464
  keyUsages = jwk.d ? ["deriveBits"] : [];
160414
160465
  break;
160415
160466
  default:
160416
- throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
160467
+ throw new JOSENotSupported(unsupportedAlg);
160417
160468
  }
160418
160469
  break;
160419
160470
  }
@@ -160432,7 +160483,7 @@ function subtleMapping(jwk) {
160432
160483
  keyUsages = jwk.d ? ["deriveBits"] : [];
160433
160484
  break;
160434
160485
  default:
160435
- throw new JOSENotSupported('Invalid or unsupported JWK "alg" (Algorithm) Parameter value');
160486
+ throw new JOSENotSupported(unsupportedAlg);
160436
160487
  }
160437
160488
  break;
160438
160489
  }
@@ -160454,91 +160505,8 @@ async function jwkToKey(jwk) {
160454
160505
  return crypto.subtle.importKey("jwk", keyData, algorithm, jwk.ext ?? (jwk.d || jwk.priv ? false : true), jwk.key_ops ?? keyUsages);
160455
160506
  }
160456
160507
 
160457
- // node_modules/jose/dist/webapi/key/import.js
160458
- async function importJWK(jwk, alg, options) {
160459
- if (!isObject3(jwk)) {
160460
- throw new TypeError("JWK must be an object");
160461
- }
160462
- let ext;
160463
- alg ??= jwk.alg;
160464
- ext ??= options?.extractable ?? jwk.ext;
160465
- switch (jwk.kty) {
160466
- case "oct":
160467
- if (typeof jwk.k !== "string" || !jwk.k) {
160468
- throw new TypeError('missing "k" (Key Value) Parameter value');
160469
- }
160470
- return decode3(jwk.k);
160471
- case "RSA":
160472
- if ("oth" in jwk && jwk.oth !== undefined) {
160473
- throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
160474
- }
160475
- return jwkToKey({ ...jwk, alg, ext });
160476
- case "AKP": {
160477
- if (typeof jwk.alg !== "string" || !jwk.alg) {
160478
- throw new TypeError('missing "alg" (Algorithm) Parameter value');
160479
- }
160480
- if (alg !== undefined && alg !== jwk.alg) {
160481
- throw new TypeError("JWK alg and alg option value mismatch");
160482
- }
160483
- return jwkToKey({ ...jwk, ext });
160484
- }
160485
- case "EC":
160486
- case "OKP":
160487
- return jwkToKey({ ...jwk, alg, ext });
160488
- default:
160489
- throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
160490
- }
160491
- }
160492
-
160493
- // node_modules/jose/dist/webapi/lib/validate_crit.js
160494
- function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
160495
- if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {
160496
- throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
160497
- }
160498
- if (!protectedHeader || protectedHeader.crit === undefined) {
160499
- return new Set;
160500
- }
160501
- if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
160502
- throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
160503
- }
160504
- let recognized;
160505
- if (recognizedOption !== undefined) {
160506
- recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
160507
- } else {
160508
- recognized = recognizedDefault;
160509
- }
160510
- for (const parameter of protectedHeader.crit) {
160511
- if (!recognized.has(parameter)) {
160512
- throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
160513
- }
160514
- if (joseHeader[parameter] === undefined) {
160515
- throw new Err(`Extension Header Parameter "${parameter}" is missing`);
160516
- }
160517
- if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
160518
- throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
160519
- }
160520
- }
160521
- return new Set(protectedHeader.crit);
160522
- }
160523
-
160524
- // node_modules/jose/dist/webapi/lib/validate_algorithms.js
160525
- function validateAlgorithms(option, algorithms) {
160526
- if (algorithms !== undefined && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
160527
- throw new TypeError(`"${option}" option must be an array of strings`);
160528
- }
160529
- if (!algorithms) {
160530
- return;
160531
- }
160532
- return new Set(algorithms);
160533
- }
160534
-
160535
- // node_modules/jose/dist/webapi/lib/is_jwk.js
160536
- var isJWK = (key) => isObject3(key) && typeof key.kty === "string";
160537
- var isPrivateJWK = (key) => key.kty !== "oct" && (key.kty === "AKP" && typeof key.priv === "string" || typeof key.d === "string");
160538
- var isPublicJWK = (key) => key.kty !== "oct" && key.d === undefined && key.priv === undefined;
160539
- var isSecretJWK = (key) => key.kty === "oct" && typeof key.k === "string";
160540
-
160541
160508
  // node_modules/jose/dist/webapi/lib/normalize_key.js
160509
+ var unusableForAlg = "given KeyObject instance cannot be used for this algorithm";
160542
160510
  var cache;
160543
160511
  var handleJWK = async (key, jwk, alg, freeze = false) => {
160544
160512
  cache ||= new WeakMap;
@@ -160573,13 +160541,13 @@ var handleKeyObject = (keyObject, alg) => {
160573
160541
  case "ECDH-ES+A256KW":
160574
160542
  break;
160575
160543
  default:
160576
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
160544
+ throw new TypeError(unusableForAlg);
160577
160545
  }
160578
160546
  cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, isPublic ? [] : ["deriveBits"]);
160579
160547
  }
160580
160548
  if (keyObject.asymmetricKeyType === "ed25519") {
160581
160549
  if (alg !== "EdDSA" && alg !== "Ed25519") {
160582
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
160550
+ throw new TypeError(unusableForAlg);
160583
160551
  }
160584
160552
  cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
160585
160553
  isPublic ? "verify" : "sign"
@@ -160590,7 +160558,7 @@ var handleKeyObject = (keyObject, alg) => {
160590
160558
  case "ml-dsa-65":
160591
160559
  case "ml-dsa-87": {
160592
160560
  if (alg !== keyObject.asymmetricKeyType.toUpperCase()) {
160593
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
160561
+ throw new TypeError(unusableForAlg);
160594
160562
  }
160595
160563
  cryptoKey = keyObject.toCryptoKey(keyObject.asymmetricKeyType, extractable, [
160596
160564
  isPublic ? "verify" : "sign"
@@ -160619,7 +160587,7 @@ var handleKeyObject = (keyObject, alg) => {
160619
160587
  hash2 = "SHA-512";
160620
160588
  break;
160621
160589
  default:
160622
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
160590
+ throw new TypeError(unusableForAlg);
160623
160591
  }
160624
160592
  if (alg.startsWith("RSA-OAEP")) {
160625
160593
  return keyObject.toCryptoKey({
@@ -160640,21 +160608,10 @@ var handleKeyObject = (keyObject, alg) => {
160640
160608
  ]);
160641
160609
  const namedCurve = nist.get(keyObject.asymmetricKeyDetails?.namedCurve);
160642
160610
  if (!namedCurve) {
160643
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
160611
+ throw new TypeError(unusableForAlg);
160644
160612
  }
160645
- if (alg === "ES256" && namedCurve === "P-256") {
160646
- cryptoKey = keyObject.toCryptoKey({
160647
- name: "ECDSA",
160648
- namedCurve
160649
- }, extractable, [isPublic ? "verify" : "sign"]);
160650
- }
160651
- if (alg === "ES384" && namedCurve === "P-384") {
160652
- cryptoKey = keyObject.toCryptoKey({
160653
- name: "ECDSA",
160654
- namedCurve
160655
- }, extractable, [isPublic ? "verify" : "sign"]);
160656
- }
160657
- if (alg === "ES512" && namedCurve === "P-521") {
160613
+ const expectedCurve = { ES256: "P-256", ES384: "P-384", ES512: "P-521" };
160614
+ if (expectedCurve[alg] && namedCurve === expectedCurve[alg]) {
160658
160615
  cryptoKey = keyObject.toCryptoKey({
160659
160616
  name: "ECDSA",
160660
160617
  namedCurve
@@ -160668,7 +160625,7 @@ var handleKeyObject = (keyObject, alg) => {
160668
160625
  }
160669
160626
  }
160670
160627
  if (!cryptoKey) {
160671
- throw new TypeError("given KeyObject instance cannot be used for this algorithm");
160628
+ throw new TypeError(unusableForAlg);
160672
160629
  }
160673
160630
  if (!cached2) {
160674
160631
  cache.set(keyObject, { [alg]: cryptoKey });
@@ -160709,6 +160666,84 @@ async function normalizeKey(key, alg) {
160709
160666
  throw new Error("unreachable");
160710
160667
  }
160711
160668
 
160669
+ // node_modules/jose/dist/webapi/key/import.js
160670
+ async function importJWK(jwk, alg, options) {
160671
+ if (!isObject3(jwk)) {
160672
+ throw new TypeError("JWK must be an object");
160673
+ }
160674
+ let ext;
160675
+ alg ??= jwk.alg;
160676
+ ext ??= options?.extractable ?? jwk.ext;
160677
+ switch (jwk.kty) {
160678
+ case "oct":
160679
+ if (typeof jwk.k !== "string" || !jwk.k) {
160680
+ throw new TypeError('missing "k" (Key Value) Parameter value');
160681
+ }
160682
+ return decode3(jwk.k);
160683
+ case "RSA":
160684
+ if ("oth" in jwk && jwk.oth !== undefined) {
160685
+ throw new JOSENotSupported('RSA JWK "oth" (Other Primes Info) Parameter value is not supported');
160686
+ }
160687
+ return jwkToKey({ ...jwk, alg, ext });
160688
+ case "AKP": {
160689
+ if (typeof jwk.alg !== "string" || !jwk.alg) {
160690
+ throw new TypeError('missing "alg" (Algorithm) Parameter value');
160691
+ }
160692
+ if (alg !== undefined && alg !== jwk.alg) {
160693
+ throw new TypeError("JWK alg and alg option value mismatch");
160694
+ }
160695
+ return jwkToKey({ ...jwk, ext });
160696
+ }
160697
+ case "EC":
160698
+ case "OKP":
160699
+ return jwkToKey({ ...jwk, alg, ext });
160700
+ default:
160701
+ throw new JOSENotSupported('Unsupported "kty" (Key Type) Parameter value');
160702
+ }
160703
+ }
160704
+
160705
+ // node_modules/jose/dist/webapi/lib/validate_crit.js
160706
+ function validateCrit(Err, recognizedDefault, recognizedOption, protectedHeader, joseHeader) {
160707
+ if (joseHeader.crit !== undefined && protectedHeader?.crit === undefined) {
160708
+ throw new Err('"crit" (Critical) Header Parameter MUST be integrity protected');
160709
+ }
160710
+ if (!protectedHeader || protectedHeader.crit === undefined) {
160711
+ return new Set;
160712
+ }
160713
+ if (!Array.isArray(protectedHeader.crit) || protectedHeader.crit.length === 0 || protectedHeader.crit.some((input) => typeof input !== "string" || input.length === 0)) {
160714
+ throw new Err('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');
160715
+ }
160716
+ let recognized;
160717
+ if (recognizedOption !== undefined) {
160718
+ recognized = new Map([...Object.entries(recognizedOption), ...recognizedDefault.entries()]);
160719
+ } else {
160720
+ recognized = recognizedDefault;
160721
+ }
160722
+ for (const parameter of protectedHeader.crit) {
160723
+ if (!recognized.has(parameter)) {
160724
+ throw new JOSENotSupported(`Extension Header Parameter "${parameter}" is not recognized`);
160725
+ }
160726
+ if (joseHeader[parameter] === undefined) {
160727
+ throw new Err(`Extension Header Parameter "${parameter}" is missing`);
160728
+ }
160729
+ if (recognized.get(parameter) && protectedHeader[parameter] === undefined) {
160730
+ throw new Err(`Extension Header Parameter "${parameter}" MUST be integrity protected`);
160731
+ }
160732
+ }
160733
+ return new Set(protectedHeader.crit);
160734
+ }
160735
+
160736
+ // node_modules/jose/dist/webapi/lib/validate_algorithms.js
160737
+ function validateAlgorithms(option, algorithms) {
160738
+ if (algorithms !== undefined && (!Array.isArray(algorithms) || algorithms.some((s) => typeof s !== "string"))) {
160739
+ throw new TypeError(`"${option}" option must be an array of strings`);
160740
+ }
160741
+ if (!algorithms) {
160742
+ return;
160743
+ }
160744
+ return new Set(algorithms);
160745
+ }
160746
+
160712
160747
  // node_modules/jose/dist/webapi/lib/check_key_type.js
160713
160748
  var tag = (key) => key?.[Symbol.toStringTag];
160714
160749
  var jwkMatchesOp = (alg, key, usage) => {
@@ -160829,62 +160864,6 @@ function checkKeyType(alg, key, usage) {
160829
160864
  }
160830
160865
  }
160831
160866
 
160832
- // node_modules/jose/dist/webapi/lib/subtle_dsa.js
160833
- function subtleAlgorithm(alg, algorithm) {
160834
- const hash2 = `SHA-${alg.slice(-3)}`;
160835
- switch (alg) {
160836
- case "HS256":
160837
- case "HS384":
160838
- case "HS512":
160839
- return { hash: hash2, name: "HMAC" };
160840
- case "PS256":
160841
- case "PS384":
160842
- case "PS512":
160843
- return { hash: hash2, name: "RSA-PSS", saltLength: parseInt(alg.slice(-3), 10) >> 3 };
160844
- case "RS256":
160845
- case "RS384":
160846
- case "RS512":
160847
- return { hash: hash2, name: "RSASSA-PKCS1-v1_5" };
160848
- case "ES256":
160849
- case "ES384":
160850
- case "ES512":
160851
- return { hash: hash2, name: "ECDSA", namedCurve: algorithm.namedCurve };
160852
- case "Ed25519":
160853
- case "EdDSA":
160854
- return { name: "Ed25519" };
160855
- case "ML-DSA-44":
160856
- case "ML-DSA-65":
160857
- case "ML-DSA-87":
160858
- return { name: alg };
160859
- default:
160860
- throw new JOSENotSupported(`alg ${alg} is not supported either by JOSE or your javascript runtime`);
160861
- }
160862
- }
160863
-
160864
- // node_modules/jose/dist/webapi/lib/get_sign_verify_key.js
160865
- async function getSigKey(alg, key, usage) {
160866
- if (key instanceof Uint8Array) {
160867
- if (!alg.startsWith("HS")) {
160868
- throw new TypeError(invalidKeyInput(key, "CryptoKey", "KeyObject", "JSON Web Key"));
160869
- }
160870
- return crypto.subtle.importKey("raw", key, { hash: `SHA-${alg.slice(-3)}`, name: "HMAC" }, false, [usage]);
160871
- }
160872
- checkSigCryptoKey(key, alg, usage);
160873
- return key;
160874
- }
160875
-
160876
- // node_modules/jose/dist/webapi/lib/verify.js
160877
- async function verify(alg, key, signature, data) {
160878
- const cryptoKey = await getSigKey(alg, key, "verify");
160879
- checkKeyLength(alg, cryptoKey);
160880
- const algorithm = subtleAlgorithm(alg, cryptoKey.algorithm);
160881
- try {
160882
- return await crypto.subtle.verify(algorithm, cryptoKey, signature, data);
160883
- } catch {
160884
- return false;
160885
- }
160886
- }
160887
-
160888
160867
  // node_modules/jose/dist/webapi/jws/flattened/verify.js
160889
160868
  async function flattenedVerify(jws, key, options) {
160890
160869
  if (!isObject3(jws)) {
@@ -160951,12 +160930,7 @@ async function flattenedVerify(jws, key, options) {
160951
160930
  }
160952
160931
  checkKeyType(alg, key, "verify");
160953
160932
  const data = concat(jws.protected !== undefined ? encode3(jws.protected) : new Uint8Array, encode3("."), typeof jws.payload === "string" ? b64 ? encode3(jws.payload) : encoder.encode(jws.payload) : jws.payload);
160954
- let signature;
160955
- try {
160956
- signature = decode3(jws.signature);
160957
- } catch {
160958
- throw new JWSInvalid("Failed to base64url decode the signature");
160959
- }
160933
+ const signature = decodeBase64url(jws.signature, "signature", JWSInvalid);
160960
160934
  const k = await normalizeKey(key, alg);
160961
160935
  const verified = await verify(alg, k, signature, data);
160962
160936
  if (!verified) {
@@ -160964,11 +160938,7 @@ async function flattenedVerify(jws, key, options) {
160964
160938
  }
160965
160939
  let payload;
160966
160940
  if (b64) {
160967
- try {
160968
- payload = decode3(jws.payload);
160969
- } catch {
160970
- throw new JWSInvalid("Failed to base64url decode the payload");
160971
- }
160941
+ payload = decodeBase64url(jws.payload, "payload", JWSInvalid);
160972
160942
  } else if (typeof jws.payload === "string") {
160973
160943
  payload = encoder.encode(jws.payload);
160974
160944
  } else {
@@ -161367,7 +161337,7 @@ function isCloudflareWorkers() {
161367
161337
  var USER_AGENT;
161368
161338
  if (typeof navigator === "undefined" || !navigator.userAgent?.startsWith?.("Mozilla/5.0 ")) {
161369
161339
  const NAME = "jose";
161370
- const VERSION = "v6.2.0";
161340
+ const VERSION = "v6.2.1";
161371
161341
  USER_AGENT = `${NAME}/${VERSION}`;
161372
161342
  }
161373
161343
  var customFetch = Symbol();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cyanheads/pubmed-mcp-server",
3
- "version": "2.1.5",
3
+ "version": "2.1.6",
4
4
  "mcpName": "io.github.cyanheads/pubmed-mcp-server",
5
5
  "description": "MCP server for PubMed/NCBI E-utilities integration. Search articles, fetch metadata, generate citations, explore MeSH terms, and discover related research.",
6
6
  "main": "dist/index.js",
@@ -98,7 +98,7 @@
98
98
  "depcheck": "^1.4.7",
99
99
  "diff": "^8.0.3",
100
100
  "execa": "^9.6.1",
101
- "fast-check": "^4.5.3",
101
+ "fast-check": "^4.6.0",
102
102
  "husky": "^9.1.7",
103
103
  "ignore": "^7.0.5",
104
104
  "msw": "^2.12.10",
@@ -165,7 +165,7 @@
165
165
  "dotenv": "^17.3.1",
166
166
  "fast-xml-parser": "^5.4.2",
167
167
  "hono": "^4.12.5",
168
- "jose": "^6.2.0",
168
+ "jose": "^6.2.1",
169
169
  "js-yaml": "^4.1.1",
170
170
  "node-cron": "^4.2.1",
171
171
  "papaparse": "^5.5.3",