@danainnovations/cortex-mcp 1.0.56 → 1.0.57

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-JWMGLAAN.js";
5
+ export {
6
+ openBrowser
7
+ };
8
+ //# sourceMappingURL=browser-LPEABS5F.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,60 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/utils/browser.ts
4
+ import { exec } from "child_process";
5
+
6
+ // src/utils/platform.ts
7
+ import { homedir, platform } from "os";
8
+ import { join } from "path";
9
+ function getHomeDir() {
10
+ return homedir();
11
+ }
12
+ function getPlatform() {
13
+ const p = platform();
14
+ if (p === "darwin") return "macos";
15
+ if (p === "win32") return "windows";
16
+ return "linux";
17
+ }
18
+ function getClaudeDesktopConfigPath() {
19
+ const home = getHomeDir();
20
+ const p = getPlatform();
21
+ switch (p) {
22
+ case "macos":
23
+ return join(
24
+ home,
25
+ "Library",
26
+ "Application Support",
27
+ "Claude",
28
+ "claude_desktop_config.json"
29
+ );
30
+ case "windows":
31
+ return join(
32
+ process.env.APPDATA || join(home, "AppData", "Roaming"),
33
+ "Claude",
34
+ "claude_desktop_config.json"
35
+ );
36
+ case "linux":
37
+ return join(home, ".config", "Claude", "claude_desktop_config.json");
38
+ }
39
+ }
40
+ function getCursorConfigPath() {
41
+ const home = getHomeDir();
42
+ return join(home, ".cursor", "mcp.json");
43
+ }
44
+
45
+ // src/utils/browser.ts
46
+ function openBrowser(url) {
47
+ return new Promise((resolve) => {
48
+ const platform2 = getPlatform();
49
+ const cmd = platform2 === "macos" ? "open" : platform2 === "windows" ? "start" : "xdg-open";
50
+ exec(`${cmd} "${url}"`, () => resolve());
51
+ });
52
+ }
53
+
54
+ export {
55
+ getHomeDir,
56
+ getClaudeDesktopConfigPath,
57
+ getCursorConfigPath,
58
+ openBrowser
59
+ };
60
+ //# sourceMappingURL=chunk-JWMGLAAN.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\" :\n platform === \"windows\" ? \"start\" :\n \"xdg-open\";\n exec(`${cmd} \"${url}\"`, () => resolve());\n });\n}\n","import { homedir, platform } from \"node:os\";\nimport { join } from \"node:path\";\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/**\n * Get the Claude Desktop config file path for the current platform.\n */\nexport function getClaudeDesktopConfigPath(): string {\n const home = getHomeDir();\n const p = getPlatform();\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 return join(\n process.env.APPDATA || join(home, \"AppData\", \"Roaming\"),\n \"Claude\",\n \"claude_desktop_config.json\"\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"],"mappings":";;;AAAA,SAAS,YAAY;;;ACArB,SAAS,SAAS,gBAAgB;AAClC,SAAS,YAAY;AAGd,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;AAKO,SAAS,6BAAqC;AACnD,QAAM,OAAO,WAAW;AACxB,QAAM,IAAI,YAAY;AAEtB,UAAQ,GAAG;AAAA,IACT,KAAK;AACH,aAAO;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF,KAAK;AACH,aAAO;AAAA,QACL,QAAQ,IAAI,WAAW,KAAK,MAAM,WAAW,SAAS;AAAA,QACtD;AAAA,QACA;AAAA,MACF;AAAA,IACF,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;;;AD9CO,SAAS,YAAY,KAA4B;AACtD,SAAO,IAAI,QAAQ,CAAC,YAAY;AAC9B,UAAMA,YAAW,YAAY;AAC7B,UAAM,MACJA,cAAa,UAAU,SACvBA,cAAa,YAAY,UACzB;AACF,SAAK,GAAG,GAAG,KAAK,GAAG,KAAK,MAAM,QAAQ,CAAC;AAAA,EACzC,CAAC;AACH;","names":["platform"]}
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/constants.ts
4
+ var DEFAULT_SERVER_URL = "https://cortex-bice.vercel.app";
5
+ var PROTOCOL_VERSION = "2025-03-26";
6
+ var AVAILABLE_MCPS = [
7
+ {
8
+ name: "asana",
9
+ displayName: "Asana",
10
+ description: "Projects, tasks, teams, workspaces (17 tools)",
11
+ serverName: "cortex-asana",
12
+ authMode: "personal"
13
+ },
14
+ {
15
+ name: "github",
16
+ displayName: "GitHub",
17
+ description: "Repos, PRs, issues, branches, code review (30 tools)",
18
+ serverName: "cortex-github",
19
+ authMode: "company"
20
+ },
21
+ {
22
+ name: "vercel",
23
+ displayName: "Vercel",
24
+ description: "Deployments, projects, env vars (15 tools)",
25
+ serverName: "cortex-vercel",
26
+ authMode: "company"
27
+ },
28
+ {
29
+ name: "supabase",
30
+ displayName: "Supabase",
31
+ description: "Database, migrations, edge functions (20+ tools)",
32
+ serverName: "cortex-supabase",
33
+ authMode: "company"
34
+ },
35
+ {
36
+ name: "m365",
37
+ displayName: "Microsoft 365",
38
+ description: "Email, calendar, OneDrive, Teams, meetings, contacts, tasks, notes (33 tools)",
39
+ serverName: "cortex-m365",
40
+ authMode: "personal"
41
+ },
42
+ {
43
+ name: "mailchimp",
44
+ displayName: "Mailchimp",
45
+ description: "Audiences, contacts, campaigns, templates, analytics (28 tools)",
46
+ serverName: "cortex-mailchimp",
47
+ authMode: "personal"
48
+ },
49
+ {
50
+ name: "salesforce",
51
+ displayName: "Salesforce",
52
+ description: "CRM queries, records, reports, and org data (14 tools)",
53
+ serverName: "cortex-salesforce",
54
+ authMode: "personal"
55
+ },
56
+ {
57
+ name: "monday",
58
+ displayName: "Monday.com",
59
+ description: "Boards, items, groups, updates, workspaces (18 tools)",
60
+ serverName: "cortex-monday",
61
+ authMode: "personal",
62
+ installUrl: "https://auth.monday.com/oauth2/authorize?client_id=c8d2c70bd792a4c36c6f023c0b707517&response_type=install"
63
+ },
64
+ {
65
+ name: "slack",
66
+ displayName: "Slack",
67
+ description: "Messaging, channels, search, reactions, bookmarks (22 tools)",
68
+ serverName: "cortex-slack",
69
+ authMode: "personal"
70
+ },
71
+ {
72
+ name: "powerbi",
73
+ displayName: "Power BI",
74
+ description: "Workspaces, datasets, push data, DAX queries, reports, dashboards (14 tools)",
75
+ serverName: "cortex-powerbi",
76
+ authMode: "personal"
77
+ },
78
+ {
79
+ name: "bestbuy",
80
+ displayName: "Best Buy",
81
+ description: "Product search, pricing, reviews, store locations (7 tools)",
82
+ serverName: "cortex-bestbuy",
83
+ authMode: "company"
84
+ }
85
+ ];
86
+ var MCP_NAMES = AVAILABLE_MCPS.map((m) => m.name);
87
+ var DEFAULT_MCPS = [...MCP_NAMES];
88
+ var DEFAULT_API_KEY = "ctx_07d37a81_9f7be06af38d04753090a4034f907a65ec06cd675ed26f65653898388e2d1709";
89
+ var CONFIG_DIR_NAME = ".cortex-mcp";
90
+ var CONFIG_FILE_NAME = "config.json";
91
+ var CREDENTIALS_FILE_NAME = "credentials.json";
92
+
93
+ export {
94
+ DEFAULT_SERVER_URL,
95
+ PROTOCOL_VERSION,
96
+ AVAILABLE_MCPS,
97
+ MCP_NAMES,
98
+ DEFAULT_MCPS,
99
+ DEFAULT_API_KEY,
100
+ CONFIG_DIR_NAME,
101
+ CONFIG_FILE_NAME,
102
+ CREDENTIALS_FILE_NAME
103
+ };
104
+ //# sourceMappingURL=chunk-WDD2YERC.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["/** Default Cortex server URL */\nexport const DEFAULT_SERVER_URL = \"https://cortex-bice.vercel.app\";\n\n/** MCP protocol version supported by Cortex (Streamable HTTP) */\nexport const PROTOCOL_VERSION = \"2025-03-26\";\n\n/** Available MCPs with their metadata */\nexport const AVAILABLE_MCPS = [\n {\n name: \"asana\",\n displayName: \"Asana\",\n description: \"Projects, tasks, teams, workspaces (17 tools)\",\n serverName: \"cortex-asana\",\n authMode: \"personal\" as const,\n },\n {\n name: \"github\",\n displayName: \"GitHub\",\n description: \"Repos, PRs, issues, branches, code review (30 tools)\",\n serverName: \"cortex-github\",\n authMode: \"company\" as const,\n },\n {\n name: \"vercel\",\n displayName: \"Vercel\",\n description: \"Deployments, projects, env vars (15 tools)\",\n serverName: \"cortex-vercel\",\n authMode: \"company\" as const,\n },\n {\n name: \"supabase\",\n displayName: \"Supabase\",\n description: \"Database, migrations, edge functions (20+ tools)\",\n serverName: \"cortex-supabase\",\n authMode: \"company\" as const,\n },\n {\n name: \"m365\",\n displayName: \"Microsoft 365\",\n description: \"Email, calendar, OneDrive, Teams, meetings, contacts, tasks, notes (33 tools)\",\n serverName: \"cortex-m365\",\n authMode: \"personal\" as const,\n },\n {\n name: \"mailchimp\",\n displayName: \"Mailchimp\",\n description: \"Audiences, contacts, campaigns, templates, analytics (28 tools)\",\n serverName: \"cortex-mailchimp\",\n authMode: \"personal\" as const,\n },\n {\n name: \"salesforce\",\n displayName: \"Salesforce\",\n description: \"CRM queries, records, reports, and org data (14 tools)\",\n serverName: \"cortex-salesforce\",\n authMode: \"personal\" as const,\n },\n {\n name: \"monday\",\n displayName: \"Monday.com\",\n description: \"Boards, items, groups, updates, workspaces (18 tools)\",\n serverName: \"cortex-monday\",\n authMode: \"personal\" as const,\n installUrl: \"https://auth.monday.com/oauth2/authorize?client_id=c8d2c70bd792a4c36c6f023c0b707517&response_type=install\",\n },\n {\n name: \"slack\",\n displayName: \"Slack\",\n description: \"Messaging, channels, search, reactions, bookmarks (22 tools)\",\n serverName: \"cortex-slack\",\n authMode: \"personal\" as const,\n },\n {\n name: \"powerbi\",\n displayName: \"Power BI\",\n description: \"Workspaces, datasets, push data, DAX queries, reports, dashboards (14 tools)\",\n serverName: \"cortex-powerbi\",\n authMode: \"personal\" as const,\n },\n {\n name: \"bestbuy\",\n displayName: \"Best Buy\",\n description: \"Product search, pricing, reviews, store locations (7 tools)\",\n serverName: \"cortex-bestbuy\",\n authMode: \"company\" as const,\n },\n] as const;\n\n/** All available MCP names */\nexport const MCP_NAMES: string[] = AVAILABLE_MCPS.map((m) => m.name);\n\n/** Default MCPs enabled on fresh setup */\nexport const DEFAULT_MCPS: string[] = [...MCP_NAMES];\n\n/** Shared API key embedded in the package (no user prompt needed) */\nexport const DEFAULT_API_KEY =\n \"ctx_07d37a81_9f7be06af38d04753090a4034f907a65ec06cd675ed26f65653898388e2d1709\";\n\n/** Config directory name */\nexport const CONFIG_DIR_NAME = \".cortex-mcp\";\n\n/** Config file name */\nexport const CONFIG_FILE_NAME = \"config.json\";\n\n/** Credentials file name (stores personal API key from login) */\nexport const CREDENTIALS_FILE_NAME = \"credentials.json\";\n"],"mappings":";;;AACO,IAAM,qBAAqB;AAG3B,IAAM,mBAAmB;AAGzB,IAAM,iBAAiB;AAAA,EAC5B;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,YAAY;AAAA,EACd;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,aAAa;AAAA,IACb,aAAa;AAAA,IACb,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AACF;AAGO,IAAM,YAAsB,eAAe,IAAI,CAAC,MAAM,EAAE,IAAI;AAG5D,IAAM,eAAyB,CAAC,GAAG,SAAS;AAG5C,IAAM,kBACX;AAGK,IAAM,kBAAkB;AAGxB,IAAM,mBAAmB;AAGzB,IAAM,wBAAwB;","names":[]}
package/dist/cli.js CHANGED
@@ -1,4 +1,21 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ AVAILABLE_MCPS,
4
+ CONFIG_DIR_NAME,
5
+ CONFIG_FILE_NAME,
6
+ CREDENTIALS_FILE_NAME,
7
+ DEFAULT_API_KEY,
8
+ DEFAULT_MCPS,
9
+ DEFAULT_SERVER_URL,
10
+ MCP_NAMES,
11
+ PROTOCOL_VERSION
12
+ } from "./chunk-WDD2YERC.js";
13
+ import {
14
+ getClaudeDesktopConfigPath,
15
+ getCursorConfigPath,
16
+ getHomeDir,
17
+ openBrowser
18
+ } from "./chunk-JWMGLAAN.js";
2
19
 
3
20
  // bin/cli.ts
4
21
  import { Command } from "commander";
@@ -6,145 +23,14 @@ import { Command } from "commander";
6
23
  // src/cli/setup.ts
7
24
  import * as readline2 from "readline";
8
25
 
9
- // src/constants.ts
10
- var DEFAULT_SERVER_URL = "https://cortex-bice.vercel.app";
11
- var PROTOCOL_VERSION = "2024-11-05";
12
- var AVAILABLE_MCPS = [
13
- {
14
- name: "asana",
15
- displayName: "Asana",
16
- description: "Projects, tasks, teams, workspaces (17 tools)",
17
- serverName: "cortex-asana",
18
- authMode: "personal"
19
- },
20
- {
21
- name: "github",
22
- displayName: "GitHub",
23
- description: "Repos, PRs, issues, branches, code review (30 tools)",
24
- serverName: "cortex-github",
25
- authMode: "company"
26
- },
27
- {
28
- name: "vercel",
29
- displayName: "Vercel",
30
- description: "Deployments, projects, env vars (15 tools)",
31
- serverName: "cortex-vercel",
32
- authMode: "company"
33
- },
34
- {
35
- name: "supabase",
36
- displayName: "Supabase",
37
- description: "Database, migrations, edge functions (20+ tools)",
38
- serverName: "cortex-supabase",
39
- authMode: "company"
40
- },
41
- {
42
- name: "m365",
43
- displayName: "Microsoft 365",
44
- description: "Email, calendar, OneDrive, Teams, meetings, contacts, tasks, notes (33 tools)",
45
- serverName: "cortex-m365",
46
- authMode: "personal"
47
- },
48
- {
49
- name: "mailchimp",
50
- displayName: "Mailchimp",
51
- description: "Audiences, contacts, campaigns, templates, analytics (28 tools)",
52
- serverName: "cortex-mailchimp",
53
- authMode: "personal"
54
- },
55
- {
56
- name: "salesforce",
57
- displayName: "Salesforce",
58
- description: "CRM queries, records, reports, and org data (14 tools)",
59
- serverName: "cortex-salesforce",
60
- authMode: "personal"
61
- },
62
- {
63
- name: "monday",
64
- displayName: "Monday.com",
65
- description: "Boards, items, groups, updates, workspaces (18 tools)",
66
- serverName: "cortex-monday",
67
- authMode: "personal",
68
- installUrl: "https://auth.monday.com/oauth2/authorize?client_id=c8d2c70bd792a4c36c6f023c0b707517&response_type=install"
69
- },
70
- {
71
- name: "slack",
72
- displayName: "Slack",
73
- description: "Messaging, channels, search, reactions, bookmarks (22 tools)",
74
- serverName: "cortex-slack",
75
- authMode: "personal"
76
- },
77
- {
78
- name: "powerbi",
79
- displayName: "Power BI",
80
- description: "Workspaces, datasets, push data, DAX queries, reports, dashboards (14 tools)",
81
- serverName: "cortex-powerbi",
82
- authMode: "personal"
83
- },
84
- {
85
- name: "bestbuy",
86
- displayName: "Best Buy",
87
- description: "Product search, pricing, reviews, store locations (7 tools)",
88
- serverName: "cortex-bestbuy",
89
- authMode: "company"
90
- }
91
- ];
92
- var MCP_NAMES = AVAILABLE_MCPS.map((m) => m.name);
93
- var DEFAULT_MCPS = [...MCP_NAMES];
94
- var DEFAULT_API_KEY = "ctx_07d37a81_9f7be06af38d04753090a4034f907a65ec06cd675ed26f65653898388e2d1709";
95
- var CONFIG_DIR_NAME = ".cortex-mcp";
96
- var CONFIG_FILE_NAME = "config.json";
97
- var CREDENTIALS_FILE_NAME = "credentials.json";
98
-
99
26
  // src/config/storage.ts
100
27
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
101
- import { join as join2 } from "path";
102
-
103
- // src/utils/platform.ts
104
- import { homedir, platform } from "os";
105
28
  import { join } from "path";
106
- function getHomeDir() {
107
- return homedir();
108
- }
109
- function getPlatform() {
110
- const p = platform();
111
- if (p === "darwin") return "macos";
112
- if (p === "win32") return "windows";
113
- return "linux";
114
- }
115
- function getClaudeDesktopConfigPath() {
116
- const home = getHomeDir();
117
- const p = getPlatform();
118
- switch (p) {
119
- case "macos":
120
- return join(
121
- home,
122
- "Library",
123
- "Application Support",
124
- "Claude",
125
- "claude_desktop_config.json"
126
- );
127
- case "windows":
128
- return join(
129
- process.env.APPDATA || join(home, "AppData", "Roaming"),
130
- "Claude",
131
- "claude_desktop_config.json"
132
- );
133
- case "linux":
134
- return join(home, ".config", "Claude", "claude_desktop_config.json");
135
- }
136
- }
137
- function getCursorConfigPath() {
138
- const home = getHomeDir();
139
- return join(home, ".cursor", "mcp.json");
140
- }
141
-
142
- // src/config/storage.ts
143
29
  function getConfigDir() {
144
- return join2(getHomeDir(), CONFIG_DIR_NAME);
30
+ return join(getHomeDir(), CONFIG_DIR_NAME);
145
31
  }
146
32
  function getConfigPath() {
147
- return join2(getConfigDir(), CONFIG_FILE_NAME);
33
+ return join(getConfigDir(), CONFIG_FILE_NAME);
148
34
  }
149
35
  function readConfig() {
150
36
  const path = getConfigPath();
@@ -376,9 +262,9 @@ function configureClient(clientType, serverUrl, apiKey, mcps) {
376
262
 
377
263
  // src/auth/credentials.ts
378
264
  import { existsSync as existsSync3, mkdirSync as mkdirSync3, readFileSync as readFileSync3, unlinkSync, writeFileSync as writeFileSync3 } from "fs";
379
- import { join as join3 } from "path";
265
+ import { join as join2 } from "path";
380
266
  function getCredentialsPath() {
381
- return join3(getHomeDir(), CONFIG_DIR_NAME, CREDENTIALS_FILE_NAME);
267
+ return join2(getHomeDir(), CONFIG_DIR_NAME, CREDENTIALS_FILE_NAME);
382
268
  }
383
269
  function readCredentials() {
384
270
  const path = getCredentialsPath();
@@ -391,7 +277,7 @@ function readCredentials() {
391
277
  }
392
278
  }
393
279
  function writeCredentials(creds) {
394
- const dir = join3(getHomeDir(), CONFIG_DIR_NAME);
280
+ const dir = join2(getHomeDir(), CONFIG_DIR_NAME);
395
281
  if (!existsSync3(dir)) {
396
282
  mkdirSync3(dir, { recursive: true, mode: 448 });
397
283
  }
@@ -419,16 +305,6 @@ function getEffectiveApiKey() {
419
305
  // src/cli/login.ts
420
306
  import * as readline from "readline";
421
307
 
422
- // src/utils/browser.ts
423
- import { exec } from "child_process";
424
- function openBrowser(url) {
425
- return new Promise((resolve) => {
426
- const platform2 = getPlatform();
427
- const cmd = platform2 === "macos" ? "open" : platform2 === "windows" ? "start" : "xdg-open";
428
- exec(`${cmd} "${url}"`, () => resolve());
429
- });
430
- }
431
-
432
308
  // src/cli/connect.ts
433
309
  function log(msg) {
434
310
  process.stderr.write(msg + "\n");
@@ -582,18 +458,23 @@ function log2(msg) {
582
458
  function sleep2(ms) {
583
459
  return new Promise((resolve) => setTimeout(resolve, ms));
584
460
  }
585
- async function loginWithSSO(serverUrl) {
461
+ async function loginWithSSO(serverUrl, emailHint) {
586
462
  let sessionId;
587
463
  let authUrl;
588
464
  let expiresIn;
589
465
  try {
466
+ const body = {};
467
+ if (emailHint) {
468
+ body.email_hint = emailHint;
469
+ }
590
470
  const resp = await fetch(`${serverUrl}/api/v1/auth/employee/initiate`, {
591
471
  method: "POST",
592
- headers: { "Content-Type": "application/json" }
472
+ headers: { "Content-Type": "application/json" },
473
+ body: JSON.stringify(body)
593
474
  });
594
475
  if (!resp.ok) {
595
476
  log2(` Error: Failed to start authentication (HTTP ${resp.status})`);
596
- return null;
477
+ return { status: "failed" };
597
478
  }
598
479
  const data = await resp.json();
599
480
  sessionId = data.session_id;
@@ -603,7 +484,7 @@ async function loginWithSSO(serverUrl) {
603
484
  const msg = err instanceof Error ? err.message : String(err);
604
485
  log2(` Error: Could not reach Cortex server at ${serverUrl}`);
605
486
  log2(` ${msg}`);
606
- return null;
487
+ return { status: "failed" };
607
488
  }
608
489
  log2(" Opening browser for Okta SSO login...");
609
490
  await openBrowser(authUrl);
@@ -624,17 +505,25 @@ async function loginWithSSO(serverUrl) {
624
505
  const email = result.employee_email || result.user_info?.email || "unknown";
625
506
  const name = result.employee_name || result.user_info?.name || "";
626
507
  const apiKey = result.api_key || "";
627
- return { apiKey, email, name: name || void 0 };
508
+ return { status: "success", apiKey, email, name: name || void 0 };
628
509
  }
629
510
  if (result.status === "expired") {
630
511
  process.stderr.write("\n");
631
512
  log2(" Authentication session expired. Please try again.");
632
- return null;
513
+ return { status: "failed" };
633
514
  }
634
515
  if (result.status === "error") {
635
516
  process.stderr.write("\n");
636
- log2(` Authentication failed: ${result.error_message || "unknown error"}`);
637
- return null;
517
+ if (result.error_message === "not_verified_employee" && !emailHint) {
518
+ return {
519
+ status: "needs_hint",
520
+ ssoEmail: result.sso_email || "unknown"
521
+ };
522
+ }
523
+ log2(
524
+ ` Authentication failed: ${result.error_message || "unknown error"}`
525
+ );
526
+ return { status: "failed" };
638
527
  }
639
528
  process.stderr.write(".");
640
529
  } catch {
@@ -643,7 +532,7 @@ async function loginWithSSO(serverUrl) {
643
532
  }
644
533
  process.stderr.write("\n");
645
534
  log2(" Timeout waiting for authentication. Please try again.");
646
- return null;
535
+ return { status: "failed" };
647
536
  }
648
537
  async function showConnectionsAndAutoConnect(apiKey, serverUrl) {
649
538
  let existingConnections = [];
@@ -730,7 +619,31 @@ async function showConnectionsAndAutoConnect(apiKey, serverUrl) {
730
619
  }
731
620
  rl2.close();
732
621
  }
733
- async function runLogin() {
622
+ async function promptForEmailHint(ssoEmail) {
623
+ log2("");
624
+ log2(` Your SSO email (${ssoEmail}) was not found in the employee directory.`);
625
+ log2(
626
+ " This can happen if your Okta account uses a different email than your company directory."
627
+ );
628
+ log2("");
629
+ const rl2 = readline.createInterface({
630
+ input: process.stdin,
631
+ output: process.stderr
632
+ });
633
+ const answer = await new Promise((resolve) => {
634
+ rl2.question(
635
+ " Enter your company email address: ",
636
+ (a) => resolve(a.trim())
637
+ );
638
+ });
639
+ rl2.close();
640
+ if (!answer || !answer.includes("@")) {
641
+ log2(" Invalid email. Run 'cortex-mcp login --email you@company.com' to try again.");
642
+ return null;
643
+ }
644
+ return answer;
645
+ }
646
+ async function runLogin(emailHint) {
734
647
  const existing = readCredentials();
735
648
  if (existing) {
736
649
  log2("");
@@ -745,8 +658,29 @@ async function runLogin() {
745
658
  log2(" Cortex MCP Login");
746
659
  log2(" Sign in with your company Okta SSO account");
747
660
  log2("");
748
- const result = await loginWithSSO(serverUrl);
749
- if (!result) {
661
+ let result = await loginWithSSO(serverUrl, emailHint);
662
+ if (result.status === "needs_hint") {
663
+ let hintEmail;
664
+ if (emailHint) {
665
+ hintEmail = emailHint;
666
+ } else {
667
+ hintEmail = await promptForEmailHint(result.ssoEmail);
668
+ }
669
+ if (!hintEmail) {
670
+ process.exit(1);
671
+ }
672
+ log2("");
673
+ log2(" Retrying with your company email. You'll need to complete SSO again.");
674
+ log2("");
675
+ result = await loginWithSSO(serverUrl, hintEmail);
676
+ if (result.status === "needs_hint") {
677
+ log2("");
678
+ log2(" The provided email was also not found in the employee directory.");
679
+ log2(" Please verify your email and contact IT if the issue persists.");
680
+ process.exit(1);
681
+ }
682
+ }
683
+ if (result.status !== "success") {
750
684
  process.exit(1);
751
685
  }
752
686
  const { apiKey, email, name } = result;
@@ -814,7 +748,7 @@ async function validateApiKey(apiKey, serverUrl) {
814
748
  return "unreachable";
815
749
  }
816
750
  }
817
- async function runSetup() {
751
+ async function runSetup(emailHint) {
818
752
  let apiKey = getEffectiveApiKey();
819
753
  let creds = readCredentials();
820
754
  log3("");
@@ -921,8 +855,48 @@ async function runSetup() {
921
855
  log3(" Sign in with your company Okta SSO account.");
922
856
  log3("");
923
857
  rl.close();
924
- const result = await loginWithSSO(DEFAULT_SERVER_URL);
925
- if (!result) {
858
+ let result = await loginWithSSO(DEFAULT_SERVER_URL, emailHint);
859
+ if (result.status === "needs_hint") {
860
+ let hintEmail;
861
+ if (emailHint) {
862
+ hintEmail = emailHint;
863
+ } else {
864
+ log3("");
865
+ log3(
866
+ ` Your SSO email (${result.ssoEmail}) was not found in the employee directory.`
867
+ );
868
+ log3(
869
+ " This can happen if your Okta account uses a different email than your company directory."
870
+ );
871
+ log3("");
872
+ const hintRl = readline2.createInterface({
873
+ input: process.stdin,
874
+ output: process.stderr
875
+ });
876
+ hintEmail = await new Promise((resolve) => {
877
+ hintRl.question(
878
+ " Enter your company email address: ",
879
+ (a) => resolve(a.trim())
880
+ );
881
+ });
882
+ hintRl.close();
883
+ if (!hintEmail || !hintEmail.includes("@")) {
884
+ log3(" Invalid email. Run 'cortex-mcp login --email you@company.com' to try again.");
885
+ process.exit(1);
886
+ }
887
+ }
888
+ log3("");
889
+ log3(" Retrying with your company email. You'll need to complete SSO again.");
890
+ log3("");
891
+ result = await loginWithSSO(DEFAULT_SERVER_URL, hintEmail);
892
+ if (result.status === "needs_hint") {
893
+ log3("");
894
+ log3(" The provided email was also not found in the employee directory.");
895
+ log3(" Please verify your email and contact IT if the issue persists.");
896
+ process.exit(1);
897
+ }
898
+ }
899
+ if (result.status !== "success") {
926
900
  log3(" Login failed. Run 'cortex-mcp login' to try again.");
927
901
  process.exit(1);
928
902
  }
@@ -1622,9 +1596,12 @@ var program = new Command();
1622
1596
  program.name("cortex-mcp").description(
1623
1597
  "Connect your AI tools to Asana, GitHub, Microsoft 365, Monday.com, Salesforce, Vercel & Supabase via Cortex"
1624
1598
  ).version("1.0.0");
1625
- program.command("setup").description("Interactive setup wizard \u2014 configure MCPs and AI clients").action(async () => {
1599
+ program.command("setup").description("Interactive setup wizard \u2014 configure MCPs and AI clients").option(
1600
+ "--email <email>",
1601
+ "Company email (use if your Okta email differs from your directory email)"
1602
+ ).action(async (options) => {
1626
1603
  try {
1627
- await runSetup();
1604
+ await runSetup(options.email);
1628
1605
  } catch (err) {
1629
1606
  if (err.code === "ERR_USE_AFTER_CLOSE") {
1630
1607
  process.exit(0);
@@ -1653,9 +1630,12 @@ program.command("status").description("Show current Cortex MCP configuration").a
1653
1630
  program.command("reset").description("Remove all Cortex MCP entries from AI clients").action(() => {
1654
1631
  runReset();
1655
1632
  });
1656
- program.command("login").description("Sign in with your company Okta SSO account").action(async () => {
1633
+ program.command("login").description("Sign in with your company Okta SSO account").option(
1634
+ "--email <email>",
1635
+ "Company email (use if your Okta email differs from your directory email)"
1636
+ ).action(async (options) => {
1657
1637
  try {
1658
- await runLogin();
1638
+ await runLogin(options.email);
1659
1639
  } catch (err) {
1660
1640
  if (err.code === "ERR_USE_AFTER_CLOSE") {
1661
1641
  process.exit(0);
@@ -1697,5 +1677,16 @@ program.command("disconnect <provider>").description("Remove your personal OAuth
1697
1677
  process.exit(1);
1698
1678
  }
1699
1679
  });
1680
+ program.command("connect-mobile").description("Connect Cortex to Claude on mobile \u2014 opens setup page in browser").action(async () => {
1681
+ const { DEFAULT_SERVER_URL: DEFAULT_SERVER_URL2 } = await import("./constants-YJ6WYI46.js");
1682
+ const { openBrowser: openBrowser2 } = await import("./browser-LPEABS5F.js");
1683
+ const url = `${DEFAULT_SERVER_URL2}/connect`;
1684
+ console.log("\nOpening Cortex connect page...");
1685
+ console.log(` ${url}
1686
+ `);
1687
+ console.log("Follow the steps to connect Cortex to your Claude account.");
1688
+ console.log("Once connected, tools will be available on web, desktop, and mobile.\n");
1689
+ await openBrowser2(url);
1690
+ });
1700
1691
  program.parse();
1701
1692
  //# sourceMappingURL=cli.js.map