@yawlabs/npmjs-mcp 0.11.1 → 0.11.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 +28 -11
  2. package/package.json +57 -57
package/dist/index.js CHANGED
@@ -30437,11 +30437,15 @@ function maxSatisfying(versions, range) {
30437
30437
  for (const sub of subRanges) {
30438
30438
  const parsed = parseRange(sub);
30439
30439
  if (!parsed) continue;
30440
- const subTargetsPrerelease = /\d+\.\d+\.\d+-/.test(sub);
30440
+ const anchorMatch = sub.match(/(\d+)\.(\d+)\.(\d+)-/);
30441
+ const prereleaseAnchor = anchorMatch ? [Number(anchorMatch[1]), Number(anchorMatch[2]), Number(anchorMatch[3])] : null;
30441
30442
  for (const v of versions) {
30442
- if (v.includes("-") && !subTargetsPrerelease) continue;
30443
30443
  const vp = parseSemver(v);
30444
30444
  if (!vp) continue;
30445
+ if (v.includes("-")) {
30446
+ if (!prereleaseAnchor) continue;
30447
+ if (vp[0] !== prereleaseAnchor[0] || vp[1] !== prereleaseAnchor[1] || vp[2] !== prereleaseAnchor[2]) continue;
30448
+ }
30445
30449
  if (parsed.min && cmpSemver(vp, parsed.min) < 0) continue;
30446
30450
  if (parsed.max && cmpSemver(vp, parsed.max) >= 0) continue;
30447
30451
  if (!bestParsed || cmpSemver(vp, bestParsed) > 0) {
@@ -30951,8 +30955,10 @@ var authTools = [
30951
30955
  handler: async (input) => {
30952
30956
  const authErr = requireAuth();
30953
30957
  if (authErr) return authErr;
30958
+ const userErr = validateUsername(input.username);
30959
+ if (userErr) return { ok: false, status: 400, error: userErr };
30954
30960
  const res = await registryGetAuth(
30955
- `/-/user/org.couchdb.user:${encodeURIComponent(input.username)}/package`
30961
+ `/-/user/org.couchdb.user:${encUser(input.username)}/package`
30956
30962
  );
30957
30963
  if (!res.ok) return translateError(res, { op: `user_packages ${input.username}` });
30958
30964
  const packages = Object.entries(res.data).map(([name, access]) => ({ name, access }));
@@ -31242,6 +31248,7 @@ function classifyHookTarget(target) {
31242
31248
  if (/^@[^/]+$/.test(target)) return { type: "scope", name: target };
31243
31249
  return { type: "package", name: target };
31244
31250
  }
31251
+ var httpsEndpoint = external_exports3.string().url().refine((u) => u.startsWith("https://"), { message: "Endpoint must use https://" });
31245
31252
  function stripSecrets(data) {
31246
31253
  if (Array.isArray(data)) {
31247
31254
  return data.map((item) => stripSecrets(item));
@@ -31269,7 +31276,7 @@ var hookTools = [
31269
31276
  },
31270
31277
  inputSchema: external_exports3.object({
31271
31278
  target: external_exports3.string().describe("Hook target: 'pkg', '@scope/pkg', '@scope', or '~user'"),
31272
- endpoint: external_exports3.string().url().describe("HTTPS URL that will receive POST events"),
31279
+ endpoint: httpsEndpoint.describe("HTTPS URL that will receive POST events"),
31273
31280
  secret: external_exports3.string().describe("Secret used to HMAC-sign webhook payloads")
31274
31281
  }),
31275
31282
  handler: async (input) => {
@@ -31347,7 +31354,7 @@ var hookTools = [
31347
31354
  },
31348
31355
  inputSchema: external_exports3.object({
31349
31356
  id: external_exports3.string().describe("Hook ID"),
31350
- endpoint: external_exports3.string().url().describe("New HTTPS URL"),
31357
+ endpoint: httpsEndpoint.describe("New HTTPS URL"),
31351
31358
  secret: external_exports3.string().describe("New signing secret")
31352
31359
  }),
31353
31360
  handler: async (input) => {
@@ -31673,20 +31680,21 @@ var packageTools = [
31673
31680
  if (!res.ok) return translateError(res, { pkg: input.name, op: "versions" });
31674
31681
  const pkg = res.data;
31675
31682
  const limit = input.limit ?? 50;
31676
- const allVersions = Object.keys(pkg.versions).map((v) => ({
31683
+ const totalPublished = Object.keys(pkg.versions).length;
31684
+ const dated = Object.keys(pkg.versions).map((v) => ({
31677
31685
  version: v,
31678
31686
  date: pkg.time[v],
31679
31687
  deprecated: pkg.versions[v].deprecated,
31680
31688
  npmUser: pkg.versions[v]._npmUser?.name
31681
- })).sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
31682
- const versions = limit > 0 ? allVersions.slice(0, limit) : allVersions;
31689
+ })).filter((r) => r.date).sort((a, b) => new Date(b.date).getTime() - new Date(a.date).getTime());
31690
+ const versions = limit > 0 ? dated.slice(0, limit) : dated;
31683
31691
  return {
31684
31692
  ok: true,
31685
31693
  status: 200,
31686
31694
  data: {
31687
31695
  name: pkg.name,
31688
31696
  distTags: pkg["dist-tags"],
31689
- total: allVersions.length,
31697
+ total: totalPublished,
31690
31698
  showing: versions.length,
31691
31699
  versions
31692
31700
  }
@@ -32372,6 +32380,12 @@ var workflowTools = [
32372
32380
  detail: `"${input.name}" exists. Maintainers: ${maintainers.join(", ") || "unknown"}. Authenticate to check your access.`
32373
32381
  });
32374
32382
  }
32383
+ } else {
32384
+ checks.push({
32385
+ check: "Package name availability",
32386
+ status: "warn",
32387
+ detail: `Could not verify whether "${input.name}" is available or whether you have access (registry returned HTTP ${pkgRes.status}). Re-run npm_publish_preflight before publishing.`
32388
+ });
32375
32389
  }
32376
32390
  if (twoFactorAuth && twoFactorAuth !== "disabled" && canPublishHeadless !== true) {
32377
32391
  actions.push({
@@ -32439,6 +32453,7 @@ function parseTeamTarget(target) {
32439
32453
  function highestVersion(versions) {
32440
32454
  const parsed = [];
32441
32455
  for (const v of versions) {
32456
+ if (v.includes("-")) continue;
32442
32457
  const m = v.match(/^(\d+)\.(\d+)\.(\d+)/);
32443
32458
  if (m) parsed.push([Number(m[1]), Number(m[2]), Number(m[3]), v]);
32444
32459
  }
@@ -32640,6 +32655,7 @@ var writeTools = [
32640
32655
  tarballError = "could not re-fetch packument for tarball DELETE rev";
32641
32656
  }
32642
32657
  }
32658
+ const complete = !tarballUrl || tarballDeleted;
32643
32659
  return {
32644
32660
  ok: true,
32645
32661
  status: 200,
@@ -32647,6 +32663,7 @@ var writeTools = [
32647
32663
  package: input.name,
32648
32664
  unpublishedVersion: input.version,
32649
32665
  remainingVersions: Object.keys(packument.versions),
32666
+ complete,
32650
32667
  tarballDeleted,
32651
32668
  ...tarballError ? { tarballWarning: tarballError } : {}
32652
32669
  }
@@ -33303,9 +33320,9 @@ var writeTools = [
33303
33320
  ];
33304
33321
 
33305
33322
  // src/index.ts
33306
- var version2 = true ? "0.11.1" : (await null).createRequire(import.meta.url)("../package.json").version;
33323
+ var version2 = true ? "0.11.3" : (await null).createRequire(import.meta.url)("../package.json").version;
33307
33324
  var subcommand = process.argv[2];
33308
- if (subcommand === "version" || subcommand === "--version") {
33325
+ if (subcommand === "version" || subcommand === "--version" || subcommand === "-v" || subcommand === "-V") {
33309
33326
  console.log(version2);
33310
33327
  process.exit(0);
33311
33328
  }
package/package.json CHANGED
@@ -1,57 +1,57 @@
1
- {
2
- "name": "@yawlabs/npmjs-mcp",
3
- "version": "0.11.1",
4
- "description": "npm registry MCP server — package intelligence, security audits, and dependency analysis for AI assistants",
5
- "license": "MIT",
6
- "author": "YawLabs <contact@yaw.sh>",
7
- "repository": {
8
- "type": "git",
9
- "url": "git+https://github.com/YawLabs/npmjs-mcp.git"
10
- },
11
- "keywords": [
12
- "npm",
13
- "npmjs",
14
- "registry",
15
- "mcp",
16
- "model-context-protocol",
17
- "ai",
18
- "packages",
19
- "security",
20
- "audit",
21
- "dependencies"
22
- ],
23
- "type": "module",
24
- "main": "dist/index.js",
25
- "bin": {
26
- "npmjs-mcp": "dist/index.js"
27
- },
28
- "files": [
29
- "dist/index.js"
30
- ],
31
- "scripts": {
32
- "build": "tsc && node build.mjs",
33
- "dev": "tsc --watch",
34
- "start": "node dist/index.js",
35
- "test": "npm run build && node --test dist/api.test.js dist/tools/tools.test.js dist/tools/handlers.test.js dist/tools/writes.test.js dist/tools/hooks.test.js",
36
- "test:ci": "npm run test",
37
- "lint": "biome check src/",
38
- "lint:fix": "biome check --write src/",
39
- "prepublishOnly": "npm run build"
40
- },
41
- "dependencies": {},
42
- "overrides": {
43
- "hono": "^4.12.14",
44
- "@hono/node-server": "^1.19.13"
45
- },
46
- "devDependencies": {
47
- "@biomejs/biome": "^2.4.12",
48
- "@modelcontextprotocol/sdk": "^1.29.0",
49
- "@types/node": "^25.6.0",
50
- "esbuild": "^0.28.0",
51
- "typescript": "^6.0.3",
52
- "zod": "^4.3.6"
53
- },
54
- "engines": {
55
- "node": ">=18"
56
- }
57
- }
1
+ {
2
+ "name": "@yawlabs/npmjs-mcp",
3
+ "version": "0.11.3",
4
+ "description": "npm registry MCP server — package intelligence, security audits, and dependency analysis for AI assistants",
5
+ "license": "MIT",
6
+ "author": "YawLabs <contact@yaw.sh>",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/YawLabs/npmjs-mcp.git"
10
+ },
11
+ "keywords": [
12
+ "npm",
13
+ "npmjs",
14
+ "registry",
15
+ "mcp",
16
+ "model-context-protocol",
17
+ "ai",
18
+ "packages",
19
+ "security",
20
+ "audit",
21
+ "dependencies"
22
+ ],
23
+ "type": "module",
24
+ "main": "dist/index.js",
25
+ "bin": {
26
+ "npmjs-mcp": "dist/index.js"
27
+ },
28
+ "files": [
29
+ "dist/index.js"
30
+ ],
31
+ "scripts": {
32
+ "build": "tsc && node build.mjs",
33
+ "dev": "tsc --watch",
34
+ "start": "node dist/index.js",
35
+ "test": "npm run build && node --test dist/api.test.js dist/tools/tools.test.js dist/tools/handlers.test.js dist/tools/writes.test.js dist/tools/hooks.test.js",
36
+ "test:ci": "npm run test",
37
+ "lint": "biome check src/",
38
+ "lint:fix": "biome check --write src/",
39
+ "prepublishOnly": "npm run build"
40
+ },
41
+ "dependencies": {},
42
+ "overrides": {
43
+ "hono": "^4.12.14",
44
+ "@hono/node-server": "^1.19.13"
45
+ },
46
+ "devDependencies": {
47
+ "@biomejs/biome": "^2.4.12",
48
+ "@modelcontextprotocol/sdk": "^1.29.0",
49
+ "@types/node": "^25.6.0",
50
+ "esbuild": "^0.28.0",
51
+ "typescript": "^6.0.3",
52
+ "zod": "^4.3.6"
53
+ },
54
+ "engines": {
55
+ "node": ">=20"
56
+ }
57
+ }