@4da/mcp-server 5.0.2 → 5.0.4

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 (96) hide show
  1. package/README.md +3 -3
  2. package/dist/auth-context.d.ts +0 -1
  3. package/dist/auth-context.js +0 -1
  4. package/dist/auth.d.ts +0 -1
  5. package/dist/auth.js +0 -1
  6. package/dist/db.d.ts +17 -2
  7. package/dist/db.js +104 -67
  8. package/dist/doctor.d.ts +0 -1
  9. package/dist/doctor.js +17 -15
  10. package/dist/embeddings.d.ts +0 -1
  11. package/dist/embeddings.js +0 -1
  12. package/dist/http-transport.d.ts +0 -1
  13. package/dist/http-transport.js +0 -1
  14. package/dist/index.d.ts +0 -1
  15. package/dist/index.js +17 -5
  16. package/dist/live/cache.d.ts +0 -1
  17. package/dist/live/cache.js +0 -1
  18. package/dist/live/crates-registry.d.ts +0 -1
  19. package/dist/live/crates-registry.js +5 -8
  20. package/dist/live/cvss.d.ts +0 -1
  21. package/dist/live/cvss.js +0 -1
  22. package/dist/live/go-registry.d.ts +0 -1
  23. package/dist/live/go-registry.js +4 -9
  24. package/dist/live/hn-fetcher.d.ts +0 -1
  25. package/dist/live/hn-fetcher.js +23 -11
  26. package/dist/live/http-utils.d.ts +0 -1
  27. package/dist/live/http-utils.js +0 -1
  28. package/dist/live/index.d.ts +0 -1
  29. package/dist/live/index.js +0 -1
  30. package/dist/live/npm-registry.d.ts +0 -1
  31. package/dist/live/npm-registry.js +4 -8
  32. package/dist/live/osv-scanner.d.ts +20 -2
  33. package/dist/live/osv-scanner.js +82 -9
  34. package/dist/live/platform.d.ts +0 -1
  35. package/dist/live/platform.js +0 -1
  36. package/dist/live/pypi-registry.d.ts +0 -1
  37. package/dist/live/pypi-registry.js +7 -10
  38. package/dist/live/rate-limiter.d.ts +0 -1
  39. package/dist/live/rate-limiter.js +0 -1
  40. package/dist/live/semver-utils.d.ts +11 -1
  41. package/dist/live/semver-utils.js +14 -1
  42. package/dist/live/types.d.ts +0 -1
  43. package/dist/live/types.js +0 -1
  44. package/dist/live/version-resolver.d.ts +0 -1
  45. package/dist/live/version-resolver.js +0 -1
  46. package/dist/live-singleton.d.ts +0 -1
  47. package/dist/live-singleton.js +0 -1
  48. package/dist/project-scanner.d.ts +0 -1
  49. package/dist/project-scanner.js +0 -1
  50. package/dist/schema-registry.d.ts +17 -8
  51. package/dist/schema-registry.js +54 -9
  52. package/dist/schemas/developer-dna.json +1 -1
  53. package/dist/schemas/get-context.json +2 -2
  54. package/dist/schemas/get-relevant-content.json +1 -1
  55. package/dist/schemas/record-feedback.json +1 -1
  56. package/dist/setup.d.ts +0 -1
  57. package/dist/setup.js +0 -1
  58. package/dist/tool-dispatch.d.ts +0 -1
  59. package/dist/tool-dispatch.js +21 -2
  60. package/dist/tools/agent-memory.d.ts +0 -1
  61. package/dist/tools/agent-memory.js +0 -1
  62. package/dist/tools/decision-enforcement.d.ts +0 -1
  63. package/dist/tools/decision-enforcement.js +0 -1
  64. package/dist/tools/decision-memory.d.ts +0 -1
  65. package/dist/tools/decision-memory.js +0 -1
  66. package/dist/tools/decision-recall.d.ts +0 -1
  67. package/dist/tools/decision-recall.js +0 -1
  68. package/dist/tools/dependency-health.d.ts +0 -1
  69. package/dist/tools/dependency-health.js +31 -5
  70. package/dist/tools/developer-dna.d.ts +3 -3
  71. package/dist/tools/developer-dna.js +63 -47
  72. package/dist/tools/ecosystem-pulse.d.ts +7 -2
  73. package/dist/tools/ecosystem-pulse.js +39 -3
  74. package/dist/tools/get-actionable-signals.d.ts +0 -1
  75. package/dist/tools/get-actionable-signals.js +0 -1
  76. package/dist/tools/get-context.d.ts +0 -1
  77. package/dist/tools/get-context.js +2 -3
  78. package/dist/tools/get-relevant-content.d.ts +0 -1
  79. package/dist/tools/get-relevant-content.js +1 -3
  80. package/dist/tools/index.d.ts +0 -1
  81. package/dist/tools/index.js +0 -1
  82. package/dist/tools/knowledge-gaps.d.ts +0 -1
  83. package/dist/tools/knowledge-gaps.js +79 -17
  84. package/dist/tools/recall.d.ts +0 -1
  85. package/dist/tools/recall.js +0 -1
  86. package/dist/tools/record-feedback.d.ts +1 -2
  87. package/dist/tools/record-feedback.js +7 -8
  88. package/dist/tools/upgrade-planner.d.ts +0 -1
  89. package/dist/tools/upgrade-planner.js +15 -3
  90. package/dist/tools/vulnerability-scan.d.ts +0 -1
  91. package/dist/tools/vulnerability-scan.js +0 -1
  92. package/dist/tools/what-should-i-know.d.ts +0 -1
  93. package/dist/tools/what-should-i-know.js +6 -3
  94. package/dist/types.d.ts +2 -3
  95. package/dist/types.js +0 -1
  96. package/package.json +37 -11
@@ -2,22 +2,22 @@
2
2
  /**
3
3
  * record_feedback tool
4
4
  *
5
- * Record user feedback on an item for learning.
5
+ * Record explicit user interaction history for an item.
6
6
  */
7
7
  /**
8
8
  * Tool definition for MCP registration
9
9
  */
10
10
  export const recordFeedbackTool = {
11
11
  name: "record_feedback",
12
- description: `Record user feedback on a content item.
12
+ description: `Record explicit user interaction history for a content item.
13
13
 
14
14
  Feedback actions:
15
- - "click": User clicked/opened the item (moderate positive signal)
16
- - "save": User saved/bookmarked the item (strong positive signal)
17
- - "dismiss": User dismissed the item (weak negative signal)
18
- - "mark_irrelevant": User marked item as not relevant (strong negative signal)
15
+ - "click": User clicked/opened the item
16
+ - "save": User saved/bookmarked the item
17
+ - "dismiss": User dismissed the item
18
+ - "mark_irrelevant": User marked item as not relevant
19
19
 
20
- This feedback helps 4DA learn user preferences over time.`,
20
+ This records what happened; it does not train content preferences (interaction counts only graduate scoring's bootstrap gate).`,
21
21
  inputSchema: {
22
22
  type: "object",
23
23
  properties: {
@@ -58,4 +58,3 @@ export function executeRecordFeedback(db, params) {
58
58
  }
59
59
  return db.recordFeedback(params.item_id, params.source_type, params.action);
60
60
  }
61
- //# sourceMappingURL=record-feedback.js.map
@@ -80,4 +80,3 @@ export declare const upgradePlannerTool: {
80
80
  };
81
81
  export declare function executeUpgradePlanner(_db: FourDADatabase, params: UpgradePlannerParams, liveIntel: LiveIntelligence | null): Promise<UpgradePlanResult>;
82
82
  export {};
83
- //# sourceMappingURL=upgrade-planner.d.ts.map
@@ -17,7 +17,7 @@
17
17
  * - When no vulnerability scan has run, the plan says so instead of silently
18
18
  * producing a CVE-blind ranking.
19
19
  */
20
- import { maxSemver } from "../live/semver-utils.js";
20
+ import { compareSemver, maxSemver } from "../live/semver-utils.js";
21
21
  const PROVENANCE_NOTE = "Point-in-time heuristic from local lockfiles plus live registry/OSV lookups. " +
22
22
  "Not the 4DA desktop app's cross-project, version-confirmed plan.";
23
23
  export const upgradePlannerTool = {
@@ -136,8 +136,21 @@ export async function executeUpgradePlanner(_db, params, liveIntel) {
136
136
  // Skip if no upgrade needed (no vuln, not deprecated, not behind => no reasons)
137
137
  if (reasons.length === 0)
138
138
  continue;
139
+ // Never recommend a downgrade: when the current version is a prerelease
140
+ // AHEAD of the latest stable (rsa 0.10.0-rc.18 vs stable 0.9.10), the
141
+ // stable line is not an upgrade target. Fall back to the highest vuln
142
+ // fix version that IS ahead of current, else no target ("review").
143
+ if (targetVersion &&
144
+ dep.currentVersion &&
145
+ compareSemver(dep.currentVersion, targetVersion) >= 0) {
146
+ const vulnFixesAhead = (vulns ?? [])
147
+ .map((v) => v.fixedVersion)
148
+ .filter((f) => Boolean(f))
149
+ .filter((f) => compareSemver(f, dep.currentVersion) > 0);
150
+ targetVersion = vulnFixesAhead.length > 0 ? maxSemver(vulnFixesAhead) : null;
151
+ }
139
152
  const label = dep.versionsBehind?.label;
140
- const upgradeType = !label || label === "up-to-date" ? "patch" : label;
153
+ const upgradeType = !label || label === "up-to-date" ? "unknown" : label;
141
154
  recommendations.push({
142
155
  package: dep.name,
143
156
  ecosystem: dep.ecosystem,
@@ -245,4 +258,3 @@ export async function executeUpgradePlanner(_db, params, liveIntel) {
245
258
  provenance: { mode: "standalone_heuristic", note: PROVENANCE_NOTE },
246
259
  };
247
260
  }
248
- //# sourceMappingURL=upgrade-planner.js.map
@@ -177,4 +177,3 @@ export declare function executeVulnerabilityScan(db: FourDADatabase, params: Vul
177
177
  message?: undefined;
178
178
  hint?: undefined;
179
179
  }>;
180
- //# sourceMappingURL=vulnerability-scan.d.ts.map
@@ -213,4 +213,3 @@ function formatVuln(v) {
213
213
  references: v.references,
214
214
  };
215
215
  }
216
- //# sourceMappingURL=vulnerability-scan.js.map
@@ -76,4 +76,3 @@ export declare const whatShouldIKnowTool: {
76
76
  };
77
77
  export declare function executeWhatShouldIKnow(db: FourDADatabase, params: WhatShouldIKnowParams): WhatShouldIKnowResult | Promise<WhatShouldIKnowResult>;
78
78
  export {};
79
- //# sourceMappingURL=what-should-i-know.d.ts.map
@@ -40,9 +40,13 @@ export const whatShouldIKnowTool = {
40
40
  function getOpenDecisionWindows(db) {
41
41
  try {
42
42
  const rawDb = db.getRawDb();
43
- return rawDb.prepare(`SELECT id, title, description, urgency
43
+ return rawDb.prepare(
44
+ // opened_at, not created_at — the wrong column name made this query
45
+ // throw (swallowed below) on EVERY schema in existence, so the
46
+ // decision-windows section had never returned a row for anyone.
47
+ `SELECT id, title, description, urgency
44
48
  FROM decision_windows WHERE status = 'open'
45
- ORDER BY urgency DESC, created_at DESC
49
+ ORDER BY urgency DESC, opened_at DESC
46
50
  LIMIT 20`).all();
47
51
  }
48
52
  catch {
@@ -345,4 +349,3 @@ export function executeWhatShouldIKnow(db, params) {
345
349
  // Provider configured -> hybrid wisdom (returns a Promise; dispatch awaits).
346
350
  return getRelevantWisdomHybrid(db, task, files, embedConfig).then(({ wisdom, recall_mode }) => finalize(wisdom, recall_mode));
347
351
  }
348
- //# sourceMappingURL=what-should-i-know.js.map
package/dist/types.d.ts CHANGED
@@ -81,7 +81,7 @@ export interface ActiveTopic {
81
81
  last_seen: string;
82
82
  }
83
83
  /**
84
- * Learned topic affinity
84
+ * Retained compatibility shape for historic topic affinity data.
85
85
  */
86
86
  export interface TopicAffinity {
87
87
  topic: string;
@@ -92,7 +92,7 @@ export interface TopicAffinity {
92
92
  total_exposures: number;
93
93
  }
94
94
  /**
95
- * Anti-topic (learned exclusion)
95
+ * Retained compatibility shape for historic anti-topic data.
96
96
  */
97
97
  export interface AntiTopic {
98
98
  topic: string;
@@ -394,4 +394,3 @@ export interface AgentFeedbackTopItemRow {
394
394
  used_count: number;
395
395
  rejected_count: number;
396
396
  }
397
- //# sourceMappingURL=types.d.ts.map
package/dist/types.js CHANGED
@@ -5,4 +5,3 @@
5
5
  * These types mirror the 4DA database schema for read operations.
6
6
  */
7
7
  export {};
8
- //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@4da/mcp-server",
3
- "version": "5.0.2",
3
+ "version": "5.0.4",
4
4
  "mcpName": "io.github.4DA-Systems/4da-mcp-server",
5
5
  "description": "Dependency intelligence for AI coding agents. Live CVE scanning, dependency health, upgrade planning, ecosystem news, decision memory — zero config, privacy-first. 9 tools standalone, 14 total with desktop app.",
6
6
  "type": "module",
@@ -18,6 +18,18 @@
18
18
  "README.md",
19
19
  "LICENSE"
20
20
  ],
21
+ "scripts": {
22
+ "clean": "node -e \"const fs=require('fs');fs.rmSync('dist',{recursive:true,force:true})\"",
23
+ "build": "pnpm run clean && tsc && pnpm run copy-schemas",
24
+ "copy-schemas": "node -e \"const fs=require('fs');const path=require('path');const src='src/schemas';const dst='dist/schemas';if(!fs.existsSync(dst))fs.mkdirSync(dst,{recursive:true});fs.readdirSync(src).filter(f=>f.endsWith('.json')).forEach(f=>fs.copyFileSync(path.join(src,f),path.join(dst,f)))\"",
25
+ "dev": "tsc --watch",
26
+ "start": "node dist/index.js",
27
+ "inspect": "npx @modelcontextprotocol/inspector node dist/index.js",
28
+ "setup": "node dist/setup.js",
29
+ "test": "vitest run",
30
+ "test:watch": "vitest",
31
+ "prepublishOnly": "pnpm run build"
32
+ },
21
33
  "keywords": [
22
34
  "mcp",
23
35
  "mcp-server",
@@ -84,14 +96,28 @@
84
96
  "engines": {
85
97
  "node": ">=20.0.0"
86
98
  },
87
- "scripts": {
88
- "build": "tsc && pnpm run copy-schemas",
89
- "copy-schemas": "node -e \"const fs=require('fs');const path=require('path');const src='src/schemas';const dst='dist/schemas';if(!fs.existsSync(dst))fs.mkdirSync(dst,{recursive:true});fs.readdirSync(src).filter(f=>f.endsWith('.json')).forEach(f=>fs.copyFileSync(path.join(src,f),path.join(dst,f)))\"",
90
- "dev": "tsc --watch",
91
- "start": "node dist/index.js",
92
- "inspect": "npx @modelcontextprotocol/inspector node dist/index.js",
93
- "setup": "node dist/setup.js",
94
- "test": "vitest run",
95
- "test:watch": "vitest"
99
+ "pnpm": {
100
+ "onlyBuiltDependencies": [
101
+ "better-sqlite3",
102
+ "esbuild"
103
+ ],
104
+ "overrides": {
105
+ "fast-uri": ">=3.1.5",
106
+ "ip-address": ">=10.3.1 <11",
107
+ "vite": ">=7.3.5 <8",
108
+ "esbuild": ">=0.28.1",
109
+ "hono": ">=4.12.34 <5",
110
+ "@hono/node-server": ">=2.0.5 <3",
111
+ "minimatch@>=9.0.0 <9.0.6": ">=9.0.7",
112
+ "picomatch@>=4.0.0 <4.0.4": ">=4.0.4",
113
+ "brace-expansion@<1.1.18": ">=1.1.18 <2",
114
+ "brace-expansion@>=2.0.0 <2.0.3": ">=2.0.3",
115
+ "brace-expansion@>=3.0.0 <5.0.9": ">=5.0.9 <6",
116
+ "js-yaml@>=4.0.0 <4.3.1": ">=4.3.1 <5",
117
+ "nanoid@<3.3.18": ">=3.3.18 <4",
118
+ "nanoid@>=4.0.0 <5.1.16": ">=5.1.16 <6",
119
+ "postcss@<8.5.23": ">=8.5.23 <9",
120
+ "undici@>=7.0.0 <7.29.0": ">=7.29.0 <8"
121
+ }
96
122
  }
97
- }
123
+ }