@aifinpay/mcp 2.0.0-rc.5 → 2.1.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/LICENSE +21 -0
- package/README.md +117 -64
- package/bin/aifinpay-mcp.js +115 -67
- package/dist/api.d.ts +2 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +6 -0
- package/dist/api.js.map +1 -0
- package/dist/config.d.ts +11 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +27 -11
- package/dist/config.js.map +1 -1
- package/dist/identity.d.ts +9 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +81 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +3 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -6
- package/dist/index.js.map +1 -1
- package/dist/safe-fetch.d.ts.map +1 -1
- package/dist/safe-fetch.js +73 -19
- package/dist/safe-fetch.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +108 -22
- package/dist/server.js.map +1 -1
- package/dist/tools/agent-address.d.ts.map +1 -1
- package/dist/tools/agent-address.js +5 -4
- package/dist/tools/agent-address.js.map +1 -1
- package/dist/tools/{payable-fetch.d.ts → agent-history.d.ts} +21 -23
- package/dist/tools/agent-history.d.ts.map +1 -0
- package/dist/tools/agent-history.js +141 -0
- package/dist/tools/agent-history.js.map +1 -0
- package/dist/tools/agent-quota.d.ts.map +1 -1
- package/dist/tools/agent-quota.js +3 -1
- package/dist/tools/agent-quota.js.map +1 -1
- package/dist/tools/{agent-quote.d.ts → dev-payment-quote.d.ts} +10 -12
- package/dist/tools/dev-payment-quote.d.ts.map +1 -0
- package/dist/tools/dev-payment-quote.js +80 -0
- package/dist/tools/dev-payment-quote.js.map +1 -0
- package/dist/tools/production-control.d.ts +104 -0
- package/dist/tools/production-control.d.ts.map +1 -1
- package/dist/tools/production-control.js +177 -14
- package/dist/tools/production-control.js.map +1 -1
- package/dist/tools/supported-chains.d.ts +38 -0
- package/dist/tools/supported-chains.d.ts.map +1 -0
- package/dist/tools/supported-chains.js +132 -0
- package/dist/tools/supported-chains.js.map +1 -0
- package/package.json +28 -6
- package/skills/SKILL.md +271 -0
- package/smithery.yaml +137 -0
- package/dist/directory.d.ts +0 -55
- package/dist/directory.d.ts.map +0 -1
- package/dist/directory.js +0 -56
- package/dist/directory.js.map +0 -1
- package/dist/tools/agent-call.d.ts +0 -68
- package/dist/tools/agent-call.d.ts.map +0 -1
- package/dist/tools/agent-call.js +0 -129
- package/dist/tools/agent-call.js.map +0 -1
- package/dist/tools/agent-claim-self.d.ts +0 -66
- package/dist/tools/agent-claim-self.d.ts.map +0 -1
- package/dist/tools/agent-claim-self.js +0 -299
- package/dist/tools/agent-claim-self.js.map +0 -1
- package/dist/tools/agent-quote.d.ts.map +0 -1
- package/dist/tools/agent-quote.js +0 -81
- package/dist/tools/agent-quote.js.map +0 -1
- package/dist/tools/pay-with-split.d.ts +0 -93
- package/dist/tools/pay-with-split.d.ts.map +0 -1
- package/dist/tools/pay-with-split.js +0 -138
- package/dist/tools/pay-with-split.js.map +0 -1
- package/dist/tools/payable-fetch.d.ts.map +0 -1
- package/dist/tools/payable-fetch.js +0 -135
- package/dist/tools/payable-fetch.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-address.d.ts","sourceRoot":"","sources":["../../src/tools/agent-address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"agent-address.d.ts","sourceRoot":"","sources":["../../src/tools/agent-address.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8B/B;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;GAWrF"}
|
|
@@ -13,7 +13,10 @@ export function agentAddressTool() {
|
|
|
13
13
|
type: "object",
|
|
14
14
|
properties: {
|
|
15
15
|
solana: { type: "string", description: "Solana base58 address" },
|
|
16
|
-
evm: {
|
|
16
|
+
evm: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "EVM address used across EVM networks (Polygon, Base, Arbitrum, Optimism, BNB, Unichain, Avalanche, Robinhood, etc.)",
|
|
19
|
+
},
|
|
17
20
|
casper: {
|
|
18
21
|
type: "string",
|
|
19
22
|
description: "Casper identity derived from the same seed. Read-only in this MCP RC; no payment signing tool is exposed.",
|
|
@@ -32,9 +35,7 @@ export async function runAgentAddress(ctx, _args) {
|
|
|
32
35
|
note: "Read-only address discovery. Payment signing is intentionally absent from this MCP production RC until the final SDK v2 release contains independently trusted deployment pins and paid E2E evidence.",
|
|
33
36
|
};
|
|
34
37
|
return {
|
|
35
|
-
content: [
|
|
36
|
-
{ type: "text", text: JSON.stringify(payload, null, 2) },
|
|
37
|
-
],
|
|
38
|
+
content: [{ type: "text", text: JSON.stringify(payload, null, 2) }],
|
|
38
39
|
structuredContent: payload,
|
|
39
40
|
};
|
|
40
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-address.js","sourceRoot":"","sources":["../../src/tools/agent-address.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,2DAA2D;YAC3D,kEAAkE;YAClE,yIAAyI;QAC3I,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;QACD,WAAW,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,eAAe,EAAE,K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;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QACnE,iBAAiB,EAAE,OAAO;KAC3B,CAAC;AACJ,CAAC"}
|
|
@@ -1,51 +1,49 @@
|
|
|
1
1
|
import type { ToolContext } from "../server.js";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function agentHistoryTool(): {
|
|
3
3
|
name: string;
|
|
4
4
|
description: string;
|
|
5
5
|
inputSchema: {
|
|
6
6
|
type: string;
|
|
7
|
+
additionalProperties: boolean;
|
|
7
8
|
properties: {
|
|
8
|
-
|
|
9
|
+
address: {
|
|
9
10
|
type: string;
|
|
10
|
-
description: string;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
passport: {
|
|
13
13
|
type: string;
|
|
14
|
-
|
|
15
|
-
default: string;
|
|
14
|
+
description: string;
|
|
16
15
|
};
|
|
17
|
-
|
|
16
|
+
network: {
|
|
18
17
|
type: string;
|
|
18
|
+
default: string;
|
|
19
19
|
description: string;
|
|
20
20
|
};
|
|
21
|
-
|
|
21
|
+
source: {
|
|
22
22
|
type: string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
};
|
|
26
|
-
description: string;
|
|
23
|
+
enum: string[];
|
|
24
|
+
default: string;
|
|
27
25
|
};
|
|
28
|
-
|
|
26
|
+
limit: {
|
|
29
27
|
type: string;
|
|
30
|
-
|
|
28
|
+
minimum: number;
|
|
29
|
+
maximum: number;
|
|
30
|
+
default: number;
|
|
31
31
|
};
|
|
32
|
-
|
|
32
|
+
offset: {
|
|
33
33
|
type: string;
|
|
34
|
-
|
|
34
|
+
minimum: number;
|
|
35
|
+
maximum: number;
|
|
36
|
+
default: number;
|
|
35
37
|
};
|
|
36
38
|
};
|
|
37
|
-
required: string[];
|
|
38
39
|
};
|
|
39
40
|
annotations: {
|
|
40
41
|
readOnlyHint: boolean;
|
|
41
|
-
openWorldHint: boolean;
|
|
42
42
|
destructiveHint: boolean;
|
|
43
|
-
|
|
44
|
-
outputSchema: {
|
|
45
|
-
type: string;
|
|
43
|
+
openWorldHint: boolean;
|
|
46
44
|
};
|
|
47
45
|
};
|
|
48
|
-
export declare function
|
|
46
|
+
export declare function runAgentHistory(ctx: ToolContext, args: Record<string, unknown>): Promise<{
|
|
49
47
|
isError: boolean;
|
|
50
48
|
content: {
|
|
51
49
|
type: string;
|
|
@@ -57,4 +55,4 @@ export declare function runPayableFetch(ctx: ToolContext, args: Record<string, u
|
|
|
57
55
|
text: string;
|
|
58
56
|
}[];
|
|
59
57
|
}>;
|
|
60
|
-
//# sourceMappingURL=
|
|
58
|
+
//# sourceMappingURL=agent-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-history.d.ts","sourceRoot":"","sources":["../../src/tools/agent-history.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0B/B;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;GA2HpF"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { apiUrl } from "../api.js";
|
|
2
|
+
export function agentHistoryTool() {
|
|
3
|
+
return {
|
|
4
|
+
name: "agent_history",
|
|
5
|
+
description: "Read an agent's payment history by EVM address, public passport identifier, or both. Defaults to the current wallet. Transactions are indexed AiFinPay Polygon settlements, not arbitrary wallet transfers. Receipts include retained prepaid batches and test payments. Never pass a seed, private key or API secret as a passport.",
|
|
6
|
+
inputSchema: {
|
|
7
|
+
type: "object",
|
|
8
|
+
additionalProperties: false,
|
|
9
|
+
properties: {
|
|
10
|
+
address: { type: "string" },
|
|
11
|
+
passport: {
|
|
12
|
+
type: "string",
|
|
13
|
+
description: "Public @username, AIFP-… number or aifp_agent_… identifier",
|
|
14
|
+
},
|
|
15
|
+
network: {
|
|
16
|
+
type: "string",
|
|
17
|
+
default: "polygon",
|
|
18
|
+
description: "Exact passport wallet network; indexed transactions currently support polygon only",
|
|
19
|
+
},
|
|
20
|
+
source: { type: "string", enum: ["transactions", "receipts"], default: "transactions" },
|
|
21
|
+
limit: { type: "integer", minimum: 1, maximum: 100, default: 25 },
|
|
22
|
+
offset: { type: "integer", minimum: 0, maximum: 100000, default: 0 },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
annotations: { readOnlyHint: true, destructiveHint: false, openWorldHint: false },
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export async function runAgentHistory(ctx, args) {
|
|
29
|
+
const base = ctx.config.baseUrl || "https://aifinpay.io";
|
|
30
|
+
const source = args.source ?? "transactions", network = args.network ?? "polygon";
|
|
31
|
+
const limit = args.limit ?? 25, offset = args.offset ?? 0;
|
|
32
|
+
const failure = (message) => ({
|
|
33
|
+
isError: true,
|
|
34
|
+
content: [{ type: "text", text: message }],
|
|
35
|
+
});
|
|
36
|
+
if (!Number.isSafeInteger(limit) ||
|
|
37
|
+
Number(limit) < 1 ||
|
|
38
|
+
Number(limit) > 100 ||
|
|
39
|
+
!Number.isSafeInteger(offset) ||
|
|
40
|
+
Number(offset) < 0 ||
|
|
41
|
+
Number(offset) > 100000)
|
|
42
|
+
return failure("Invalid history pagination");
|
|
43
|
+
if (source !== "receipts" && source !== "transactions")
|
|
44
|
+
return failure("Unknown history source");
|
|
45
|
+
async function get(path) {
|
|
46
|
+
const response = await ctx.agent.inner.fetchImpl(apiUrl(base, path), {
|
|
47
|
+
headers: { accept: "application/json" },
|
|
48
|
+
});
|
|
49
|
+
if (!response.ok)
|
|
50
|
+
throw new Error(`HTTP ${response.status} from history/resolver; passport resolution requires a deployed Agent Passport backend`);
|
|
51
|
+
return (await response.json());
|
|
52
|
+
}
|
|
53
|
+
try {
|
|
54
|
+
let address = args.address == null ? undefined : String(args.address);
|
|
55
|
+
if (args.passport) {
|
|
56
|
+
const identifier = String(args.passport).trim();
|
|
57
|
+
if (!/^(@[a-z][a-z0-9_]{2,31}|AIFP-\d{1,18}|aifp_agent_[0-9a-f]{32})$/i.test(identifier)) {
|
|
58
|
+
return failure("passport must be a public @username, AIFP number or aifp_agent_* id; never a secret");
|
|
59
|
+
}
|
|
60
|
+
const resolved = await get(`/api/agent/resolve/${encodeURIComponent(identifier)}`);
|
|
61
|
+
if (resolved?.agent?.status !== "active" || !Array.isArray(resolved.agent.wallets))
|
|
62
|
+
throw new Error("Passport is not active or has no verified wallets");
|
|
63
|
+
const wallets = resolved.agent.wallets.filter((w) => w.network === network && w.chain_family === "evm" && Number(w.verified_at) > 0);
|
|
64
|
+
const wallet = wallets.find((w) => w.is_primary) || wallets[0];
|
|
65
|
+
if (!wallet || typeof wallet.address !== "string")
|
|
66
|
+
throw new Error("Passport has no verified EVM wallet on the requested network");
|
|
67
|
+
if (address && address.toLowerCase() !== wallet.address.toLowerCase())
|
|
68
|
+
throw new Error("Address does not match passport wallet");
|
|
69
|
+
address = wallet.address;
|
|
70
|
+
}
|
|
71
|
+
address ??= ctx.agent.evmAddress;
|
|
72
|
+
if (!/^0x[0-9a-fA-F]{40}$/.test(address))
|
|
73
|
+
return failure("Expected an EVM address");
|
|
74
|
+
const query = new URLSearchParams({ limit: String(limit), offset: String(offset) });
|
|
75
|
+
if (source === "transactions")
|
|
76
|
+
query.set("chain", String(network));
|
|
77
|
+
const body = await get(`/v1/agents/${address.toLowerCase()}/${source}?${query}`);
|
|
78
|
+
if (!Array.isArray(body?.[source]))
|
|
79
|
+
throw new Error("Invalid history response");
|
|
80
|
+
const fields = source === "receipts"
|
|
81
|
+
? [
|
|
82
|
+
"receipt_id",
|
|
83
|
+
"merchant_id",
|
|
84
|
+
"resource",
|
|
85
|
+
"scope",
|
|
86
|
+
"tier",
|
|
87
|
+
"quota",
|
|
88
|
+
"used",
|
|
89
|
+
"remaining",
|
|
90
|
+
"amount",
|
|
91
|
+
"currency",
|
|
92
|
+
"exp",
|
|
93
|
+
"chain",
|
|
94
|
+
"tx_ref",
|
|
95
|
+
"payer",
|
|
96
|
+
"network_mode",
|
|
97
|
+
"settled_at",
|
|
98
|
+
"expires_at",
|
|
99
|
+
"unit_quota",
|
|
100
|
+
"metering_version",
|
|
101
|
+
]
|
|
102
|
+
: [
|
|
103
|
+
"tx_hash",
|
|
104
|
+
"log_index",
|
|
105
|
+
"chain",
|
|
106
|
+
"payment_id",
|
|
107
|
+
"block_number",
|
|
108
|
+
"block_ts",
|
|
109
|
+
"agent_address",
|
|
110
|
+
"merchant_address",
|
|
111
|
+
"token_address",
|
|
112
|
+
"total_amount",
|
|
113
|
+
"merchant_amount",
|
|
114
|
+
"treasury_fee",
|
|
115
|
+
"ip_creator_fee",
|
|
116
|
+
];
|
|
117
|
+
const items = body[source].map((row) => Object.fromEntries(fields.filter((f) => row?.[f] !== undefined).map((f) => [f, row[f]])));
|
|
118
|
+
return {
|
|
119
|
+
content: [
|
|
120
|
+
{
|
|
121
|
+
type: "text",
|
|
122
|
+
text: JSON.stringify({
|
|
123
|
+
address: address.toLowerCase(),
|
|
124
|
+
source,
|
|
125
|
+
items,
|
|
126
|
+
limit,
|
|
127
|
+
offset,
|
|
128
|
+
next_offset: typeof body.next_offset === "number" ? body.next_offset : null,
|
|
129
|
+
coverage: source === "receipts"
|
|
130
|
+
? "Retained receipts only; externally metered quotas may lag"
|
|
131
|
+
: "Indexed AiFinPay Polygon settlements only; excludes arbitrary wallet transfers and may lag the chain",
|
|
132
|
+
}, null, 2),
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
catch (error) {
|
|
138
|
+
return failure(`History lookup failed: ${error.message}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=agent-history.js.map
|
|
@@ -0,0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B;aACjB,CAAC;QACR,MAAM,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAC1C,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CACzF,CAAC;QACF,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE;wBAC9B,MAAM;wBACN,KAAK;wBACL,KAAK;wBACL,MAAM;wBACN,WAAW,EAAE,OAAO,IAAI,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI;wBAC3E,QAAQ,EACN,MAAM,KAAK,UAAU;4BACnB,CAAC,CAAC,2DAA2D;4BAC7D,CAAC,CAAC,sGAAsG;qBAC7G,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,OAAO,CAAC,0BAA2B,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-quota.d.ts","sourceRoot":"","sources":["../../src/tools/agent-quota.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"agent-quota.d.ts","sourceRoot":"","sources":["../../src/tools/agent-quota.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,wBAAgB,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;EA0B7B;AAiBD,wBAAsB,aAAa,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;GAqElF"}
|
|
@@ -32,7 +32,9 @@ export async function runAgentQuota(ctx, args) {
|
|
|
32
32
|
const includeExhausted = args.include_exhausted === true;
|
|
33
33
|
let resp;
|
|
34
34
|
try {
|
|
35
|
-
resp = await ctx.agent.inner.fetchImpl(`${base}/v1/agents/${address}/receipts`, {
|
|
35
|
+
resp = await ctx.agent.inner.fetchImpl(`${base}/v1/agents/${address}/receipts`, {
|
|
36
|
+
method: "GET",
|
|
37
|
+
});
|
|
36
38
|
}
|
|
37
39
|
catch (e) {
|
|
38
40
|
const err = e;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-quota.js","sourceRoot":"","sources":["../../src/tools/agent-quota.ts"],"names":[],"mappings":"AAuBA,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAE/C,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,wEAAwE;YACxE,qEAAqE;YACrE,oEAAoE;YACpE,uDAAuD;QACzD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,
|
|
1
|
+
{"version":3,"file":"agent-quota.js","sourceRoot":"","sources":["../../src/tools/agent-quota.ts"],"names":[],"mappings":"AAuBA,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAE/C,MAAM,UAAU,cAAc;IAC5B,OAAO;QACL,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,wEAAwE;YACxE,qEAAqE;YACrE,oEAAoE;YACpE,u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AC,CAAC,sBAAsB,cAAc,8EAA8E;gBACpH,CAAC,CAAC,iEAAiE;YACrE,CAAC,CAAC,6KAA6K;KACpL,CAAC;IAEF,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KACpE,CAAC;AACJ,CAAC;AAED,SAAS,WAAW,CAAC,GAAG,KAAe;IACrC,OAAO;QACL,OAAO,EAAE,IAAI;QACb,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;KACpD,CAAC;AACJ,CAAC"}
|
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
import type { ToolContext } from "../server.js";
|
|
2
|
-
export declare function
|
|
2
|
+
export declare function devPaymentQuoteTool(): {
|
|
3
3
|
name: string;
|
|
4
4
|
description: string;
|
|
5
5
|
inputSchema: {
|
|
6
6
|
type: string;
|
|
7
|
+
additionalProperties: boolean;
|
|
7
8
|
properties: {
|
|
8
|
-
|
|
9
|
+
contract_version: {
|
|
9
10
|
type: string;
|
|
10
|
-
|
|
11
|
+
enum: string[];
|
|
11
12
|
};
|
|
12
|
-
|
|
13
|
+
units: {
|
|
13
14
|
type: string;
|
|
14
|
-
|
|
15
|
-
default:
|
|
15
|
+
minimum: number;
|
|
16
|
+
default: number;
|
|
16
17
|
};
|
|
17
18
|
};
|
|
18
19
|
required: string[];
|
|
19
20
|
};
|
|
20
21
|
annotations: {
|
|
21
22
|
readOnlyHint: boolean;
|
|
22
|
-
openWorldHint: boolean;
|
|
23
23
|
destructiveHint: boolean;
|
|
24
|
-
|
|
25
|
-
outputSchema: {
|
|
26
|
-
type: string;
|
|
24
|
+
openWorldHint: boolean;
|
|
27
25
|
};
|
|
28
26
|
};
|
|
29
|
-
export declare function
|
|
27
|
+
export declare function runDevPaymentQuote(ctx: ToolContext, args: Record<string, unknown>): Promise<{
|
|
30
28
|
isError: boolean;
|
|
31
29
|
content: {
|
|
32
30
|
type: string;
|
|
@@ -38,4 +36,4 @@ export declare function runAgentQuote(ctx: ToolContext, args: Record<string, unk
|
|
|
38
36
|
text: string;
|
|
39
37
|
}[];
|
|
40
38
|
}>;
|
|
41
|
-
//# sourceMappingURL=
|
|
39
|
+
//# sourceMappingURL=dev-payment-quote.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-payment-quote.d.ts","sourceRoot":"","sources":["../../src/tools/dev-payment-quote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;EAgBlC;AAED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;GAmEvF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export function devPaymentQuoteTool() {
|
|
2
|
+
return {
|
|
3
|
+
name: "dev_payment_quote",
|
|
4
|
+
description: "Inspect the dev paid-content challenge and quote a prepaid batch on Amoy. Checks the requested contract version against the deployed quote. Never signs or broadcasts; a version mismatch is an error, not permission to relabel a contract.",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object",
|
|
7
|
+
additionalProperties: false,
|
|
8
|
+
properties: {
|
|
9
|
+
contract_version: { type: "string", enum: ["1.2", "1.4"] },
|
|
10
|
+
units: { type: "integer", minimum: 1, default: 1000 },
|
|
11
|
+
},
|
|
12
|
+
required: ["contract_version"],
|
|
13
|
+
},
|
|
14
|
+
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export async function runDevPaymentQuote(ctx, args) {
|
|
18
|
+
const fail = (text) => ({ isError: true, content: [{ type: "text", text }] });
|
|
19
|
+
const version = args.contract_version, units = args.units ?? 1000;
|
|
20
|
+
if (version !== "1.2" && version !== "1.4")
|
|
21
|
+
return fail("Choose contract_version 1.2 or 1.4");
|
|
22
|
+
if (!Number.isSafeInteger(units) || Number(units) < 1)
|
|
23
|
+
return fail("units must be a positive integer");
|
|
24
|
+
if (!ctx.config.devMode || !ctx.config.baseUrl)
|
|
25
|
+
return fail("Configure AIFINPAY_MODE=dev and AIFINPAY_BASE_URL explicitly");
|
|
26
|
+
try {
|
|
27
|
+
const base = ctx.config.baseUrl.replace(/\/+$/, "");
|
|
28
|
+
if (["aifinpay.io", "api.aifinpay.io", "gateway.aifinpay.io"].includes(new URL(base).hostname)) {
|
|
29
|
+
return fail("Dev quotes require a separate dev backend URL");
|
|
30
|
+
}
|
|
31
|
+
const fetchImpl = ctx.agent.inner.fetchImpl;
|
|
32
|
+
const resource = "/v1/dev/paid/data";
|
|
33
|
+
const response = await fetchImpl(`${base}${resource}`);
|
|
34
|
+
if (response.status !== 402)
|
|
35
|
+
return fail(`Dev paid route must return 402; received HTTP ${response.status}`);
|
|
36
|
+
const challenge = (await response.json());
|
|
37
|
+
if (!challenge?.merchant_id || !challenge.accepted_chains?.includes("amoy"))
|
|
38
|
+
return fail("Dev route has no configured Amoy settlement");
|
|
39
|
+
const quoted = await fetchImpl(`${base}/v1/quote`, {
|
|
40
|
+
method: "POST",
|
|
41
|
+
headers: { "content-type": "application/json" },
|
|
42
|
+
body: JSON.stringify({
|
|
43
|
+
merchant_id: challenge.merchant_id,
|
|
44
|
+
resource,
|
|
45
|
+
scope: "exact",
|
|
46
|
+
tier: "standard",
|
|
47
|
+
units,
|
|
48
|
+
payer: ctx.agent.evmAddress,
|
|
49
|
+
}),
|
|
50
|
+
});
|
|
51
|
+
if (!quoted.ok)
|
|
52
|
+
return fail(`Dev quote failed: HTTP ${quoted.status}`);
|
|
53
|
+
const quote = (await quoted.json());
|
|
54
|
+
if (quote.network_mode !== "test" ||
|
|
55
|
+
quote.merchant_id !== challenge.merchant_id ||
|
|
56
|
+
quote.resource !== resource ||
|
|
57
|
+
quote.accepted_chains?.length !== 1 ||
|
|
58
|
+
quote.accepted_chains[0] !== "amoy") {
|
|
59
|
+
return fail("Quote is not bound to this test merchant/resource on Amoy");
|
|
60
|
+
}
|
|
61
|
+
if (quote.settlement_call?.splitter_version !== version)
|
|
62
|
+
return fail(`Requested ${version}; backend advertises ${quote.settlement_call?.splitter_version ?? "no verified version"}. Configure the corresponding dev deployment first.`);
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: "text",
|
|
67
|
+
text: JSON.stringify({
|
|
68
|
+
quote,
|
|
69
|
+
signing_available: false,
|
|
70
|
+
next_step: "Use a separately verified Amoy executor for this exact deployment; current MCP does not broadcast payments. Keep the quote and transaction reference for receipt recovery.",
|
|
71
|
+
}, null, 2),
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return fail("Dev backend unavailable or returned an invalid response");
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=dev-payment-quote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dev-payment-quote.js","sourceRoot":"","sources":["../../src/tools/dev-payment-quote.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,8OAA8O;QAChP,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,oBAAoB,EAAE,KAAK;YAC3B,UAAU,EAAE;gBACV,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE;gBAC1D,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,E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,CAAC;YACnC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,MAAM,EACnC,CAAC;YACD,OAAO,IAAI,CAAC,2DAA2D,CAAC,CAAC;QAC3E,CAAC;QACD,IAAI,KAAK,CAAC,eAAe,EAAE,gBAAgB,KAAK,OAAO;YACrD,OAAO,IAAI,CACT,aAAa,OAAO,wBAAwB,KAAK,CAAC,eAAe,EAAE,gBAAgB,IAAI,qBAAqB,qDAAqD,CAClK,CAAC;QACJ,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,KAAK;wBACL,iBAAiB,EAAE,KAAK;wBACxB,SAAS,EACP,4KAA4K;qBAC/K,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC,yDAAyD,CAAC,CAAC;IACzE,CAAC;AACH,CAAC"}
|
|
@@ -105,4 +105,108 @@ export declare function runSettlementInvoice(ctx: ToolContext, args: Record<stri
|
|
|
105
105
|
text: string;
|
|
106
106
|
}[];
|
|
107
107
|
}>;
|
|
108
|
+
export declare function settlementSolanaTool(): {
|
|
109
|
+
name: string;
|
|
110
|
+
description: string;
|
|
111
|
+
inputSchema: {
|
|
112
|
+
type: string;
|
|
113
|
+
properties: {
|
|
114
|
+
route_class: {
|
|
115
|
+
type: string;
|
|
116
|
+
enum: string[];
|
|
117
|
+
};
|
|
118
|
+
chain: {
|
|
119
|
+
type: string;
|
|
120
|
+
enum: string[];
|
|
121
|
+
};
|
|
122
|
+
asset: {
|
|
123
|
+
type: string;
|
|
124
|
+
enum: string[];
|
|
125
|
+
description: string;
|
|
126
|
+
};
|
|
127
|
+
gross_amount: {
|
|
128
|
+
type: string;
|
|
129
|
+
description: string;
|
|
130
|
+
};
|
|
131
|
+
merchant_wallet: {
|
|
132
|
+
type: string;
|
|
133
|
+
description: string;
|
|
134
|
+
};
|
|
135
|
+
order_id: {
|
|
136
|
+
type: string;
|
|
137
|
+
};
|
|
138
|
+
valid_until: {
|
|
139
|
+
type: string;
|
|
140
|
+
description: string;
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
required: string[];
|
|
144
|
+
};
|
|
145
|
+
annotations: {
|
|
146
|
+
readOnlyHint: boolean;
|
|
147
|
+
openWorldHint: boolean;
|
|
148
|
+
destructiveHint: boolean;
|
|
149
|
+
};
|
|
150
|
+
outputSchema: {
|
|
151
|
+
type: string;
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
export declare function runSettlementSolana(ctx: ToolContext, args: Record<string, unknown>): Promise<{
|
|
155
|
+
content: {
|
|
156
|
+
type: string;
|
|
157
|
+
text: string;
|
|
158
|
+
}[];
|
|
159
|
+
}>;
|
|
160
|
+
export declare function settlementCasperTool(): {
|
|
161
|
+
name: string;
|
|
162
|
+
description: string;
|
|
163
|
+
inputSchema: {
|
|
164
|
+
type: string;
|
|
165
|
+
properties: {
|
|
166
|
+
route_class: {
|
|
167
|
+
type: string;
|
|
168
|
+
enum: string[];
|
|
169
|
+
};
|
|
170
|
+
chain: {
|
|
171
|
+
type: string;
|
|
172
|
+
enum: string[];
|
|
173
|
+
};
|
|
174
|
+
asset: {
|
|
175
|
+
type: string;
|
|
176
|
+
enum: string[];
|
|
177
|
+
description: string;
|
|
178
|
+
};
|
|
179
|
+
gross_amount: {
|
|
180
|
+
type: string;
|
|
181
|
+
description: string;
|
|
182
|
+
};
|
|
183
|
+
merchant_wallet: {
|
|
184
|
+
type: string;
|
|
185
|
+
description: string;
|
|
186
|
+
};
|
|
187
|
+
order_id: {
|
|
188
|
+
type: string;
|
|
189
|
+
};
|
|
190
|
+
valid_until: {
|
|
191
|
+
type: string;
|
|
192
|
+
description: string;
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
required: string[];
|
|
196
|
+
};
|
|
197
|
+
annotations: {
|
|
198
|
+
readOnlyHint: boolean;
|
|
199
|
+
openWorldHint: boolean;
|
|
200
|
+
destructiveHint: boolean;
|
|
201
|
+
};
|
|
202
|
+
outputSchema: {
|
|
203
|
+
type: string;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
export declare function runSettlementCasper(ctx: ToolContext, args: Record<string, unknown>): Promise<{
|
|
207
|
+
content: {
|
|
208
|
+
type: string;
|
|
209
|
+
text: string;
|
|
210
|
+
}[];
|
|
211
|
+
}>;
|
|
108
212
|
//# sourceMappingURL=production-control.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"production-control.d.ts","sourceRoot":"","sources":["../../src/tools/production-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"production-control.d.ts","sourceRoot":"","sources":["../../src/tools/production-control.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AA2ChD,wBAAgB,wBAAwB;;;;;;;;;;;;;;;;;;;;;EAmBvC;AAED,wBAAsB,uBAAuB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAS5F;AAED,wBAAgB,oBAAoB;;;;;;;;;;;;;;;;;;;;EAgBnC;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAQxF;AAED,wBAAgB,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BpC;AAED,wBAAsB,oBAAoB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAyBzF;AAQD,wBAAgB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCnC;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAoCxF;AAQD,wBAAgB,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiCnC;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;GAoCxF"}
|