@danielblomma/cortex-mcp 0.4.1 → 0.4.2

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/README.md CHANGED
@@ -77,6 +77,22 @@ Codex:
77
77
  codex mcp list
78
78
  ```
79
79
 
80
+ ## Claude Plugin Marketplace
81
+
82
+ Install via Claude Code plugin marketplace:
83
+
84
+ ```bash
85
+ /plugin marketplace add DanielBlomma/cortex
86
+ /plugin install cortex@cortex-marketplace
87
+ /plugin enable cortex
88
+ ```
89
+
90
+ Then initialize Cortex in your target repository:
91
+
92
+ ```bash
93
+ cortex init --bootstrap
94
+ ```
95
+
80
96
  ## Manual MCP Configuration
81
97
 
82
98
  If auto-registration is unavailable, configure MCP manually.
package/bin/cortex.mjs CHANGED
@@ -468,6 +468,52 @@ function ensureProjectInitialized(targetDir) {
468
468
  }
469
469
  }
470
470
 
471
+ function isTruthyEnv(value) {
472
+ if (typeof value !== "string") {
473
+ return false;
474
+ }
475
+ const normalized = value.trim().toLowerCase();
476
+ return normalized === "1" || normalized === "true" || normalized === "yes" || normalized === "on";
477
+ }
478
+
479
+ function canAutoInitialize(targetDir) {
480
+ const scaffoldPaths = [".context", "scripts", "mcp", ".githooks"].map((entry) => path.join(targetDir, entry));
481
+ return scaffoldPaths.every((entryPath) => !fs.existsSync(entryPath));
482
+ }
483
+
484
+ async function ensureProjectInitializedForMcp(targetDir) {
485
+ const mcpPackageJson = path.join(targetDir, "mcp", "package.json");
486
+ const serverEntry = path.join(targetDir, "mcp", "dist", "server.js");
487
+
488
+ if (fs.existsSync(mcpPackageJson) && fs.existsSync(serverEntry)) {
489
+ return;
490
+ }
491
+
492
+ if (!isTruthyEnv(process.env.CORTEX_AUTO_BOOTSTRAP_ON_MCP)) {
493
+ ensureProjectInitialized(targetDir);
494
+ return;
495
+ }
496
+
497
+ if (!fs.existsSync(mcpPackageJson)) {
498
+ if (!canAutoInitialize(targetDir)) {
499
+ throw new Error(
500
+ `Cannot auto-initialize Cortex in ${targetDir}: scaffold paths already exist. Run 'cortex init --bootstrap' manually.`
501
+ );
502
+ }
503
+ ensureScaffoldExists();
504
+ fs.mkdirSync(targetDir, { recursive: true });
505
+ installScaffold(targetDir, false);
506
+ installAssistantHelpers(targetDir);
507
+ await markPlanEvent(targetDir, "init");
508
+ console.log(`[cortex] auto-init completed in ${targetDir}`);
509
+ }
510
+
511
+ if (!fs.existsSync(serverEntry)) {
512
+ console.log("[cortex] auto-bootstrap: running initial bootstrap for MCP");
513
+ await runContextCommand(targetDir, ["bootstrap"]);
514
+ }
515
+ }
516
+
471
517
  async function runContextCommand(cwd, contextArgs) {
472
518
  const contextScript = path.join(cwd, "scripts", "context.sh");
473
519
  if (!fs.existsSync(contextScript)) {
@@ -584,6 +630,7 @@ async function run() {
584
630
  const target = process.env.CORTEX_PROJECT_ROOT
585
631
  ? path.resolve(process.env.CORTEX_PROJECT_ROOT)
586
632
  : process.cwd();
633
+ await ensureProjectInitializedForMcp(target);
587
634
  ensureProjectInitialized(target);
588
635
  const serverEntry = path.join(target, "mcp", "dist", "server.js");
589
636
  if (!fs.existsSync(serverEntry)) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@danielblomma/cortex-mcp",
3
3
  "mcpName": "io.github.DanielBlomma/cortex",
4
- "version": "0.4.1",
4
+ "version": "0.4.2",
5
5
  "description": "Local, repo-scoped context platform for coding assistants. Semantic search, graph relationships, and architectural rule context.",
6
6
  "type": "module",
7
7
  "author": "Daniel Blomma",