@elisym/mcp 0.8.14 → 0.8.16
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/index.js +27 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -450,6 +450,7 @@ async function runInstall(options) {
|
|
|
450
450
|
}
|
|
451
451
|
const entry = buildServerEntry(options.agent, options.env);
|
|
452
452
|
let installed = 0;
|
|
453
|
+
let rebound = 0;
|
|
453
454
|
for (const client of CLIENTS) {
|
|
454
455
|
if (options.client && client.name !== options.client) {
|
|
455
456
|
continue;
|
|
@@ -459,10 +460,13 @@ async function runInstall(options) {
|
|
|
459
460
|
continue;
|
|
460
461
|
}
|
|
461
462
|
try {
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
463
|
+
const result = await installToConfig(path, entry, options.agent);
|
|
464
|
+
if (result === "installed") {
|
|
464
465
|
console.log(`Installed to ${client.name}: ${path}`);
|
|
465
466
|
installed++;
|
|
467
|
+
} else if (result === "rebound") {
|
|
468
|
+
console.log(`Rebound ${client.name} to agent "${options.agent}": ${path}`);
|
|
469
|
+
rebound++;
|
|
466
470
|
} else {
|
|
467
471
|
console.log(`Already installed in ${client.name}`);
|
|
468
472
|
}
|
|
@@ -470,7 +474,7 @@ async function runInstall(options) {
|
|
|
470
474
|
console.log(`Skipped ${client.name}: ${e.message}`);
|
|
471
475
|
}
|
|
472
476
|
}
|
|
473
|
-
if (installed === 0 && !options.client) {
|
|
477
|
+
if (installed === 0 && rebound === 0 && !options.client) {
|
|
474
478
|
console.log("No MCP clients found to install into.");
|
|
475
479
|
}
|
|
476
480
|
}
|
|
@@ -610,7 +614,7 @@ async function runList() {
|
|
|
610
614
|
async function writeJsonAtomic(path, data) {
|
|
611
615
|
await writeFileAtomic(path, JSON.stringify(data, null, 2), 384);
|
|
612
616
|
}
|
|
613
|
-
async function installToConfig(path, entry) {
|
|
617
|
+
async function installToConfig(path, entry, agentRebind) {
|
|
614
618
|
let raw;
|
|
615
619
|
try {
|
|
616
620
|
raw = await readFile(path, "utf-8");
|
|
@@ -619,7 +623,7 @@ async function installToConfig(path, entry) {
|
|
|
619
623
|
throw err;
|
|
620
624
|
}
|
|
621
625
|
await writeJsonAtomic(path, { mcpServers: { elisym: entry } });
|
|
622
|
-
return
|
|
626
|
+
return "installed";
|
|
623
627
|
}
|
|
624
628
|
let config;
|
|
625
629
|
try {
|
|
@@ -630,12 +634,27 @@ async function installToConfig(path, entry) {
|
|
|
630
634
|
if (!config.mcpServers) {
|
|
631
635
|
config.mcpServers = {};
|
|
632
636
|
}
|
|
633
|
-
|
|
634
|
-
|
|
637
|
+
const existing = config.mcpServers.elisym;
|
|
638
|
+
if (existing) {
|
|
639
|
+
if (agentRebind === void 0) {
|
|
640
|
+
return "unchanged";
|
|
641
|
+
}
|
|
642
|
+
if (typeof existing !== "object" || Array.isArray(existing)) {
|
|
643
|
+
return "unchanged";
|
|
644
|
+
}
|
|
645
|
+
const rawEnv = existing.env;
|
|
646
|
+
const currentEnv = rawEnv && typeof rawEnv === "object" && !Array.isArray(rawEnv) ? { ...rawEnv } : {};
|
|
647
|
+
if (currentEnv.ELISYM_AGENT === agentRebind) {
|
|
648
|
+
return "unchanged";
|
|
649
|
+
}
|
|
650
|
+
currentEnv.ELISYM_AGENT = agentRebind;
|
|
651
|
+
existing.env = currentEnv;
|
|
652
|
+
await safeRewriteJson(path, raw, config);
|
|
653
|
+
return "rebound";
|
|
635
654
|
}
|
|
636
655
|
config.mcpServers.elisym = entry;
|
|
637
656
|
await safeRewriteJson(path, raw, config);
|
|
638
|
-
return
|
|
657
|
+
return "installed";
|
|
639
658
|
}
|
|
640
659
|
function createLogger(destination) {
|
|
641
660
|
const opts = {
|