@elisym/mcp 0.8.16 → 0.8.17
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 +28 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -448,7 +448,21 @@ async function runInstall(options) {
|
|
|
448
448
|
if (options.agent) {
|
|
449
449
|
validateAgentName(options.agent);
|
|
450
450
|
}
|
|
451
|
-
|
|
451
|
+
let effectiveAgent = options.agent;
|
|
452
|
+
if (effectiveAgent === void 0) {
|
|
453
|
+
const resolved = await resolveDefaultAgent();
|
|
454
|
+
if (resolved.kind === "ambiguous") {
|
|
455
|
+
console.log(
|
|
456
|
+
`Multiple agents found (${resolved.names.join(", ")}). Re-run with --agent <name> to choose one.`
|
|
457
|
+
);
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
if (resolved.kind === "single") {
|
|
461
|
+
effectiveAgent = resolved.name;
|
|
462
|
+
console.log(`Auto-bound to agent "${effectiveAgent}".`);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
const entry = buildServerEntry(effectiveAgent, options.env);
|
|
452
466
|
let installed = 0;
|
|
453
467
|
let rebound = 0;
|
|
454
468
|
for (const client of CLIENTS) {
|
|
@@ -460,12 +474,12 @@ async function runInstall(options) {
|
|
|
460
474
|
continue;
|
|
461
475
|
}
|
|
462
476
|
try {
|
|
463
|
-
const result = await installToConfig(path, entry,
|
|
477
|
+
const result = await installToConfig(path, entry, effectiveAgent);
|
|
464
478
|
if (result === "installed") {
|
|
465
479
|
console.log(`Installed to ${client.name}: ${path}`);
|
|
466
480
|
installed++;
|
|
467
481
|
} else if (result === "rebound") {
|
|
468
|
-
console.log(`Rebound ${client.name} to agent "${
|
|
482
|
+
console.log(`Rebound ${client.name} to agent "${effectiveAgent}": ${path}`);
|
|
469
483
|
rebound++;
|
|
470
484
|
} else {
|
|
471
485
|
console.log(`Already installed in ${client.name}`);
|
|
@@ -478,6 +492,17 @@ async function runInstall(options) {
|
|
|
478
492
|
console.log("No MCP clients found to install into.");
|
|
479
493
|
}
|
|
480
494
|
}
|
|
495
|
+
async function resolveDefaultAgent() {
|
|
496
|
+
const agents = await listAgents(process.cwd());
|
|
497
|
+
const [first, second] = agents;
|
|
498
|
+
if (!first) {
|
|
499
|
+
return { kind: "none" };
|
|
500
|
+
}
|
|
501
|
+
if (!second) {
|
|
502
|
+
return { kind: "single", name: first.name };
|
|
503
|
+
}
|
|
504
|
+
return { kind: "ambiguous", names: agents.map((agent) => agent.name) };
|
|
505
|
+
}
|
|
481
506
|
async function runUpdate(options) {
|
|
482
507
|
validateClientName(options.client);
|
|
483
508
|
if (options.agent) {
|