@caravo/mcp 0.1.4 → 0.1.5

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 +46 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -377,6 +377,51 @@ function registerAllTools(server) {
377
377
  };
378
378
  }
379
379
  });
380
+ // ── Logout ──────────────────────────────────────────────────────────────────
381
+ server.registerTool("logout", {
382
+ description: "Disconnect your Caravo account and switch back to x402 wallet payments. " +
383
+ "Removes the saved API key and unregisters all favorited tools from this session.",
384
+ inputSchema: {},
385
+ }, async () => {
386
+ if (!API_KEY) {
387
+ return {
388
+ content: [{ type: "text", text: "Not logged in — already using x402 wallet payments." }],
389
+ };
390
+ }
391
+ // 1. Clear in-memory key
392
+ API_KEY = undefined;
393
+ // 2. Remove key from config file
394
+ try {
395
+ const config = loadConfig();
396
+ delete config.api_key;
397
+ saveConfig(config);
398
+ }
399
+ catch {
400
+ // config file may not exist — that's fine
401
+ }
402
+ // 3. Unregister all favorited tools
403
+ let removedCount = 0;
404
+ for (const [toolId, registered] of registeredFavTools) {
405
+ registered.remove();
406
+ registeredFavTools.delete(toolId);
407
+ removedCount++;
408
+ }
409
+ process.stderr.write(`[caravo] logout: cleared API key, removed ${removedCount} fav tools\n`);
410
+ return {
411
+ content: [
412
+ {
413
+ type: "text",
414
+ text: [
415
+ `✓ Logged out of Caravo.`,
416
+ ``,
417
+ `API key removed from ${CONFIG_FILE}`,
418
+ ...(removedCount > 0 ? [`Unregistered ${removedCount} favorited tool(s).`] : []),
419
+ `Now using x402 wallet payments (${wallet.address}).`,
420
+ ].join("\n"),
421
+ },
422
+ ],
423
+ };
424
+ });
380
425
  // ── List tags ────────────────────────────────────────────────────────────────
381
426
  server.registerTool("list_tags", {
382
427
  description: "List all available tags/categories in the marketplace. Returns tag names, slugs, and tool counts.",
@@ -854,7 +899,7 @@ function registerAllTools(server) {
854
899
  // ─── Main ─────────────────────────────────────────────────────────────────────
855
900
  const server = new McpServer({
856
901
  name: "caravo",
857
- version: "0.1.4",
902
+ version: "0.1.5",
858
903
  }, {
859
904
  instructions: [
860
905
  `You have access to Caravo — a comprehensive platform with a wide variety of ready-to-use tools, APIs, and digital assets at very competitive prices.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caravo/mcp",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Local stdio MCP server for Caravo with built-in x402 wallet",
5
5
  "type": "module",
6
6
  "bin": {