@yawlabs/npmjs-mcp 0.11.8 → 0.11.11

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 +51 -37
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -31233,7 +31233,7 @@ function parseSingleConstraint(r) {
31233
31233
  if (patch === null) {
31234
31234
  return { min: [major, minor, 0], max: [major, minor + 1, 0] };
31235
31235
  }
31236
- return null;
31236
+ return { min: [major, minor, patch], max: [major, minor, patch + 1] };
31237
31237
  }
31238
31238
  return null;
31239
31239
  }
@@ -31453,46 +31453,54 @@ var analysisTools = [
31453
31453
  packages: external_exports.array(external_exports.string()).min(2).max(5).describe("Package names to compare")
31454
31454
  }),
31455
31455
  handler: async (input) => {
31456
- const results = await Promise.all(
31456
+ const partials = await Promise.all(
31457
31457
  input.packages.map(async (name) => {
31458
31458
  const [pkgRes, dlRes] = await Promise.all([
31459
31459
  registryGet(`/${encPkg(name)}`),
31460
31460
  downloadsGet(`/downloads/point/last-week/${encPkg(name)}`)
31461
31461
  ]);
31462
- if (!pkgRes.ok) {
31463
- return { name, error: pkgRes.error };
31464
- }
31465
- const pkg = pkgRes.data;
31466
- const latest = pkg["dist-tags"]?.latest;
31467
- const latestVersion = latest ? pkg.versions[latest] : void 0;
31468
- const versionKeys = Object.keys(pkg.versions);
31469
- let vulnerabilities = 0;
31470
- if (latest) {
31471
- const auditRes = await registryPost("/-/npm/v1/security/advisories/bulk", {
31472
- [name]: [latest]
31473
- });
31474
- if (auditRes.ok && auditRes.data?.[name]) {
31475
- vulnerabilities = auditRes.data[name].length;
31476
- }
31477
- }
31478
- return {
31479
- name,
31480
- description: pkg.description,
31481
- latest,
31482
- license: pkg.license ?? latestVersion?.license,
31483
- maintainers: pkg.maintainers?.map((m) => m.name),
31484
- weeklyDownloads: dlRes.ok ? dlRes.data.downloads : null,
31485
- versionCount: versionKeys.length,
31486
- created: pkg.time.created,
31487
- lastPublish: latest ? pkg.time[latest] : void 0,
31488
- deprecated: latestVersion?.deprecated ?? false,
31489
- hasReadme: !!(pkg.readme && pkg.readme.length > 0),
31490
- repository: pkg.repository,
31491
- homepage: pkg.homepage,
31492
- vulnerabilities
31493
- };
31462
+ return { name, pkgRes, dlRes };
31494
31463
  })
31495
31464
  );
31465
+ const auditMap = {};
31466
+ for (const { name, pkgRes } of partials) {
31467
+ if (!pkgRes.ok) continue;
31468
+ const latest = pkgRes.data["dist-tags"]?.latest;
31469
+ if (latest) auditMap[name] = [latest];
31470
+ }
31471
+ let auditData = {};
31472
+ if (Object.keys(auditMap).length > 0) {
31473
+ const auditRes = await registryPost("/-/npm/v1/security/advisories/bulk", auditMap);
31474
+ if (auditRes.ok && auditRes.data) auditData = auditRes.data;
31475
+ }
31476
+ const results = partials.map(({ name, pkgRes, dlRes }) => {
31477
+ if (!pkgRes.ok) {
31478
+ const translated = translateError(pkgRes, { pkg: name, op: "compare" });
31479
+ return { name, error: translated.error };
31480
+ }
31481
+ const pkg = pkgRes.data;
31482
+ const latest = pkg["dist-tags"]?.latest;
31483
+ const latestVersion = latest ? pkg.versions[latest] : void 0;
31484
+ const versionKeys = Object.keys(pkg.versions);
31485
+ const advisories = auditData[name];
31486
+ const vulnerabilities = Array.isArray(advisories) ? advisories.length : 0;
31487
+ return {
31488
+ name,
31489
+ description: pkg.description,
31490
+ latest,
31491
+ license: pkg.license ?? latestVersion?.license,
31492
+ maintainers: pkg.maintainers?.map((m) => m.name),
31493
+ weeklyDownloads: dlRes.ok ? dlRes.data.downloads : null,
31494
+ versionCount: versionKeys.length,
31495
+ created: pkg.time.created,
31496
+ lastPublish: latest ? pkg.time[latest] : void 0,
31497
+ deprecated: latestVersion?.deprecated ?? false,
31498
+ hasReadme: !!(pkg.readme && pkg.readme.length > 0),
31499
+ repository: pkg.repository,
31500
+ homepage: pkg.homepage,
31501
+ vulnerabilities
31502
+ };
31503
+ });
31496
31504
  return { ok: true, status: 200, data: { comparison: results } };
31497
31505
  }
31498
31506
  },
@@ -31521,6 +31529,7 @@ var analysisTools = [
31521
31529
  const latestVersion = latest ? pkg.versions[latest] : void 0;
31522
31530
  const versionKeys = Object.keys(pkg.versions);
31523
31531
  let vulnerabilityCount = null;
31532
+ let auditReliable = true;
31524
31533
  if (latest) {
31525
31534
  const auditRes = await registryPost("/-/npm/v1/security/advisories/bulk", {
31526
31535
  [input.name]: [latest]
@@ -31528,7 +31537,11 @@ var analysisTools = [
31528
31537
  if (auditRes.ok) {
31529
31538
  const advisories = auditRes.data?.[input.name];
31530
31539
  vulnerabilityCount = Array.isArray(advisories) ? advisories.length : 0;
31540
+ } else {
31541
+ auditReliable = false;
31531
31542
  }
31543
+ } else {
31544
+ auditReliable = false;
31532
31545
  }
31533
31546
  const publishDates = versionKeys.map((v) => pkg.time[v]).filter(Boolean).map((d) => new Date(d).getTime()).sort((a, b) => b - a);
31534
31547
  const now = Date.now();
@@ -31562,6 +31575,7 @@ var analysisTools = [
31562
31575
  daysSinceLastPublish,
31563
31576
  avgDaysBetweenReleases,
31564
31577
  vulnerabilityCount,
31578
+ auditReliable,
31565
31579
  hasLicense,
31566
31580
  hasReadme,
31567
31581
  hasRepo,
@@ -31937,7 +31951,7 @@ var dependencyTools = [
31937
31951
  if (tree[resolvedKey]) return;
31938
31952
  const versionData = pkg.versions[resolvedVersion];
31939
31953
  if (!versionData) {
31940
- tree[resolvedKey] = { version: resolvedVersion, dependencies: {} };
31954
+ tree[resolvedKey] = { version: resolvedVersion, dependencies: {}, failed: true };
31941
31955
  return;
31942
31956
  }
31943
31957
  const deps = versionData.dependencies ?? {};
@@ -33475,7 +33489,7 @@ var writeTools = [
33475
33489
  // via the packument (step 3 succeeded), so we report success with a warning.
33476
33490
  {
33477
33491
  name: "npm_unpublish_version",
33478
- description: "Unpublish a specific version of a package. IRREVERSIBLE: once unpublished, the version cannot be re-published and will be blocked for 72 hours. Only works within 72 hours of the original publish for most packages. Requires explicit confirm: true to prevent accidents. Follows the npm CLI flow (mutate packument + delete tarball). For full-package unpublish use npm_unpublish_package.",
33492
+ description: "Unpublish a specific version of a package. IRREVERSIBLE: once unpublished, the version cannot be re-published and will be blocked for 72 hours. Only works within 72 hours of the original publish for most packages. Requires explicit confirm: true to prevent accidents. Follows the npm CLI flow (mutate packument + delete tarball). For full-package unpublish use npm_unpublish_package. Dist-tag handling: any dist-tag that pointed at the unpublished version is removed. Only `latest` is auto-reassigned (to the highest remaining stable version). Other tags like `next`/`beta` are left unset \u2014 reassign them explicitly with npm_dist_tag_set if needed.",
33479
33493
  annotations: {
33480
33494
  title: "Unpublish version",
33481
33495
  readOnlyHint: false,
@@ -34221,7 +34235,7 @@ var writeTools = [
34221
34235
  ];
34222
34236
 
34223
34237
  // src/index.ts
34224
- var version2 = true ? "0.11.8" : (await null).createRequire(import.meta.url)("../package.json").version;
34238
+ var version2 = true ? "0.11.11" : (await null).createRequire(import.meta.url)("../package.json").version;
34225
34239
  var subcommand = process.argv[2];
34226
34240
  if (subcommand === "version" || subcommand === "--version" || subcommand === "-v" || subcommand === "-V") {
34227
34241
  console.log(version2);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yawlabs/npmjs-mcp",
3
- "version": "0.11.8",
3
+ "version": "0.11.11",
4
4
  "mcpName": "io.github.YawLabs/npmjs-mcp",
5
5
  "description": "npm registry MCP server — package intelligence, security audits, and dependency analysis for AI assistants",
6
6
  "license": "MIT",