@danainnovations/cortex-mcp 1.0.79 → 1.0.80

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.
package/dist/cli.js CHANGED
@@ -1231,6 +1231,13 @@ function getWizardHtml() {
1231
1231
  return html;
1232
1232
  }).join('');
1233
1233
 
1234
+ // Add verify button for debugging config issues
1235
+ var verifyHtml = '<div style="margin-top: 12px; text-align: center;">' +
1236
+ '<button onclick="verifyConfig()" style="background: transparent; border: 1px solid #555; color: #aaa; padding: 6px 16px; border-radius: 6px; cursor: pointer; font-size: 12px;">Verify Config File</button>' +
1237
+ '<pre id="verify-result" style="display:none; margin-top: 8px; padding: 10px; background: #1a1a2e; border-radius: 6px; font-size: 11px; text-align: left; max-height: 200px; overflow: auto; color: #ccc;"></pre>' +
1238
+ '</div>';
1239
+ resultEl.innerHTML += verifyHtml;
1240
+
1234
1241
  btn.textContent = 'Continue';
1235
1242
  btn.disabled = false;
1236
1243
  btn.onclick = function() { goToStep('connect'); };
@@ -1427,6 +1434,19 @@ function getWizardHtml() {
1427
1434
  });
1428
1435
  }
1429
1436
 
1437
+ async function verifyConfig() {
1438
+ var el = document.getElementById('verify-result');
1439
+ el.style.display = 'block';
1440
+ el.textContent = 'Reading config file...';
1441
+ try {
1442
+ var resp = await fetch('/api/debug/config');
1443
+ var data = await resp.json();
1444
+ el.textContent = JSON.stringify(data, null, 2);
1445
+ } catch (err) {
1446
+ el.textContent = 'Error: ' + err.message;
1447
+ }
1448
+ }
1449
+
1430
1450
  function copySnippet(btn) {
1431
1451
  var pre = btn.parentElement.querySelector('pre');
1432
1452
  navigator.clipboard.writeText(pre.textContent).then(function() {
@@ -1445,6 +1465,9 @@ function getWizardHtml() {
1445
1465
  </html>`;
1446
1466
  }
1447
1467
 
1468
+ // src/wizard/routes.ts
1469
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
1470
+
1448
1471
  // src/config/clients.ts
1449
1472
  import { existsSync, readFileSync, writeFileSync } from "fs";
1450
1473
  import { dirname } from "path";
@@ -2107,6 +2130,28 @@ async function handleApiRoute(path, searchParams, req, res, options, onComplete)
2107
2130
  json(res, { results });
2108
2131
  return true;
2109
2132
  }
2133
+ if (path === "/api/debug/config" && method === "GET") {
2134
+ const configPath = getClaudeDesktopConfigPath();
2135
+ const result = {
2136
+ path: configPath,
2137
+ exists: existsSync4(configPath),
2138
+ platform: getPlatform()
2139
+ };
2140
+ if (existsSync4(configPath)) {
2141
+ try {
2142
+ const raw = readFileSync4(configPath, "utf-8");
2143
+ const parsed = JSON.parse(raw);
2144
+ result.contents = parsed;
2145
+ result.hasMcpServers = !!parsed?.mcpServers;
2146
+ result.hasCortex = !!parsed?.mcpServers?.cortex;
2147
+ } catch (e) {
2148
+ result.error = String(e);
2149
+ result.rawContents = readFileSync4(configPath, "utf-8");
2150
+ }
2151
+ }
2152
+ json(res, result);
2153
+ return true;
2154
+ }
2110
2155
  if (path === "/api/connections" && method === "GET") {
2111
2156
  const apiKey = getState().apiKey;
2112
2157
  try {
@@ -2342,7 +2387,7 @@ async function runConfigure(options) {
2342
2387
  }
2343
2388
 
2344
2389
  // src/proxy/stdio-server.ts
2345
- import { readFileSync as readFileSync5, statSync as statSync2 } from "fs";
2390
+ import { readFileSync as readFileSync6, statSync as statSync2 } from "fs";
2346
2391
  import { Server } from "@modelcontextprotocol/sdk/server/index.js";
2347
2392
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
2348
2393
  import {
@@ -2458,9 +2503,9 @@ var CortexHttpClient = class {
2458
2503
  import {
2459
2504
  copyFileSync,
2460
2505
  cpSync,
2461
- existsSync as existsSync4,
2506
+ existsSync as existsSync5,
2462
2507
  mkdirSync as mkdirSync4,
2463
- readFileSync as readFileSync4,
2508
+ readFileSync as readFileSync5,
2464
2509
  readdirSync,
2465
2510
  rmSync,
2466
2511
  statSync,
@@ -2513,7 +2558,7 @@ function resolvePath(p) {
2513
2558
  }
2514
2559
  function isBinaryFile(filePath) {
2515
2560
  try {
2516
- const fd = readFileSync4(filePath, { flag: "r" });
2561
+ const fd = readFileSync5(filePath, { flag: "r" });
2517
2562
  const chunk = fd.subarray(0, BINARY_CHECK_SIZE);
2518
2563
  if (chunk.length === 0) return false;
2519
2564
  for (const sig of BINARY_SIGNATURES) {
@@ -2600,7 +2645,7 @@ function handleReadFile(args) {
2600
2645
  throw new Error(`File size (${stat.size} bytes) exceeds maximum allowed size (${MAX_READ_SIZE} bytes).`);
2601
2646
  }
2602
2647
  if (isBinaryFile(filePath)) {
2603
- const raw = readFileSync4(filePath);
2648
+ const raw = readFileSync5(filePath);
2604
2649
  return ok({
2605
2650
  content: raw.toString("base64"),
2606
2651
  is_binary: true,
@@ -2609,7 +2654,7 @@ function handleReadFile(args) {
2609
2654
  path: filePath
2610
2655
  });
2611
2656
  }
2612
- const text = readFileSync4(filePath, encoding);
2657
+ const text = readFileSync5(filePath, encoding);
2613
2658
  return ok({
2614
2659
  content: text,
2615
2660
  is_binary: false,
@@ -2630,7 +2675,7 @@ function handleReadFileLines(args) {
2630
2675
  }
2631
2676
  if (startLine < 1) throw new Error("start_line must be >= 1.");
2632
2677
  if (endLine !== void 0 && endLine < startLine) throw new Error("end_line must be >= start_line.");
2633
- const text = readFileSync4(filePath, encoding);
2678
+ const text = readFileSync5(filePath, encoding);
2634
2679
  const allLines = text.split(/\n/);
2635
2680
  const totalLines = allLines.length;
2636
2681
  const startIdx = startLine - 1;
@@ -2653,7 +2698,7 @@ function handleWriteFile(args) {
2653
2698
  const isBinary = args.is_binary || false;
2654
2699
  const overwrite = args.overwrite !== false;
2655
2700
  const createParents = args.create_parents || false;
2656
- const created = !existsSync4(filePath);
2701
+ const created = !existsSync5(filePath);
2657
2702
  if (!overwrite && !created) {
2658
2703
  throw new Error("File already exists.");
2659
2704
  }
@@ -2684,7 +2729,7 @@ function handleAppendFile(args) {
2684
2729
  const filePath = resolvePath(args.path);
2685
2730
  const content = args.content;
2686
2731
  const encoding = args.encoding || "utf-8";
2687
- if (!existsSync4(filePath)) throw new Error("File not found.");
2732
+ if (!existsSync5(filePath)) throw new Error("File not found.");
2688
2733
  const encoded = Buffer.from(content, encoding);
2689
2734
  appendFileSync(filePath, content, encoding);
2690
2735
  const newSize = statSync(filePath).size;
@@ -2697,7 +2742,7 @@ function handleAppendFile(args) {
2697
2742
  function handleCreateDirectory(args) {
2698
2743
  const dirPath = resolvePath(args.path);
2699
2744
  const parents = args.parents !== false;
2700
- if (existsSync4(dirPath)) {
2745
+ if (existsSync5(dirPath)) {
2701
2746
  return ok({ path: dirPath, created: false });
2702
2747
  }
2703
2748
  if (parents) {
@@ -2710,7 +2755,7 @@ function handleCreateDirectory(args) {
2710
2755
  function handleDelete(args) {
2711
2756
  const targetPath = resolvePath(args.path);
2712
2757
  const recursive = args.recursive || false;
2713
- if (!existsSync4(targetPath)) throw new Error("Path not found.");
2758
+ if (!existsSync5(targetPath)) throw new Error("Path not found.");
2714
2759
  const stat = statSync(targetPath, { throwIfNoEntry: false });
2715
2760
  if (!stat) throw new Error("Path not found.");
2716
2761
  if (stat.isDirectory()) {
@@ -2740,8 +2785,8 @@ function handleMove(args) {
2740
2785
  const source = resolvePath(args.source);
2741
2786
  const destination = resolvePath(args.destination);
2742
2787
  const overwrite = args.overwrite || false;
2743
- if (!existsSync4(source)) throw new Error("Source path not found.");
2744
- if (existsSync4(destination) && !overwrite) throw new Error("Destination already exists.");
2788
+ if (!existsSync5(source)) throw new Error("Source path not found.");
2789
+ if (existsSync5(destination) && !overwrite) throw new Error("Destination already exists.");
2745
2790
  const stat = statSync(source);
2746
2791
  const type = stat.isDirectory() ? "directory" : "file";
2747
2792
  const bytesMoved = stat.isDirectory() ? countDirectoryContents(source).bytes : stat.size;
@@ -2771,11 +2816,11 @@ function handleCopy(args) {
2771
2816
  const source = resolvePath(args.source);
2772
2817
  const destination = resolvePath(args.destination);
2773
2818
  const overwrite = args.overwrite || false;
2774
- if (!existsSync4(source)) throw new Error("Source path not found.");
2775
- if (existsSync4(destination) && !overwrite) throw new Error("Destination already exists.");
2819
+ if (!existsSync5(source)) throw new Error("Source path not found.");
2820
+ if (existsSync5(destination) && !overwrite) throw new Error("Destination already exists.");
2776
2821
  const stat = statSync(source);
2777
2822
  if (stat.isDirectory()) {
2778
- if (existsSync4(destination) && overwrite) {
2823
+ if (existsSync5(destination) && overwrite) {
2779
2824
  rmSync(destination, { recursive: true });
2780
2825
  }
2781
2826
  cpSync(source, destination, { recursive: true });
@@ -2792,7 +2837,7 @@ function handleListDirectory(args) {
2792
2837
  const maxDepth = args.max_depth || 1;
2793
2838
  const pattern = args.pattern;
2794
2839
  const includeHidden = args.include_hidden || false;
2795
- if (!existsSync4(dirPath)) throw new Error("Directory not found.");
2840
+ if (!existsSync5(dirPath)) throw new Error("Directory not found.");
2796
2841
  const stat = statSync(dirPath);
2797
2842
  if (!stat.isDirectory()) throw new Error("Path is not a directory.");
2798
2843
  const effectiveDepth = recursive ? maxDepth : 1;
@@ -2847,7 +2892,7 @@ function handleListDirectory(args) {
2847
2892
  }
2848
2893
  function handleExists(args) {
2849
2894
  const targetPath = resolvePath(args.path);
2850
- const pathExists = existsSync4(targetPath);
2895
+ const pathExists = existsSync5(targetPath);
2851
2896
  let type = null;
2852
2897
  if (pathExists) {
2853
2898
  const stat = statSync(targetPath, { throwIfNoEntry: false });
@@ -2859,7 +2904,7 @@ function handleExists(args) {
2859
2904
  }
2860
2905
  function handleGetFileInfo(args) {
2861
2906
  const filePath = resolvePath(args.path);
2862
- if (!existsSync4(filePath)) throw new Error("Path not found.");
2907
+ if (!existsSync5(filePath)) throw new Error("Path not found.");
2863
2908
  const stat = statSync(filePath, { throwIfNoEntry: false });
2864
2909
  if (!stat) throw new Error("Path not found.");
2865
2910
  const isDir = stat.isDirectory();
@@ -2885,7 +2930,7 @@ function handleSearchFiles(args) {
2885
2930
  const recursive = args.recursive !== false;
2886
2931
  const includeHidden = args.include_hidden || false;
2887
2932
  const maxResults = args.max_results || 1e3;
2888
- if (!existsSync4(searchPath)) throw new Error("Directory not found.");
2933
+ if (!existsSync5(searchPath)) throw new Error("Directory not found.");
2889
2934
  if (!statSync(searchPath).isDirectory()) throw new Error("Path is not a directory.");
2890
2935
  const patternRe = globToRegex(pattern);
2891
2936
  const matches = [];
@@ -2932,7 +2977,7 @@ function handleFindInFiles(args) {
2932
2977
  const contextLines = args.context_lines || 0;
2933
2978
  const maxResults = args.max_results || 500;
2934
2979
  const includeHidden = args.include_hidden || false;
2935
- if (!existsSync4(searchPath)) throw new Error("Directory not found.");
2980
+ if (!existsSync5(searchPath)) throw new Error("Directory not found.");
2936
2981
  if (!statSync(searchPath).isDirectory()) throw new Error("Path is not a directory.");
2937
2982
  const flags = caseSensitive ? "" : "i";
2938
2983
  const re = isRegex ? new RegExp(query, flags) : new RegExp(query.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), flags);
@@ -2961,7 +3006,7 @@ function handleFindInFiles(args) {
2961
3006
  let fileHasMatch = false;
2962
3007
  let lines;
2963
3008
  try {
2964
- const text = readFileSync4(fullPath, "utf-8");
3009
+ const text = readFileSync5(fullPath, "utf-8");
2965
3010
  lines = text.split("\n");
2966
3011
  } catch {
2967
3012
  continue;
@@ -3001,7 +3046,7 @@ function handleGetTree(args) {
3001
3046
  const maxDepth = args.max_depth || 3;
3002
3047
  const includeHidden = args.include_hidden || false;
3003
3048
  const maxEntries = args.max_entries || 500;
3004
- if (!existsSync4(rootPath)) throw new Error("Directory not found.");
3049
+ if (!existsSync5(rootPath)) throw new Error("Directory not found.");
3005
3050
  if (!statSync(rootPath).isDirectory()) throw new Error("Path is not a directory.");
3006
3051
  const lines = [];
3007
3052
  let entryCount = 0;
@@ -3156,7 +3201,7 @@ async function handleLocalFileUpload(cortex, toolName, args) {
3156
3201
  };
3157
3202
  }
3158
3203
  if (fileSize <= INLINE_UPLOAD_MAX) {
3159
- const fileBuffer2 = readFileSync5(filePath);
3204
+ const fileBuffer2 = readFileSync6(filePath);
3160
3205
  const base64Content = fileBuffer2.toString("base64");
3161
3206
  const forwardArgs = { ...args, content: base64Content };
3162
3207
  delete forwardArgs.file_path;
@@ -3208,7 +3253,7 @@ async function handleLocalFileUpload(cortex, toolName, args) {
3208
3253
  isError: true
3209
3254
  };
3210
3255
  }
3211
- const fileBuffer = readFileSync5(filePath);
3256
+ const fileBuffer = readFileSync6(filePath);
3212
3257
  const chunkSize = 2.5 * 1024 * 1024;
3213
3258
  const total = fileBuffer.length;
3214
3259
  let driveItem = {};
@@ -3375,7 +3420,7 @@ function runStatus() {
3375
3420
  }
3376
3421
 
3377
3422
  // src/cli/reset.ts
3378
- import { existsSync as existsSync5, unlinkSync as unlinkSync3, rmdirSync } from "fs";
3423
+ import { existsSync as existsSync6, unlinkSync as unlinkSync3, rmdirSync } from "fs";
3379
3424
  function runReset() {
3380
3425
  console.log("");
3381
3426
  console.log(" Resetting Cortex MCP configuration...");
@@ -3396,7 +3441,7 @@ function runReset() {
3396
3441
  ` Codex: ${codexReset ? "entries removed" : "no entries found"}`
3397
3442
  );
3398
3443
  const configPath = getConfigPath();
3399
- if (existsSync5(configPath)) {
3444
+ if (existsSync6(configPath)) {
3400
3445
  unlinkSync3(configPath);
3401
3446
  console.log(` Config file: removed`);
3402
3447
  }