@danainnovations/cortex-mcp 1.0.91 → 1.0.93

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
@@ -821,7 +821,7 @@ function getWizardHtml() {
821
821
  <div id="conn-list" class="conn-list"></div>
822
822
  <div class="btn-row">
823
823
  <button class="btn btn-secondary" onclick="goToStep('clients')">Back</button>
824
- <button class="btn btn-primary" onclick="goToStep('done')">Continue</button>
824
+ <button class="btn btn-primary" onclick="finishSetup()">Finish Setup</button>
825
825
  </div>
826
826
  </div>
827
827
  </div>
@@ -858,6 +858,7 @@ function getWizardHtml() {
858
858
  selectedClients: [],
859
859
  configuredClients: [],
860
860
  connections: [],
861
+ serverUrl: '',
861
862
  };
862
863
 
863
864
  // \u2500\u2500 Step Index Map \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
@@ -890,6 +891,7 @@ function getWizardHtml() {
890
891
  vscode: '<svg viewBox="0 0 16 16"><path d="M11.5 1L5 7l-3-2.5L1 5l3.5 3L1 11l1 .5L5 9l6.5 6 2.5-1V2z"/></svg>',
891
892
  antigravity: '<svg viewBox="0 0 16 16"><path d="M8 1l2 5h5l-4 3 1.5 5L8 11l-4.5 3L5 9 1 6h5z"/></svg>',
892
893
  codex: '<svg viewBox="0 0 16 16"><circle cx="8" cy="8" r="3" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M8 1v3M8 12v3M1 8h3M12 8h3" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/></svg>',
894
+ 'claude-ai': '<svg viewBox="0 0 16 16"><path d="M8 1a7 7 0 100 14A7 7 0 008 1zm0 1.2a5.8 5.8 0 110 11.6A5.8 5.8 0 018 2.2z"/><path d="M2.5 8h11M8 2.5c-1.8 2-2.7 3.5-2.7 5.5S6.2 12 8 13.5c1.8-1.5 2.7-3.5 2.7-5.5S9.8 4.5 8 2.5z" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round"/></svg>',
893
895
  perplexity: '<svg viewBox="0 0 16 16"><circle cx="8" cy="8" r="6" fill="none" stroke="currentColor" stroke-width="1.2"/><path d="M8 2v12M2 8h12M4 4l8 8M12 4l-8 8" stroke="currentColor" stroke-width="1" stroke-linecap="round"/></svg>',
894
896
  stdio: '<svg viewBox="0 0 16 16"><path d="M2 3h12a1 1 0 011 1v8a1 1 0 01-1 1H2a1 1 0 01-1-1V4a1 1 0 011-1zm1 2v6h10V5H3z"/></svg>',
895
897
  };
@@ -908,6 +910,7 @@ function getWizardHtml() {
908
910
  state.selectedMcps = state.enabledMcps.slice();
909
911
  state.detectedClients = data.detectedClients || [];
910
912
  state.configuredClients = (data.config && data.config.configuredClients) || [];
913
+ state.serverUrl = data.serverUrl || '';
911
914
  } catch (err) {
912
915
  console.error('Failed to load state:', err);
913
916
  }
@@ -1199,7 +1202,7 @@ function getWizardHtml() {
1199
1202
  function renderClientItem(client) {
1200
1203
  var detected = client.detected;
1201
1204
  var icon = CLIENT_ICONS[client.type] || '';
1202
- var isManual = client.type === 'perplexity' || client.type === 'stdio';
1205
+ var isManual = client.type === 'perplexity' || client.type === 'stdio' || client.type === 'claude-ai';
1203
1206
  var alreadyConfigured = !isManual && state.configuredClients.indexOf(client.type) !== -1;
1204
1207
  var statusText = alreadyConfigured ? 'Configured' : (detected ? 'Detected' : 'Not found');
1205
1208
  return (
@@ -1220,14 +1223,17 @@ function getWizardHtml() {
1220
1223
  document.getElementById('btn-configure').textContent = 'Configure';
1221
1224
 
1222
1225
  // Pre-select already-configured clients (exclude manual/additional ones)
1223
- var manualClientTypes = ['perplexity', 'stdio'];
1226
+ var nonAutoTypes = ['perplexity', 'stdio', 'claude-ai'];
1224
1227
  state.selectedClients = state.configuredClients.filter(function(c) {
1225
- return manualClientTypes.indexOf(c) === -1;
1228
+ return nonAutoTypes.indexOf(c) === -1;
1226
1229
  });
1227
1230
 
1228
- // Split into auto-configured and manual-setup clients
1231
+ // Split into auto-configured, web/mobile, and manual-setup clients
1229
1232
  var autoClients = state.detectedClients.filter(function(c) {
1230
- return c.type !== 'perplexity' && c.type !== 'stdio';
1233
+ return c.type !== 'perplexity' && c.type !== 'stdio' && c.type !== 'claude-ai';
1234
+ });
1235
+ var webClients = state.detectedClients.filter(function(c) {
1236
+ return c.type === 'claude-ai';
1231
1237
  });
1232
1238
  var manualClients = state.detectedClients.filter(function(c) {
1233
1239
  return c.type === 'perplexity' || c.type === 'stdio';
@@ -1235,6 +1241,14 @@ function getWizardHtml() {
1235
1241
 
1236
1242
  var html = autoClients.map(renderClientItem).join('');
1237
1243
 
1244
+ if (webClients.length > 0) {
1245
+ html += '<div class="client-section-divider">' +
1246
+ '<div class="client-section-title">Web & Mobile</div>' +
1247
+ '<div class="client-section-subtitle">Use Cortex tools on claude.ai and the Claude mobile app</div>' +
1248
+ '</div>';
1249
+ html += webClients.map(renderClientItem).join('');
1250
+ }
1251
+
1238
1252
  if (manualClients.length > 0) {
1239
1253
  html += '<div class="client-section-divider">' +
1240
1254
  '<div class="client-section-title">Additional Clients</div>' +
@@ -1245,9 +1259,9 @@ function getWizardHtml() {
1245
1259
 
1246
1260
  el.innerHTML = html;
1247
1261
 
1248
- var manualTypes = ['perplexity', 'stdio'];
1262
+ var manualTypes = ['perplexity', 'stdio', 'claude-ai'];
1249
1263
  el.querySelectorAll('.client-item:not(.disabled):not(.already-configured)').forEach(function(item) {
1250
- // Auto-select detected clients, but NOT manual/additional ones (Perplexity, OpenClaw)
1264
+ // Auto-select detected clients, but NOT manual/additional/web ones
1251
1265
  if (manualTypes.indexOf(item.dataset.client) === -1) {
1252
1266
  item.classList.add('checked');
1253
1267
  }
@@ -1313,6 +1327,22 @@ function getWizardHtml() {
1313
1327
  '<span>' + (r.success ? '&#10003;' : '&#10007;') + '</span>' +
1314
1328
  '<span>' + (r.success ? escapeHtml(r.message || 'Configured') : escapeHtml(r.client) + ': ' + (r.error || 'Failed')) + '</span>' +
1315
1329
  '</div>';
1330
+ // Show Claude.ai instructions with copyable URL
1331
+ if (r.client === 'claude-ai' && r.success && r.message) {
1332
+ var mcpUrl = (state.serverUrl || 'https://cortex-bice.vercel.app') + '/mcp/cortex';
1333
+ html += '<div class="stdio-snippet" style="text-align: left;">' +
1334
+ '<ol style="margin: 0 0 12px 0; padding-left: 20px; line-height: 1.8;">' +
1335
+ '<li>Open <a href="https://claude.ai/settings/integrations" target="_blank" style="color: #00A3E1;">claude.ai/settings/integrations</a></li>' +
1336
+ '<li>Click <strong>Add custom integration</strong></li>' +
1337
+ '<li>Paste this URL and click Add:</li>' +
1338
+ '</ol>' +
1339
+ '<div style="display: flex; align-items: center; gap: 8px; background: rgba(0,163,225,0.08); border: 1px solid rgba(0,163,225,0.2); border-radius: 6px; padding: 8px 12px;">' +
1340
+ '<code style="flex: 1; font-size: 12px; word-break: break-all;">' + escapeHtml(mcpUrl) + '</code>' +
1341
+ '<button class="copy-btn" onclick="copySnippet(this)">Copy</button>' +
1342
+ '</div>' +
1343
+ '<p style="margin: 10px 0 0 0; font-size: 12px; opacity: 0.7;">Claude handles SSO authentication automatically. Tools sync to mobile.</p>' +
1344
+ '</div>';
1345
+ }
1316
1346
  // Show copyable snippet for stdio/OpenClaw and Perplexity instructions
1317
1347
  if ((r.client === 'stdio' || r.client === 'perplexity') && r.success && r.message) {
1318
1348
  var snippet = r.message.replace(/^Add this to your client config:\\n\\n/, '');
@@ -1492,12 +1522,20 @@ function getWizardHtml() {
1492
1522
  // Server may already be closing
1493
1523
  }
1494
1524
 
1495
- document.getElementById('step-done').querySelector('.card').innerHTML =
1496
- '<div class="text-center">' +
1497
- '<div class="success-circle"><span class="success-check">&#10003;</span></div>' +
1498
- '<h2>All Done</h2>' +
1499
- '<p class="subtitle mt-2">You can close this tab. Restart your AI clients to see the new tools.</p>' +
1500
- '</div>';
1525
+ // Show completion message in whatever step is currently active
1526
+ var activeStep = document.querySelector('.step.active');
1527
+ if (activeStep) {
1528
+ activeStep.querySelector('.card').innerHTML =
1529
+ '<div class="text-center">' +
1530
+ '<div class="success-circle"><span class="success-check">&#10003;</span></div>' +
1531
+ '<h2>Setup Complete!</h2>' +
1532
+ '<p class="subtitle mt-2">You can close this tab. Restart your AI clients to see the new tools.</p>' +
1533
+ '<p class="subtitle mt-1" style="opacity: 0.6;">This window will close automatically.</p>' +
1534
+ '</div>';
1535
+ }
1536
+
1537
+ // Auto-close the tab after a short delay
1538
+ setTimeout(function() { window.close(); }, 3000);
1501
1539
  }
1502
1540
 
1503
1541
  // \u2500\u2500 Helpers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500
@@ -1637,6 +1675,12 @@ function detectClients() {
1637
1675
  configPath: null,
1638
1676
  detected: getPlatform() === "macos" && existsSync(perplexityDir)
1639
1677
  });
1678
+ clients.push({
1679
+ type: "claude-ai",
1680
+ name: "Claude.ai & Mobile",
1681
+ configPath: null,
1682
+ detected: true
1683
+ });
1640
1684
  clients.push({
1641
1685
  type: "stdio",
1642
1686
  name: "OpenClaw",
@@ -1897,6 +1941,10 @@ function configurePerplexity(serverUrl, _apiKey, mcps) {
1897
1941
  }
1898
1942
  return lines.join("\n");
1899
1943
  }
1944
+ function configureClaudeAi(serverUrl, _apiKey, _mcps) {
1945
+ const url = `${serverUrl}/mcp/cortex`;
1946
+ return 'Add Cortex to Claude.ai & Mobile:\n\n1. Open claude.ai/settings/integrations\n2. Click "Add custom integration"\n3. Paste this URL: ' + url + "\n4. Click Add \u2014 Claude handles SSO authentication automatically\n\nOnce added, Cortex tools are available on claude.ai, Claude Desktop (web), and the Claude mobile app.";
1947
+ }
1900
1948
  function generateStdioSnippet(_apiKey) {
1901
1949
  const isWindowsTarget = getPlatform() === "windows" || isWSL();
1902
1950
  const config = {
@@ -1992,8 +2040,12 @@ function configureClient(clientType, serverUrl, apiKey, mcps) {
1992
2040
  return `Claude Desktop configured (${path})`;
1993
2041
  }
1994
2042
  case "claude-code":
1995
- configureClaudeCode(serverUrl, apiKey, mcps);
1996
- return "Claude Code configured";
2043
+ try {
2044
+ configureClaudeCode(serverUrl, apiKey, mcps);
2045
+ return "Claude Code configured";
2046
+ } catch {
2047
+ return "Claude Code \u2014 skipped (Cortex is already available via Claude Desktop config)";
2048
+ }
1997
2049
  case "cursor":
1998
2050
  configureCursor(serverUrl, apiKey, mcps);
1999
2051
  return "Cursor configured";
@@ -2008,6 +2060,8 @@ function configureClient(clientType, serverUrl, apiKey, mcps) {
2008
2060
  return "Codex configured";
2009
2061
  case "perplexity":
2010
2062
  return configurePerplexity(serverUrl, apiKey, mcps);
2063
+ case "claude-ai":
2064
+ return configureClaudeAi(serverUrl, apiKey, mcps);
2011
2065
  case "stdio":
2012
2066
  return "Add this to your client config:\n\n" + generateStdioSnippet(apiKey);
2013
2067
  }
@@ -2151,7 +2205,8 @@ async function handleApiRoute(path, searchParams, req, res, options, onComplete)
2151
2205
  description: m.description,
2152
2206
  authMode: m.authMode
2153
2207
  })),
2154
- detectedClients: clients
2208
+ detectedClients: clients,
2209
+ serverUrl: options.serverUrl
2155
2210
  });
2156
2211
  return true;
2157
2212
  }