mcp-adr-analysis-server 2.6.20 → 2.7.19

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 (46) hide show
  1. package/README.md +12 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/src/index.d.ts.map +1 -1
  4. package/dist/src/index.js +59 -9
  5. package/dist/src/index.js.map +1 -1
  6. package/dist/src/resources/deployment-status-resource.d.ts.map +1 -1
  7. package/dist/src/resources/deployment-status-resource.js +31 -24
  8. package/dist/src/resources/deployment-status-resource.js.map +1 -1
  9. package/dist/src/tools/adr-suggestion-tool.js +2 -1
  10. package/dist/src/tools/adr-suggestion-tool.js.map +1 -1
  11. package/dist/src/tools/ce-mcp-tools.d.ts +14 -1
  12. package/dist/src/tools/ce-mcp-tools.d.ts.map +1 -1
  13. package/dist/src/tools/ce-mcp-tools.js +27 -1
  14. package/dist/src/tools/ce-mcp-tools.js.map +1 -1
  15. package/dist/src/tools/perform-research-tool.d.ts +18 -0
  16. package/dist/src/tools/perform-research-tool.d.ts.map +1 -1
  17. package/dist/src/tools/perform-research-tool.js +67 -4
  18. package/dist/src/tools/perform-research-tool.js.map +1 -1
  19. package/dist/src/tools/tool-catalog.d.ts +1 -1
  20. package/dist/src/tools/tool-catalog.js +59 -59
  21. package/dist/src/tools/tool-catalog.js.map +1 -1
  22. package/dist/src/tools/tool-dispatcher.d.ts +1 -1
  23. package/dist/src/tools/tool-dispatcher.js +1 -1
  24. package/dist/src/tools/tree-sitter-code-tools.d.ts +6 -1
  25. package/dist/src/tools/tree-sitter-code-tools.d.ts.map +1 -1
  26. package/dist/src/tools/tree-sitter-code-tools.js +6 -1
  27. package/dist/src/tools/tree-sitter-code-tools.js.map +1 -1
  28. package/dist/src/utils/adr-discovery.d.ts.map +1 -1
  29. package/dist/src/utils/adr-discovery.js +33 -5
  30. package/dist/src/utils/adr-discovery.js.map +1 -1
  31. package/dist/src/utils/context-document-manager.d.ts +4 -3
  32. package/dist/src/utils/context-document-manager.d.ts.map +1 -1
  33. package/dist/src/utils/context-document-manager.js +37 -8
  34. package/dist/src/utils/context-document-manager.js.map +1 -1
  35. package/dist/src/utils/knowledge-graph-manager.d.ts +11 -0
  36. package/dist/src/utils/knowledge-graph-manager.d.ts.map +1 -1
  37. package/dist/src/utils/knowledge-graph-manager.js +52 -6
  38. package/dist/src/utils/knowledge-graph-manager.js.map +1 -1
  39. package/dist/src/utils/research-orchestrator.d.ts.map +1 -1
  40. package/dist/src/utils/research-orchestrator.js +24 -5
  41. package/dist/src/utils/research-orchestrator.js.map +1 -1
  42. package/package.json +2 -1
  43. package/dist/src/utils/monitoring.d.ts +0 -249
  44. package/dist/src/utils/monitoring.d.ts.map +0 -1
  45. package/dist/src/utils/monitoring.js +0 -513
  46. package/dist/src/utils/monitoring.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;GAMG;AAgIH;;GAEG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,aAAa,CAAgB;IACrC,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,MAAM,CAAkC;IAChD,OAAO,CAAC,SAAS,CAAwB;IACzC,OAAO,CAAC,yBAAyB,CAA4B;IAC7D,OAAO,CAAC,yBAAyB,CAA4B;IAC7D,OAAO,CAAC,mBAAmB,CAAsB;IACjD,OAAO,CAAC,WAAW,CAAc;IACjC,OAAO,CAAC,gBAAgB,CAAyB;;IAkCjD;;OAEG;YACW,qBAAqB;IAWnC;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAKlC;;;;;;;;;OASG;IACH,OAAO,CAAC,aAAa;IAsyIrB;;OAEG;YACW,sBAAsB;YA8GtB,mBAAmB;YAqMnB,sBAAsB;YA+QtB,uBAAuB;YA+bvB,uBAAuB;YAuQvB,mBAAmB;YA2VnB,k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AAqB;IAiCnC;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA2G/B;;OAEG;YACW,kBAAkB;YA0FlB,kBAAkB;IAWhC;;;;;;;OAOG;YACW,oCAAoC;IAuFlD;;OAEG;YACW,YAAY;IA+a1B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAuC5B;;OAEG;IAEH;;OAEG;YACW,SAAS;IAiBvB;;OAEG;YACW,aAAa;YA+Cb,QAAQ;YAuCR,SAAS;YAqCT,aAAa;YAsCb,0BAA0B;YAY1B,YAAY;YAYZ,mBAAmB;YAYnB,eAAe;YAYf,eAAe;YAYf,0BAA0B;YAa1B,UAAU;YAwBV,WAAW;YAYX,aAAa;YAab,qBAAqB;YAYrB,sBAAsB;IAYpC;;OAEG;YACW,qBAAqB;IAYnC;;;OAGG;YACW,YAAY;IAY1B;;;OAGG;YACW,wBAAwB;IAYtC;;;OAGG;YACW,uBAAuB;IAYrC;;;OAGG;YACW,cAAc;IAY5B;;;OAGG;YACW,eAAe;IAY7B;;;OAGG;YACW,gBAAgB;IAiB9B;;;OAGG;YACW,kBAAkB;IAyHhC;;;;;;;;;;;OAWG;YACW,cAAc;IA2D5B;;;;;;;;;;;OAWG;YACW,UAAU;CAwHzB"}
package/dist/src/index.js CHANGED
@@ -1378,6 +1378,11 @@ export class McpAdrAnalysisServer {
1378
1378
  description: 'Directory containing ADR files',
1379
1379
  default: 'docs/adrs',
1380
1380
  },
1381
+ researchDirectory: {
1382
+ type: 'string',
1383
+ description: 'Directory the research document is written to. Previously unset and unsettable: output went to docs/context/research/ regardless (#1528).',
1384
+ default: 'docs/research',
1385
+ },
1381
1386
  confidenceThreshold: {
1382
1387
  type: 'number',
1383
1388
  description: 'Minimum confidence threshold (0-1) before suggesting web search',
@@ -3700,7 +3705,25 @@ export class McpAdrAnalysisServer {
3700
3705
  const directive = getCEMCPDirective(name, safeArgs);
3701
3706
  if (directive) {
3702
3707
  this.logger.info(`[CE-MCP] Returning directive for tool: ${name}`);
3703
- return formatDirectiveResponse(directive);
3708
+ const directiveResponse = formatDirectiveResponse(directive);
3709
+ // Record BEFORE returning. This early return skips the dispatch
3710
+ // switch below and, with it, the trackToolExecution call on the
3711
+ // success path -- so every tool in CE_MCP_DIRECTIVE_TOOLS was
3712
+ // invisible to usage tracking whenever CE-MCP mode was on. All
3713
+ // twelve of them, including `perform_research`, whose disposition
3714
+ // ADR-023 defers *pending usage data*. See #1489.
3715
+ //
3716
+ // Deliberately not fatal: a directive is the tool's real answer, and
3717
+ // failing to record it must never withhold it. trackToolExecution
3718
+ // already swallows and warns internally; the catch here covers a
3719
+ // throw before that boundary.
3720
+ try {
3721
+ await this.trackToolExecution(name, args, directiveResponse, true);
3722
+ }
3723
+ catch (trackingError) {
3724
+ this.logger.warn(`[CE-MCP] Usage tracking failed for ${name}: ${trackingError instanceof Error ? trackingError.message : String(trackingError)}`);
3725
+ }
3726
+ return directiveResponse;
3704
3727
  }
3705
3728
  // Fall through to legacy execution if no directive available
3706
3729
  this.logger.info(`[CE-MCP] No directive available for ${name}, using legacy path`);
@@ -4356,13 +4379,30 @@ export class McpAdrAnalysisServer {
4356
4379
  - **Execution Mode**: ${status.executionMode}
4357
4380
  - **AI Model**: ${status.model}
4358
4381
 
4359
- ${status.reason
4360
- ? `## ⚠️ Issue Detected
4382
+ ${
4383
+ // CE-MCP is the DEFAULT mode and needs no API key. Reporting the absence of
4384
+ // one as an "Issue Detected" -- immediately after saying no external API call
4385
+ // is needed -- told every new user to go and buy a key they do not need.
4386
+ // Legacy configuration is only a problem for someone who asked for it. (#1414)
4387
+ status.executionMode === 'ce-mcp'
4388
+ ? `## ✅ Running in CE-MCP mode
4389
+
4390
+ No API key is required. Tools return orchestration directives that your host LLM
4391
+ executes directly, which is why **AI Execution Enabled: NO** above is expected and
4392
+ correct rather than a fault.
4393
+
4394
+ Note that only some tools currently return a directive; the rest return their
4395
+ result directly. See ADR-014 and ADR-021.
4396
+
4397
+ Legacy OpenRouter execution is off by design. You only need the configuration
4398
+ below if you deliberately want that older path.`
4399
+ : status.reason
4400
+ ? `## ⚠️ Issue Detected
4361
4401
  **Problem**: ${status.reason}
4362
4402
 
4363
4403
  ## Solution
4364
4404
  ${!status.hasApiKey
4365
- ? `
4405
+ ? `
4366
4406
  1. Get an OpenRouter API key from https://openrouter.ai/keys
4367
4407
  2. Add it to your MCP configuration:
4368
4408
  \`\`\`json
@@ -4381,8 +4421,8 @@ ${!status.hasApiKey
4381
4421
  \`\`\`
4382
4422
  3. Restart your MCP client (Claude Desktop, etc.)
4383
4423
  `
4384
- : status.executionMode !== 'full'
4385
- ? `
4424
+ : status.executionMode !== 'full'
4425
+ ? `
4386
4426
  1. Update your MCP configuration to set EXECUTION_MODE to "full":
4387
4427
  \`\`\`json
4388
4428
  {
@@ -4397,8 +4437,8 @@ ${!status.hasApiKey
4397
4437
  \`\`\`
4398
4438
  2. Restart your MCP client
4399
4439
  `
4400
- : ''}`
4401
- : `## ✅ Configuration Looks Good!
4440
+ : ''}`
4441
+ : `## ✅ Configuration Looks Good!
4402
4442
 
4403
4443
  AI execution is properly configured. Tools should return actual results instead of prompts.
4404
4444
 
@@ -7505,7 +7545,17 @@ Please provide:
7505
7545
  // Fall back to static resource handling
7506
7546
  // Parse URI to determine resource type and parameters
7507
7547
  const url = new globalThis.URL(uri);
7508
- const resourceType = url.pathname.replace('/', '');
7548
+ // For a non-special scheme like `adr://adr_list`, WHATWG URL puts the name in
7549
+ // `host`, not `pathname` -- pathname is ''. Reading pathname alone made every one
7550
+ // of the 16 cases below unreachable: resourceType was always '', so the switch fell
7551
+ // straight to `default` and threw "Unknown resource type: " with nothing after the
7552
+ // colon. 16 of the 17 concrete resources advertised in resources/list were dead.
7553
+ //
7554
+ // adr://adr_list -> host 'adr_list', pathname ''
7555
+ // adr://adr/{id} -> host 'adr', pathname '/%7Bid%7D'
7556
+ //
7557
+ // Prefer the host; fall back to pathname so path-style URIs still resolve.
7558
+ const resourceType = url.host || url.pathname.replace('/', '');
7509
7559
  const params = Object.fromEntries(url.searchParams.entries());
7510
7560
  switch (resourceType) {
7511
7561
  case 'architectural_knowledge_graph': {