@agentwonderland/mcp 0.1.53 → 0.1.55
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/__tests__/api-client.test.js +65 -1
- package/dist/core/__tests__/link-cli.test.js +95 -0
- package/dist/core/api-client.d.ts +3 -1
- package/dist/core/api-client.js +39 -2
- package/dist/core/link-cli.d.ts +17 -0
- package/dist/core/link-cli.js +165 -0
- package/dist/core/version.d.ts +1 -1
- package/dist/core/version.js +1 -1
- package/dist/index.js +8 -5
- package/dist/tools/__tests__/playbooks.test.d.ts +1 -0
- package/dist/tools/__tests__/playbooks.test.js +2123 -0
- package/dist/tools/__tests__/wallet.test.js +5 -4
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.js +1 -0
- package/dist/tools/passes.js +4 -21
- package/dist/tools/playbooks.d.ts +2 -0
- package/dist/tools/playbooks.js +984 -0
- package/dist/tools/run.js +4 -18
- package/dist/tools/solve.js +4 -18
- package/dist/tools/wallet.js +9 -12
- package/package.json +1 -1
- package/src/core/__tests__/api-client.test.ts +77 -0
- package/src/core/__tests__/link-cli.test.ts +110 -0
- package/src/core/api-client.ts +43 -1
- package/src/core/link-cli.ts +189 -0
- package/src/core/version.ts +1 -1
- package/src/index.ts +8 -5
- package/src/tools/__tests__/playbooks.test.ts +2364 -0
- package/src/tools/__tests__/wallet.test.ts +5 -4
- package/src/tools/index.ts +1 -0
- package/src/tools/passes.ts +3 -21
- package/src/tools/playbooks.ts +1221 -0
- package/src/tools/run.ts +3 -17
- package/src/tools/solve.ts +3 -17
- package/src/tools/wallet.ts +9 -12
package/src/tools/run.ts
CHANGED
|
@@ -14,13 +14,11 @@ import {
|
|
|
14
14
|
hasWalletConfigured,
|
|
15
15
|
getWalletAddress,
|
|
16
16
|
normalizePaymentMethod,
|
|
17
|
-
isCardPaymentEnabled,
|
|
18
17
|
} from "../core/payments.js";
|
|
19
18
|
import { requiresSpendConfirmation, getDefaultTipAmount } from "../core/config.js";
|
|
20
19
|
import { formatRunResult } from "../core/formatters.js";
|
|
21
20
|
import { canSpend, recordSpend, requiresPolicyConfirmation } from "../core/spend-policy.js";
|
|
22
21
|
import { storeFeedbackToken } from "./_token-cache.js";
|
|
23
|
-
import { getOrCreatePendingCardSetup, formatCardSetupBlocks } from "../core/card-setup.js";
|
|
24
22
|
import {
|
|
25
23
|
formatPaymentLabel,
|
|
26
24
|
formatRunConfirmationCommand,
|
|
@@ -127,30 +125,18 @@ export function registerRunTools(server: McpServer): void {
|
|
|
127
125
|
{
|
|
128
126
|
agent_id: z.string().describe("Agent ID (UUID, slug, or name)"),
|
|
129
127
|
input: z.record(z.string(), z.unknown()).describe("Input payload for the agent"),
|
|
130
|
-
pay_with: z.string().trim().min(1).optional().describe("
|
|
128
|
+
pay_with: z.string().trim().min(1).optional().describe("Launch payment method — wallet ID or chain name (tempo, base, solana). Auto-detected if omitted."),
|
|
131
129
|
confirmed: z.boolean().optional().describe("Set to true to confirm spending after seeing the price quote."),
|
|
132
130
|
},
|
|
133
131
|
async ({ agent_id, input, pay_with, confirmed }) => {
|
|
134
132
|
if (!hasWalletConfigured()) {
|
|
135
|
-
if (isCardPaymentEnabled()) {
|
|
136
|
-
try {
|
|
137
|
-
const { url } = await getOrCreatePendingCardSetup();
|
|
138
|
-
return multiText(...formatCardSetupBlocks(url));
|
|
139
|
-
} catch {
|
|
140
|
-
// Fall through to the setup message below.
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
133
|
const setupLines = [
|
|
144
134
|
"No payment method configured.",
|
|
145
135
|
"",
|
|
146
|
-
"
|
|
147
|
-
"You can also run wallet_setup({ action: \"start\" }) to see all payment options.",
|
|
136
|
+
"Run wallet_setup({ action: \"start\" }) to configure a launch USDC payment method.",
|
|
148
137
|
"",
|
|
149
|
-
"
|
|
138
|
+
"Launch options: Tempo USDC, Base USDC, or Solana USDC.",
|
|
150
139
|
];
|
|
151
|
-
if (isCardPaymentEnabled()) {
|
|
152
|
-
setupLines.push("", "Or wallet_setup({ action: \"add-card\" }) to connect a credit card.");
|
|
153
|
-
}
|
|
154
140
|
return text(setupLines.join("\n"));
|
|
155
141
|
}
|
|
156
142
|
|
package/src/tools/solve.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
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 { getOrCreatePendingCardSetup, formatCardSetupBlocks } from "../core/card-setup.js";
|
|
5
4
|
import {
|
|
6
5
|
getCompatiblePaymentMethods,
|
|
7
6
|
hasWalletConfigured,
|
|
@@ -10,7 +9,6 @@ import {
|
|
|
10
9
|
getWalletAddress,
|
|
11
10
|
normalizePaymentMethod,
|
|
12
11
|
toRegistryPaymentMethod,
|
|
13
|
-
isCardPaymentEnabled,
|
|
14
12
|
} from "../core/payments.js";
|
|
15
13
|
import { requiresSpendConfirmation, getDefaultTipAmount } from "../core/config.js";
|
|
16
14
|
import { agentList, formatRunResult } from "../core/formatters.js";
|
|
@@ -159,7 +157,7 @@ export function registerSolveTools(server: McpServer): void {
|
|
|
159
157
|
.trim()
|
|
160
158
|
.min(1)
|
|
161
159
|
.optional()
|
|
162
|
-
.describe("
|
|
160
|
+
.describe("Launch payment method — wallet ID or chain name (tempo, base, solana). Auto-detected if omitted."),
|
|
163
161
|
confirmed: z
|
|
164
162
|
.boolean()
|
|
165
163
|
.optional()
|
|
@@ -167,25 +165,13 @@ export function registerSolveTools(server: McpServer): void {
|
|
|
167
165
|
},
|
|
168
166
|
async ({ intent, input, budget, pay_with, confirmed }) => {
|
|
169
167
|
if (!hasWalletConfigured()) {
|
|
170
|
-
if (isCardPaymentEnabled()) {
|
|
171
|
-
try {
|
|
172
|
-
const { url } = await getOrCreatePendingCardSetup();
|
|
173
|
-
return multiText(...formatCardSetupBlocks(url));
|
|
174
|
-
} catch {
|
|
175
|
-
// Fall through to the setup message below.
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
168
|
const setupLines = [
|
|
179
169
|
"No payment method configured.",
|
|
180
170
|
"",
|
|
181
|
-
"
|
|
182
|
-
"You can also run wallet_setup({ action: \"start\" }) to see all payment options.",
|
|
171
|
+
"Run wallet_setup({ action: \"start\" }) to configure a launch USDC payment method.",
|
|
183
172
|
"",
|
|
184
|
-
"
|
|
173
|
+
"Launch options: Tempo USDC, Base USDC, or Solana USDC.",
|
|
185
174
|
];
|
|
186
|
-
if (isCardPaymentEnabled()) {
|
|
187
|
-
setupLines.push("", "Or wallet_setup({ action: \"add-card\" }) to connect a credit card.");
|
|
188
|
-
}
|
|
189
175
|
return text(setupLines.join("\n"));
|
|
190
176
|
}
|
|
191
177
|
|
package/src/tools/wallet.ts
CHANGED
|
@@ -66,21 +66,18 @@ function isFreshLinkSetup(pending: { createdAt: string }): boolean {
|
|
|
66
66
|
|
|
67
67
|
function formatPaymentSetupMenu(): string {
|
|
68
68
|
return [
|
|
69
|
-
"Choose a payment method to set up:",
|
|
69
|
+
"Choose a launch payment method to set up:",
|
|
70
70
|
"",
|
|
71
|
-
"1.
|
|
72
|
-
" wallet_setup({ action: \"add-link\" })",
|
|
73
|
-
"",
|
|
74
|
-
"2. Tempo USDC",
|
|
71
|
+
"1. Tempo USDC",
|
|
75
72
|
" wallet_setup({ action: \"create\", chain: \"tempo\" })",
|
|
76
73
|
"",
|
|
77
|
-
"
|
|
74
|
+
"2. Base USDC",
|
|
78
75
|
" wallet_setup({ action: \"create\", chain: \"base\" })",
|
|
79
76
|
"",
|
|
80
|
-
"
|
|
77
|
+
"3. Solana USDC",
|
|
81
78
|
" wallet_setup({ action: \"create\", chain: \"solana\" })",
|
|
82
79
|
"",
|
|
83
|
-
"
|
|
80
|
+
"4. Import an existing wallet",
|
|
84
81
|
" wallet_setup({ action: \"import\", chain: \"base\", key: \"<private key>\" })",
|
|
85
82
|
].join("\n");
|
|
86
83
|
}
|
|
@@ -93,7 +90,7 @@ export function registerWalletTools(server: McpServer): void {
|
|
|
93
90
|
// ── wallet_status (extracted from check_wallet) ─────────────────
|
|
94
91
|
server.tool(
|
|
95
92
|
"wallet_status",
|
|
96
|
-
"Check payment readiness. Shows
|
|
93
|
+
"Check launch payment readiness. Shows configured wallets, chains, addresses, and USDC balances.",
|
|
97
94
|
{},
|
|
98
95
|
async () => {
|
|
99
96
|
const wallets = getWallets();
|
|
@@ -192,11 +189,11 @@ export function registerWalletTools(server: McpServer): void {
|
|
|
192
189
|
// ── wallet_setup ────────────────────────────────────────────────
|
|
193
190
|
server.tool(
|
|
194
191
|
"wallet_setup",
|
|
195
|
-
"Set up or manage an Agent Wonderland payment method. Use 'start' for a guided setup menu.
|
|
192
|
+
"Set up or manage an Agent Wonderland launch payment method. Use 'start' for a guided USDC setup menu. 'create' makes a new crypto wallet (encrypted via OWS if available, otherwise plaintext — run 'enable-ows' to upgrade). 'import' takes an existing private key. 'enable-ows' installs the Open Wallet Standard native module for encrypted at-rest storage. Tempo/Base share one EVM key; Solana uses a separate ed25519 key. Card and Link actions are present for non-launch compatibility only and should not be recommended for launch runs. NEVER delete or rotate keys programmatically; direct users to edit ~/.agentwonderland/config.json or ~/.ows/ manually.",
|
|
196
193
|
{
|
|
197
194
|
action: z
|
|
198
195
|
.enum(["start", "create", "import", "add-card", "remove-card", "add-link", "remove-link", "enable-ows"])
|
|
199
|
-
.describe("'start' shows the guided
|
|
196
|
+
.describe("'start' shows the guided launch USDC setup menu, 'create' makes a crypto wallet, 'import' imports an existing key, 'enable-ows' installs encrypted key storage; add-card/add-link are non-launch compatibility actions"),
|
|
200
197
|
name: z
|
|
201
198
|
.string()
|
|
202
199
|
.optional()
|
|
@@ -212,7 +209,7 @@ export function registerWalletTools(server: McpServer): void {
|
|
|
212
209
|
link_payment_method_id: z.string().optional()
|
|
213
210
|
.describe("Link payment method ID from `npx @stripe/link-cli payment-methods list`; used with action 'add-link'."),
|
|
214
211
|
link_payment_method: z.string().optional()
|
|
215
|
-
.describe("Friendly Link payment method selector, such as a
|
|
212
|
+
.describe("Friendly Link payment method selector, such as a saved payment method label or last4; used with action 'add-link'."),
|
|
216
213
|
},
|
|
217
214
|
async ({ action, name, key, chain, link_payment_method_id, link_payment_method }) => {
|
|
218
215
|
if (action === "start") {
|