@arispay/payagent-mcp 2.0.1 → 2.5.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.
package/dist/index.d.ts CHANGED
@@ -1,2 +1 @@
1
-
2
- export { }
1
+ #!/usr/bin/env node
package/dist/index.js CHANGED
@@ -1,91 +1,447 @@
1
1
  #!/usr/bin/env node
2
+ #!/usr/bin/env node
2
3
 
3
4
  // src/index.ts
4
5
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
6
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
7
  import { z } from "zod";
7
- import { payFetchDelegated, getUSDCBalance, formatUSDC } from "payagent";
8
- var arispayUrl = process.env.ARISPAY_URL ?? "https://api.arispay.app";
9
- var agentKey = process.env.ARISPAY_AGENT_KEY;
10
- var walletAddress = process.env.PAYAGENT_WALLET;
11
- if (!agentKey) {
12
- console.error(
13
- "Error: ARISPAY_AGENT_KEY environment variable is required.\nProvision an agent at https://payagent.arispay.app to get a key."
14
- );
15
- process.exit(1);
8
+ import {
9
+ DelegationClient,
10
+ HostedTopupNotConfiguredError,
11
+ formatUSDC,
12
+ getAgent,
13
+ getApiKey,
14
+ getArispayUrl,
15
+ getUSDCBalance,
16
+ launchAgent,
17
+ listAgents,
18
+ payFetchDelegated
19
+ } from "payagent";
20
+ var arispayUrl = getArispayUrl(process.env.ARISPAY_URL);
21
+ var legacyAgentKey = process.env.ARISPAY_AGENT_KEY;
22
+ var legacyWalletAddress = process.env.PAYAGENT_WALLET;
23
+ function resolveAgent(name) {
24
+ if (name) return getAgent(name);
25
+ const agents = listAgents();
26
+ return agents[0];
27
+ }
28
+ function resolveAgentKey(name) {
29
+ if (name) {
30
+ const stored = getAgent(name);
31
+ if (stored) return { key: stored.apiKey, source: `agent \`${name}\`` };
32
+ return void 0;
33
+ }
34
+ if (legacyAgentKey) return { key: legacyAgentKey, source: "ARISPAY_AGENT_KEY" };
35
+ const first = listAgents()[0];
36
+ if (first) return { key: first.apiKey, source: `agent \`${first.name}\`` };
37
+ return void 0;
38
+ }
39
+ function requireDevKey() {
40
+ const key = getApiKey();
41
+ if (!key) {
42
+ throw new Error(
43
+ "No ArisPay developer key found. Run `npx payagent init` or set ARISPAY_API_KEY."
44
+ );
45
+ }
46
+ return key;
47
+ }
48
+ function textResult(text, isError = false) {
49
+ return {
50
+ content: [{ type: "text", text }],
51
+ ...isError ? { isError } : {}
52
+ };
16
53
  }
17
- var fetch402 = payFetchDelegated({
18
- arispayUrl,
19
- apiKey: agentKey
20
- });
21
54
  var server = new McpServer({
22
55
  name: "payagent",
23
- version: "2.0.0"
56
+ version: "2.1.0"
24
57
  });
25
58
  server.tool(
26
59
  "pay_api",
27
60
  {
28
61
  url: z.string().describe("The full URL of the API endpoint to call"),
29
62
  method: z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]).default("GET").describe("HTTP method"),
30
- headers: z.record(z.string(), z.string()).optional().describe("Additional HTTP headers to include"),
31
- body: z.string().optional().describe("Request body (for POST/PUT/PATCH)")
63
+ headers: z.record(z.string(), z.string()).optional().describe("Additional HTTP headers"),
64
+ body: z.string().optional().describe("Request body (for POST/PUT/PATCH)"),
65
+ agent: z.string().optional().describe("Optional: name of a locally-stored agent to pay with. Defaults to ARISPAY_AGENT_KEY or the first stored agent.")
32
66
  },
33
- async ({ url, method, headers, body }) => {
67
+ async ({ url, method, headers, body, agent }) => {
68
+ const resolved = resolveAgentKey(agent);
69
+ if (!resolved) {
70
+ return textResult(
71
+ "No agent key available. Either set ARISPAY_AGENT_KEY, create one with `create_agent`, or run `npx payagent agent create` from the CLI.",
72
+ true
73
+ );
74
+ }
34
75
  try {
35
- const response = await fetch402(url, {
36
- method,
37
- headers,
38
- body
39
- });
76
+ const fetch402 = payFetchDelegated({ arispayUrl, apiKey: resolved.key });
77
+ const response = await fetch402(url, { method, headers, body });
40
78
  const responseBody = await response.text();
41
- return {
42
- content: [
43
- {
44
- type: "text",
45
- text: [
46
- `HTTP ${response.status}`,
47
- "",
48
- responseBody
49
- ].join("\n")
50
- }
51
- ]
52
- };
79
+ return textResult(
80
+ [`HTTP ${response.status} (paid via ${resolved.source})`, "", responseBody].join("\n")
81
+ );
53
82
  } catch (err) {
54
- return {
55
- content: [
56
- {
57
- type: "text",
58
- text: `Error: ${err instanceof Error ? err.message : String(err)}`
59
- }
60
- ],
61
- isError: true
62
- };
83
+ return textResult(`Error: ${err instanceof Error ? err.message : String(err)}`, true);
63
84
  }
64
85
  }
65
86
  );
66
87
  server.tool(
67
88
  "check_wallet",
68
- {},
69
- async () => {
70
- const lines = [
71
- `ArisPay URL: ${arispayUrl}`,
72
- `Agent key: ${agentKey.slice(0, 10)}\u2026`
73
- ];
89
+ {
90
+ agent: z.string().optional().describe("Optional: name of a locally-stored agent. Defaults to legacy ARISPAY_WALLET mode.")
91
+ },
92
+ async ({ agent }) => {
93
+ const resolved = resolveAgent(agent);
94
+ const walletAddress = resolved?.walletAddress ?? legacyWalletAddress;
95
+ const keyTail = resolved?.apiKey.slice(-4) ?? (legacyAgentKey ? legacyAgentKey.slice(-4) : void 0);
96
+ const lines = [`ArisPay URL: ${arispayUrl}`];
97
+ if (resolved) lines.push(`Agent: ${resolved.name} (${resolved.agentId})`);
98
+ if (keyTail) lines.push(`Agent key: ap_\u2026${keyTail}`);
74
99
  if (walletAddress) {
75
100
  lines.push(`Wallet: ${walletAddress}`);
76
101
  try {
77
- const raw = await getUSDCBalance(walletAddress, "base");
78
- lines.push(`Balance: ${formatUSDC(raw)} USDC on Base`);
102
+ const raw = await getUSDCBalance(walletAddress, resolved?.network ?? "base");
103
+ lines.push(`Balance: ${formatUSDC(raw)} USDC on ${resolved?.network ?? "base"}`);
79
104
  } catch (err) {
80
105
  lines.push(`Balance: unavailable (${err instanceof Error ? err.message : String(err)})`);
81
106
  }
82
107
  } else {
83
- lines.push("", "Set PAYAGENT_WALLET=0x\u2026 in env to include on-chain balance.");
108
+ lines.push("", "No wallet known. Use `create_agent` or set PAYAGENT_WALLET for legacy mode.");
109
+ }
110
+ lines.push("", "Manage limits + full history: https://arispay.app/dashboard");
111
+ return textResult(lines.join("\n"));
112
+ }
113
+ );
114
+ server.tool(
115
+ "create_agent",
116
+ {
117
+ name: z.string().describe("Local identifier for this agent. Used by later tools."),
118
+ perTx: z.number().int().positive().describe("Per-transaction spend cap in cents."),
119
+ daily: z.number().int().positive().describe("Daily spend cap in cents."),
120
+ monthly: z.number().int().positive().describe("Monthly spend cap in cents."),
121
+ allowedDomains: z.array(z.string()).optional().describe("If provided, restrict this agent to paying only these domains."),
122
+ network: z.enum(["base", "base-sepolia", "ethereum", "polygon"]).default("base").describe("EVM network the agent pays on."),
123
+ agentType: z.string().optional().describe('Optional metadata label (e.g. "hermes").')
124
+ },
125
+ async ({ name, perTx, daily, monthly, allowedDomains, network, agentType }) => {
126
+ try {
127
+ requireDevKey();
128
+ const agent = await launchAgent({
129
+ name,
130
+ limits: { perTx, daily, monthly },
131
+ allowedDomains,
132
+ network,
133
+ agentType
134
+ });
135
+ const lines = [
136
+ `\u2713 Agent \`${name}\` created.`,
137
+ ` Agent ID: ${agent.agentId}`,
138
+ ` Wallet: ${agent.walletAddress}`,
139
+ ` Network: ${agent.network}`,
140
+ ` Limits: ${perTx}\xA2 / tx, ${daily}\xA2 / day, ${monthly}\xA2 / month`,
141
+ "",
142
+ ` Fund the wallet with USDC on ${agent.network}, then call \`get_balance\` with name="${name}".`
143
+ ];
144
+ return textResult(lines.join("\n"));
145
+ } catch (err) {
146
+ return textResult(`create_agent failed: ${err instanceof Error ? err.message : String(err)}`, true);
147
+ }
148
+ }
149
+ );
150
+ server.tool(
151
+ "fund_agent",
152
+ {
153
+ name: z.string().describe("Name of a locally-stored agent."),
154
+ hosted: z.boolean().optional().describe(
155
+ "If true, request a provider-hosted onramp URL (Coinbase, etc.) instead of the plain wallet address. Requires ARISPAY_ONRAMP_PROVIDER on the API deployment."
156
+ ),
157
+ amount: z.number().optional().describe("Preset top-up amount in dollars. Only meaningful with `hosted: true`.")
158
+ },
159
+ async ({ name, hosted, amount }) => {
160
+ const stored = getAgent(name);
161
+ if (!stored) return textResult(`No locally-stored agent named \`${name}\`.`, true);
162
+ if (hosted) {
163
+ const devKey = getApiKey();
164
+ if (!devKey) {
165
+ return textResult(
166
+ "No ArisPay developer key found. Run `npx payagent init` first.",
167
+ true
168
+ );
169
+ }
170
+ const client = new DelegationClient(arispayUrl, devKey);
171
+ try {
172
+ const link = await client.getHostedTopup(stored.agentId, { amount });
173
+ const lines2 = [
174
+ `Top up \`${name}\` via ${link.provider}:`,
175
+ "",
176
+ ` ${link.fundingUrl}`,
177
+ "",
178
+ ` Wallet: ${link.walletAddress}`,
179
+ ` Network: ${link.network}`,
180
+ ` URL valid until: ${link.expiresAt}`,
181
+ "",
182
+ "Share that URL with the end-user; the onramp deposits USDC straight to the agent's wallet."
183
+ ];
184
+ return textResult(lines2.join("\n"));
185
+ } catch (err) {
186
+ if (err instanceof HostedTopupNotConfiguredError) {
187
+ return textResult(
188
+ [
189
+ "Hosted onramp is not configured on this ArisPay deployment.",
190
+ "Falling back to the manual path:",
191
+ "",
192
+ ` Send USDC on ${stored.network ?? "base"} to ${stored.walletAddress}`,
193
+ "",
194
+ "Ask the deployment owner to set ARISPAY_ONRAMP_PROVIDER=coinbase (+ COINBASE_ONRAMP_APP_ID) to enable hosted top-ups."
195
+ ].join("\n")
196
+ );
197
+ }
198
+ return textResult(
199
+ `fund_agent (hosted) failed: ${err instanceof Error ? err.message : String(err)}`,
200
+ true
201
+ );
202
+ }
203
+ }
204
+ const lines = [
205
+ `Fund \`${name}\` by sending USDC on ${stored.network ?? "base"} to:`,
206
+ "",
207
+ ` ${stored.walletAddress}`,
208
+ "",
209
+ "Pass `hosted: true` to get a Coinbase onramp URL instead (requires ARISPAY_ONRAMP_PROVIDER).",
210
+ "Call `get_balance` when the deposit lands."
211
+ ];
212
+ return textResult(lines.join("\n"));
213
+ }
214
+ );
215
+ server.tool(
216
+ "get_balance",
217
+ {
218
+ name: z.string().describe("Name of a locally-stored agent.")
219
+ },
220
+ async ({ name }) => {
221
+ const stored = getAgent(name);
222
+ if (!stored) return textResult(`No locally-stored agent named \`${name}\`.`, true);
223
+ try {
224
+ const devKey = requireDevKey();
225
+ const client = new DelegationClient(arispayUrl, devKey);
226
+ const balance = await client.getBalance(stored.agentId);
227
+ const human = formatUSDC(BigInt(balance.usdcBalance || "0"));
228
+ const lines = [
229
+ `${name}: ${human} USDC on ${balance.network}`,
230
+ balance.fundedAt ? ` First funded at: ${balance.fundedAt}` : " Not yet funded.",
231
+ ` Wallet: ${balance.walletAddress}`
232
+ ];
233
+ return textResult(lines.join("\n"));
234
+ } catch (err) {
235
+ return textResult(`get_balance failed: ${err instanceof Error ? err.message : String(err)}`, true);
236
+ }
237
+ }
238
+ );
239
+ server.tool(
240
+ "create_enduser",
241
+ {
242
+ externalId: z.string().describe("Your own stable id for this customer (e.g. `tg:12345`)."),
243
+ email: z.string().optional().describe("Optional email for compliance / receipts."),
244
+ findOrCreate: z.boolean().optional().describe("If true, return the existing user instead of erroring on externalId collision.")
245
+ },
246
+ async ({ externalId, email, findOrCreate }) => {
247
+ try {
248
+ const devKey = requireDevKey();
249
+ const client = new DelegationClient(arispayUrl, devKey);
250
+ const user = await client.createEndUser({ externalId, email, findOrCreate });
251
+ const lines = [
252
+ `\u2713 End-user \`${externalId}\` ready.`,
253
+ ` ArisPay id: ${user.id}`,
254
+ ` Has card: ${user.hasPaymentMethod ? "yes" : "no"}`,
255
+ ` Has wallet: ${user.hasWallet ? "yes" : "no"}`
256
+ ];
257
+ return textResult(lines.join("\n"));
258
+ } catch (err) {
259
+ return textResult(
260
+ `create_enduser failed: ${err instanceof Error ? err.message : String(err)}`,
261
+ true
262
+ );
263
+ }
264
+ }
265
+ );
266
+ server.tool(
267
+ "attach_card_for_user",
268
+ {
269
+ userId: z.string().describe("The ArisPay-internal end-user id (not externalId)."),
270
+ agentName: z.string().optional().describe("Optional locally-stored agent name to scope the card-setup session to.")
271
+ },
272
+ async ({ userId, agentName }) => {
273
+ try {
274
+ const devKey = requireDevKey();
275
+ const client = new DelegationClient(arispayUrl, devKey);
276
+ const agentId = agentName ? getAgent(agentName)?.agentId : void 0;
277
+ const session = await client.createCardSetupSession({ endUserId: userId, agentId });
278
+ const lines = [
279
+ `Card-entry URL for user \`${userId}\`:`,
280
+ "",
281
+ ` ${session.setupUrl}`,
282
+ "",
283
+ ` Expires at: ${session.expiresAt}`,
284
+ "",
285
+ "Share this URL with the end-user. They enter the card on ArisPay's hosted page; we handle tokenization + 3DS.",
286
+ "Call `get_user_status` afterwards to confirm the card is attached."
287
+ ];
288
+ return textResult(lines.join("\n"));
289
+ } catch (err) {
290
+ return textResult(
291
+ `attach_card_for_user failed: ${err instanceof Error ? err.message : String(err)}`,
292
+ true
293
+ );
294
+ }
295
+ }
296
+ );
297
+ server.tool(
298
+ "set_user_limits",
299
+ {
300
+ userId: z.string().describe("ArisPay-internal end-user id."),
301
+ agentName: z.string().describe("Locally-stored agent name."),
302
+ perTx: z.number().int().optional().describe("Per-transaction cap in cents. Omit to inherit agent defaults."),
303
+ daily: z.number().int().optional().describe("Daily cap in cents."),
304
+ monthly: z.number().int().optional().describe("Monthly cap in cents."),
305
+ allowedMcc: z.array(z.string()).optional().describe("Allowed Merchant Category Codes."),
306
+ blockedMcc: z.array(z.string()).optional().describe("Blocked MCCs.")
307
+ },
308
+ async ({ userId, agentName, perTx, daily, monthly, allowedMcc, blockedMcc }) => {
309
+ try {
310
+ const stored = getAgent(agentName);
311
+ if (!stored) {
312
+ return textResult(`No locally-stored agent named \`${agentName}\`.`, true);
313
+ }
314
+ const devKey = requireDevKey();
315
+ const client = new DelegationClient(arispayUrl, devKey);
316
+ const limit = await client.setUserLimits(userId, {
317
+ agentId: stored.agentId,
318
+ maxPerTransaction: perTx ?? null,
319
+ maxDaily: daily ?? null,
320
+ maxMonthly: monthly ?? null,
321
+ allowedMerchantCategories: allowedMcc,
322
+ blockedMerchantCategories: blockedMcc
323
+ });
324
+ return textResult(
325
+ [
326
+ `\u2713 Limits set for \`${userId}\` on agent \`${agentName}\`.`,
327
+ ` per-tx ${limit.maxPerTransaction ?? "inherit"}\xA2, daily ${limit.maxDaily ?? "inherit"}\xA2, monthly ${limit.maxMonthly ?? "inherit"}\xA2`
328
+ ].join("\n")
329
+ );
330
+ } catch (err) {
331
+ return textResult(
332
+ `set_user_limits failed: ${err instanceof Error ? err.message : String(err)}`,
333
+ true
334
+ );
335
+ }
336
+ }
337
+ );
338
+ server.tool(
339
+ "get_user_status",
340
+ {
341
+ userId: z.string().describe("ArisPay-internal end-user id.")
342
+ },
343
+ async ({ userId }) => {
344
+ try {
345
+ const devKey = requireDevKey();
346
+ const client = new DelegationClient(arispayUrl, devKey);
347
+ const user = await client.getEndUser(userId);
348
+ const lines = [
349
+ `${user.externalId} (${user.id})`,
350
+ ` email: ${user.email ?? "\u2014"}`,
351
+ ` card: ${user.hasPaymentMethod ? `${user.cardBrand ?? "card"} \u2026${user.cardLast4 ?? "????"}` : "\u2014"}`,
352
+ ` wallet: ${user.walletAddress ?? "\u2014"}${user.walletChain ? ` on ${user.walletChain}` : ""}`
353
+ ];
354
+ if (user.hasWallet) {
355
+ try {
356
+ const w = await client.getWalletStatus(userId);
357
+ lines.push(` balance: ${w.usdcBalance} USDC base units`);
358
+ lines.push(` allowance: ${w.usdcAllowance} (${w.allowanceSufficient ? "ok" : "insufficient"})`);
359
+ lines.push(` ready: ${w.ready}`);
360
+ } catch {
361
+ }
362
+ }
363
+ return textResult(lines.join("\n"));
364
+ } catch (err) {
365
+ return textResult(
366
+ `get_user_status failed: ${err instanceof Error ? err.message : String(err)}`,
367
+ true
368
+ );
369
+ }
370
+ }
371
+ );
372
+ server.tool(
373
+ "pay_merchant",
374
+ {
375
+ agentName: z.string().describe("Name of the locally-stored agent making the payment."),
376
+ merchantUrl: z.string().describe("Canonical merchant URL (stored on the payment record)."),
377
+ amount: z.number().int().positive().describe("Amount in cents."),
378
+ memo: z.string().describe("Human-readable memo attached to the payment."),
379
+ userId: z.string().optional().describe("Optional ArisPay end-user id. Required when the agent is in platform mode."),
380
+ rail: z.enum(["card", "crypto", "balance", "mpp"]).optional().describe("Force a specific rail. Default: server-picked based on agent mode + userId."),
381
+ merchantName: z.string().optional().describe("Optional human-readable merchant name."),
382
+ merchantCategoryCode: z.string().optional().describe("MCC for spend-limit enforcement.")
383
+ },
384
+ async ({ agentName, merchantUrl, amount, memo, userId, rail, merchantName, merchantCategoryCode }) => {
385
+ try {
386
+ const stored = getAgent(agentName);
387
+ if (!stored) {
388
+ return textResult(`No locally-stored agent named \`${agentName}\`.`, true);
389
+ }
390
+ const devKey = requireDevKey();
391
+ const client = new DelegationClient(arispayUrl, devKey);
392
+ const payment = await client.createPayment(stored.agentId, {
393
+ amount,
394
+ memo,
395
+ merchantUrl,
396
+ merchantName,
397
+ merchantCategoryCode,
398
+ userId,
399
+ rail
400
+ });
401
+ const lines = [
402
+ `Payment ${payment.id}: ${payment.status}`,
403
+ ` rail: ${payment.rail}`,
404
+ ` amount: ${payment.amount}\xA2 ${payment.currency}`
405
+ ];
406
+ if (payment.merchantName) lines.push(` merchant: ${payment.merchantName}`);
407
+ if (payment.txHash) lines.push(` tx hash: ${payment.txHash}`);
408
+ if (payment.nextAction) {
409
+ lines.push(` next action: ${payment.nextAction.type}`);
410
+ if (payment.nextAction.challengeUrl) {
411
+ lines.push(` 3DS challenge URL: ${payment.nextAction.challengeUrl}`);
412
+ }
413
+ }
414
+ if (payment.error) {
415
+ lines.push(` error: ${payment.error.code} \u2014 ${payment.error.message}`);
416
+ }
417
+ return textResult(lines.join("\n"), payment.status === "failed");
418
+ } catch (err) {
419
+ return textResult(
420
+ `pay_merchant failed: ${err instanceof Error ? err.message : String(err)}`,
421
+ true
422
+ );
423
+ }
424
+ }
425
+ );
426
+ server.tool(
427
+ "list_agents",
428
+ {},
429
+ async () => {
430
+ const agents = listAgents();
431
+ if (!agents.length) {
432
+ return textResult("No agents stored locally. Create one with `create_agent`.");
84
433
  }
85
- lines.push("", "Delegation limits + full spend history: https://payagent.arispay.app");
86
- return {
87
- content: [{ type: "text", text: lines.join("\n") }]
88
- };
434
+ const lines = agents.map(
435
+ (a) => [
436
+ a.name,
437
+ ` agent id: ${a.agentId}`,
438
+ ` wallet: ${a.walletAddress}`,
439
+ ` network: ${a.network ?? "base"}`,
440
+ ` limits: ${a.limits.perTx}\xA2 / tx, ${a.limits.daily}\xA2 / day, ${a.limits.monthly}\xA2 / month`,
441
+ ` created: ${a.createdAt}`
442
+ ].join("\n")
443
+ );
444
+ return textResult(lines.join("\n\n"));
89
445
  }
90
446
  );
91
447
  async function main() {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * payagent-mcp — MCP server that lets AI agents pay for APIs.\n *\n * Thin wrapper around `payagent`'s delegated signing path. No private keys\n * touch this process — ArisPay holds a Coinbase CDP-managed wallet and\n * enforces spend limits server-side.\n *\n * Configuration via environment variables:\n * - ARISPAY_URL: ArisPay API base URL (default: https://api.arispay.app)\n * - ARISPAY_AGENT_KEY: The agent-scoped API key returned by createX402Agent (required)\n * - PAYAGENT_WALLET: Optional wallet address for `check_wallet` tool output\n */\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod';\nimport { payFetchDelegated, getUSDCBalance, formatUSDC } from 'payagent';\n\n// ── Config from env ─────────────────────────────────\n\nconst arispayUrl = process.env.ARISPAY_URL ?? 'https://api.arispay.app';\nconst agentKey = process.env.ARISPAY_AGENT_KEY;\nconst walletAddress = process.env.PAYAGENT_WALLET;\n\nif (!agentKey) {\n console.error(\n 'Error: ARISPAY_AGENT_KEY environment variable is required.\\n' +\n 'Provision an agent at https://payagent.arispay.app to get a key.',\n );\n process.exit(1);\n}\n\nconst fetch402 = payFetchDelegated({\n arispayUrl,\n apiKey: agentKey,\n});\n\n// ── MCP Server ──────────────────────────────────────\n\nconst server = new McpServer({\n name: 'payagent',\n version: '2.0.0',\n});\n\nserver.tool(\n 'pay_api',\n {\n url: z.string().describe('The full URL of the API endpoint to call'),\n method: z\n .enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH'])\n .default('GET')\n .describe('HTTP method'),\n headers: z\n .record(z.string(), z.string())\n .optional()\n .describe('Additional HTTP headers to include'),\n body: z\n .string()\n .optional()\n .describe('Request body (for POST/PUT/PATCH)'),\n },\n async ({ url, method, headers, body }) => {\n try {\n const response = await fetch402(url, {\n method,\n headers,\n body,\n });\n const responseBody = await response.text();\n\n return {\n content: [\n {\n type: 'text' as const,\n text: [\n `HTTP ${response.status}`,\n '',\n responseBody,\n ].join('\\n'),\n },\n ],\n };\n } catch (err) {\n return {\n content: [\n {\n type: 'text' as const,\n text: `Error: ${err instanceof Error ? err.message : String(err)}`,\n },\n ],\n isError: true,\n };\n }\n },\n);\n\nserver.tool(\n 'check_wallet',\n {},\n async () => {\n const lines = [\n `ArisPay URL: ${arispayUrl}`,\n `Agent key: ${agentKey.slice(0, 10)}…`,\n ];\n\n if (walletAddress) {\n lines.push(`Wallet: ${walletAddress}`);\n try {\n const raw = await getUSDCBalance(walletAddress, 'base');\n lines.push(`Balance: ${formatUSDC(raw)} USDC on Base`);\n } catch (err) {\n lines.push(`Balance: unavailable (${err instanceof Error ? err.message : String(err)})`);\n }\n } else {\n lines.push('', 'Set PAYAGENT_WALLET=0x… in env to include on-chain balance.');\n }\n\n lines.push('', 'Delegation limits + full spend history: https://payagent.arispay.app');\n\n return {\n content: [{ type: 'text' as const, text: lines.join('\\n') }],\n };\n },\n);\n\n// ── Start ───────────────────────────────────────────\n\nasync function main() {\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n\nmain().catch((err) => {\n console.error('Fatal:', err);\n process.exit(1);\n});\n"],"mappings":";;;AAYA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,S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QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC;AAAA,UAClE;AAAA,QACF;AAAA,QACA,SAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF;AACF;AAEA,OAAO;AAAA,EACL;AAAA,EACA,CAAC;AAAA,EACD,YAAY;AACV,UAAM,QAAQ;AAAA,MACZ,gBAAgB,UAAU;AAAA,MAC1B,gBAAgB,SAAS,MAAM,GAAG,EAAE,CAAC;AAAA,IACvC;AAEA,QAAI,eAAe;AACjB,YAAM,KAAK,gBAAgB,aAAa,EAAE;AAC1C,UAAI;AACF,cAAM,MAAM,MAAM,eAAe,eAAe,MAAM;AACtD,cAAM,KAAK,gBAAgB,WAAW,GAAG,CAAC,eAAe;AAAA,MAC3D,SAAS,KAAK;AACZ,cAAM,KAAK,6BAA6B,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC,GAAG;AAAA,MAC7F;AAAA,IACF,OAAO;AACL,YAAM,KAAK,IAAI,kEAA6D;AAAA,IAC9E;AAEA,UAAM,KAAK,IAAI,sEAAsE;AAErF,WAAO;AAAA,MACL,SAAS,CAAC,EAAE,MAAM,QAAiB,MAAM,MAAM,KAAK,IAAI,EAAE,CAAC;AAAA,IAC7D;AAAA,EACF;AACF;AAIA,eAAe,OAAO;AACpB,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,MAAM,UAAU,GAAG;AAC3B,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\n/**\n * payagent-mcp — MCP server for agent-side x402 payments + headless launch.\n *\n * Six tools over stdio:\n * - pay_api(url, ...) — paid HTTP request via delegated signing\n * - check_wallet() — report current agent credentials + on-chain balance\n * - create_agent(...) — provision a new x402 agent (calls /v1/agents/x402)\n * - fund_agent({ name }) — return the wallet address + instructions for deposit\n * - get_balance({ name }) — on-server USDC balance + fundedAt latch\n * - list_agents() — enumerate locally-cached agents\n *\n * Config store lives at ~/.payagent/config.json (shared with the `payagent`\n * CLI). Credentials created via `npx payagent init` + `payagent agent create`\n * are immediately available here; equally, agents created via\n * `create_agent` are immediately visible to the CLI.\n *\n * Two auth modes, picked at request time:\n * 1. Legacy single-agent: ARISPAY_AGENT_KEY set → pay_api + check_wallet use it directly.\n * 2. Multi-agent: no env var, credentials come from the shared config store.\n * Management tools (create / fund / get_balance / list) always use the\n * developer key from the config store (or ARISPAY_API_KEY env).\n */\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod';\nimport {\n DelegationClient,\n HostedTopupNotConfiguredError,\n formatUSDC,\n getAgent,\n getApiKey,\n getArispayUrl,\n getUSDCBalance,\n launchAgent,\n listAgents,\n payFetchDelegated,\n type StoredAgent,\n} from 'payagent';\n\n// ── Configuration ─────────────────────────────────────\n\nconst arispayUrl = getArispayUrl(process.env.ARISPAY_URL);\n/** Legacy single-agent key (kept for backwards compatibility). */\nconst legacyAgentKey = process.env.ARISPAY_AGENT_KEY;\nconst legacyWalletAddress = process.env.PAYAGENT_WALLET;\n\nfunction resolveAgent(name?: string): StoredAgent | undefined {\n if (name) return getAgent(name);\n const agents = listAgents();\n return agents[0];\n}\n\n/**\n * Look up the agent-scoped key to use for paid requests.\n * Priority: explicit agent name → legacy env var → first stored agent.\n */\nfunction resolveAgentKey(name?: string): { key: string; source: string } | undefined {\n if (name) {\n const stored = getAgent(name);\n if (stored) return { key: stored.apiKey, source: `agent \\`${name}\\`` };\n return undefined;\n }\n if (legacyAgentKey) return { key: legacyAgentKey, source: 'ARISPAY_AGENT_KEY' };\n const first = listAgents()[0];\n if (first) return { key: first.apiKey, source: `agent \\`${first.name}\\`` };\n return undefined;\n}\n\nfunction requireDevKey(): string {\n const key = getApiKey();\n if (!key) {\n throw new Error(\n 'No ArisPay developer key found. Run `npx payagent init` or set ARISPAY_API_KEY.',\n );\n }\n return key;\n}\n\nfunction textResult(text: string, isError = false) {\n return {\n content: [{ type: 'text' as const, text }],\n ...(isError ? { isError } : {}),\n };\n}\n\n// ── MCP Server ────────────────────────────────────────\n\nconst server = new McpServer({\n name: 'payagent',\n version: '2.1.0',\n});\n\n// --- pay_api ----------------------------------------------------------------\n\nserver.tool(\n 'pay_api',\n {\n url: z.string().describe('The full URL of the API endpoint to call'),\n method: z\n .enum(['GET', 'POST', 'PUT', 'DELETE', 'PATCH'])\n .default('GET')\n .describe('HTTP method'),\n headers: z.record(z.string(), z.string()).optional().describe('Additional HTTP headers'),\n body: z.string().optional().describe('Request body (for POST/PUT/PATCH)'),\n agent: z\n .string()\n .optional()\n .describe('Optional: name of a locally-stored agent to pay with. Defaults to ARISPAY_AGENT_KEY or the first stored agent.'),\n },\n async ({ url, method, headers, body, agent }) => {\n const resolved = resolveAgentKey(agent);\n if (!resolved) {\n return textResult(\n 'No agent key available. Either set ARISPAY_AGENT_KEY, create one with `create_agent`, or run `npx payagent agent create` from the CLI.',\n true,\n );\n }\n try {\n const fetch402 = payFetchDelegated({ arispayUrl, apiKey: resolved.key });\n const response = await fetch402(url, { method, headers, body });\n const responseBody = await response.text();\n return textResult(\n [`HTTP ${response.status} (paid via ${resolved.source})`, '', responseBody].join('\\n'),\n );\n } catch (err) {\n return textResult(`Error: ${err instanceof Error ? err.message : String(err)}`, true);\n }\n },\n);\n\n// --- check_wallet ----------------------------------------------------------\n\nserver.tool(\n 'check_wallet',\n {\n agent: z\n .string()\n .optional()\n .describe('Optional: name of a locally-stored agent. Defaults to legacy ARISPAY_WALLET mode.'),\n },\n async ({ agent }) => {\n const resolved = resolveAgent(agent);\n const walletAddress = resolved?.walletAddress ?? legacyWalletAddress;\n const keyTail = resolved?.apiKey.slice(-4) ?? (legacyAgentKey ? legacyAgentKey.slice(-4) : undefined);\n\n const lines = [`ArisPay URL: ${arispayUrl}`];\n if (resolved) lines.push(`Agent: ${resolved.name} (${resolved.agentId})`);\n if (keyTail) lines.push(`Agent key: ap_…${keyTail}`);\n\n if (walletAddress) {\n lines.push(`Wallet: ${walletAddress}`);\n try {\n const raw = await getUSDCBalance(walletAddress, (resolved?.network as 'base') ?? 'base');\n lines.push(`Balance: ${formatUSDC(raw)} USDC on ${resolved?.network ?? 'base'}`);\n } catch (err) {\n lines.push(`Balance: unavailable (${err instanceof Error ? err.message : String(err)})`);\n }\n } else {\n lines.push('', 'No wallet known. Use `create_agent` or set PAYAGENT_WALLET for legacy mode.');\n }\n\n lines.push('', 'Manage limits + full history: https://arispay.app/dashboard');\n return textResult(lines.join('\\n'));\n },\n);\n\n// --- create_agent ----------------------------------------------------------\n\nserver.tool(\n 'create_agent',\n {\n name: z.string().describe('Local identifier for this agent. Used by later tools.'),\n perTx: z.number().int().positive().describe('Per-transaction spend cap in cents.'),\n daily: z.number().int().positive().describe('Daily spend cap in cents.'),\n monthly: z.number().int().positive().describe('Monthly spend cap in cents.'),\n allowedDomains: z\n .array(z.string())\n .optional()\n .describe('If provided, restrict this agent to paying only these domains.'),\n network: z\n .enum(['base', 'base-sepolia', 'ethereum', 'polygon'])\n .default('base')\n .describe('EVM network the agent pays on.'),\n agentType: z.string().optional().describe('Optional metadata label (e.g. \"hermes\").'),\n },\n async ({ name, perTx, daily, monthly, allowedDomains, network, agentType }) => {\n try {\n requireDevKey(); // fail fast with a helpful message if not signed in\n const agent = await launchAgent({\n name,\n limits: { perTx, daily, monthly },\n allowedDomains,\n network,\n agentType,\n });\n const lines = [\n `✓ Agent \\`${name}\\` created.`,\n ` Agent ID: ${agent.agentId}`,\n ` Wallet: ${agent.walletAddress}`,\n ` Network: ${agent.network}`,\n ` Limits: ${perTx}¢ / tx, ${daily}¢ / day, ${monthly}¢ / month`,\n '',\n ` Fund the wallet with USDC on ${agent.network}, then call \\`get_balance\\` with name=\"${name}\".`,\n ];\n return textResult(lines.join('\\n'));\n } catch (err) {\n return textResult(`create_agent failed: ${err instanceof Error ? err.message : String(err)}`, true);\n }\n },\n);\n\n// --- fund_agent ------------------------------------------------------------\n\nserver.tool(\n 'fund_agent',\n {\n name: z.string().describe('Name of a locally-stored agent.'),\n hosted: z\n .boolean()\n .optional()\n .describe(\n 'If true, request a provider-hosted onramp URL (Coinbase, etc.) instead of the plain wallet address. Requires ARISPAY_ONRAMP_PROVIDER on the API deployment.',\n ),\n amount: z\n .number()\n .optional()\n .describe('Preset top-up amount in dollars. Only meaningful with `hosted: true`.'),\n },\n async ({ name, hosted, amount }) => {\n const stored = getAgent(name);\n if (!stored) return textResult(`No locally-stored agent named \\`${name}\\`.`, true);\n\n if (hosted) {\n const devKey = getApiKey();\n if (!devKey) {\n return textResult(\n 'No ArisPay developer key found. Run `npx payagent init` first.',\n true,\n );\n }\n const client = new DelegationClient(arispayUrl, devKey);\n try {\n const link = await client.getHostedTopup(stored.agentId, { amount });\n const lines = [\n `Top up \\`${name}\\` via ${link.provider}:`,\n '',\n ` ${link.fundingUrl}`,\n '',\n ` Wallet: ${link.walletAddress}`,\n ` Network: ${link.network}`,\n ` URL valid until: ${link.expiresAt}`,\n '',\n 'Share that URL with the end-user; the onramp deposits USDC straight to the agent\\'s wallet.',\n ];\n return textResult(lines.join('\\n'));\n } catch (err) {\n if (err instanceof HostedTopupNotConfiguredError) {\n return textResult(\n [\n 'Hosted onramp is not configured on this ArisPay deployment.',\n 'Falling back to the manual path:',\n '',\n ` Send USDC on ${stored.network ?? 'base'} to ${stored.walletAddress}`,\n '',\n 'Ask the deployment owner to set ARISPAY_ONRAMP_PROVIDER=coinbase (+ COINBASE_ONRAMP_APP_ID) to enable hosted top-ups.',\n ].join('\\n'),\n );\n }\n return textResult(\n `fund_agent (hosted) failed: ${err instanceof Error ? err.message : String(err)}`,\n true,\n );\n }\n }\n\n const lines = [\n `Fund \\`${name}\\` by sending USDC on ${stored.network ?? 'base'} to:`,\n '',\n ` ${stored.walletAddress}`,\n '',\n 'Pass `hosted: true` to get a Coinbase onramp URL instead (requires ARISPAY_ONRAMP_PROVIDER).',\n 'Call `get_balance` when the deposit lands.',\n ];\n return textResult(lines.join('\\n'));\n },\n);\n\n// --- get_balance -----------------------------------------------------------\n\nserver.tool(\n 'get_balance',\n {\n name: z.string().describe('Name of a locally-stored agent.'),\n },\n async ({ name }) => {\n const stored = getAgent(name);\n if (!stored) return textResult(`No locally-stored agent named \\`${name}\\`.`, true);\n try {\n const devKey = requireDevKey();\n const client = new DelegationClient(arispayUrl, devKey);\n const balance = await client.getBalance(stored.agentId);\n const human = formatUSDC(BigInt(balance.usdcBalance || '0'));\n const lines = [\n `${name}: ${human} USDC on ${balance.network}`,\n balance.fundedAt\n ? ` First funded at: ${balance.fundedAt}`\n : ' Not yet funded.',\n ` Wallet: ${balance.walletAddress}`,\n ];\n return textResult(lines.join('\\n'));\n } catch (err) {\n return textResult(`get_balance failed: ${err instanceof Error ? err.message : String(err)}`, true);\n }\n },\n);\n\n// --- create_enduser --------------------------------------------------------\n\nserver.tool(\n 'create_enduser',\n {\n externalId: z.string().describe('Your own stable id for this customer (e.g. `tg:12345`).'),\n email: z.string().optional().describe('Optional email for compliance / receipts.'),\n findOrCreate: z\n .boolean()\n .optional()\n .describe('If true, return the existing user instead of erroring on externalId collision.'),\n },\n async ({ externalId, email, findOrCreate }) => {\n try {\n const devKey = requireDevKey();\n const client = new DelegationClient(arispayUrl, devKey);\n const user = await client.createEndUser({ externalId, email, findOrCreate });\n const lines = [\n `✓ End-user \\`${externalId}\\` ready.`,\n ` ArisPay id: ${user.id}`,\n ` Has card: ${user.hasPaymentMethod ? 'yes' : 'no'}`,\n ` Has wallet: ${user.hasWallet ? 'yes' : 'no'}`,\n ];\n return textResult(lines.join('\\n'));\n } catch (err) {\n return textResult(\n `create_enduser failed: ${err instanceof Error ? err.message : String(err)}`,\n true,\n );\n }\n },\n);\n\n// --- attach_card_for_user -------------------------------------------------\n\nserver.tool(\n 'attach_card_for_user',\n {\n userId: z.string().describe('The ArisPay-internal end-user id (not externalId).'),\n agentName: z\n .string()\n .optional()\n .describe('Optional locally-stored agent name to scope the card-setup session to.'),\n },\n async ({ userId, agentName }) => {\n try {\n const devKey = requireDevKey();\n const client = new DelegationClient(arispayUrl, devKey);\n const agentId = agentName ? getAgent(agentName)?.agentId : undefined;\n const session = await client.createCardSetupSession({ endUserId: userId, agentId });\n const lines = [\n `Card-entry URL for user \\`${userId}\\`:`,\n '',\n ` ${session.setupUrl}`,\n '',\n ` Expires at: ${session.expiresAt}`,\n '',\n 'Share this URL with the end-user. They enter the card on ArisPay\\'s hosted page; we handle tokenization + 3DS.',\n 'Call `get_user_status` afterwards to confirm the card is attached.',\n ];\n return textResult(lines.join('\\n'));\n } catch (err) {\n return textResult(\n `attach_card_for_user failed: ${err instanceof Error ? err.message : String(err)}`,\n true,\n );\n }\n },\n);\n\n// --- set_user_limits -------------------------------------------------------\n\nserver.tool(\n 'set_user_limits',\n {\n userId: z.string().describe('ArisPay-internal end-user id.'),\n agentName: z.string().describe('Locally-stored agent name.'),\n perTx: z.number().int().optional().describe('Per-transaction cap in cents. Omit to inherit agent defaults.'),\n daily: z.number().int().optional().describe('Daily cap in cents.'),\n monthly: z.number().int().optional().describe('Monthly cap in cents.'),\n allowedMcc: z.array(z.string()).optional().describe('Allowed Merchant Category Codes.'),\n blockedMcc: z.array(z.string()).optional().describe('Blocked MCCs.'),\n },\n async ({ userId, agentName, perTx, daily, monthly, allowedMcc, blockedMcc }) => {\n try {\n const stored = getAgent(agentName);\n if (!stored) {\n return textResult(`No locally-stored agent named \\`${agentName}\\`.`, true);\n }\n const devKey = requireDevKey();\n const client = new DelegationClient(arispayUrl, devKey);\n const limit = await client.setUserLimits(userId, {\n agentId: stored.agentId,\n maxPerTransaction: perTx ?? null,\n maxDaily: daily ?? null,\n maxMonthly: monthly ?? null,\n allowedMerchantCategories: allowedMcc,\n blockedMerchantCategories: blockedMcc,\n });\n return textResult(\n [\n `✓ Limits set for \\`${userId}\\` on agent \\`${agentName}\\`.`,\n ` per-tx ${limit.maxPerTransaction ?? 'inherit'}¢, daily ${limit.maxDaily ?? 'inherit'}¢, monthly ${limit.maxMonthly ?? 'inherit'}¢`,\n ].join('\\n'),\n );\n } catch (err) {\n return textResult(\n `set_user_limits failed: ${err instanceof Error ? err.message : String(err)}`,\n true,\n );\n }\n },\n);\n\n// --- get_user_status -------------------------------------------------------\n\nserver.tool(\n 'get_user_status',\n {\n userId: z.string().describe('ArisPay-internal end-user id.'),\n },\n async ({ userId }) => {\n try {\n const devKey = requireDevKey();\n const client = new DelegationClient(arispayUrl, devKey);\n const user = await client.getEndUser(userId);\n const lines = [\n `${user.externalId} (${user.id})`,\n ` email: ${user.email ?? '—'}`,\n ` card: ${user.hasPaymentMethod ? `${user.cardBrand ?? 'card'} …${user.cardLast4 ?? '????'}` : '—'}`,\n ` wallet: ${user.walletAddress ?? '—'}${user.walletChain ? ` on ${user.walletChain}` : ''}`,\n ];\n if (user.hasWallet) {\n try {\n const w = await client.getWalletStatus(userId);\n lines.push(` balance: ${w.usdcBalance} USDC base units`);\n lines.push(` allowance: ${w.usdcAllowance} (${w.allowanceSufficient ? 'ok' : 'insufficient'})`);\n lines.push(` ready: ${w.ready}`);\n } catch {\n // getWalletStatus fails if wallet not configured — ignore.\n }\n }\n return textResult(lines.join('\\n'));\n } catch (err) {\n return textResult(\n `get_user_status failed: ${err instanceof Error ? err.message : String(err)}`,\n true,\n );\n }\n },\n);\n\n// --- pay_merchant ----------------------------------------------------------\n\nserver.tool(\n 'pay_merchant',\n {\n agentName: z.string().describe('Name of the locally-stored agent making the payment.'),\n merchantUrl: z.string().describe('Canonical merchant URL (stored on the payment record).'),\n amount: z.number().int().positive().describe('Amount in cents.'),\n memo: z.string().describe('Human-readable memo attached to the payment.'),\n userId: z\n .string()\n .optional()\n .describe('Optional ArisPay end-user id. Required when the agent is in platform mode.'),\n rail: z\n .enum(['card', 'crypto', 'balance', 'mpp'])\n .optional()\n .describe('Force a specific rail. Default: server-picked based on agent mode + userId.'),\n merchantName: z.string().optional().describe('Optional human-readable merchant name.'),\n merchantCategoryCode: z.string().optional().describe('MCC for spend-limit enforcement.'),\n },\n async ({ agentName, merchantUrl, amount, memo, userId, rail, merchantName, merchantCategoryCode }) => {\n try {\n const stored = getAgent(agentName);\n if (!stored) {\n return textResult(`No locally-stored agent named \\`${agentName}\\`.`, true);\n }\n const devKey = requireDevKey();\n const client = new DelegationClient(arispayUrl, devKey);\n const payment = await client.createPayment(stored.agentId, {\n amount,\n memo,\n merchantUrl,\n merchantName,\n merchantCategoryCode,\n userId,\n rail,\n });\n const lines = [\n `Payment ${payment.id}: ${payment.status}`,\n ` rail: ${payment.rail}`,\n ` amount: ${payment.amount}¢ ${payment.currency}`,\n ];\n if (payment.merchantName) lines.push(` merchant: ${payment.merchantName}`);\n if (payment.txHash) lines.push(` tx hash: ${payment.txHash}`);\n if (payment.nextAction) {\n lines.push(` next action: ${payment.nextAction.type}`);\n if (payment.nextAction.challengeUrl) {\n lines.push(` 3DS challenge URL: ${payment.nextAction.challengeUrl}`);\n }\n }\n if (payment.error) {\n lines.push(` error: ${payment.error.code} — ${payment.error.message}`);\n }\n return textResult(lines.join('\\n'), payment.status === 'failed');\n } catch (err) {\n return textResult(\n `pay_merchant failed: ${err instanceof Error ? err.message : String(err)}`,\n true,\n );\n }\n },\n);\n\n// --- list_agents -----------------------------------------------------------\n\nserver.tool(\n 'list_agents',\n {},\n async () => {\n const agents = listAgents();\n if (!agents.length) {\n return textResult('No agents stored locally. Create one with `create_agent`.');\n }\n const lines = agents.map((a) =>\n [\n a.name,\n ` agent id: ${a.agentId}`,\n ` wallet: ${a.walletAddress}`,\n ` network: ${a.network ?? 'base'}`,\n ` limits: ${a.limits.perTx}¢ / tx, ${a.limits.daily}¢ / day, ${a.limits.monthly}¢ / month`,\n ` created: ${a.createdAt}`,\n ].join('\\n'),\n );\n return textResult(lines.join('\\n\\n'));\n },\n);\n\n// ── Start ─────────────────────────────────────────────\n\nasync function main() {\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n\nmain().catch((err) => {\n console.error('Fatal:', err);\n process.exit(1);\n});\n"],"mappings":";;;;AAuBA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,SAAS;AAClB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAIP,IAAM,aAAa,cAAc,QAAQ,IAAI,WAAW;AAExD,IAAM,iBAAiB,QAAQ,IAAI;AACnC,IAAM,sBAAsB,QAAQ,IAAI;AAExC,SAAS,aAAa,MAAwC;AAC5D,MAAI,KAAM,QAAO,SAAS,IAAI;AAC9B,QAAM,SAAS,WAAW;AAC1B,SAAO,OAAO,CAAC;AACjB;AAMA,SAAS,gBAAgB,MAA4D;AACnF,MAAI,MAAM;AACR,UAAM,SAAS,SAAS,IAAI;AAC5B,QAAI,OAAQ,QAAO,EAAE,KAAK,OAAO,QAAQ,QAAQ,WAAW,IAAI,KAAK;AACrE,WAAO;AAAA,EACT;AACA,MAAI,eAAgB,QAAO,EAAE,KAAK,gBAAgB,QAAQ,oBAAoB;AAC9E,QAAM,QAAQ,WAAW,EAAE,CAAC;AAC5B,MAAI,MAAO,QAAO,EAAE,KAAK,MAAM,QAAQ,QAAQ,WAAW,MAAM,IAAI,KAAK;AACzE,SAAO;AACT;AAEA,SAAS,gBAAwB;AAC/B,QAAM,MAAM,UAAU;AACtB,MAAI,CAAC,KAAK;AACR,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,WAAW,MAAc,UAAU,OAAO;AACjD,SAAO;AAAA,IACL,SAAS,CAAC,EAAE,MAAM,QAAiB,KAAK,CAAC;AAAA,IACzC,GAAI,UAAU,EAAE,QAAQ,IAAI,CAAC;AAAA,EAC/B;AACF;AAIA,IAAM,SAAS,IAAI,UAAU;AAAA,EAC3B,MAA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UAAU,OAAO,GAAG,CAAC;AAAA,QACxE;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;AAIA,OAAO;AAAA,EACL;AAAA,EACA,CAAC;AAAA,EACD,YAAY;AACV,UAAM,SAAS,WAAW;AAC1B,QAAI,CAAC,OAAO,QAAQ;AAClB,aAAO,WAAW,2DAA2D;AAAA,IAC/E;AACA,UAAM,QAAQ,OAAO;AAAA,MAAI,CAAC,MACxB;AAAA,QACE,EAAE;AAAA,QACF,gBAAgB,EAAE,OAAO;AAAA,QACzB,gBAAgB,EAAE,aAAa;AAAA,QAC/B,gBAAgB,EAAE,WAAW,MAAM;AAAA,QACnC,gBAAgB,EAAE,OAAO,KAAK,cAAW,EAAE,OAAO,KAAK,eAAY,EAAE,OAAO,OAAO;AAAA,QACnF,gBAAgB,EAAE,SAAS;AAAA,MAC7B,EAAE,KAAK,IAAI;AAAA,IACb;AACA,WAAO,WAAW,MAAM,KAAK,MAAM,CAAC;AAAA,EACtC;AACF;AAIA,eAAe,OAAO;AACpB,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;AAEA,KAAK,EAAE,MAAM,CAAC,QAAQ;AACpB,UAAQ,MAAM,UAAU,GAAG;AAC3B,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["lines"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arispay/payagent-mcp",
3
- "version": "2.0.1",
3
+ "version": "2.5.0",
4
4
  "description": "MCP server for ArisPay-delegated x402 USDC payments. Use with Claude Desktop, Cursor, or any MCP client — no private keys in your process.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -12,10 +12,8 @@
12
12
  "README.md",
13
13
  "LICENSE"
14
14
  ],
15
- "scripts": {
16
- "build": "tsup",
17
- "dev": "tsup --watch",
18
- "prepublishOnly": "npm run build"
15
+ "publishConfig": {
16
+ "access": "public"
19
17
  },
20
18
  "keywords": [
21
19
  "arispay",
@@ -41,17 +39,22 @@
41
39
  "license": "MIT",
42
40
  "repository": {
43
41
  "type": "git",
44
- "url": "git+https://github.com/stevemilton/payagent-mcp.git"
42
+ "url": "git+https://github.com/arispay-inc/payagent-mcp.git"
45
43
  },
46
- "homepage": "https://github.com/stevemilton/payagent-mcp#readme",
44
+ "homepage": "https://github.com/arispay-inc/payagent-mcp#readme",
47
45
  "dependencies": {
48
46
  "@modelcontextprotocol/sdk": "^1.12.1",
49
- "payagent": "^2.0.0",
50
- "zod": "^3.25.0"
47
+ "zod": "^3.25.0",
48
+ "payagent": "^2.5.0"
51
49
  },
52
50
  "devDependencies": {
53
51
  "@types/node": "^22.0.0",
54
52
  "tsup": "^8.0.0",
55
53
  "typescript": "^5.7.0"
54
+ },
55
+ "scripts": {
56
+ "build": "tsup",
57
+ "dev": "tsup --watch",
58
+ "type-check": "tsc --noEmit"
56
59
  }
57
- }
60
+ }