@elisym/mcp 0.8.16 → 0.8.18
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 +40 -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) {
|
|
@@ -1807,6 +1832,12 @@ ${wrapped}`);
|
|
|
1807
1832
|
`Provider "${input.provider_npub}" has no Solana payment address for capability "${input.capability}". Cannot verify payment recipient - refusing to proceed. Ask the provider to publish a capability card with a payment address.`
|
|
1808
1833
|
);
|
|
1809
1834
|
}
|
|
1835
|
+
const buyerWallet = agent.solanaKeypair?.publicKey;
|
|
1836
|
+
if (buyerWallet && expectedRecipient && buyerWallet === expectedRecipient) {
|
|
1837
|
+
return errorResult(
|
|
1838
|
+
`Cannot buy from yourself - your agent's Solana wallet (${buyerWallet}) matches the provider's payment address. Use a different agent or provider.`
|
|
1839
|
+
);
|
|
1840
|
+
}
|
|
1810
1841
|
const submittedAt = Date.now();
|
|
1811
1842
|
const jobId = await agent.client.marketplace.submitJobRequest(agent.identity, {
|
|
1812
1843
|
input: input.input,
|
|
@@ -1965,6 +1996,12 @@ To confirm, call buy_capability again with max_price_lamports set (e.g. ${price}
|
|
|
1965
1996
|
`Provider "${input.provider_npub}" has no Solana payment address for capability "${input.capability}". Cannot verify payment recipient.`
|
|
1966
1997
|
);
|
|
1967
1998
|
}
|
|
1999
|
+
const buyerWallet = agent.solanaKeypair?.publicKey;
|
|
2000
|
+
if (buyerWallet && expectedRecipient && buyerWallet === expectedRecipient) {
|
|
2001
|
+
return errorResult(
|
|
2002
|
+
`Cannot buy from yourself - your agent's Solana wallet (${buyerWallet}) matches the provider's payment address. Use a different agent or provider.`
|
|
2003
|
+
);
|
|
2004
|
+
}
|
|
1968
2005
|
const submittedAt = Date.now();
|
|
1969
2006
|
const jobId = await agent.client.marketplace.submitJobRequest(agent.identity, {
|
|
1970
2007
|
input: input.input || "",
|