@rackspay/wallet-mcp 1.0.4 → 1.1.0

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/build/index.js +59 -5
  2. package/package.json +2 -2
package/build/index.js CHANGED
@@ -440,12 +440,13 @@ server.tool("racks_cancel_order", "Cancel an open order on Hyperliquid by order
440
440
  // ─────────────────────────────────────────────────────────────────────────────
441
441
  server.tool("racks_get_markets", "Browse active Polymarket prediction markets. Returns market questions, outcomes, " +
442
442
  "current prices (0–1 scale = probability), and token IDs needed for placing bets. " +
443
- "Use the next_cursor value to paginate through more markets.", {
443
+ "Use keyword to search by topic (e.g. 'bitcoin', 'election'). " +
444
+ "Use next_cursor to paginate through more markets.", {
444
445
  next_cursor: z
445
446
  .string()
446
447
  .optional()
447
448
  .default("MA==")
448
- .describe('Pagination cursor (use the next_cursor from a previous call, or omit for the first page)'),
449
+ .describe("Pagination cursor (use the next_cursor from a previous call, or omit for the first page)"),
449
450
  limit: z
450
451
  .number()
451
452
  .int()
@@ -454,18 +455,29 @@ server.tool("racks_get_markets", "Browse active Polymarket prediction markets. R
454
455
  .optional()
455
456
  .default(10)
456
457
  .describe("Number of markets to return (default 10, max 50)"),
457
- }, async ({ next_cursor, limit }) => {
458
- const res = await request("GET", `/api/v1/agent/predict/markets?next_cursor=${encodeURIComponent(next_cursor ?? "MA==")}&limit=${limit}`);
458
+ keyword: z
459
+ .string()
460
+ .optional()
461
+ .describe("Optional keyword to filter markets by question text (e.g. 'bitcoin', 'election', 'fed rate')"),
462
+ }, async ({ next_cursor, limit, keyword }) => {
463
+ const qs = new URLSearchParams({
464
+ next_cursor: next_cursor ?? "MA==",
465
+ limit: String(limit),
466
+ ...(keyword ? { keyword } : {}),
467
+ });
468
+ const res = await request("GET", `/api/v1/agent/predict/markets?${qs.toString()}`);
459
469
  if (!res.ok)
460
470
  return apiError(res, "Failed to fetch Polymarket markets");
461
471
  const d = res.data;
472
+ const markets = d.data;
462
473
  return {
463
474
  content: [
464
475
  {
465
476
  type: "text",
466
477
  text: JSON.stringify({
467
478
  success: true,
468
- markets: d.data,
479
+ count: d.count ?? (Array.isArray(markets) ? markets.length : 0),
480
+ markets,
469
481
  next_cursor: d.next_cursor,
470
482
  note: "Prices are probabilities on a 0–1 scale. Use token_id when placing bets.",
471
483
  }, null, 2),
@@ -554,6 +566,48 @@ server.tool("racks_get_bet_positions", "List all open Polymarket positions for t
554
566
  ],
555
567
  };
556
568
  });
569
+ // ─────────────────────────────────────────────────────────────────────────────
570
+ // Tool: racks_mpp_request
571
+ // ─────────────────────────────────────────────────────────────────────────────
572
+ server.tool("racks_mpp_request", "Make a paid HTTP request on behalf of this agent using the Machine Payments Protocol (MPP / Tempo). " +
573
+ "The agent's Privy wallet automatically signs and pays the 402 payment challenge — " +
574
+ "no manual approval or wallet management needed. " +
575
+ "Use this to call any MPP-enabled API (LLM inference, image generation, web search, data feeds, etc.). " +
576
+ "Returns the API response data plus the on-chain Tempo payment receipt. " +
577
+ "Requires PathUSD (Tempo's USDC) at the agent's EVM wallet address on the Tempo chain. " +
578
+ "Bridge USDC to Tempo first using racks_bridge_usdc if the agent's Tempo balance is low.", {
579
+ url: z
580
+ .string()
581
+ .url()
582
+ .describe("The MPP-enabled API endpoint URL to call (must support HTTP 402 payment challenge)"),
583
+ max_amount: z
584
+ .string()
585
+ .optional()
586
+ .describe("Maximum USDC amount willing to spend on this request (e.g. '0.10' for 10 cents). " +
587
+ "Used for logging only — actual amount is determined by the server's 402 challenge."),
588
+ }, async ({ url, max_amount }) => {
589
+ const res = await request("POST", "/api/v1/agent/mpp", { url, ...(max_amount ? { max_amount } : {}) });
590
+ if (!res.ok)
591
+ return apiError(res, "MPP request failed");
592
+ const d = res.data;
593
+ return {
594
+ content: [
595
+ {
596
+ type: "text",
597
+ text: JSON.stringify({
598
+ success: true,
599
+ url: d.url,
600
+ wallet_address: d.wallet_address,
601
+ receipt: d.receipt,
602
+ data: d.data,
603
+ note: d.receipt
604
+ ? "Payment completed. Receipt proves the Tempo on-chain settlement."
605
+ : "Request completed (no payment was required).",
606
+ }, null, 2),
607
+ },
608
+ ],
609
+ };
610
+ });
557
611
  // ============================================================================
558
612
  // SERVER STARTUP
559
613
  // ============================================================================
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rackspay/wallet-mcp",
3
- "version": "1.0.4",
4
- "description": "RACKS Wallet MCP — crypto trading and betting infrastructure for AI agents. Trade perps on Hyperliquid, bet on Polymarket, and check on-chain balances via Claude Desktop or any MCP client.",
3
+ "version": "1.1.0",
4
+ "description": "RACKS Wallet MCP — crypto trading, betting, and MPP payments for AI agents. Trade perps on Hyperliquid, bet on Polymarket, pay APIs via Tempo/MPP, and check on-chain balances via Claude Desktop or any MCP client.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "rackswallet": "./build/index.js"