@caravo/mcp 0.1.13 → 0.1.14

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.
Files changed (2) hide show
  1. package/dist/index.js +49 -10
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -210,11 +210,29 @@ function makeFavToolHandler(tool) {
210
210
  {
211
211
  type: "text",
212
212
  text: [
213
- `Payment required for ${tool.name} ($${tool.pricing.price_per_call})`,
214
- `Fund your wallet to use this tool:`,
215
- ` Address: ${wallet.address}`,
216
- ` Network: Base (eip155:8453)`,
217
- ` Asset: USDC`,
213
+ `Payment required for ${tool.name} ($${tool.pricing.price_per_call}). Two options:`,
214
+ ``,
215
+ `Option A — Caravo balance (recommended):`,
216
+ ` Run the "login" tool to connect your account, then top up at https://caravo.ai/dashboard`,
217
+ ``,
218
+ `Option B — USDC wallet (no registration):`,
219
+ ` Send USDC on Base to ${wallet.address}`,
220
+ ].join("\n"),
221
+ },
222
+ ],
223
+ isError: true,
224
+ };
225
+ }
226
+ if (result.error === "Insufficient balance") {
227
+ return {
228
+ content: [
229
+ {
230
+ type: "text",
231
+ text: [
232
+ `Insufficient Caravo balance (have $${result.balance ?? 0}, need $${result.cost ?? "?"}).`,
233
+ ``,
234
+ `Top up your balance at https://caravo.ai/dashboard`,
235
+ `Or enable auto top-up in your dashboard settings to never run out.`,
218
236
  ].join("\n"),
219
237
  },
220
238
  ],
@@ -379,16 +397,37 @@ function registerAllTools(server) {
379
397
  };
380
398
  }
381
399
  if (result.x402Version || result.accepts) {
400
+ const price = result.accepts?.[0]?.amount
401
+ ? `$${(parseInt(result.accepts[0].amount) / 1e6).toFixed(6)}`
402
+ : "?";
403
+ return {
404
+ content: [
405
+ {
406
+ type: "text",
407
+ text: [
408
+ `Payment required (${price}). Two options:`,
409
+ ``,
410
+ `Option A — Caravo balance (recommended):`,
411
+ ` Run the "login" tool to connect your account, then top up at https://caravo.ai/dashboard`,
412
+ ``,
413
+ `Option B — USDC wallet (no registration):`,
414
+ ` Send USDC on Base to ${wallet.address}`,
415
+ ].join("\n"),
416
+ },
417
+ ],
418
+ isError: true,
419
+ };
420
+ }
421
+ if (result.error === "Insufficient balance") {
382
422
  return {
383
423
  content: [
384
424
  {
385
425
  type: "text",
386
426
  text: [
387
- `Payment required. Fund your wallet to continue:`,
388
- ` Address: ${wallet.address}`,
389
- ` Network: Base (eip155:8453)`,
390
- ` Asset: USDC`,
391
- ` Amount: at least $${result.accepts?.[0]?.amount ? (parseInt(result.accepts[0].amount) / 1e6).toFixed(6) : "?"}`,
427
+ `Insufficient Caravo balance (have $${result.balance ?? 0}, need $${result.cost ?? "?"}).`,
428
+ ``,
429
+ `Top up your balance at https://caravo.ai/dashboard`,
430
+ `Or enable auto top-up in your dashboard settings to never run out.`,
392
431
  ].join("\n"),
393
432
  },
394
433
  ],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caravo/mcp",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "The API marketplace built for autonomous AI agents. Search, execute, and pay for 200+ tools at $0.001–0.05 per call.",
5
5
  "type": "module",
6
6
  "bin": {