@danainnovations/cortex-mcp 1.0.105 → 1.0.108
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 +99 -22
- package/dist/cli.js.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2096,7 +2096,7 @@ function configureClaudeAi(serverUrl, _apiKey, _mcps) {
|
|
|
2096
2096
|
}
|
|
2097
2097
|
function configureClaudeCowork(serverUrl, _apiKey, _mcps) {
|
|
2098
2098
|
const url = `${serverUrl}/mcp/cortex`;
|
|
2099
|
-
return 'Add Cortex to Claude CoWork:\n\n1. Open Claude Desktop \u2192 Settings \u2192 Connectors\n2. Click "Add custom connector"\n3. Name: Cortex CoWork\n4. Remote MCP server URL: ' + url + "\n5. Click Add \u2014 sign in via Okta when prompted\n6. Cortex tools are now available in CoWork sessions";
|
|
2099
|
+
return 'Add Cortex to Claude CoWork:\n\n1. Open Claude Desktop \u2192 Settings \u2192 Connectors\n2. Click "Add custom connector"\n3. Name: Cortex CoWork\n4. Remote MCP server URL: ' + url + "\n5. Click Add \u2014 sign in via Okta when prompted\n6. Cortex tools are now available in CoWork sessions\n\nFor vibe coding (building full apps with branded design, deployment, and auth):\n7. In your project folder, run: npx @danainnovations/cortex-mcp cowork-setup\n This creates a CLAUDE.md with the vibe coding workflow instructions";
|
|
2100
2100
|
}
|
|
2101
2101
|
function generateStdioSnippet(_apiKey) {
|
|
2102
2102
|
const isWindowsTarget = getPlatform() === "windows" || isWSL();
|
|
@@ -2312,17 +2312,17 @@ function getState() {
|
|
|
2312
2312
|
return wizardState;
|
|
2313
2313
|
}
|
|
2314
2314
|
function parseBody(req) {
|
|
2315
|
-
return new Promise((
|
|
2315
|
+
return new Promise((resolve3) => {
|
|
2316
2316
|
const chunks = [];
|
|
2317
2317
|
req.on("data", (chunk) => chunks.push(chunk));
|
|
2318
2318
|
req.on("end", () => {
|
|
2319
2319
|
try {
|
|
2320
|
-
|
|
2320
|
+
resolve3(JSON.parse(Buffer.concat(chunks).toString()));
|
|
2321
2321
|
} catch {
|
|
2322
|
-
|
|
2322
|
+
resolve3({});
|
|
2323
2323
|
}
|
|
2324
2324
|
});
|
|
2325
|
-
req.on("error", () =>
|
|
2325
|
+
req.on("error", () => resolve3({}));
|
|
2326
2326
|
});
|
|
2327
2327
|
}
|
|
2328
2328
|
function json(res, data, status = 200) {
|
|
@@ -2595,7 +2595,7 @@ async function handleApiRoute(path, searchParams, req, res, options, onComplete)
|
|
|
2595
2595
|
|
|
2596
2596
|
// src/wizard/server.ts
|
|
2597
2597
|
function startWizardServer(options) {
|
|
2598
|
-
return new Promise((
|
|
2598
|
+
return new Promise((resolve3, reject) => {
|
|
2599
2599
|
let completionResolve;
|
|
2600
2600
|
const completionPromise = new Promise((r) => {
|
|
2601
2601
|
completionResolve = r;
|
|
@@ -2637,7 +2637,7 @@ function startWizardServer(options) {
|
|
|
2637
2637
|
});
|
|
2638
2638
|
server.listen(0, "127.0.0.1", () => {
|
|
2639
2639
|
const addr = server.address();
|
|
2640
|
-
|
|
2640
|
+
resolve3({
|
|
2641
2641
|
port: addr.port,
|
|
2642
2642
|
close: () => new Promise((r) => {
|
|
2643
2643
|
for (const socket of connections) {
|
|
@@ -3730,15 +3730,15 @@ async function startStdioServer(options) {
|
|
|
3730
3730
|
}
|
|
3731
3731
|
initialized = true;
|
|
3732
3732
|
}
|
|
3733
|
-
const
|
|
3734
|
-
name: "
|
|
3735
|
-
description: "
|
|
3733
|
+
const BUILD_APP_TOOL = {
|
|
3734
|
+
name: "build_app",
|
|
3735
|
+
description: "Build and deploy a branded Next.js application. Call this tool when a user asks to build, create, or make an app, dashboard, tool, or website. Returns the step-by-step workflow for creating a production-ready app with Sonance Brand design, GitHub repo, Vercel deployment, Supabase database, and user authentication \u2014 all fully automated. The user never needs to configure anything.",
|
|
3736
3736
|
inputSchema: {
|
|
3737
3737
|
type: "object",
|
|
3738
3738
|
properties: {
|
|
3739
|
-
|
|
3739
|
+
description: {
|
|
3740
3740
|
type: "string",
|
|
3741
|
-
description: "
|
|
3741
|
+
description: "What the user wants to build (e.g., 'expense dashboard showing Concur data by month')"
|
|
3742
3742
|
}
|
|
3743
3743
|
}
|
|
3744
3744
|
}
|
|
@@ -3811,13 +3811,13 @@ async function startStdioServer(options) {
|
|
|
3811
3811
|
}
|
|
3812
3812
|
const result = response.result;
|
|
3813
3813
|
const tools = (result.tools || []).map(overrideUploadToolSchema);
|
|
3814
|
-
return { tools: [
|
|
3814
|
+
return { tools: [BUILD_APP_TOOL, ...tools] };
|
|
3815
3815
|
});
|
|
3816
3816
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
3817
3817
|
await ensureInitialized();
|
|
3818
3818
|
const { name, arguments: args } = request.params;
|
|
3819
3819
|
const typedArgs = args ?? {};
|
|
3820
|
-
if (name === "
|
|
3820
|
+
if (name === "build_app") {
|
|
3821
3821
|
return {
|
|
3822
3822
|
content: [{ type: "text", text: VIBE_CODING_GUIDE_RESPONSE }],
|
|
3823
3823
|
isError: false
|
|
@@ -3945,15 +3945,15 @@ function log2(msg) {
|
|
|
3945
3945
|
process.stderr.write(msg + "\n");
|
|
3946
3946
|
}
|
|
3947
3947
|
function sleep(ms) {
|
|
3948
|
-
return new Promise((
|
|
3948
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
3949
3949
|
}
|
|
3950
3950
|
function waitForEnter() {
|
|
3951
|
-
return new Promise((
|
|
3951
|
+
return new Promise((resolve3) => {
|
|
3952
3952
|
process.stdin.setRawMode?.(false);
|
|
3953
3953
|
process.stdin.resume();
|
|
3954
3954
|
process.stdin.once("data", () => {
|
|
3955
3955
|
process.stdin.pause();
|
|
3956
|
-
|
|
3956
|
+
resolve3();
|
|
3957
3957
|
});
|
|
3958
3958
|
});
|
|
3959
3959
|
}
|
|
@@ -4091,7 +4091,7 @@ function log3(msg) {
|
|
|
4091
4091
|
process.stderr.write(msg + "\n");
|
|
4092
4092
|
}
|
|
4093
4093
|
function sleep2(ms) {
|
|
4094
|
-
return new Promise((
|
|
4094
|
+
return new Promise((resolve3) => setTimeout(resolve3, ms));
|
|
4095
4095
|
}
|
|
4096
4096
|
async function loginWithSSO(serverUrl, emailHint) {
|
|
4097
4097
|
let sessionId;
|
|
@@ -4220,8 +4220,8 @@ async function showConnectionsAndAutoConnect(apiKey, serverUrl) {
|
|
|
4220
4220
|
input: process.stdin,
|
|
4221
4221
|
output: process.stderr
|
|
4222
4222
|
});
|
|
4223
|
-
const ask = (question) => new Promise((
|
|
4224
|
-
rl.question(question, (answer) =>
|
|
4223
|
+
const ask = (question) => new Promise((resolve3) => {
|
|
4224
|
+
rl.question(question, (answer) => resolve3(answer.trim().toLowerCase()));
|
|
4225
4225
|
});
|
|
4226
4226
|
for (const mcp of personalMcps) {
|
|
4227
4227
|
const answer = await ask(
|
|
@@ -4265,10 +4265,10 @@ async function promptForEmailHint(ssoEmail) {
|
|
|
4265
4265
|
input: process.stdin,
|
|
4266
4266
|
output: process.stderr
|
|
4267
4267
|
});
|
|
4268
|
-
const answer = await new Promise((
|
|
4268
|
+
const answer = await new Promise((resolve3) => {
|
|
4269
4269
|
rl.question(
|
|
4270
4270
|
" Enter your company email address: ",
|
|
4271
|
-
(a) =>
|
|
4271
|
+
(a) => resolve3(a.trim())
|
|
4272
4272
|
);
|
|
4273
4273
|
});
|
|
4274
4274
|
rl.close();
|
|
@@ -4531,6 +4531,75 @@ async function runDisconnect(provider) {
|
|
|
4531
4531
|
}
|
|
4532
4532
|
}
|
|
4533
4533
|
|
|
4534
|
+
// src/cli/cowork-setup.ts
|
|
4535
|
+
import { existsSync as existsSync7, readFileSync as readFileSync7, writeFileSync as writeFileSync5 } from "fs";
|
|
4536
|
+
import { resolve as resolve2 } from "path";
|
|
4537
|
+
var CORTEX_SECTION_MARKER = "<!-- cortex-vibe-coding -->";
|
|
4538
|
+
var VIBE_CODING_INSTRUCTIONS = `${CORTEX_SECTION_MARKER}
|
|
4539
|
+
# Cortex Vibe Coding Workflow
|
|
4540
|
+
|
|
4541
|
+
When building apps, always use Cortex MCP tools and follow this workflow:
|
|
4542
|
+
|
|
4543
|
+
## New App (when user says "build me an app/dashboard/tool")
|
|
4544
|
+
|
|
4545
|
+
1. **Design first:** Call \`sonance_brand__design_app\` to get the branded starter blueprint, then \`sonance_brand__get_css_theme\` for CSS variables
|
|
4546
|
+
2. **Create a branded HTML proof-of-concept** and show the user before proceeding \u2014 do NOT start building until they approve
|
|
4547
|
+
3. **Validate requirements:** Does it need a database? User auth? Present the infrastructure plan to the user
|
|
4548
|
+
4. **Write Next.js + TypeScript code** using Sonance Brand components (\`sonance_brand__get_components_by_category\`) \u2014 never hardcode colors or write custom UI components
|
|
4549
|
+
5. **If auth needed:** Call \`supabase__setup_cortex_auth\` and include auth template files (login page, callback route, middleware, sign-out)
|
|
4550
|
+
6. **Create a private GitHub repo** (\`github__create_repository\`) and push code (\`github__push_files\`) \u2014 never push .env files or secrets
|
|
4551
|
+
7. **Set ALL environment variables** on Vercel (\`vercel__set_env_vars_batch\`) BEFORE deploying \u2014 extract values from tool responses, never ask the user to copy keys
|
|
4552
|
+
8. **Deploy and verify:** \`vercel__deploy\` then \`vercel__get_deployment\` \u2014 if it fails, check logs, fix code, push fix, retry until READY
|
|
4553
|
+
9. **If auth:** Register the redirect URI with \`supabase__add_redirect_uri\`
|
|
4554
|
+
10. **Quality checks:** Run security scan, lint, code review, and \`sonance_brand__evaluate_design\` (must score Tier 3+)
|
|
4555
|
+
|
|
4556
|
+
## Existing Project (when user references a repo/project name)
|
|
4557
|
+
|
|
4558
|
+
Skip the POC. Go directly to the requested changes. Still apply: brand components, env vars before deploy, deployment verification, quality checks.
|
|
4559
|
+
|
|
4560
|
+
## Key Rules
|
|
4561
|
+
|
|
4562
|
+
- The user should NEVER manually set environment variables, copy API keys, or configure auth \u2014 everything is automated
|
|
4563
|
+
- Always use Next.js + TypeScript for production apps
|
|
4564
|
+
- Always use Sonance Brand components and CSS tokens
|
|
4565
|
+
- Always verify deployment succeeds before sharing URLs
|
|
4566
|
+
- Keep code modular: components in /components, utilities in /lib, no file over 300 lines
|
|
4567
|
+
${CORTEX_SECTION_MARKER}`;
|
|
4568
|
+
function log6(msg) {
|
|
4569
|
+
process.stderr.write(msg + "\n");
|
|
4570
|
+
}
|
|
4571
|
+
async function runCoworkSetup(options) {
|
|
4572
|
+
const targetDir = options?.path ? resolve2(options.path) : process.cwd();
|
|
4573
|
+
const claudeMdPath = resolve2(targetDir, "CLAUDE.md");
|
|
4574
|
+
log6("");
|
|
4575
|
+
log6(" Cortex CoWork Setup");
|
|
4576
|
+
log6(" Setting up vibe coding workflow instructions...");
|
|
4577
|
+
log6("");
|
|
4578
|
+
if (existsSync7(claudeMdPath)) {
|
|
4579
|
+
const existing = readFileSync7(claudeMdPath, "utf-8");
|
|
4580
|
+
if (existing.includes(CORTEX_SECTION_MARKER)) {
|
|
4581
|
+
const before = existing.split(CORTEX_SECTION_MARKER)[0];
|
|
4582
|
+
const afterParts = existing.split(CORTEX_SECTION_MARKER);
|
|
4583
|
+
const after = afterParts.length > 2 ? afterParts.slice(2).join(CORTEX_SECTION_MARKER) : "";
|
|
4584
|
+
writeFileSync5(claudeMdPath, before.trimEnd() + "\n\n" + VIBE_CODING_INSTRUCTIONS + "\n" + after.trimStart(), "utf-8");
|
|
4585
|
+
log6(" Updated existing Cortex section in CLAUDE.md");
|
|
4586
|
+
} else {
|
|
4587
|
+
writeFileSync5(claudeMdPath, existing.trimEnd() + "\n\n" + VIBE_CODING_INSTRUCTIONS + "\n", "utf-8");
|
|
4588
|
+
log6(" Appended Cortex vibe coding instructions to existing CLAUDE.md");
|
|
4589
|
+
}
|
|
4590
|
+
} else {
|
|
4591
|
+
writeFileSync5(claudeMdPath, VIBE_CODING_INSTRUCTIONS + "\n", "utf-8");
|
|
4592
|
+
log6(" Created CLAUDE.md with vibe coding instructions");
|
|
4593
|
+
}
|
|
4594
|
+
log6(` File: ${claudeMdPath}`);
|
|
4595
|
+
log6("");
|
|
4596
|
+
log6(" Next steps:");
|
|
4597
|
+
log6(" 1. Open Claude Desktop \u2192 start a CoWork session in this folder");
|
|
4598
|
+
log6(" 2. You should see 'Instructions: CLAUDE.md' in the sidebar");
|
|
4599
|
+
log6(" 3. Ask Claude to build an app \u2014 it will follow the Cortex workflow");
|
|
4600
|
+
log6("");
|
|
4601
|
+
}
|
|
4602
|
+
|
|
4534
4603
|
// bin/cli.ts
|
|
4535
4604
|
if (process.platform === "win32") {
|
|
4536
4605
|
process.on("uncaughtException", (err2) => {
|
|
@@ -4640,6 +4709,14 @@ program.command("connect-mobile").description("Connect Cortex to Claude on mobil
|
|
|
4640
4709
|
console.log("Once connected, tools will be available on web, desktop, and mobile.\n");
|
|
4641
4710
|
await openBrowser2(url);
|
|
4642
4711
|
});
|
|
4712
|
+
program.command("cowork-setup").description("Set up CLAUDE.md with vibe coding workflow instructions for Claude CoWork").option("--path <path>", "Directory to create CLAUDE.md in (default: current directory)").action(async (options) => {
|
|
4713
|
+
try {
|
|
4714
|
+
await runCoworkSetup(options);
|
|
4715
|
+
} catch (err2) {
|
|
4716
|
+
console.error("CoWork setup failed:", err2);
|
|
4717
|
+
process.exit(1);
|
|
4718
|
+
}
|
|
4719
|
+
});
|
|
4643
4720
|
var knownCmds = program.commands.map((c) => c.name());
|
|
4644
4721
|
var rawArgs = process.argv.slice(1);
|
|
4645
4722
|
var hasCmd = rawArgs.some(
|