@agentwonderland/mcp 0.1.17 → 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.
@@ -8,9 +8,11 @@ export declare function initiateCardSetup(): Promise<{
8
8
  token: string;
9
9
  }>;
10
10
  /**
11
- * Format the card setup prompt shown to the user.
11
+ * Format the card setup prompt as multiple content blocks.
12
+ * Block 1: QR code (may be collapsed in some clients)
13
+ * Block 2: URL + instructions (short, always visible)
12
14
  */
13
- export declare function formatCardSetupPrompt(qr: string, url: string): string;
15
+ export declare function formatCardSetupBlocks(qr: string, url: string): string[];
14
16
  /**
15
17
  * Poll for card setup completion. Returns the card details or null on timeout.
16
18
  */
@@ -18,18 +18,23 @@ export async function initiateCardSetup() {
18
18
  return { qr, url: shortUrl, token };
19
19
  }
20
20
  /**
21
- * Format the card setup prompt shown to the user.
21
+ * Format the card setup prompt as multiple content blocks.
22
+ * Block 1: QR code (may be collapsed in some clients)
23
+ * Block 2: URL + instructions (short, always visible)
22
24
  */
23
- export function formatCardSetupPrompt(qr, url) {
25
+ export function formatCardSetupBlocks(qr, url) {
24
26
  return [
25
- "Connect a payment card to get started:\n",
26
- qr,
27
- `Or open: ${url}`,
28
- "",
29
- "We also support crypto wallets (Base USDC, Tempo USDC) — use wallet_setup({ action: \"create\" }) if you prefer.",
30
- "",
31
- "IMPORTANT: Present the QR code and link above to the user. After they enter their card, call wallet_setup({ action: \"add-card\" }) to confirm the connection.",
32
- ].join("\n");
27
+ "\n" + qr.trim(),
28
+ [
29
+ `IMPORTANT: You MUST present this link to the user so they can connect a payment card:`,
30
+ "",
31
+ url,
32
+ "",
33
+ `Tell the user: "Scan the QR code above or open this link to connect your card. Let me know when you're done."`,
34
+ `After they confirm, call wallet_setup({ action: "add-card" }) to complete setup.`,
35
+ `Crypto wallets (Base/Tempo USDC) are also available via wallet_setup({ action: "create" }).`,
36
+ ].join("\n"),
37
+ ];
33
38
  }
34
39
  /**
35
40
  * Poll for card setup completion. Returns the card details or null on timeout.
package/dist/tools/run.js CHANGED
@@ -5,7 +5,7 @@ import { getConfiguredMethods, hasWalletConfigured, getWalletAddress } from "../
5
5
  import { requiresSpendConfirmation, getDefaultTipAmount } from "../core/config.js";
6
6
  import { formatRunResult } from "../core/formatters.js";
7
7
  import { storeFeedbackToken } from "./_token-cache.js";
8
- import { initiateCardSetup, formatCardSetupPrompt } from "../core/card-setup.js";
8
+ import { initiateCardSetup, formatCardSetupBlocks } from "../core/card-setup.js";
9
9
  const POLL_INTERVAL_MS = 3000;
10
10
  const POLL_MAX_MS = 120000; // 2 minutes
11
11
  async function pollJobUntilDone(jobId, agentName) {
@@ -48,7 +48,8 @@ export function registerRunTools(server) {
48
48
  if (!hasWalletConfigured()) {
49
49
  try {
50
50
  const { qr, url } = await initiateCardSetup();
51
- return text(formatCardSetupPrompt(qr, url));
51
+ const blocks = formatCardSetupBlocks(qr, url);
52
+ return multiText(...blocks);
52
53
  }
53
54
  catch {
54
55
  return text("No payment method configured.\n\n" +
@@ -1,6 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { apiGet, apiPost, apiPostWithPayment } from "../core/api-client.js";
3
- import { initiateCardSetup, formatCardSetupPrompt } from "../core/card-setup.js";
3
+ import { initiateCardSetup, formatCardSetupBlocks } from "../core/card-setup.js";
4
4
  import { hasWalletConfigured, getConfiguredMethods, getAcceptedPaymentMethods, getWalletAddress, } from "../core/payments.js";
5
5
  import { requiresSpendConfirmation, getDefaultTipAmount } from "../core/config.js";
6
6
  import { agentList, formatRunResult } from "../core/formatters.js";
@@ -96,7 +96,8 @@ export function registerSolveTools(server) {
96
96
  if (!hasWalletConfigured()) {
97
97
  try {
98
98
  const { qr, url } = await initiateCardSetup();
99
- return text(formatCardSetupPrompt(qr, url));
99
+ const blocks = formatCardSetupBlocks(qr, url);
100
+ return { content: blocks.map((t) => ({ type: "text", text: t })) };
100
101
  }
101
102
  catch {
102
103
  return text("No payment method configured.\n\n" +
@@ -64,13 +64,19 @@ export function registerWalletTools(server) {
64
64
  try {
65
65
  const { qr, url, token } = await initiateCardSetup();
66
66
  pendingCardSetup = { token };
67
- return text([
68
- "Scan to connect a payment card:\n",
69
- qr,
70
- `Or open: ${url}`,
71
- "",
72
- "After entering your card, tell me and I'll confirm the connection.",
73
- ].join("\n"));
67
+ return {
68
+ content: [
69
+ { type: "text", text: "\n" + qr.trim() },
70
+ { type: "text", text: [
71
+ `IMPORTANT: You MUST present this link to the user so they can connect a payment card:`,
72
+ "",
73
+ url,
74
+ "",
75
+ `Tell the user: "Scan the QR code above or open this link to connect your card. Let me know when you're done."`,
76
+ `After they confirm, call wallet_setup({ action: "add-card" }) to complete setup.`,
77
+ ].join("\n") },
78
+ ],
79
+ };
74
80
  }
75
81
  catch {
76
82
  return text("Error: Could not create card setup session. Try again later.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentwonderland/mcp",
3
- "version": "0.1.17",
3
+ "version": "0.1.19",
4
4
  "type": "module",
5
5
  "description": "MCP server for the Agent Wonderland AI agent marketplace",
6
6
  "bin": {
@@ -27,18 +27,23 @@ export async function initiateCardSetup(): Promise<{
27
27
  }
28
28
 
29
29
  /**
30
- * Format the card setup prompt shown to the user.
30
+ * Format the card setup prompt as multiple content blocks.
31
+ * Block 1: QR code (may be collapsed in some clients)
32
+ * Block 2: URL + instructions (short, always visible)
31
33
  */
32
- export function formatCardSetupPrompt(qr: string, url: string): string {
34
+ export function formatCardSetupBlocks(qr: string, url: string): string[] {
33
35
  return [
34
- "Connect a payment card to get started:\n",
35
- qr,
36
- `Or open: ${url}`,
37
- "",
38
- "We also support crypto wallets (Base USDC, Tempo USDC) — use wallet_setup({ action: \"create\" }) if you prefer.",
39
- "",
40
- "IMPORTANT: Present the QR code and link above to the user. After they enter their card, call wallet_setup({ action: \"add-card\" }) to confirm the connection.",
41
- ].join("\n");
36
+ "\n" + qr.trim(),
37
+ [
38
+ `IMPORTANT: You MUST present this link to the user so they can connect a payment card:`,
39
+ "",
40
+ url,
41
+ "",
42
+ `Tell the user: "Scan the QR code above or open this link to connect your card. Let me know when you're done."`,
43
+ `After they confirm, call wallet_setup({ action: "add-card" }) to complete setup.`,
44
+ `Crypto wallets (Base/Tempo USDC) are also available via wallet_setup({ action: "create" }).`,
45
+ ].join("\n"),
46
+ ];
42
47
  }
43
48
 
44
49
  /**
package/src/tools/run.ts CHANGED
@@ -6,7 +6,7 @@ import { getConfiguredMethods, hasWalletConfigured, getWalletAddress } from "../
6
6
  import { requiresSpendConfirmation, getDefaultTipAmount } from "../core/config.js";
7
7
  import { formatRunResult } from "../core/formatters.js";
8
8
  import { storeFeedbackToken, getFeedbackToken } from "./_token-cache.js";
9
- import { initiateCardSetup, formatCardSetupPrompt } from "../core/card-setup.js";
9
+ import { initiateCardSetup, formatCardSetupBlocks } from "../core/card-setup.js";
10
10
 
11
11
  const POLL_INTERVAL_MS = 3000;
12
12
  const POLL_MAX_MS = 120000; // 2 minutes
@@ -72,7 +72,8 @@ export function registerRunTools(server: McpServer): void {
72
72
  if (!hasWalletConfigured()) {
73
73
  try {
74
74
  const { qr, url } = await initiateCardSetup();
75
- return text(formatCardSetupPrompt(qr, url));
75
+ const blocks = formatCardSetupBlocks(qr, url);
76
+ return multiText(...blocks);
76
77
  } catch {
77
78
  return text(
78
79
  "No payment method configured.\n\n" +
@@ -1,7 +1,7 @@
1
1
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { z } from "zod";
3
3
  import { apiGet, apiPost, apiPostWithPayment } from "../core/api-client.js";
4
- import { initiateCardSetup, formatCardSetupPrompt } from "../core/card-setup.js";
4
+ import { initiateCardSetup, formatCardSetupBlocks } from "../core/card-setup.js";
5
5
  import {
6
6
  hasWalletConfigured,
7
7
  getConfiguredMethods,
@@ -122,7 +122,8 @@ export function registerSolveTools(server: McpServer): void {
122
122
  if (!hasWalletConfigured()) {
123
123
  try {
124
124
  const { qr, url } = await initiateCardSetup();
125
- return text(formatCardSetupPrompt(qr, url));
125
+ const blocks = formatCardSetupBlocks(qr, url);
126
+ return { content: blocks.map((t) => ({ type: "text" as const, text: t })) };
126
127
  } catch {
127
128
  return text(
128
129
  "No payment method configured.\n\n" +
@@ -99,13 +99,19 @@ export function registerWalletTools(server: McpServer): void {
99
99
  const { qr, url, token } = await initiateCardSetup();
100
100
  pendingCardSetup = { token };
101
101
 
102
- return text([
103
- "Scan to connect a payment card:\n",
104
- qr,
105
- `Or open: ${url}`,
106
- "",
107
- "After entering your card, tell me and I'll confirm the connection.",
108
- ].join("\n"));
102
+ return {
103
+ content: [
104
+ { type: "text" as const, text: "\n" + qr.trim() },
105
+ { type: "text" as const, text: [
106
+ `IMPORTANT: You MUST present this link to the user so they can connect a payment card:`,
107
+ "",
108
+ url,
109
+ "",
110
+ `Tell the user: "Scan the QR code above or open this link to connect your card. Let me know when you're done."`,
111
+ `After they confirm, call wallet_setup({ action: "add-card" }) to complete setup.`,
112
+ ].join("\n") },
113
+ ],
114
+ };
109
115
  } catch {
110
116
  return text("Error: Could not create card setup session. Try again later.");
111
117
  }