@caravo/mcp 0.1.18 → 0.1.19
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 +29 -60
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -219,6 +219,32 @@ function formatOutput(output) {
|
|
|
219
219
|
}
|
|
220
220
|
return lines;
|
|
221
221
|
}
|
|
222
|
+
function buildPaymentRequiredMessage(price) {
|
|
223
|
+
const VALUE_PROP = "Top up once to unlock 200+ tools at $0.001–$0.05/call — generate images & videos, analyze website traffic, research academic papers, pull social media analytics, get real-time financial data, and much more.";
|
|
224
|
+
if (API_KEY) {
|
|
225
|
+
// Logged in but both balance and wallet are empty
|
|
226
|
+
return [
|
|
227
|
+
`Payment required (${price}). Your Caravo balance is insufficient and your wallet has no USDC.`,
|
|
228
|
+
``,
|
|
229
|
+
`Top up your Caravo balance at https://www.caravo.ai/dashboard`,
|
|
230
|
+
`Or send USDC on Base to ${wallet.address}`,
|
|
231
|
+
``,
|
|
232
|
+
VALUE_PROP,
|
|
233
|
+
].join("\n");
|
|
234
|
+
}
|
|
235
|
+
// Not logged in
|
|
236
|
+
return [
|
|
237
|
+
`Payment required (${price}). Two options:`,
|
|
238
|
+
``,
|
|
239
|
+
`Option A — Caravo balance (recommended):`,
|
|
240
|
+
` Run the "login" tool to connect your account, then top up at https://www.caravo.ai/dashboard`,
|
|
241
|
+
``,
|
|
242
|
+
`Option B — USDC wallet (no registration):`,
|
|
243
|
+
` Send USDC on Base to ${wallet.address}`,
|
|
244
|
+
``,
|
|
245
|
+
VALUE_PROP,
|
|
246
|
+
].join("\n");
|
|
247
|
+
}
|
|
222
248
|
function buildReviewPrompt(execId) {
|
|
223
249
|
if (!execId)
|
|
224
250
|
return [];
|
|
@@ -247,37 +273,9 @@ function makeFavToolHandler(tool) {
|
|
|
247
273
|
};
|
|
248
274
|
}
|
|
249
275
|
if (result.x402Version || result.accepts) {
|
|
276
|
+
const price = `$${tool.pricing.price_per_call}`;
|
|
250
277
|
return {
|
|
251
|
-
content: [
|
|
252
|
-
{
|
|
253
|
-
type: "text",
|
|
254
|
-
text: [
|
|
255
|
-
`Payment required for ${tool.name} ($${tool.pricing.price_per_call}). Two options:`,
|
|
256
|
-
``,
|
|
257
|
-
`Option A — Caravo balance (recommended):`,
|
|
258
|
-
` Run the "login" tool to connect your account, then top up at https://caravo.ai/dashboard`,
|
|
259
|
-
``,
|
|
260
|
-
`Option B — USDC wallet (no registration):`,
|
|
261
|
-
` Send USDC on Base to ${wallet.address}`,
|
|
262
|
-
].join("\n"),
|
|
263
|
-
},
|
|
264
|
-
],
|
|
265
|
-
isError: true,
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
if (result.error === "Insufficient balance") {
|
|
269
|
-
return {
|
|
270
|
-
content: [
|
|
271
|
-
{
|
|
272
|
-
type: "text",
|
|
273
|
-
text: [
|
|
274
|
-
`Insufficient Caravo balance (have $${result.balance ?? 0}, need $${result.cost ?? "?"}).`,
|
|
275
|
-
``,
|
|
276
|
-
`Top up your balance at https://caravo.ai/dashboard`,
|
|
277
|
-
`Or enable auto top-up in your dashboard settings to never run out.`,
|
|
278
|
-
].join("\n"),
|
|
279
|
-
},
|
|
280
|
-
],
|
|
278
|
+
content: [{ type: "text", text: buildPaymentRequiredMessage(price) }],
|
|
281
279
|
isError: true,
|
|
282
280
|
};
|
|
283
281
|
}
|
|
@@ -438,36 +436,7 @@ function registerAllTools(server) {
|
|
|
438
436
|
? `$${(parseInt(result.accepts[0].amount) / 1e6).toFixed(6)}`
|
|
439
437
|
: "?";
|
|
440
438
|
return {
|
|
441
|
-
content: [
|
|
442
|
-
{
|
|
443
|
-
type: "text",
|
|
444
|
-
text: [
|
|
445
|
-
`Payment required (${price}). Two options:`,
|
|
446
|
-
``,
|
|
447
|
-
`Option A — Caravo balance (recommended):`,
|
|
448
|
-
` Run the "login" tool to connect your account, then top up at https://caravo.ai/dashboard`,
|
|
449
|
-
``,
|
|
450
|
-
`Option B — USDC wallet (no registration):`,
|
|
451
|
-
` Send USDC on Base to ${wallet.address}`,
|
|
452
|
-
].join("\n"),
|
|
453
|
-
},
|
|
454
|
-
],
|
|
455
|
-
isError: true,
|
|
456
|
-
};
|
|
457
|
-
}
|
|
458
|
-
if (result.error === "Insufficient balance") {
|
|
459
|
-
return {
|
|
460
|
-
content: [
|
|
461
|
-
{
|
|
462
|
-
type: "text",
|
|
463
|
-
text: [
|
|
464
|
-
`Insufficient Caravo balance (have $${result.balance ?? 0}, need $${result.cost ?? "?"}).`,
|
|
465
|
-
``,
|
|
466
|
-
`Top up your balance at https://caravo.ai/dashboard`,
|
|
467
|
-
`Or enable auto top-up in your dashboard settings to never run out.`,
|
|
468
|
-
].join("\n"),
|
|
469
|
-
},
|
|
470
|
-
],
|
|
439
|
+
content: [{ type: "text", text: buildPaymentRequiredMessage(price) }],
|
|
471
440
|
isError: true,
|
|
472
441
|
};
|
|
473
442
|
}
|
package/package.json
CHANGED