@agentwonderland/mcp 0.1.17 → 0.1.18
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/core/card-setup.d.ts +4 -2
- package/dist/core/card-setup.js +15 -10
- package/dist/tools/run.js +3 -2
- package/dist/tools/solve.js +3 -2
- package/dist/tools/wallet.js +13 -7
- package/package.json +1 -1
- package/src/core/card-setup.ts +15 -10
- package/src/tools/run.ts +3 -2
- package/src/tools/solve.ts +3 -2
- package/src/tools/wallet.ts +13 -7
|
@@ -8,9 +8,11 @@ export declare function initiateCardSetup(): Promise<{
|
|
|
8
8
|
token: string;
|
|
9
9
|
}>;
|
|
10
10
|
/**
|
|
11
|
-
* Format the card setup prompt
|
|
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
|
|
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
|
*/
|
package/dist/core/card-setup.js
CHANGED
|
@@ -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
|
|
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
|
|
25
|
+
export function formatCardSetupBlocks(qr, url) {
|
|
24
26
|
return [
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
27
|
+
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,
|
|
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
|
-
|
|
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" +
|
package/dist/tools/solve.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { apiGet, apiPost, apiPostWithPayment } from "../core/api-client.js";
|
|
3
|
-
import { initiateCardSetup,
|
|
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
|
-
|
|
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" +
|
package/dist/tools/wallet.js
CHANGED
|
@@ -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
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
67
|
+
return {
|
|
68
|
+
content: [
|
|
69
|
+
{ type: "text", text: 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
package/src/core/card-setup.ts
CHANGED
|
@@ -27,18 +27,23 @@ export async function initiateCardSetup(): Promise<{
|
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* Format the card setup prompt
|
|
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
|
|
34
|
+
export function formatCardSetupBlocks(qr: string, url: string): string[] {
|
|
33
35
|
return [
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
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,
|
|
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
|
-
|
|
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" +
|
package/src/tools/solve.ts
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
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" +
|
package/src/tools/wallet.ts
CHANGED
|
@@ -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
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
102
|
+
return {
|
|
103
|
+
content: [
|
|
104
|
+
{ type: "text" as const, text: 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
|
}
|