@aifinpay/mcp 2.4.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/README.md +62 -23
- package/dist/config.d.ts +10 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +28 -5
- package/dist/config.js.map +1 -1
- package/dist/directory.d.ts +55 -0
- package/dist/directory.d.ts.map +1 -0
- package/dist/directory.js +56 -0
- package/dist/directory.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/native-price.d.ts +18 -9
- package/dist/native-price.d.ts.map +1 -1
- package/dist/native-price.js +34 -29
- package/dist/native-price.js.map +1 -1
- package/dist/pay-chains.d.ts +31 -0
- package/dist/pay-chains.d.ts.map +1 -0
- package/dist/pay-chains.js +37 -0
- package/dist/pay-chains.js.map +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +9 -1
- package/dist/server.js.map +1 -1
- package/dist/tools/agent-address.d.ts.map +1 -1
- package/dist/tools/agent-address.js +1 -1
- package/dist/tools/agent-address.js.map +1 -1
- package/dist/tools/agent-call.d.ts +68 -0
- package/dist/tools/agent-call.d.ts.map +1 -0
- package/dist/tools/agent-call.js +129 -0
- package/dist/tools/agent-call.js.map +1 -0
- package/dist/tools/agent-quote.d.ts +41 -0
- package/dist/tools/agent-quote.d.ts.map +1 -0
- package/dist/tools/agent-quote.js +81 -0
- package/dist/tools/agent-quote.js.map +1 -0
- package/dist/tools/pay-with-split.d.ts +93 -0
- package/dist/tools/pay-with-split.d.ts.map +1 -0
- package/dist/tools/pay-with-split.js +138 -0
- package/dist/tools/pay-with-split.js.map +1 -0
- package/dist/tools/payable-fetch.d.ts.map +1 -1
- package/dist/tools/payable-fetch.js +30 -17
- package/dist/tools/payable-fetch.js.map +1 -1
- package/package.json +3 -3
- package/skills/SKILL.md +27 -15
- package/smithery.yaml +72 -40
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
// NOTE on the chain enum below: pay_with_split and quote_split are
|
|
2
|
+
// BACKEND-INVOICE-DRIVEN — they call the operator API
|
|
3
|
+
// (POST /api/b2b/pay-with-split, GET /api/b2b/quote-split), which supports
|
|
4
|
+
// solana + 6 on-chain-verified EVM chains (polygon, base, optimism,
|
|
5
|
+
// unichain, botchain, xrplevm). Keep this enum in lockstep with the
|
|
6
|
+
// backend's ../evm-chains.js registry — a chain listed here without
|
|
7
|
+
// backend support would just be rejected server-side. Stables: USDC on
|
|
8
|
+
// base/optimism/unichain, USDC+USDT on polygon; botchain/xrplevm are
|
|
9
|
+
// native-token only. Direct (non-invoice) splitter settlement lives in
|
|
10
|
+
// the SDK's AiFinPayAgent.call() (@aifinpay/agent >= 1.3.0).
|
|
11
|
+
export function payWithSplitTool() {
|
|
12
|
+
return {
|
|
13
|
+
name: "pay_with_split",
|
|
14
|
+
description: "Get on-chain instructions for a fee-on-top atomic 3-way payment. " +
|
|
15
|
+
"The merchant receives the FULL quoted price; AiFinPay protocol fee " +
|
|
16
|
+
"(1%) and creator/referral fee (0.01%) are added ON TOP. The agent " +
|
|
17
|
+
"executes the returned instructions with their chain SDK of choice. " +
|
|
18
|
+
"Returns 503 with onboarding message if the splitter is not yet " +
|
|
19
|
+
"deployed on the requested chain.",
|
|
20
|
+
inputSchema: {
|
|
21
|
+
type: "object",
|
|
22
|
+
properties: {
|
|
23
|
+
chain: {
|
|
24
|
+
type: "string",
|
|
25
|
+
enum: ["solana", "polygon", "base", "optimism", "unichain", "botchain", "xrplevm"],
|
|
26
|
+
description: "Chain to settle on.",
|
|
27
|
+
},
|
|
28
|
+
merchant_wallet: {
|
|
29
|
+
type: "string",
|
|
30
|
+
description: "Recipient — Solana base58 pubkey or Polygon 0x address.",
|
|
31
|
+
},
|
|
32
|
+
merchant_amount: {
|
|
33
|
+
type: "string",
|
|
34
|
+
description: "Merchant's quoted price in chain units (lamports for Solana, " +
|
|
35
|
+
"wei for Polygon). Use a string to preserve precision.",
|
|
36
|
+
},
|
|
37
|
+
order_id: {
|
|
38
|
+
type: "string",
|
|
39
|
+
description: "Off-chain reference (max 64 chars).",
|
|
40
|
+
},
|
|
41
|
+
fee_recipient: {
|
|
42
|
+
type: "string",
|
|
43
|
+
description: "Optional — receives the IP-creator fee. Omit to route the " +
|
|
44
|
+
"creator slot to AiFinPay treasury.",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
required: ["chain", "merchant_wallet", "merchant_amount", "order_id"],
|
|
48
|
+
},
|
|
49
|
+
// Returns on-chain instructions/invoice; does not itself broadcast funds.
|
|
50
|
+
annotations: { readOnlyHint: false, openWorldHint: false, destructiveHint: false },
|
|
51
|
+
outputSchema: { type: "object" },
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
export async function runPayWithSplit(ctx, args) {
|
|
55
|
+
const chain = args.chain;
|
|
56
|
+
if (!chain || !["solana", "polygon", "base", "optimism", "unichain", "botchain", "xrplevm"].includes(chain)) {
|
|
57
|
+
return errorResult("chain must be 'solana', 'polygon', 'base', 'optimism', 'unichain', 'botchain' or 'xrplevm'");
|
|
58
|
+
}
|
|
59
|
+
const merchantWallet = String(args.merchant_wallet ?? "");
|
|
60
|
+
const merchantAmount = String(args.merchant_amount ?? "");
|
|
61
|
+
const orderId = String(args.order_id ?? "");
|
|
62
|
+
if (!merchantWallet || !merchantAmount || !orderId) {
|
|
63
|
+
return errorResult("merchant_wallet, merchant_amount, and order_id are all required");
|
|
64
|
+
}
|
|
65
|
+
const feeRecipient = typeof args.fee_recipient === "string" && args.fee_recipient
|
|
66
|
+
? args.fee_recipient
|
|
67
|
+
: undefined;
|
|
68
|
+
try {
|
|
69
|
+
const invoice = await ctx.agent.inner.payWithSplitInvoice({
|
|
70
|
+
// published @aifinpay/agent (<=1.3.0) still types this "solana"|"polygon";
|
|
71
|
+
// the value is forwarded verbatim to the backend, which accepts all 7.
|
|
72
|
+
// Drop the cast once agent >=1.3.1 (widened types) is published.
|
|
73
|
+
chain: chain,
|
|
74
|
+
merchantWallet,
|
|
75
|
+
merchantAmount,
|
|
76
|
+
orderId,
|
|
77
|
+
feeRecipient,
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
content: [{ type: "text", text: JSON.stringify(invoice, null, 2) }],
|
|
81
|
+
structuredContent: invoice,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
const err = e;
|
|
86
|
+
return errorResult(`${err.constructor.name}: ${err.message}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
export function quoteSplitTool() {
|
|
90
|
+
return {
|
|
91
|
+
name: "quote_split",
|
|
92
|
+
description: "Pure-view: compute the fee-on-top breakdown (merchant + treasury + " +
|
|
93
|
+
"creator + total) for a given merchant amount. No payment, no auth. " +
|
|
94
|
+
"Use this BEFORE pay_with_split to decide whether the cost is " +
|
|
95
|
+
"acceptable.",
|
|
96
|
+
inputSchema: {
|
|
97
|
+
type: "object",
|
|
98
|
+
properties: {
|
|
99
|
+
chain: { type: "string", enum: ["solana", "polygon", "base", "optimism", "unichain", "botchain", "xrplevm"] },
|
|
100
|
+
merchant_amount: {
|
|
101
|
+
type: "string",
|
|
102
|
+
description: "Merchant's quoted price (lamports for Solana, wei for Polygon).",
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
required: ["chain", "merchant_amount"],
|
|
106
|
+
},
|
|
107
|
+
annotations: { readOnlyHint: true, openWorldHint: false, destructiveHint: false },
|
|
108
|
+
outputSchema: { type: "object" },
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
export async function runQuoteSplit(ctx, args) {
|
|
112
|
+
const chain = args.chain;
|
|
113
|
+
if (!chain || !["solana", "polygon", "base", "optimism", "unichain", "botchain", "xrplevm"].includes(chain)) {
|
|
114
|
+
return errorResult("chain must be 'solana', 'polygon', 'base', 'optimism', 'unichain', 'botchain' or 'xrplevm'");
|
|
115
|
+
}
|
|
116
|
+
const merchantAmount = String(args.merchant_amount ?? "");
|
|
117
|
+
if (!merchantAmount)
|
|
118
|
+
return errorResult("merchant_amount required");
|
|
119
|
+
try {
|
|
120
|
+
// Same published-type lag as above — cast until agent >=1.3.1 ships.
|
|
121
|
+
const quote = await ctx.agent.inner.quoteSplit({ chain: chain, merchantAmount });
|
|
122
|
+
return {
|
|
123
|
+
content: [{ type: "text", text: JSON.stringify(quote, null, 2) }],
|
|
124
|
+
structuredContent: quote,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
const err = e;
|
|
129
|
+
return errorResult(`${err.constructor.name}: ${err.message}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function errorResult(...lines) {
|
|
133
|
+
return {
|
|
134
|
+
isError: true,
|
|
135
|
+
content: lines.map((line) => ({ type: "text", text: line })),
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=pay-with-split.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pay-with-split.js","sourceRoot":"","sources":["../../src/tools/pay-with-split.ts"],"names":[],"mappings":"AAEA,mEAAmE;AACnE,sDAAsD;AACtD,2EAA2E;AAC3E,oEAAoE;AACpE,oEAAoE;AACpE,oEAAoE;AACpE,uEAAuE;AACvE,qEAAqE;AACrE,uEAAuE;AACvE,6DAA6D;AAE7D,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACT,mEAAmE;YACnE,qEAAqE;YACrE,oEAAoE;YACpE,qEAAqE;YACrE,iEAAiE;YACjE,kCAAkC;QACpC,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,CAAC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C;QACvB,OAAO,WAAW,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,SAAS,WAAW,CAAC,GAAG,KAAe;IACrC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;KAC7D,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payable-fetch.d.ts","sourceRoot":"","sources":["../../src/tools/payable-fetch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"payable-fetch.d.ts","sourceRoot":"","sources":["../../src/tools/payable-fetch.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAWhD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B/B;AAED,2FAA2F;AAC3F,wBAAsB,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAgPpF"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Aifp1SettlementUnsupportedError, parseGatewayUrl } from "@aifinpay/agent";
|
|
2
2
|
import { validatePaymentConfig } from "../config.js";
|
|
3
3
|
import { PaymentStateError } from "../payment-state.js";
|
|
4
|
-
import {
|
|
4
|
+
import { independentNativeUsd } from "../native-price.js";
|
|
5
|
+
import { payChain } from "../pay-chains.js";
|
|
5
6
|
// "prefix" is left out on purpose: it needs a resource to anchor to, and the
|
|
6
7
|
// owner's two real requests are "this endpoint" and "this site".
|
|
7
8
|
const SCOPES = ["exact", "merchant"];
|
|
8
9
|
export function payableFetchTool() {
|
|
9
10
|
return {
|
|
10
11
|
name: "payable_fetch",
|
|
11
|
-
description: 'Fetch a GET resource from an owner-approved AiFinPay merchant. Buys a prepaid batch through verified
|
|
12
|
+
description: 'Fetch a GET resource from an owner-approved AiFinPay merchant. Buys a prepaid batch through verified v1.4 on the chain the owner set in AIFINPAY_PAY_CHAIN (Polygon by default, or Base) — in its native currency (POL, ETH), or in the stablecoin the owner set in AIFINPAY_PAY_ASSET (e.g. USDC; gas is still native) — within owner limits, then reuses its receipt. With scope "merchant" one batch covers every path on the site. Pending payments are recovered without sending another transaction. Other payment protocols are unsupported.',
|
|
12
13
|
inputSchema: {
|
|
13
14
|
type: "object",
|
|
14
15
|
properties: {
|
|
@@ -33,10 +34,12 @@ export function payableFetchTool() {
|
|
|
33
34
|
/** Never expose bearer receipts, raw signed transactions, or exception response bodies. */
|
|
34
35
|
export async function runPayableFetch(ctx, args) {
|
|
35
36
|
let state;
|
|
37
|
+
let chain;
|
|
36
38
|
try {
|
|
37
39
|
let maxGasWei;
|
|
38
40
|
try {
|
|
39
41
|
maxGasWei = validatePaymentConfig(ctx.config);
|
|
42
|
+
chain = payChain(ctx.config.payChain);
|
|
40
43
|
}
|
|
41
44
|
catch (error) {
|
|
42
45
|
return errorResult(error.message);
|
|
@@ -63,7 +66,9 @@ export async function runPayableFetch(ctx, args) {
|
|
|
63
66
|
return errorResult("max_amount_usd must be a positive finite amount.");
|
|
64
67
|
const maximum = Math.min(ctx.config.maxAmountUsd, typeof args.max_amount_usd === "number" ? args.max_amount_usd : Infinity);
|
|
65
68
|
const parsed = parseGatewayUrl(url.href, ctx.config.gatewayOrigins, ctx.config.gatewayPathMode);
|
|
66
|
-
const
|
|
69
|
+
const pay = chain;
|
|
70
|
+
const payAsset = ctx.config.payAsset ?? pay.native;
|
|
71
|
+
const rpc = ctx.config.rpcUrl ?? pay.defaultRpc;
|
|
67
72
|
return await store.exclusive(async () => {
|
|
68
73
|
state = store.read();
|
|
69
74
|
for (const entry of ctx.agent.aifp1Receipts.list())
|
|
@@ -79,12 +84,14 @@ export async function runPayableFetch(ctx, args) {
|
|
|
79
84
|
if (pending.recovery.apiBaseUrl.replace(/\/+$/, "") !== configuredApi ||
|
|
80
85
|
(pending.recovery.paymentIssuer ?? configuredApi).replace(/\/+$/, "") !== configuredApi ||
|
|
81
86
|
pending.recovery.quote.payer?.toLowerCase() !== ctx.agent.evmAddress.toLowerCase() ||
|
|
82
|
-
call?.chain !==
|
|
87
|
+
call?.chain !== pay.name ||
|
|
83
88
|
call.splitter_version !== "1.4" ||
|
|
84
89
|
// Native calls from earlier versions may lack the field; they were POL.
|
|
85
90
|
(call.asset ?? "POL") !== pending.recovery.asset ||
|
|
86
|
-
![
|
|
87
|
-
|
|
91
|
+
![pay.native, payAsset].includes(pending.recovery.asset)) {
|
|
92
|
+
// A payment pending on another chain is recovered by switching back
|
|
93
|
+
// to that chain; it is never re-sent here and never forgotten.
|
|
94
|
+
throw new Error(`Pending payment does not match the configured wallet/API/${pay.name} v1.4 route and asset`);
|
|
88
95
|
}
|
|
89
96
|
const paid = await ctx.agent.recoverPaidPayment(pending.recovery, { paymentIssuer: configuredApi });
|
|
90
97
|
const receipt = {
|
|
@@ -119,26 +126,28 @@ export async function runPayableFetch(ctx, args) {
|
|
|
119
126
|
maxAmountUsd: Math.min(maximum, Math.max(0, ctx.config.dailyAmountUsd - spent)),
|
|
120
127
|
nativeUsdPrice: async () => {
|
|
121
128
|
// Independent public price, never the quote API's rate: Chainlink
|
|
122
|
-
// over the agent's own
|
|
123
|
-
// Coinbase, then CoinGecko. See ../native-price.ts.
|
|
124
|
-
const found = await
|
|
129
|
+
// over the agent's own RPC for the pay chain first (no extra
|
|
130
|
+
// host), then Coinbase, then CoinGecko. See ../native-price.ts.
|
|
131
|
+
const found = await independentNativeUsd({
|
|
125
132
|
fetchImpl: (input, init) => ctx.agent.inner.fetchImpl(input, init),
|
|
126
|
-
|
|
133
|
+
chain: pay,
|
|
134
|
+
rpc,
|
|
127
135
|
});
|
|
128
136
|
price = { usd: found.usd, observedAtMs: found.observedAtMs };
|
|
129
137
|
return price;
|
|
130
138
|
},
|
|
131
139
|
v14: {
|
|
132
|
-
|
|
140
|
+
chain: pay.name,
|
|
141
|
+
...(payAsset !== pay.native ? { asset: payAsset } : {}),
|
|
133
142
|
maxGasWei,
|
|
134
143
|
onPrepared: async (prepared) => {
|
|
135
144
|
if (state.pending)
|
|
136
145
|
throw new Error("A payment is already pending");
|
|
137
146
|
// A stablecoin batch is dollars already: the SDK bound the signed
|
|
138
147
|
// gross to the quoted USD amount exactly. Only a native batch
|
|
139
|
-
// needs the independent
|
|
148
|
+
// needs the independent native price.
|
|
140
149
|
let usd;
|
|
141
|
-
if (payAsset !==
|
|
150
|
+
if (payAsset !== pay.native) {
|
|
142
151
|
if (prepared.asset !== payAsset)
|
|
143
152
|
throw new Error("Prepared payment is not in the configured asset");
|
|
144
153
|
usd = Number(prepared.quote.amount);
|
|
@@ -226,21 +235,25 @@ export async function runPayableFetch(ctx, args) {
|
|
|
226
235
|
catch (error) {
|
|
227
236
|
if (error instanceof PaymentStateError)
|
|
228
237
|
return errorResult(error.message);
|
|
238
|
+
// Set before any payment step runs; the fallback only covers a throw from
|
|
239
|
+
// inside validation itself, which returns above.
|
|
240
|
+
const on = chain ?? payChain(undefined);
|
|
241
|
+
const label = on.label;
|
|
229
242
|
if (!state?.pending && error instanceof Aifp1SettlementUnsupportedError) {
|
|
230
|
-
return errorResult(
|
|
243
|
+
return errorResult(`The merchant must offer a signed native ${label} v1.4 quote (the chain set in AIFINPAY_PAY_CHAIN). Its current settlement route is unsupported; no legacy, other-chain or alternate-protocol payment was attempted.`);
|
|
231
244
|
}
|
|
232
245
|
if (!state?.pending && error instanceof Error && error.name === "V14SettlementError") {
|
|
233
246
|
const code = error.code;
|
|
234
247
|
const messages = {
|
|
235
|
-
V14_INSUFFICIENT_BALANCE:
|
|
236
|
-
V14_GAS_BUDGET_EXCEEDED:
|
|
248
|
+
V14_INSUFFICIENT_BALANCE: `The wallet needs enough ${on.native} on ${label} for the quoted purchase plus the owner-capped gas fee.`,
|
|
249
|
+
V14_GAS_BUDGET_EXCEEDED: `Estimated gas exceeds the owner's gas cap (AIFINPAY_MAX_GAS, in ${on.native}). The owner can review the limit; the agent cannot raise it.`,
|
|
237
250
|
V14_PAUSED: "The approved payment deployment is paused. No payment was sent.",
|
|
238
251
|
V14_EXPIRED: "The signed quote expired before submission. Request a fresh quote.",
|
|
239
252
|
V14_EXPIRING: "The signed quote expires too soon to submit safely. Request a fresh quote.",
|
|
240
253
|
V14_STALE_NONCE: "The signed quote uses a stale wallet nonce. Request a fresh quote.",
|
|
241
254
|
};
|
|
242
255
|
return errorResult(messages[code ?? ""] ??
|
|
243
|
-
|
|
256
|
+
`Payment verification refused this deployment, signer or quote. The merchant must offer a verified native ${label} v1.4 route; no fallback was attempted.`);
|
|
244
257
|
}
|
|
245
258
|
return errorResult(state?.pending
|
|
246
259
|
? `Payment pending (${state.pending.recovery.txRef}). Its private recovery journal is retained. Retry to recover the receipt; no replacement payment will be submitted. If submission never occurred or reverted, the owner must reconcile the journal.`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payable-fetch.js","sourceRoot":"","sources":["../../src/tools/payable-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,eAAe,EAA2B,MAAM,iBAAiB,CAAC;AAE5G,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAqB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,6EAA6E;AAC7E,iEAAiE;AACjE,MAAM,MAAM,GAAG,CAAC,OAAO,EAAE,UAAU,CAAU,CAAC;AAG9C,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,ubA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,MAAM,MAAM,CAAC,MAAM,EAAE,CAAC;gBACtB,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;YAC3E,CAAC;QACH,CAAC;IACH,CAAC;YAAS,CAAC;QACT,MAAM,CAAC,WAAW,EAAE,CAAC;IACvB,CAAC;AACH,CAAC;AACD,SAAS,WAAW,CAAC,OAAe;IAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACvE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aifinpay/mcp",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"mcpName": "io.github.daochild/aifinpay",
|
|
5
5
|
"description": "AiFinPay MCP: persistent agent wallets, discovery and owner-enabled verified native Polygon v1.4 payments with durable receipt recovery.",
|
|
6
6
|
"type": "module",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
},
|
|
77
77
|
"bugs": "https://github.com/AiFinPay/sdk/issues",
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@aifinpay/agent": "^2.
|
|
80
|
-
"@aifinpay/skill": "^2.
|
|
79
|
+
"@aifinpay/agent": "^2.3.0",
|
|
80
|
+
"@aifinpay/skill": "^2.6.0",
|
|
81
81
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
82
82
|
"bs58": "^6.0.0",
|
|
83
83
|
"tweetnacl": "^1.0.3"
|
package/skills/SKILL.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: aifinpay
|
|
3
|
-
description: Pay for x402-gated APIs and sites as an agent (AIFP-1 on Polygon,
|
|
3
|
+
description: Pay for x402-gated APIs and sites as an agent (AIFP-1 on Polygon or Base,
|
|
4
4
|
within owner-set limits) — including when the owner just says "buy access for
|
|
5
5
|
this site" — link the agent to its owner's AiFinPay dashboard, and read
|
|
6
6
|
wallet, payment history, prepaid quotas and Agent Passport records through
|
|
@@ -61,20 +61,20 @@ your language. There is no "install together" scenario.
|
|
|
61
61
|
|
|
62
62
|
## Version and release status
|
|
63
63
|
|
|
64
|
-
Released and current: MCP **2.
|
|
64
|
+
Released and current: MCP **2.5.0**, Node SDK **2.3.0**, Python **2.3.0**.
|
|
65
65
|
Payments are released — `payable_fetch` has shipped since MCP 2.2.0. An older
|
|
66
66
|
copy of this skill that calls MCP "read-only" or payments "release pending" is
|
|
67
67
|
out of date; follow this one. Install the `latest` release.
|
|
68
68
|
|
|
69
69
|
| Surface | Can it pay? |
|
|
70
70
|
|---|---|
|
|
71
|
-
| MCP `@aifinpay/mcp` 2.
|
|
72
|
-
| Node `@aifinpay/agent` 2.
|
|
73
|
-
| Python `aifinpay-agent` 2.
|
|
71
|
+
| MCP `@aifinpay/mcp` 2.5.x | Yes — `payable_fetch`, once the owner enables payments; on Polygon (POL) or, with `AIFINPAY_PAY_CHAIN=base`, on Base (ETH); USDC on either with `AIFINPAY_PAY_ASSET=USDC`; `scope: "merchant"` buys a whole site |
|
|
72
|
+
| Node `@aifinpay/agent` 2.3.x | Yes — `fetchPaid` with a v14 journal and gas cap; Polygon by default or `v14.chain: "base"`; native POL/ETH (with your own native/USD rate) or USDC (`v14.asset: "USDC"`) |
|
|
73
|
+
| Python `aifinpay-agent` 2.3.x | Yes — `agent.fetch_paid(url, allowed_origins=…, max_amount_usd=…, daily_amount_usd=…)`; Polygon by default or `chain="base"`; native POL/ETH (priced independently) or USDC (`asset="USDC"`); recover an unconfirmed payment with `agent.recover_paid(journal_path)` |
|
|
74
74
|
|
|
75
75
|
# AiFinPay agent workflow
|
|
76
76
|
|
|
77
|
-
Use the tools actually returned by MCP tools/list. MCP 2.
|
|
77
|
+
Use the tools actually returned by MCP tools/list. MCP 2.5.0 exposes
|
|
78
78
|
agent_address, agent_reload, agent_claim_self, agent_history, agent_quota,
|
|
79
79
|
agent_passport_resolve, settlement_routes, settlement_invoice and
|
|
80
80
|
deployment_info; `payable_fetch` appears when the owner has enabled payments.
|
|
@@ -154,7 +154,17 @@ fund its EVM address on Polygon with POL, or with USDC plus some POL. Funding a
|
|
|
154
154
|
unlimited spend authority. Use the owner's actual approved limits and origins,
|
|
155
155
|
then call `payable_fetch({"url":"https://merchant.example/api/data"})`.
|
|
156
156
|
|
|
157
|
-
|
|
157
|
+
To pay on **Base**, the owner sets `"AIFINPAY_PAY_CHAIN": "base"` and the gas
|
|
158
|
+
cap in ETH as `"AIFINPAY_MAX_GAS"` (e.g. `"0.0002"`; one settlement's worst
|
|
159
|
+
case including the L1 data fee is typically well under 0.0001 ETH).
|
|
160
|
+
`AIFINPAY_MAX_GAS_POL` is refused on Base rather than read as ETH. The wallet's
|
|
161
|
+
EVM address is the same on every chain: fund it with ETH **on Base**, not on
|
|
162
|
+
Ethereum mainnet. A merchant whose quote names another chain is refused, never
|
|
163
|
+
paid on a different chain; only the owner changes the chain. A payment pending
|
|
164
|
+
on one chain is recovered only with that chain configured.
|
|
165
|
+
|
|
166
|
+
It supports GET resources and AIFP-1 v1.4 payments on Polygon (POL or USDC) and
|
|
167
|
+
Base (ETH or USDC). It verifies
|
|
158
168
|
the quote, price, deployment, signer and receipt, saves the transaction before
|
|
159
169
|
broadcasting, and reuses the purchased batch. No custom merchant script is
|
|
160
170
|
needed. Other protocol/version/asset paths fail closed.
|
|
@@ -166,16 +176,18 @@ owner reconciliation. Raw transactions and receipt JWTs remain private.
|
|
|
166
176
|
|
|
167
177
|
### Network access
|
|
168
178
|
|
|
169
|
-
In a sandbox that allowlists outbound hosts, allow `api.aifinpay.io` and
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
179
|
+
In a sandbox that allowlists outbound hosts, allow `api.aifinpay.io` and an RPC
|
|
180
|
+
for the pay chain (Polygon, or Base: `mainnet.base.org` unless the owner set
|
|
181
|
+
`AIFINPAY_RPC_URL`). USDC payments need nothing else. For the independent
|
|
182
|
+
native/USD check MCP reads Chainlink on the pay chain over that RPC (POL/USD on
|
|
183
|
+
Polygon since 2.3.0, ETH/USD on Base since 2.5.0), then `api.coinbase.com`, then
|
|
184
|
+
`api.coingecko.com` — one is enough. (MCP 2.2.3 used only `api.coinbase.com`.) If no rate is available,
|
|
174
185
|
`payable_fetch` stops before paying and nothing is spent; tell the owner which
|
|
175
186
|
hosts to allow rather than inventing a workaround. With the Node SDK, pass your
|
|
176
187
|
own `nativeUsdPrice`: Chainlink POL/USD on Polygon, Coinbase `POL-USD`, or
|
|
177
188
|
CoinGecko `polygon-ecosystem-token` (never `matic-network`, frozen since
|
|
178
|
-
February 2026)
|
|
189
|
+
February 2026); on Base, ETH/USD from Chainlink on Base, Coinbase `ETH-USD` or
|
|
190
|
+
CoinGecko `ethereum`.
|
|
179
191
|
|
|
180
192
|
## After creating a wallet: link it to the owner's dashboard
|
|
181
193
|
|
|
@@ -254,7 +266,7 @@ Use agent_history. Do not guess /v1/history, /v1/payments or /v1/wallet/tx.
|
|
|
254
266
|
Canonical AIFP-1 economics are gross-inclusive: the agent pays the quoted
|
|
255
267
|
price, AiFinPay takes **1 %** (100 bps) from it, and the merchant receives
|
|
256
268
|
**99 %**. No fixed fee is implied. AIFP-1 settles live
|
|
257
|
-
on Polygon (splitter v1.4); Solana settlement is disabled. The smallest batch is
|
|
269
|
+
on Polygon and Base (splitter v1.4); Solana settlement is disabled. The smallest batch is
|
|
258
270
|
$0.10 plus gas.
|
|
259
271
|
|
|
260
272
|
(The older "98.99 / 1 / 0.01" figure was the v1.2 fee-on-top model.)
|
|
@@ -413,7 +425,7 @@ terminal for that request: do not lower units below the server minimum, edit
|
|
|
413
425
|
quotes, or construct a manual nonce, receipt or transaction workaround.
|
|
414
426
|
|
|
415
427
|
This dev quote tool never broadcasts. The new low-level SDK executor supports
|
|
416
|
-
native Amoy v1.4, while MCP/fetchPaid receipt purchases
|
|
428
|
+
native Amoy v1.4, while MCP/fetchPaid receipt purchases are live on Polygon and Base only.
|
|
417
429
|
A full paid testnet receipt flow is not yet claimed. A prepaid batch means one settlement funding
|
|
418
430
|
multiple API calls, not an arbitrary batch of on-chain transfers.
|
|
419
431
|
|
package/smithery.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
name: aifinpay
|
|
2
2
|
displayName: AiFinPay
|
|
3
|
-
description:
|
|
4
|
-
version: 2.
|
|
3
|
+
description: Payment infrastructure for AI agents. A persistent non-custodial agent wallet, Agent Passport resolution, route discovery and non-signing settlement invoices; with owner-set limits, payable_fetch buys prepaid access to AIFP-1 merchants on Polygon or Base, in POL/ETH or a pinned stablecoin.
|
|
4
|
+
version: 2.5.0
|
|
5
5
|
license: MIT
|
|
6
6
|
homepage: https://aifinpay.io
|
|
7
7
|
repository: https://github.com/AiFinPay/sdk
|
|
@@ -19,19 +19,11 @@ categories:
|
|
|
19
19
|
tags:
|
|
20
20
|
- payments
|
|
21
21
|
- ai-agents
|
|
22
|
-
-
|
|
22
|
+
- payment-infrastructure
|
|
23
|
+
- aifp-1
|
|
23
24
|
- polygon
|
|
24
|
-
- solana
|
|
25
|
-
- avalanche
|
|
26
|
-
- arbitrum
|
|
27
|
-
- bnb
|
|
28
|
-
- base
|
|
29
|
-
- unichain
|
|
30
|
-
- optimism
|
|
31
25
|
- stablecoins
|
|
32
26
|
- usdc
|
|
33
|
-
- usdt
|
|
34
|
-
- stripe-for-ai
|
|
35
27
|
- non-custodial
|
|
36
28
|
- agent-passport
|
|
37
29
|
- settlement
|
|
@@ -63,47 +55,77 @@ configSchema:
|
|
|
63
55
|
AIFINPAY_AGENT_SECRET:
|
|
64
56
|
type: string
|
|
65
57
|
title: Agent secret (base58)
|
|
66
|
-
description: Legacy Ed25519 secret for the agent identity.
|
|
67
|
-
AIFINPAY_MAX_USD:
|
|
68
|
-
type: string
|
|
69
|
-
title: Max USD per call
|
|
70
|
-
description: Hard cap per paid call. Refuses to settle anything above this. Does not enable signing.
|
|
71
|
-
default: "0.10"
|
|
72
|
-
AIFINPAY_BASE_URL:
|
|
73
|
-
type: string
|
|
74
|
-
title: API base URL
|
|
75
|
-
description: Override the AiFinPay backend endpoint.
|
|
76
|
-
default: https://aifinpay.io
|
|
77
|
-
AIFINPAY_TIMEOUT_MS:
|
|
78
|
-
type: string
|
|
79
|
-
title: Request timeout (ms)
|
|
80
|
-
description: SDK request timeout in milliseconds.
|
|
81
|
-
default: "30000"
|
|
82
|
-
AIFINPAY_MODE:
|
|
83
|
-
type: string
|
|
84
|
-
title: Runtime mode
|
|
85
|
-
description: Set to "dev" to expose dev_payment_quote tool. Requires a separate dev backend URL.
|
|
58
|
+
description: Legacy Ed25519 secret for the agent identity. The Solana, EVM and Casper addresses derive deterministically from it. With no wallet source the server uses an ephemeral identity that must not be funded. Signing happens locally inside the MCP process; the secret is never transmitted to AiFinPay servers.
|
|
86
59
|
AIFINPAY_HOME:
|
|
87
60
|
type: string
|
|
88
61
|
title: Wallet home directory
|
|
89
|
-
description: Directory of the
|
|
62
|
+
description: Directory of the agent.json keystore written by `npx @aifinpay/mcp init` (default ~/.aifinpay).
|
|
90
63
|
AIFINPAY_WALLET_PASSPHRASE:
|
|
91
64
|
type: string
|
|
92
65
|
title: Wallet passphrase
|
|
93
|
-
description: Passphrase for encrypted
|
|
66
|
+
description: Passphrase for an encrypted agent.json keystore. Without it an encrypted keystore cannot be opened and the server does not start.
|
|
67
|
+
AIFINPAY_PAYMENTS_ENABLED:
|
|
68
|
+
type: string
|
|
69
|
+
title: Enable payments
|
|
70
|
+
description: Set to "1" to register payable_fetch. Requires a persistent wallet and AIFINPAY_MAX_USD, AIFINPAY_DAILY_USD, AIFINPAY_GATEWAY_ORIGINS and a gas cap (AIFINPAY_MAX_GAS, or AIFINPAY_MAX_GAS_POL on Polygon); the server refuses to start if any is missing. Unset or "0" keeps the server read-only.
|
|
71
|
+
AIFINPAY_MAX_USD:
|
|
72
|
+
type: string
|
|
73
|
+
title: Max USD per payment
|
|
74
|
+
description: Per-payment cap for payable_fetch. Required when payments are enabled; there is no default. A tool argument can lower it for one call, never raise it.
|
|
75
|
+
AIFINPAY_DAILY_USD:
|
|
76
|
+
type: string
|
|
77
|
+
title: Max USD per 24 hours
|
|
78
|
+
description: Rolling 24-hour spending cap for payable_fetch. Required when payments are enabled.
|
|
94
79
|
AIFINPAY_GATEWAY_ORIGINS:
|
|
95
80
|
type: string
|
|
96
|
-
title:
|
|
97
|
-
description: Comma-separated exact HTTPS origins
|
|
81
|
+
title: Payable origins
|
|
82
|
+
description: Comma-separated exact HTTPS origins the agent may pay (no wildcards). Required when payments are enabled.
|
|
98
83
|
AIFINPAY_GATEWAY_PATH_MODE:
|
|
99
84
|
type: string
|
|
100
85
|
title: Gateway path mode
|
|
101
86
|
description: "Use gateway for merchant-slug identity or direct for full request-path identity."
|
|
102
87
|
default: gateway
|
|
88
|
+
AIFINPAY_PAY_CHAIN:
|
|
89
|
+
type: string
|
|
90
|
+
title: Payment chain
|
|
91
|
+
description: '"polygon" (default) or "base". Set by the owner; a quote for any other chain is refused.'
|
|
92
|
+
AIFINPAY_MAX_GAS:
|
|
93
|
+
type: string
|
|
94
|
+
title: Gas cap (native)
|
|
95
|
+
description: Gas cap per payment in the payment chain's native currency, for example "0.3" POL on Polygon or "0.0002" ETH on Base. Required when payments are enabled (or AIFINPAY_MAX_GAS_POL on Polygon).
|
|
96
|
+
AIFINPAY_MAX_GAS_POL:
|
|
97
|
+
type: string
|
|
98
|
+
title: Gas cap (POL, Polygon only)
|
|
99
|
+
description: The gas cap under its original name, in POL. Accepted on Polygon; refused on Base rather than read as ETH.
|
|
100
|
+
AIFINPAY_PAY_ASSET:
|
|
101
|
+
type: string
|
|
102
|
+
title: Payment asset
|
|
103
|
+
description: The chain's native currency (default; POL or ETH) or a stablecoin the SDK pins for that chain, such as "USDC". Gas is paid in the native currency either way.
|
|
104
|
+
AIFINPAY_RPC_URL:
|
|
105
|
+
type: string
|
|
106
|
+
title: RPC for the payment chain
|
|
107
|
+
description: Optional HTTPS RPC for the payment chain; defaults to its public RPC.
|
|
108
|
+
AIFINPAY_BASE_URL:
|
|
109
|
+
type: string
|
|
110
|
+
title: API base URL
|
|
111
|
+
description: Override the AiFinPay backend. Unset, read-only tools use https://aifinpay.io and payable_fetch quotes and receipts use https://api.aifinpay.io.
|
|
112
|
+
AIFINPAY_TIMEOUT_MS:
|
|
113
|
+
type: string
|
|
114
|
+
title: Request timeout (ms)
|
|
115
|
+
description: SDK request timeout in milliseconds.
|
|
116
|
+
default: "30000"
|
|
117
|
+
AIFINPAY_MODE:
|
|
118
|
+
type: string
|
|
119
|
+
title: Runtime mode
|
|
120
|
+
description: '"live" (default) or "dev". Dev exposes dev_payment_quote, needs a non-production AIFINPAY_BASE_URL and cannot be combined with payments.'
|
|
103
121
|
AIFINPAY_TRUSTED_HOSTS:
|
|
104
122
|
type: string
|
|
105
123
|
title: Trusted hosts
|
|
106
|
-
description: Exact hosts allowed to
|
|
124
|
+
description: Exact hosts allowed to skip the DNS pre-check, for environments that resolve only through a proxy.
|
|
125
|
+
AIFINPAY_CLAIM_ORIGINS:
|
|
126
|
+
type: string
|
|
127
|
+
title: Claim origins
|
|
128
|
+
description: Comma-separated origins agent_claim_self may contact. Defaults to the aifinpay.io dashboard and API origins; override only for staging.
|
|
107
129
|
AIFINPAY_ALLOW_PRIVATE_FETCH:
|
|
108
130
|
type: string
|
|
109
131
|
title: Allow private fetch
|
|
@@ -112,9 +134,13 @@ configSchema:
|
|
|
112
134
|
|
|
113
135
|
tools:
|
|
114
136
|
- name: agent_address
|
|
115
|
-
description: Return the agent's on-chain identities (Solana, EVM and Casper) derived from the configured
|
|
137
|
+
description: Return the agent's on-chain identities (Solana, EVM and Casper) derived from the configured wallet. Read-only.
|
|
116
138
|
- name: agent_reload
|
|
117
139
|
description: Reload the configured local wallet files after init or a file update, without starting a new conversation. Returns public addresses only.
|
|
140
|
+
- name: agent_claim_self
|
|
141
|
+
description: Link the agent to its owner's AiFinPay dashboard with a one-time URL from dash.aifinpay.io. Signs only an AiFinPay claim challenge for the agent's own address; moves no funds.
|
|
142
|
+
- name: payable_fetch
|
|
143
|
+
description: Registered only when the owner enables payments. Fetches a GET resource from an owner-approved AIFP-1 merchant, buys a prepaid batch through verified Polygon v1.4 within the owner's limits, and reuses its receipt. scope "merchant" buys one batch for the whole site.
|
|
118
144
|
- name: agent_quota
|
|
119
145
|
description: How many prepaid requests this agent has left, per service. Lists active quota batches (merchant, resource, used, remaining, expiry). Read-only.
|
|
120
146
|
- name: agent_history
|
|
@@ -122,9 +148,15 @@ tools:
|
|
|
122
148
|
- name: agent_passport_resolve
|
|
123
149
|
description: Resolve an AiFinPay Agent Passport by @username, permanent AIFP number, or immutable agent id. Returns verified public wallet bindings only.
|
|
124
150
|
- name: settlement_routes
|
|
125
|
-
description: Read AiFinPay's
|
|
151
|
+
description: Read AiFinPay's runtime-verified settlement routes. AIFP-1 is merchant monetisation (99% merchant / 1% AiFinPay / 0% creator). AIFP-2/x402 is 100% provider.
|
|
126
152
|
- name: settlement_invoice
|
|
127
|
-
description: Build and validate a non-signing
|
|
153
|
+
description: Build and validate a non-signing EVM settlement invoice. This tool never moves funds.
|
|
154
|
+
- name: settlement_solana
|
|
155
|
+
description: Build and validate a non-signing Solana settlement invoice. This tool never moves funds.
|
|
156
|
+
- name: settlement_casper
|
|
157
|
+
description: Build and validate a non-signing Casper settlement invoice. This tool never moves funds.
|
|
158
|
+
- name: deployment_info
|
|
159
|
+
description: AiFinPay deployment details across EVM, Solana and Casper — addresses, stablecoins, program IDs and settlement status. Read-only.
|
|
128
160
|
|
|
129
161
|
live_evidence:
|
|
130
162
|
- chain: polygon
|