@aifinpay/mcp 2.11.0 → 2.11.2
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 +13 -6
- package/bin/aifinpay-mcp.js +24 -6
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +9 -3
- package/dist/server.js.map +1 -1
- package/dist/tools/payment-setup-status.d.ts +15 -0
- package/dist/tools/payment-setup-status.d.ts.map +1 -1
- package/dist/tools/payment-setup-status.js +60 -2
- package/dist/tools/payment-setup-status.js.map +1 -1
- package/package.json +2 -2
- package/skills/SKILL.md +28 -16
package/README.md
CHANGED
|
@@ -4,8 +4,8 @@ AiFinPay MCP server for persistent agent identity, Agent Passport resolution,
|
|
|
4
4
|
route discovery and non-signing settlement invoices. Canonical domain:
|
|
5
5
|
**aifinpay.io**.
|
|
6
6
|
|
|
7
|
-
Version **2.11.
|
|
8
|
-
and canonical skill 2.10.
|
|
7
|
+
Version **2.11.2** is prepared in this checkout, on the published agent 2.8.0
|
|
8
|
+
and canonical skill 2.10.1 (AiFinPay/skill b8d2309, published 2026-10-19). The separate canonical producer's final immutable
|
|
9
9
|
source pin is a required handoff, not a moving-branch substitution.
|
|
10
10
|
The published baseline checked2026-10-04 was MCP2.5.0. Package publication and
|
|
11
11
|
real registry dependency/lock refresh remain release gates; a source-cohort
|
|
@@ -36,7 +36,8 @@ and only once the owner has set every limit in step 4.
|
|
|
36
36
|
batch price in POL plus the gas cap, so about `0.5 POL` for one `$0.10`
|
|
37
37
|
batch at `$0.20`/POL plus up to `0.3 POL` gas (the SDK refuses before
|
|
38
38
|
signing if the worst-case fee exceeds the cap). When the owner confirms
|
|
39
|
-
funding, they add the payment settings to the same `env` and
|
|
39
|
+
funding, they add the payment settings to the same `env` and restart the
|
|
40
|
+
aifinpay MCP server in the client (`agent_reload` does not read env):
|
|
40
41
|
|
|
41
42
|
```json
|
|
42
43
|
{
|
|
@@ -338,9 +339,15 @@ passphrase, encrypts the keystore and prints one JSON document:
|
|
|
338
339
|
The passphrase appears only inside `env`, because the caller must put it in
|
|
339
340
|
the client config and there is no other channel; a process that captures that
|
|
340
341
|
output captures the passphrase, so treat the output as a secret. A second run
|
|
341
|
-
keeps the wallet and prints a placeholder instead of the passphrase.
|
|
342
|
-
|
|
343
|
-
|
|
342
|
+
keeps the wallet and prints a placeholder instead of the passphrase. When
|
|
343
|
+
`AIFINPAY_HOME` is set, `env` also carries it (absolute), so the server reads the
|
|
344
|
+
keystore init wrote; `payment_setup_status` gives the init command with the
|
|
345
|
+
server's `AIFINPAY_HOME` for the same reason. If the keystore exists, is
|
|
346
|
+
encrypted and `AIFINPAY_WALLET_PASSPHRASE` is unset, `init` leaves it untouched,
|
|
347
|
+
prints one JSON line naming the variable and exits with status 2; its
|
|
348
|
+
`next_step` is to run init in a new, empty `AIFINPAY_HOME`
|
|
349
|
+
(`~/.aifinpay/agent-<yyyymmdd>`) and put the `env` it prints into the client
|
|
350
|
+
config.
|
|
344
351
|
|
|
345
352
|
Select the wallet in this order: `SEED_HASH` → `./aifinpay/agents.json` →
|
|
346
353
|
legacy `AIFINPAY_AGENT_SECRET` → `~/.aifinpay/agent.json`.
|
package/bin/aifinpay-mcp.js
CHANGED
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
linkSync,
|
|
42
42
|
unlinkSync,
|
|
43
43
|
} from "node:fs";
|
|
44
|
-
import { join } from "node:path";
|
|
44
|
+
import { join, resolve } from "node:path";
|
|
45
45
|
import { homedir } from "node:os";
|
|
46
46
|
import { createRequire } from "node:module";
|
|
47
47
|
import { scryptSync, randomBytes, createCipheriv, createDecipheriv } from "node:crypto";
|
|
@@ -178,19 +178,31 @@ if (arg === "init") {
|
|
|
178
178
|
|
|
179
179
|
const { loadConfigFromEnv } = await import("../dist/config.js");
|
|
180
180
|
const { loadWalletIdentity } = await import("../dist/identity.js");
|
|
181
|
-
const { PAYMENT_ENV } = await import("../dist/tools/payment-setup-status.js");
|
|
181
|
+
const { PAYMENT_ENV, lockedKeystoreStep } = await import("../dist/tools/payment-setup-status.js");
|
|
182
182
|
const config = loadConfigFromEnv();
|
|
183
183
|
// A keystore that cannot be opened is reported in one line that names the
|
|
184
|
-
// variable, never as a stack trace — and never replaced.
|
|
184
|
+
// variable, never as a stack trace — and never replaced. An agent cannot ask
|
|
185
|
+
// anyone for the passphrase, so its JSON also names the way past it that
|
|
186
|
+
// touches nothing: a new wallet in a new, empty AIFINPAY_HOME.
|
|
185
187
|
const failKeystore = (error) => {
|
|
186
188
|
const line =
|
|
187
189
|
!PASSPHRASE && existsSync(KEYSTORE)
|
|
188
190
|
? `${KEYSTORE} exists and is encrypted; set ${PASSPHRASE_ENV} to the passphrase used at init (it is not set in this environment).`
|
|
189
191
|
: error.message;
|
|
192
|
+
let encrypted = false;
|
|
193
|
+
try {
|
|
194
|
+
encrypted = Boolean(JSON.parse(readFileSync(KEYSTORE, "utf8"))?.enc);
|
|
195
|
+
} catch {
|
|
196
|
+
/* No readable keystore: the error is about something else. */
|
|
197
|
+
}
|
|
190
198
|
if (NONINTERACTIVE)
|
|
191
199
|
process.stdout.write(
|
|
192
|
-
JSON.stringify({
|
|
193
|
-
|
|
200
|
+
JSON.stringify({
|
|
201
|
+
error: line,
|
|
202
|
+
keystore: KEYSTORE,
|
|
203
|
+
...(PASSPHRASE ? {} : { missing_env: PASSPHRASE_ENV }),
|
|
204
|
+
...(encrypted ? { next_step: lockedKeystoreStep(KEYSTORE) } : {}),
|
|
205
|
+
}) + "\n"
|
|
194
206
|
);
|
|
195
207
|
else process.stderr.write(line + "\n");
|
|
196
208
|
process.exit(2);
|
|
@@ -205,6 +217,10 @@ if (arg === "init") {
|
|
|
205
217
|
const addressesOf = (agent) => ({ evm: agent.evmAddress, solana: agent.solanaAddress, casper: agent.casperAddress });
|
|
206
218
|
const indexEnv =
|
|
207
219
|
selected?.derivationIndex === undefined ? {} : { AIFINPAY_WALLET_INDEX: String(selected.derivationIndex) };
|
|
220
|
+
// The server reads the keystore (and keeps its payment journal) under the same
|
|
221
|
+
// AIFINPAY_HOME init used, so a non-default one goes into the client env too,
|
|
222
|
+
// absolute: the client does not start the server in this directory.
|
|
223
|
+
const homeEnv = process.env.AIFINPAY_HOME ? { AIFINPAY_HOME: resolve(process.env.AIFINPAY_HOME) } : {};
|
|
208
224
|
// Non-interactive stdout is one JSON document and nothing else, so the
|
|
209
225
|
// caller can parse it. The same facts, as prose, go to a terminal.
|
|
210
226
|
const emit = (json, text) => process.stdout.write(NONINTERACTIVE ? JSON.stringify(json, null, 2) + "\n" : text);
|
|
@@ -222,7 +238,7 @@ if (arg === "init") {
|
|
|
222
238
|
encrypted: null,
|
|
223
239
|
source: selected.source,
|
|
224
240
|
addresses: addressesOf(agent),
|
|
225
|
-
env: indexEnv,
|
|
241
|
+
env: { ...homeEnv, ...indexEnv },
|
|
226
242
|
payment_env_example: PAYMENT_ENV,
|
|
227
243
|
next_step: nextStep,
|
|
228
244
|
},
|
|
@@ -316,6 +332,7 @@ if (arg === "init") {
|
|
|
316
332
|
source: "legacy-keystore",
|
|
317
333
|
addresses: addressesOf(agent),
|
|
318
334
|
env: {
|
|
335
|
+
...homeEnv,
|
|
319
336
|
...(encrypted
|
|
320
337
|
? {
|
|
321
338
|
[PASSPHRASE_ENV]: GENERATED_PASSPHRASE
|
|
@@ -383,6 +400,7 @@ if (arg === "init") {
|
|
|
383
400
|
command: "npx",
|
|
384
401
|
args: ["-y", `@aifinpay/mcp@${VERSION}`],
|
|
385
402
|
env: {
|
|
403
|
+
...homeEnv,
|
|
386
404
|
...(encrypted ? { AIFINPAY_WALLET_PASSPHRASE: "<the passphrase you used for init>" } : {}),
|
|
387
405
|
...indexEnv,
|
|
388
406
|
},
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAQnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAS7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAQnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAS7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAgCvD;iFACiF;AACjF,wBAAsB,YAAY,CAAC,MAAM,GAAE,SAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2MxD;AA2BD,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,iBAAiB,CAAC;IACjC,6EAA6E;IAC7E,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,+HAA+H;IAC/H,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9D"}
|
package/dist/server.js
CHANGED
|
@@ -12,7 +12,7 @@ import { makeSafeFetch } from "./safe-fetch.js";
|
|
|
12
12
|
import { loadConfigFromEnv, validatePaymentConfig } from "./config.js";
|
|
13
13
|
import { PaymentStateStore } from "./payment-state.js";
|
|
14
14
|
import { payableFetchTool, runPayableFetch } from "./tools/payable-fetch.js";
|
|
15
|
-
import { paymentSetupStatusTool, runPaymentSetupStatus } from "./tools/payment-setup-status.js";
|
|
15
|
+
import { initCommand, paymentSetupStatusTool, runPaymentSetupStatus } from "./tools/payment-setup-status.js";
|
|
16
16
|
import { agentPassportResolveTool, runAgentPassportResolve, settlementRoutesTool, runSettlementRoutes, settlementInvoiceTool, runSettlementInvoice, settlementSolanaTool, runSettlementSolana, settlementCasperTool, runSettlementCasper, } from "./tools/production-control.js";
|
|
17
17
|
import { deploymentInfoTool, runDeploymentInfo } from "./tools/supported-chains.js";
|
|
18
18
|
import { payChain } from "./pay-chains.js";
|
|
@@ -26,6 +26,7 @@ const safeFetch = makeSafeFetch({
|
|
|
26
26
|
// for those names — see safe-fetch.ts for why this is not a proxy switch.
|
|
27
27
|
trustedHosts: loadConfigFromEnv().trustedHosts,
|
|
28
28
|
});
|
|
29
|
+
const RELOAD_ENV_NOTE = "Owner limits and AIFINPAY_PAYMENTS_ENABLED are read only when this server starts; agent_reload re-reads the keystore and nothing else. If the owner has saved them since, have the client restart the aifinpay MCP server (restart the client, or disable and re-enable the server), then call payment_setup_status.";
|
|
29
30
|
/** Read-only by default. Explicit owner configuration enables the reviewed
|
|
30
31
|
* family-specific v1.4 payable_fetch path; legacy signing tools stay retired. */
|
|
31
32
|
export async function createServer(config = {}) {
|
|
@@ -62,7 +63,7 @@ export async function createServer(config = {}) {
|
|
|
62
63
|
}));
|
|
63
64
|
identitySource = configured?.source ?? "ephemeral";
|
|
64
65
|
if (!configured)
|
|
65
|
-
log("warn",
|
|
66
|
+
log("warn", `[aifinpay-mcp] EPHEMERAL wallet — DO NOT FUND. Run \`${initCommand(config.walletHome)}\`, then agent_reload in this connection.`);
|
|
66
67
|
let paymentState;
|
|
67
68
|
if (config.paymentsEnabled) {
|
|
68
69
|
validatePaymentConfig(config);
|
|
@@ -113,7 +114,7 @@ export async function createServer(config = {}) {
|
|
|
113
114
|
agentClaimSelfTool(),
|
|
114
115
|
{
|
|
115
116
|
name: "agent_reload",
|
|
116
|
-
description: "Reload the configured local wallet files after init or a file update, without starting a new conversation. Returns public addresses only.
|
|
117
|
+
description: "Reload the configured local wallet files after init or a file update, without starting a new conversation. Returns public addresses only. Owner limits and other env changes take effect only after the client restarts the aifinpay MCP server; agent_reload does not read them.",
|
|
117
118
|
inputSchema: { type: "object", properties: {}, additionalProperties: false },
|
|
118
119
|
annotations: { readOnlyHint: false, destructiveHint: false, openWorldHint: false },
|
|
119
120
|
},
|
|
@@ -162,6 +163,11 @@ export async function createServer(config = {}) {
|
|
|
162
163
|
evm: agent.evmAddress,
|
|
163
164
|
casper: agent.casperAddress,
|
|
164
165
|
reloaded: true,
|
|
166
|
+
// A reload that succeeds while payments stay off read as "the
|
|
167
|
+
// env was not picked up", and an agent stopped there
|
|
168
|
+
// (2026-10-19): config is fixed at start, so say so.
|
|
169
|
+
payments_enabled: Boolean(config.paymentsEnabled),
|
|
170
|
+
...(config.paymentsEnabled ? {} : { env_note: RELOAD_ENV_NOTE }),
|
|
165
171
|
}),
|
|
166
172
|
},
|
|
167
173
|
],
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAuB,MAAM,iBAAiB,CAAC;AACrF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,GAC1B,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,i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C,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,KAAK,GAAG,IAAI,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -22,6 +22,21 @@ export declare const PAYMENT_ENV: Readonly<{
|
|
|
22
22
|
AIFINPAY_MAX_GAS_POL: "0.3";
|
|
23
23
|
}>;
|
|
24
24
|
export declare const INIT_COMMAND = "npx @aifinpay/mcp init";
|
|
25
|
+
/**
|
|
26
|
+
* init, run so that it writes the keystore this server reads. An agent's shell
|
|
27
|
+
* does not have the server's AIFINPAY_HOME, so a bare `npx @aifinpay/mcp init`
|
|
28
|
+
* wrote ~/.aifinpay/agent.json while the server kept looking elsewhere.
|
|
29
|
+
*/
|
|
30
|
+
export declare function initCommand(walletHome: string | undefined): string;
|
|
31
|
+
/** A directory that does not exist yet, for a new wallet beside one that cannot be opened. */
|
|
32
|
+
export declare function freshWalletHome(now?: Date): string;
|
|
33
|
+
/**
|
|
34
|
+
* The way past an encrypted keystore nobody here can open. init and the server
|
|
35
|
+
* both refuse to replace it, rightly: it may hold funds. Without this the agent
|
|
36
|
+
* had a refusal and no next move, and the next move it invented was its own key
|
|
37
|
+
* handling. A new, empty AIFINPAY_HOME leaves the old file untouched.
|
|
38
|
+
*/
|
|
39
|
+
export declare function lockedKeystoreStep(keystore: string): string;
|
|
25
40
|
interface Limit {
|
|
26
41
|
env: string;
|
|
27
42
|
set: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-setup-status.d.ts","sourceRoot":"","sources":["../../src/tools/payment-setup-status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payment-setup-status.d.ts","sourceRoot":"","sources":["../../src/tools/payment-setup-status.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAyB,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AAIrE;;;;;;;;;;GAUG;AAEH,2DAA2D;AAC3D,eAAO,MAA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;IAElC,IAAI;IACJ,WAAW;IAIX,WAAW;QAAI,IAAI;QAAY,UAAU;QAAM,oBAAoB;;IACnE,WAAW;QAAI,YAAY;QAAQ,aAAa;QAAQ,eAAe;;EAE1E;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;GAG3F;AAYD,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAOvE;AAED,wBAAsB,kBAAkB,CACtC,GAAG,EAAE,WAAW,EAChB,OAAO,EAAE;IAAE,WAAW,EAAE,OAAO,CAAA;CAAE,GAChC,OAAO,CAAC,kBAAkB,CAAC,CAgG7B"}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join, resolve } from "node:path";
|
|
1
4
|
import { validatePaymentConfig } from "../config.js";
|
|
2
5
|
import { independentNativeUsd } from "../native-price.js";
|
|
3
6
|
import { payChain } from "../pay-chains.js";
|
|
@@ -27,6 +30,53 @@ export const PAYMENT_ENV = Object.freeze({
|
|
|
27
30
|
AIFINPAY_MAX_GAS_POL: "0.3",
|
|
28
31
|
});
|
|
29
32
|
export const INIT_COMMAND = "npx @aifinpay/mcp init";
|
|
33
|
+
/** POSIX single quotes: the path reaches init byte for byte, spaces and quotes included. */
|
|
34
|
+
function shellQuote(value) {
|
|
35
|
+
return `'${value.replace(/'/g, `'\\''`)}'`;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* init, run so that it writes the keystore this server reads. An agent's shell
|
|
39
|
+
* does not have the server's AIFINPAY_HOME, so a bare `npx @aifinpay/mcp init`
|
|
40
|
+
* wrote ~/.aifinpay/agent.json while the server kept looking elsewhere.
|
|
41
|
+
*/
|
|
42
|
+
export function initCommand(walletHome) {
|
|
43
|
+
return walletHome ? `AIFINPAY_HOME=${shellQuote(resolve(walletHome))} ${INIT_COMMAND}` : INIT_COMMAND;
|
|
44
|
+
}
|
|
45
|
+
/** A directory that does not exist yet, for a new wallet beside one that cannot be opened. */
|
|
46
|
+
export function freshWalletHome(now = new Date()) {
|
|
47
|
+
const base = join(homedir(), ".aifinpay", `agent-${now.toISOString().slice(0, 10).replace(/-/g, "")}`);
|
|
48
|
+
for (let n = 1;; n++) {
|
|
49
|
+
const candidate = n === 1 ? base : `${base}-${n}`;
|
|
50
|
+
if (!existsSync(candidate))
|
|
51
|
+
return candidate;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The way past an encrypted keystore nobody here can open. init and the server
|
|
56
|
+
* both refuse to replace it, rightly: it may hold funds. Without this the agent
|
|
57
|
+
* had a refusal and no next move, and the next move it invented was its own key
|
|
58
|
+
* handling. A new, empty AIFINPAY_HOME leaves the old file untouched.
|
|
59
|
+
*/
|
|
60
|
+
export function lockedKeystoreStep(keystore) {
|
|
61
|
+
return (`${keystore} is an encrypted wallet that cannot be opened here: AIFINPAY_WALLET_PASSPHRASE is not set or is wrong. ` +
|
|
62
|
+
`Do not delete, move or overwrite it; it may hold funds. ` +
|
|
63
|
+
`If its passphrase is known, set AIFINPAY_WALLET_PASSPHRASE in the aifinpay server's env in the MCP client config and reconnect. ` +
|
|
64
|
+
`Otherwise create a new wallet in a new, empty directory: run \`${initCommand(freshWalletHome())}\`, ` +
|
|
65
|
+
`put the "env" it prints (it includes AIFINPAY_HOME) into the aifinpay server's env in the MCP client config, ` +
|
|
66
|
+
`reconnect the server, then call agent_reload and payment_setup_status again.`);
|
|
67
|
+
}
|
|
68
|
+
/** The keystore this server reads, when it is encrypted and the server has no passphrase for it. */
|
|
69
|
+
function lockedKeystore(config) {
|
|
70
|
+
if (config.walletPassphrase)
|
|
71
|
+
return undefined;
|
|
72
|
+
const keystore = join(resolve(config.walletHome || join(homedir(), ".aifinpay")), "agent.json");
|
|
73
|
+
try {
|
|
74
|
+
return JSON.parse(readFileSync(keystore, "utf8"))?.enc ? keystore : undefined;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
30
80
|
export function paymentSetupStatusTool() {
|
|
31
81
|
return {
|
|
32
82
|
name: "payment_setup_status",
|
|
@@ -101,9 +151,12 @@ export async function paymentSetupStatus(ctx, options) {
|
|
|
101
151
|
next_step: "",
|
|
102
152
|
};
|
|
103
153
|
if (!persistent) {
|
|
154
|
+
const locked = lockedKeystore(config);
|
|
104
155
|
status.next_step =
|
|
105
156
|
`No persistent wallet: this server started with an ephemeral one — do not fund ${ctx.agent.evmAddress}. ` +
|
|
106
|
-
|
|
157
|
+
(locked
|
|
158
|
+
? lockedKeystoreStep(locked)
|
|
159
|
+
: `Run \`${initCommand(config.walletHome)}\` (without a terminal it prints JSON; copy its "env" into this server's env in the MCP client config), reconnect the server, then call agent_reload and payment_setup_status again.`);
|
|
107
160
|
return status;
|
|
108
161
|
}
|
|
109
162
|
if (!config.paymentsEnabled || configError) {
|
|
@@ -113,7 +166,12 @@ export async function paymentSetupStatus(ctx, options) {
|
|
|
113
166
|
? `Owner setting refused: ${configError}. `
|
|
114
167
|
: `Payments are off until the owner enables them. `) +
|
|
115
168
|
`Have the owner add this to the server's env in the MCP client config (their real site origin and limits, not the example), then reconnect: ${block}` +
|
|
116
|
-
(configError && !config.paymentsEnabled ? ` Currently missing: ${configError}` : "")
|
|
169
|
+
(configError && !config.paymentsEnabled ? ` Currently missing: ${configError}` : "") +
|
|
170
|
+
// The env is read once, at start. An agent that saw agent_reload succeed
|
|
171
|
+
// and payments stay off concluded the settings were lost, and stopped.
|
|
172
|
+
(config.paymentsEnabled
|
|
173
|
+
? ""
|
|
174
|
+
: ` If the owner has already saved these settings, this server has not been restarted since: agent_reload does not read env. Have the client restart the aifinpay MCP server, then call payment_setup_status again.`);
|
|
117
175
|
return status;
|
|
118
176
|
}
|
|
119
177
|
const gasCap = Number(status.limits.gas_cap.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"payment-setup-status.js","sourceRoot":"","sources":["../../src/tools/payment-setup-status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"payment-setup-status.js","sourceRoot":"","sources":["../../src/tools/payment-setup-status.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,qBAAqB,EAAkB,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAiB,MAAM,kBAAkB,CAAC;AAE3D;;;;;;;;;;GAUG;AAEH,2DAA2D;AAC3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAEtC,8EAA8E;AAC9E,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IACvC,yBAAyB,EAAE,GAAG;IAC9B,wBAAwB,EAAE,0BAA0B;IACpD,0BAA0B,EAAE,QAAQ;IACpC,gBAAgB,EAAE,MAAM;IACxB,kBAAkB,EAAE,MAAM;IAC1B,oBAAoB,EAAE,KAAK;CAC5B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAErD,4FAA4F;AAC5F,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC;AAC7C,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,UAA8B;IACxD,OAAO,UAA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AC,MAAM,CAAC;QAC1E,MAAM,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,OAAO,IAAI,iCAAiC,CAAC,CAAC;IAC5E,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,YAAY,CAAC,GAAW;IAC/B,MAAM,KAAK,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,CAAC;IAC/B,MAAM,QAAQ,GAAG,CAAC,GAAG,GAAG,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC7E,OAAO,GAAG,KAAK,IAAI,QAAQ,EAAE,CAAC;AAChC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aifinpay/mcp",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.2",
|
|
4
4
|
"mcpName": "io.github.daochild/aifinpay",
|
|
5
5
|
"description": "AiFinPay MCP: persistent local agent wallets, owner-configured EVM and Solana payment adapters, durable budgets and receipt recovery.",
|
|
6
6
|
"type": "module",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"bugs": "https://github.com/AiFinPay/sdk/issues",
|
|
78
78
|
"dependencies": {
|
|
79
79
|
"@aifinpay/agent": "^2.8.0",
|
|
80
|
-
"@aifinpay/skill": "^2.10.
|
|
80
|
+
"@aifinpay/skill": "^2.10.1",
|
|
81
81
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
82
82
|
"bs58": "^6.0.0",
|
|
83
83
|
"tweetnacl": "^1.0.3"
|
package/skills/SKILL.md
CHANGED
|
@@ -6,7 +6,7 @@ description: Pay for x402-gated APIs and sites as an agent (AIFP-1 on an owner-s
|
|
|
6
6
|
wallet, payment history, prepaid quotas and Agent Passport records through
|
|
7
7
|
the AiFinPay MCP server or SDK.
|
|
8
8
|
license: MIT
|
|
9
|
-
version: 2.10.
|
|
9
|
+
version: 2.10.1
|
|
10
10
|
author: AiFinPay Support
|
|
11
11
|
metadata:
|
|
12
12
|
hermes:
|
|
@@ -61,11 +61,11 @@ your language. There is no "install together" scenario.
|
|
|
61
61
|
|
|
62
62
|
## Version and release status
|
|
63
63
|
|
|
64
|
-
Release target: MCP **2.11.
|
|
64
|
+
Release target: MCP **2.11.1**, Node SDK **2.8.0**, Python **2.7.0**.
|
|
65
65
|
This skill describes that coordinated package cohort. Check the installed
|
|
66
66
|
versions before using its additional-network instructions; a release target
|
|
67
67
|
does not establish npm/PyPI publication or production network activation.
|
|
68
|
-
Published baseline checked 2026-10-19: MCP **2.
|
|
68
|
+
Published baseline checked 2026-10-19: MCP **2.11.0**, Node SDK **2.8.0**.
|
|
69
69
|
`payable_fetch` has shipped since MCP 2.2.0, and Base since MCP 2.5.0.
|
|
70
70
|
Published packages remain usable within their documented capabilities.
|
|
71
71
|
|
|
@@ -194,21 +194,32 @@ step — no key handling of your own, no funding of an ephemeral address.
|
|
|
194
194
|
(`persistent` or ephemeral), `payments_enabled`, which owner limits are
|
|
195
195
|
set, the balance when the RPC answers, `ready`, and `next_step` — the one
|
|
196
196
|
thing still missing. Follow `next_step`; do not skip ahead.
|
|
197
|
-
3. **Persistent wallet.** If `wallet.persistent` is false, run
|
|
198
|
-
`npx @aifinpay/mcp init
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
197
|
+
3. **Persistent wallet.** If `wallet.persistent` is false, run the exact
|
|
198
|
+
command in `next_step` (it is `npx @aifinpay/mcp init`, prefixed with
|
|
199
|
+
`AIFINPAY_HOME=…` when the server uses its own wallet directory — keep
|
|
200
|
+
that prefix, or the server will not see the keystore). Without a terminal
|
|
201
|
+
init does not prompt: it generates the passphrase, writes the keystore and
|
|
202
|
+
prints one JSON document with `addresses` and an `env` block. Put that
|
|
203
|
+
`env` into the `aifinpay` server entry of the MCP client config (the
|
|
204
|
+
passphrase is only there — the output is a secret, and a second run never
|
|
205
|
+
reprints it), then call `agent_reload`: it reads the keystore and switches
|
|
206
|
+
this server to the persistent wallet. If init answers that a keystore
|
|
207
|
+
already exists and cannot be opened, do not delete or replace it: follow
|
|
208
|
+
its `next_step` and start a new wallet directory. Never fund an ephemeral
|
|
209
|
+
address.
|
|
204
210
|
4. **Fund and enable.** Tell the owner `addresses.evm` and the amount: the
|
|
205
211
|
batch price in the pay chain's native currency plus the gas cap (on
|
|
206
212
|
Polygon, about `0.5 POL` covers one `$0.10` batch plus a `0.3 POL` cap).
|
|
207
213
|
When the owner confirms funding, they add the payment settings from
|
|
208
214
|
"Paying with payable_fetch" below — with their real origin and limits —
|
|
209
|
-
to the same `env
|
|
210
|
-
`
|
|
211
|
-
|
|
215
|
+
to the same `env`. **Limits are read only when the server starts**:
|
|
216
|
+
`agent_reload` re-reads the keystore and nothing else, so after the env
|
|
217
|
+
changes the client has to restart the `aifinpay` MCP server (restart the
|
|
218
|
+
client, or disable and re-enable the server in it). Until that restart
|
|
219
|
+
`payment_setup_status` keeps reporting `payments_enabled: false`; that is
|
|
220
|
+
expected, not a refusal — say so, ask the owner for the restart, and stop.
|
|
221
|
+
After it, `payment_setup_status` reports `ready: true`. Funding, origins
|
|
222
|
+
and limits are the owner's decisions; never choose them yourself.
|
|
212
223
|
5. **Pay.** `payable_fetch({"url":"<origin><path>"})` (add
|
|
213
224
|
`"scope":"merchant"` for a site-wide batch) buys the batch and returns the
|
|
214
225
|
content with the receipt summary. Later requests reuse the batch.
|
|
@@ -238,9 +249,10 @@ into ratersapp.com", "купи доступ до цього сайту". Handle
|
|
|
238
249
|
persistent wallet first, then the owner's funding and environment block
|
|
239
250
|
with this origin in `AIFINPAY_GATEWAY_ORIGINS` (and
|
|
240
251
|
`AIFINPAY_GATEWAY_PATH_MODE=direct` when the 402 comes from the site
|
|
241
|
-
itself) — and stop until the owner has done their part.
|
|
242
|
-
|
|
243
|
-
|
|
252
|
+
itself) — and stop until the owner has done their part. Env changes take
|
|
253
|
+
effect only after the client restarts the `aifinpay` server; `agent_reload`
|
|
254
|
+
does not read them. Adding a site, raising a limit and funding the wallet
|
|
255
|
+
are the owner's decisions; never make them on your own initiative.
|
|
244
256
|
5. **Buy.** `payable_fetch({"url":"<origin><path>","scope":"merchant"})`, where
|
|
245
257
|
the path is what the owner wants to read, or a standard resource from the
|
|
246
258
|
discovery document.
|