@danainnovations/cortex-mcp 1.0.80 → 1.0.82

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.
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ openBrowser
4
+ } from "./chunk-HXROEPYY.js";
5
+ export {
6
+ openBrowser
7
+ };
8
+ //# sourceMappingURL=browser-RCYYNQJN.js.map
@@ -46,6 +46,33 @@ function getWindowsHomeFromWSL() {
46
46
  }
47
47
  return null;
48
48
  }
49
+ function getStoreClaudePath() {
50
+ try {
51
+ const localAppData = process.env.LOCALAPPDATA || join(homedir(), "AppData", "Local");
52
+ const packagesDir = join(localAppData, "Packages");
53
+ const dirs = readdirSync(packagesDir).filter((d) => d.startsWith("Claude_"));
54
+ if (dirs.length > 0) {
55
+ return join(
56
+ packagesDir,
57
+ dirs[0],
58
+ "LocalCache",
59
+ "Roaming",
60
+ "Claude",
61
+ "claude_desktop_config.json"
62
+ );
63
+ }
64
+ } catch {
65
+ }
66
+ return null;
67
+ }
68
+ function getStandardClaudeDesktopPath() {
69
+ const home = homedir();
70
+ return join(
71
+ process.env.APPDATA || join(home, "AppData", "Roaming"),
72
+ "Claude",
73
+ "claude_desktop_config.json"
74
+ );
75
+ }
49
76
  function getClaudeDesktopConfigPath() {
50
77
  const home = getHomeDir();
51
78
  const p = getPlatform();
@@ -64,12 +91,11 @@ function getClaudeDesktopConfigPath() {
64
91
  "Claude",
65
92
  "claude_desktop_config.json"
66
93
  );
67
- case "windows":
68
- return join(
69
- process.env.APPDATA || join(home, "AppData", "Roaming"),
70
- "Claude",
71
- "claude_desktop_config.json"
72
- );
94
+ case "windows": {
95
+ const storePath = getStoreClaudePath();
96
+ if (storePath) return storePath;
97
+ return getStandardClaudeDesktopPath();
98
+ }
73
99
  case "linux":
74
100
  return join(home, ".config", "Claude", "claude_desktop_config.json");
75
101
  }
@@ -104,6 +130,8 @@ export {
104
130
  getHomeDir,
105
131
  getPlatform,
106
132
  isWSL,
133
+ getStoreClaudePath,
134
+ getStandardClaudeDesktopPath,
107
135
  getClaudeDesktopConfigPath,
108
136
  getCursorConfigPath,
109
137
  getVSCodeMcpConfigPath,
@@ -111,4 +139,4 @@ export {
111
139
  getCodexConfigPath,
112
140
  openBrowser
113
141
  };
114
- //# sourceMappingURL=chunk-YA4Q2GAN.js.map
142
+ //# sourceMappingURL=chunk-HXROEPYY.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/browser.ts","../src/utils/platform.ts"],"sourcesContent":["import { exec } from \"node:child_process\";\nimport { getPlatform } from \"./platform.js\";\n\nexport function openBrowser(url: string): Promise<void> {\n return new Promise((resolve) => {\n const platform = getPlatform();\n const cmd =\n platform === \"macos\" ? `open \"${url}\"` :\n platform === \"windows\" ? `start \"\" \"${url}\"` :\n `xdg-open \"${url}\"`;\n exec(cmd, () => resolve());\n });\n}\n","import { homedir, platform } from \"node:os\";\nimport { join } from \"node:path\";\nimport { readFileSync, readdirSync } from \"node:fs\";\nimport { execSync } from \"node:child_process\";\n\n/** Get the user's home directory */\nexport function getHomeDir(): string {\n return homedir();\n}\n\n/** Get the current platform */\nexport function getPlatform(): \"macos\" | \"windows\" | \"linux\" {\n const p = platform();\n if (p === \"darwin\") return \"macos\";\n if (p === \"win32\") return \"windows\";\n return \"linux\";\n}\n\n/** Detect if running inside Windows Subsystem for Linux */\nexport function isWSL(): boolean {\n if (getPlatform() !== \"linux\") return false;\n try {\n const version = readFileSync(\"/proc/version\", \"utf-8\");\n return /microsoft|wsl/i.test(version);\n } catch {\n return false;\n }\n}\n\n/** Resolve the Windows user home directory from within WSL via /mnt/c */\nfunction getWindowsHomeFromWSL(): string | null {\n try {\n // Try cmd.exe to get the Windows USERNAME\n const raw = execSync(\"cmd.exe /c echo %USERNAME%\", {\n stdio: [\"pipe\", \"pipe\", \"pipe\"],\n timeout: 5000,\n }).toString().trim().replace(/\\r/g, \"\");\n if (raw && raw !== \"%USERNAME%\") {\n return `/mnt/c/Users/${raw}`;\n }\n } catch {\n // cmd.exe may not be available — fall through\n }\n\n try {\n // Fallback: scan /mnt/c/Users for a single non-system user directory\n const dirs = readdirSync(\"/mnt/c/Users\").filter(\n (d) =>\n d !== \"Public\" &&\n d !== \"Default\" &&\n d !== \"Default User\" &&\n d !== \"All Users\" &&\n !d.startsWith(\".\")\n );\n if (dirs.length === 1) return `/mnt/c/Users/${dirs[0]}`;\n } catch {\n // /mnt/c not mounted\n }\n\n return null;\n}\n\n/**\n * Detect Microsoft Store Claude Desktop install path.\n * Store apps use a virtualized filesystem under LocalCache\\Roaming.\n */\nexport function getStoreClaudePath(): string | null {\n try {\n const localAppData = process.env.LOCALAPPDATA || join(homedir(), \"AppData\", \"Local\");\n const packagesDir = join(localAppData, \"Packages\");\n const dirs = readdirSync(packagesDir).filter((d) => d.startsWith(\"Claude_\"));\n if (dirs.length > 0) {\n return join(\n packagesDir,\n dirs[0],\n \"LocalCache\",\n \"Roaming\",\n \"Claude\",\n \"claude_desktop_config.json\"\n );\n }\n } catch {\n // Not a Store install or can't read Packages dir\n }\n return null;\n}\n\n/**\n * Get the standard (non-Store) Claude Desktop config path on Windows.\n */\nexport function getStandardClaudeDesktopPath(): string {\n const home = homedir();\n return join(\n process.env.APPDATA || join(home, \"AppData\", \"Roaming\"),\n \"Claude\",\n \"claude_desktop_config.json\"\n );\n}\n\n/**\n * Get the Claude Desktop config file path for the current platform.\n * On Windows, prefers the Microsoft Store virtualized path if detected.\n */\nexport function getClaudeDesktopConfigPath(): string {\n const home = getHomeDir();\n const p = getPlatform();\n\n // WSL: Claude Desktop is a Windows app — write to the Windows AppData path\n if (p === \"linux\" && isWSL()) {\n const winHome = getWindowsHomeFromWSL();\n if (winHome) {\n return join(winHome, \"AppData\", \"Roaming\", \"Claude\", \"claude_desktop_config.json\");\n }\n }\n\n switch (p) {\n case \"macos\":\n return join(\n home,\n \"Library\",\n \"Application Support\",\n \"Claude\",\n \"claude_desktop_config.json\"\n );\n case \"windows\": {\n // Prefer Microsoft Store path if installed (virtualized filesystem)\n const storePath = getStoreClaudePath();\n if (storePath) return storePath;\n return getStandardClaudeDesktopPath();\n }\n case \"linux\":\n return join(home, \".config\", \"Claude\", \"claude_desktop_config.json\");\n }\n}\n\n/**\n * Get the Cursor MCP config file path for the current platform.\n */\nexport function getCursorConfigPath(): string {\n const home = getHomeDir();\n return join(home, \".cursor\", \"mcp.json\");\n}\n\n/**\n * Get the VS Code MCP config file path for the current platform.\n */\nexport function getVSCodeMcpConfigPath(): string {\n const home = getHomeDir();\n return join(home, \".vscode\", \"mcp.json\");\n}\n\n/**\n * Get the Antigravity MCP config file path for the current platform.\n */\nexport function getAntigravityConfigPath(): string {\n const home = getHomeDir();\n return join(home, \".gemini\", \"antigravity\", \"mcp_config.json\");\n}\n\n/**\n * Get the Codex (OpenAI) config file path.\n * Shared by both Codex CLI and Codex IDE extension.\n */\nexport function getCodexConfigPath(): string {\n const home = getHomeDir();\n return join(home, \".codex\", \"config.toml\");\n}\n"],"mappings":";;;AAAA,SAAS,YAAY;;;ACArB,SAAS,SAAS,gBAAgB;AAClC,SAAS,YAAY;AACrB,SAAS,cAAc,mBAAmB;AAC1C,SAAS,gBAAgB;AAGlB,SAAS,aAAqB;AACnC,SAAO,QAAQ;AACjB;AAGO,SAAS,cAA6C;AAC3D,QAAM,IAAI,SAAS;AACnB,MAAI,MAAM,SAAU,QAAO;AAC3B,MAAI,MAAM,QAAS,QAAO;AAC1B,SAAO;AACT;AAGO,SAAS,QAAiB;AAC/B,MAAI,YAAY,MAAM,QAAS,QAAO;AACtC,MAAI;AACF,UAAM,UAAU,aAAa,iBAAiB,OAAO;AACrD,WAAO,iBAAiB,KAAK,OAAO;AAAA,EACtC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGA,SAAS,wBAAuC;AAC9C,MAAI;AAEF,UAAM,MAAM,SAAS,8BAA8B;AAAA,MACjD,OAAO,CAAC,QAAQ,QAAQ,MAAM;AAAA,MAC9B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AAA,IACT,KAAK;AACH,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF,KAAK,WAAW;AAEd,YAAM,YAAY,mBAAmB;AACrC,UAAI,UAAW,QAAO;AACtB,aAAO,6BAA6B;AAAA,IACtC;AAAA,IACA,KAAK;AACH,aAAO,KAAK,MAAM,WAAW,UAAU,4BAA4B;AAAA,EACvE;AACF;AAKO,SAAS,sBAA8B;AAC5C,QAAM,OAAO,WAAW;AACxB,SAAO,KAAK,MAAM,WAAW,UAAU;AACzC;AAKO,SAAS,yBAAiC;AAC/C,QAAM,OAAO,WAAW;AACxB,SAAO,KAAK,MAAM,WAAW,UAAU;AACzC;AAKO,SAAS,2BAAmC;AACjD,QAAM,OAAO,WAAW;AACxB,SAAO,KAAK,MAAM,WAAW,eAAe,iBAAiB;AAC/D;AAMO,SAAS,qBAA6B;AAC3C,QAAM,OAAO,WAAW;AACxB,SAAO,KAAK,MAAM,UAAU,aAAa;AAC3C;;;ADnKO,SAAS,YAAY,KAA4B;AACtD,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,UAAMA,YAAW,YAAY;AAC7B,UAAM,MACJA,cAAa,UAAU,SAAS,GAAG,MACnCA,cAAa,YAAY,aAAa,GAAG,MACzC,aAAa,GAAG;AAClB,SAAK,KAAK,MAAM,QAAQ,CAAC;AAAA,EAC3B,CAAC;AACH;","names":["platform"]}
package/dist/cli.js CHANGED
@@ -17,10 +17,12 @@ import {
17
17
  getCursorConfigPath,
18
18
  getHomeDir,
19
19
  getPlatform,
20
+ getStandardClaudeDesktopPath,
21
+ getStoreClaudePath,
20
22
  getVSCodeMcpConfigPath,
21
23
  isWSL,
22
24
  openBrowser
23
- } from "./chunk-YA4Q2GAN.js";
25
+ } from "./chunk-HXROEPYY.js";
24
26
 
25
27
  // bin/cli.ts
26
28
  import { Command } from "commander";
@@ -1595,6 +1597,36 @@ function configureClaudeDesktop(_serverUrl, apiKey, _mcps) {
1595
1597
  }
1596
1598
  servers["cortex"] = cortexEntry;
1597
1599
  writeFileSync(configPath, JSON.stringify(config, null, 2) + "\n");
1600
+ if (getPlatform() === "windows") {
1601
+ const storePath = getStoreClaudePath();
1602
+ const standardPath = getStandardClaudeDesktopPath();
1603
+ const altPath = configPath === storePath ? standardPath : storePath;
1604
+ if (altPath && altPath !== configPath) {
1605
+ try {
1606
+ const altDir = dirname(altPath);
1607
+ if (!existsSync(altDir)) {
1608
+ mkdirSync(altDir, { recursive: true });
1609
+ }
1610
+ let altConfig = {};
1611
+ if (existsSync(altPath)) {
1612
+ try {
1613
+ altConfig = JSON.parse(readFileSync(altPath, "utf-8"));
1614
+ } catch {
1615
+ }
1616
+ }
1617
+ if (!altConfig.mcpServers || typeof altConfig.mcpServers !== "object") {
1618
+ altConfig.mcpServers = {};
1619
+ }
1620
+ const altServers = altConfig.mcpServers;
1621
+ for (const key of Object.keys(altServers)) {
1622
+ if (key.startsWith("cortex-") || key === "cortex") delete altServers[key];
1623
+ }
1624
+ altServers["cortex"] = cortexEntry;
1625
+ writeFileSync(altPath, JSON.stringify(altConfig, null, 2) + "\n");
1626
+ } catch {
1627
+ }
1628
+ }
1629
+ }
1598
1630
  if (isWindowsTarget) {
1599
1631
  const start = Date.now();
1600
1632
  while (Date.now() - start < 500) {
@@ -2260,6 +2292,7 @@ function startWizardServer(options) {
2260
2292
  const onComplete = () => {
2261
2293
  completionResolve();
2262
2294
  };
2295
+ const connections = /* @__PURE__ */ new Set();
2263
2296
  const server = http.createServer(async (req, res) => {
2264
2297
  const url = new URL(req.url || "/", `http://localhost`);
2265
2298
  const path = url.pathname;
@@ -2287,11 +2320,19 @@ function startWizardServer(options) {
2287
2320
  res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
2288
2321
  res.end(getWizardHtml());
2289
2322
  });
2323
+ server.on("connection", (socket) => {
2324
+ connections.add(socket);
2325
+ socket.on("close", () => connections.delete(socket));
2326
+ });
2290
2327
  server.listen(0, "127.0.0.1", () => {
2291
2328
  const addr = server.address();
2292
2329
  resolve2({
2293
2330
  port: addr.port,
2294
2331
  close: () => new Promise((r) => {
2332
+ for (const socket of connections) {
2333
+ socket.destroy();
2334
+ }
2335
+ connections.clear();
2295
2336
  server.close(() => r());
2296
2337
  }),
2297
2338
  waitForCompletion: () => completionPromise
@@ -4135,7 +4176,7 @@ program.command("disconnect <provider>").description("Remove your personal OAuth
4135
4176
  });
4136
4177
  program.command("connect-mobile").description("Connect Cortex to Claude on mobile \u2014 opens setup page in browser").action(async () => {
4137
4178
  const { DEFAULT_SERVER_URL: DEFAULT_SERVER_URL3 } = await import("./constants-QSLA3TAZ.js");
4138
- const { openBrowser: openBrowser2 } = await import("./browser-S7WMSQYY.js");
4179
+ const { openBrowser: openBrowser2 } = await import("./browser-RCYYNQJN.js");
4139
4180
  const url = `${DEFAULT_SERVER_URL3}/connect`;
4140
4181
  console.log("\nOpening Cortex connect page...");
4141
4182
  console.log(` ${url}