@aifinpay/mcp 1.5.1 → 1.5.3

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.
@@ -4,14 +4,171 @@
4
4
  * in stdio mode. Compatible with Claude Desktop, MCP Inspector, and any
5
5
  * MCP-aware agent runtime.
6
6
  *
7
- * Configure via env:
8
- * AIFINPAY_AGENT_SECRET base58 secret (load existing identity)
7
+ * Two commands, and the first one only has to be run once:
8
+ *
9
+ * npx @aifinpay/mcp init create a persistent wallet, print the config
10
+ * npx @aifinpay/mcp start the server
11
+ *
12
+ * WHY `init` EXISTS
13
+ *
14
+ * Running the server with nothing configured produced an EPHEMERAL wallet and
15
+ * a "DO NOT FUND" warning — correct, and a dead end. The warning pointed at
16
+ * `aifinpay init`, which is not published to npm: `@aifinpay/cli` and
17
+ * `aifinpay` both 404. So the documented way out of the dead end did not exist,
18
+ * and the only real path was to write a Node script against the SDK, which is
19
+ * not something you ask of someone whose goal is "give my agent a wallet".
20
+ *
21
+ * The gap was exactly one subcommand. This is it.
22
+ *
23
+ * Configure via env (all optional; the secret is read from the keystore below
24
+ * when the variable is unset):
25
+ * AIFINPAY_AGENT_SECRET base58 secret — overrides the keystore
9
26
  * AIFINPAY_BASE_URL default https://aifinpay.io
10
27
  * AIFINPAY_TIMEOUT_MS default 30000
11
28
  * AIFINPAY_MAX_USD hard cap per single payment (no default)
12
29
  */
13
- import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
14
- import { createServer, loadConfigFromEnv } from "../dist/index.js";
30
+ import { readFileSync, writeFileSync, mkdirSync, existsSync, statSync, chmodSync } from "node:fs";
31
+ import { join } from "node:path";
32
+ import { homedir } from "node:os";
33
+ import { createRequire } from "node:module";
34
+
35
+ const HOME = process.env.AIFINPAY_HOME || join(homedir(), ".aifinpay");
36
+ const KEYSTORE = join(HOME, "agent.json");
37
+
38
+ const require_ = createRequire(import.meta.url);
39
+ const VERSION = (() => {
40
+ try {
41
+ return require_("../package.json").version;
42
+ } catch {
43
+ return "unknown";
44
+ }
45
+ })();
46
+
47
+ const arg = (process.argv[2] || "").toLowerCase();
48
+
49
+ // ── help / version ────────────────────────────────────────────────────────
50
+ // These used to start the server. `--help` launching a stdio server is not a
51
+ // harmless quirk: the process appears to hang, because it is waiting for MCP
52
+ // framing on stdin that a human is never going to type.
53
+
54
+ if (arg === "--help" || arg === "-h" || arg === "help") {
55
+ process.stdout.write(`aifinpay-mcp ${VERSION}
56
+
57
+ npx @aifinpay/mcp init create a persistent wallet and print the config
58
+ npx @aifinpay/mcp start the MCP server (stdio)
59
+
60
+ Run init once. It writes ${KEYSTORE} with mode 600 and the server picks
61
+ it up automatically — you do not have to put the secret in a config file.
62
+
63
+ Env (all optional):
64
+ AIFINPAY_AGENT_SECRET base58 secret; overrides the keystore
65
+ AIFINPAY_MAX_USD hard cap per single payment — set this
66
+ AIFINPAY_BASE_URL default https://aifinpay.io
67
+ AIFINPAY_TIMEOUT_MS default 30000
68
+ AIFINPAY_HOME default ~/.aifinpay
69
+ `);
70
+ process.exit(0);
71
+ }
72
+
73
+ if (arg === "--version" || arg === "-v" || arg === "version") {
74
+ process.stdout.write(`${VERSION}\n`);
75
+ process.exit(0);
76
+ }
77
+
78
+ // ── init ──────────────────────────────────────────────────────────────────
79
+
80
+ function readKeystore() {
81
+ if (!existsSync(KEYSTORE)) return null;
82
+ try {
83
+ const parsed = JSON.parse(readFileSync(KEYSTORE, "utf8"));
84
+ return typeof parsed?.secretB58 === "string" ? parsed : null;
85
+ } catch {
86
+ return null;
87
+ }
88
+ }
89
+
90
+ if (arg === "init") {
91
+ const { Agent, AiFinPayAgent } = await import("@aifinpay/agent");
92
+
93
+ let store = readKeystore();
94
+ if (store) {
95
+ // Never silently overwrite. The file is the only copy of a key that may
96
+ // already hold funds; a second `init` that regenerated it would destroy a
97
+ // wallet to save one line of output.
98
+ process.stdout.write(`Existing wallet found at ${KEYSTORE} — keeping it.\n\n`);
99
+ } else {
100
+ mkdirSync(HOME, { recursive: true, mode: 0o700 });
101
+ store = { secretB58: Agent.new().secretB58, created: new Date().toISOString() };
102
+ writeFileSync(KEYSTORE, JSON.stringify(store, null, 2) + "\n", { mode: 0o600 });
103
+ chmodSync(KEYSTORE, 0o600); // writeFileSync honours umask; this does not
104
+ process.stdout.write(`Created ${KEYSTORE} (mode 600).\n\n`);
105
+ }
106
+
107
+ const agent = await AiFinPayAgent.fromSolanaSecret(store.secretB58);
108
+
109
+ process.stdout.write(
110
+ `Your agent's addresses — the EVM one is the same on every EVM chain:\n\n` +
111
+ ` EVM ${agent.evmAddress}\n` +
112
+ ` Solana ${agent.solanaAddress}\n` +
113
+ ` Casper ${agent.casperAddress}\n\n` +
114
+ `Add this to your MCP client config and restart it:\n\n` +
115
+ JSON.stringify(
116
+ {
117
+ mcpServers: {
118
+ aifinpay: {
119
+ command: "npx",
120
+ args: ["-y", "@aifinpay/mcp"],
121
+ env: { AIFINPAY_MAX_USD: "0.10" },
122
+ },
123
+ },
124
+ },
125
+ null,
126
+ 2,
127
+ ) +
128
+ `\n\nThe secret is NOT in that block on purpose — the server reads the\n` +
129
+ `keystore. Config files get pasted into chats and committed to git.\n\n` +
130
+ `Back up ${KEYSTORE}. It is the only copy. The derivation is not\n` +
131
+ `BIP-39, so no standard wallet can recover this from a phrase.\n\n` +
132
+ `The addresses hold nothing yet. Send POL to the EVM address to let the\n` +
133
+ `agent pay for calls.\n`,
134
+ );
135
+ process.exit(0);
136
+ }
137
+
138
+ if (arg && !arg.startsWith("-")) {
139
+ process.stderr.write(`aifinpay-mcp: unknown command "${arg}". Try --help.\n`);
140
+ process.exit(2);
141
+ }
142
+
143
+ // ── server ────────────────────────────────────────────────────────────────
144
+
145
+ // Fall back to the keystore so `init` once is genuinely enough. Env still wins:
146
+ // a caller that sets AIFINPAY_AGENT_SECRET explicitly means it.
147
+ if (!process.env.AIFINPAY_AGENT_SECRET) {
148
+ const store = readKeystore();
149
+ if (store) {
150
+ try {
151
+ const mode = statSync(KEYSTORE).mode & 0o777;
152
+ if (mode & 0o077) {
153
+ process.stderr.write(
154
+ `[warn] [aifinpay-mcp] ${KEYSTORE} is mode ${mode.toString(8)} — readable beyond your user. ` +
155
+ `Run: chmod 600 ${KEYSTORE}\n`,
156
+ );
157
+ }
158
+ } catch {
159
+ /* stat failure is not a reason to refuse to start */
160
+ }
161
+ process.env.AIFINPAY_AGENT_SECRET = store.secretB58;
162
+ } else {
163
+ process.stderr.write(
164
+ `[info] [aifinpay-mcp] no wallet configured. Run \`npx @aifinpay/mcp init\` once ` +
165
+ `for a persistent one; starting with a throwaway identity for now.\n`,
166
+ );
167
+ }
168
+ }
169
+
170
+ const { StdioServerTransport } = await import("@modelcontextprotocol/sdk/server/stdio.js");
171
+ const { createServer, loadConfigFromEnv } = await import("../dist/index.js");
15
172
 
16
173
  const { server } = await createServer(loadConfigFromEnv());
17
174
  const transport = new StdioServerTransport();
@@ -1 +1 @@
1
- {"version":3,"file":"payable-fetch.d.ts","sourceRoot":"","sources":["../../src/tools/payable-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqD/B;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;GA6D9B"}
1
+ {"version":3,"file":"payable-fetch.d.ts","sourceRoot":"","sources":["../../src/tools/payable-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,wBAAgB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsD/B;AAED,wBAAsB,eAAe,CACnC,GAAG,EAAE,WAAW,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;;;;;;;;;;;GA8F9B"}
@@ -7,9 +7,10 @@ export function payableFetchTool() {
7
7
  "without being able to settle it. " +
8
8
  "Natural-language triggers: 'fetch <paid URL>', 'pay for <url>', " +
9
9
  "'try this URL — it might be paid', 'pay the 402 and get the response'. " +
10
- "The agent automatically detects the x402 facilitator flavor (AiFinPay " +
11
- "or Coinbase x402), signs a payment from the agent's wallet, retries, " +
12
- "and returns the response status, headers, and body. For known " +
10
+ "The agent automatically detects the protocol — the AIFP-1 gateway " +
11
+ "(gateway.aifinpay.io) or an x402 facilitator (AiFinPay or Coinbase " +
12
+ "x402) — pays from the agent's wallet, retries, and returns the response " +
13
+ "status, headers, and body. For known " +
13
14
  "AiFinPay-registered providers (exa, io-net, venice, ...), prefer " +
14
15
  "`agent_call` instead — it's higher-level and resolves the bridge URL " +
15
16
  "from the registry.",
@@ -60,20 +61,47 @@ export async function runPayableFetch(ctx, args) {
60
61
  const maxAmountUsd = typeof args.max_amount_usd === "number"
61
62
  ? args.max_amount_usd
62
63
  : ctx.config.maxAmountUsd;
64
+ const forcedFacilitator = typeof args.facilitator === "string" ? args.facilitator : undefined;
63
65
  try {
64
- // Legacy URL-keyed path lives on the wrapped Solana-side Agent. For
65
- // registry-resolved Polygon-native calls prefer the `agent_call` tool.
66
- const resp = await ctx.agent.inner.pay(url, {
67
- method,
68
- body,
69
- headers,
70
- options: {
71
- maxAmountUsd,
72
- facilitator: typeof args.facilitator === "string"
73
- ? args.facilitator
74
- : undefined,
75
- },
76
- });
66
+ // Two payment protocols answer a 402 here, and this tool used to speak only
67
+ // one of them.
68
+ //
69
+ // AIFP-1 gateway (gateway.aifinpay.io/{slug}/…): quote → settle on-chain →
70
+ // receipt → retry. Lives on the unified agent as fetchPaid().
71
+ // x402 facilitators (AiFinPay / Coinbase): the X-PAYMENT header flow, on
72
+ // the wrapped Solana-side agent as inner.pay().
73
+ //
74
+ // Before this, payable_fetch called inner.pay() only, so an MCP agent
75
+ // pointed at a gateway URL got stuck on the 402 it could not read — the
76
+ // single most common paid surface we run (AIFINP-118 neighbour).
77
+ //
78
+ // Routing, safe by construction: fetchPaid() is documented to return a
79
+ // non-AIFP-1 402 UNTOUCHED and cost nothing, so trying it first can pay an
80
+ // AIFP-1 URL but can never mis-pay an x402 one. Anything it hands back still
81
+ // 402 falls through to the x402 path. A caller who forces a facilitator has
82
+ // stated x402 intent, so skip AIFP-1 entirely for them.
83
+ let resp = null;
84
+ if (!forcedFacilitator) {
85
+ resp = await ctx.agent.fetchPaid(url, { method, body, headers });
86
+ if (resp === null) {
87
+ // Budget cap hit with on_limit_exceeded="skip" — do NOT then try to pay
88
+ // the same call via x402; that would defeat the cap the caller set.
89
+ return errorResult("payment skipped: the per-call or daily budget cap was reached " +
90
+ "(on_limit_exceeded is set to skip).");
91
+ }
92
+ if (resp.status === 402) {
93
+ // Not an AIFP-1 gateway 402 — fetchPaid passed it through. Try x402.
94
+ resp = null;
95
+ }
96
+ }
97
+ if (resp === null) {
98
+ resp = await ctx.agent.inner.pay(url, {
99
+ method,
100
+ body,
101
+ headers,
102
+ options: { maxAmountUsd, facilitator: forcedFacilitator },
103
+ });
104
+ }
77
105
  const respHeaders = {};
78
106
  resp.headers.forEach((v, k) => (respHeaders[k] = v));
79
107
  const text = await resp.text();
@@ -1 +1 @@
1
- {"version":3,"file":"payable-fetch.js","sourceRoot":"","sources":["../../src/tools/payable-fetch.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,gBAAgB;IAC9B,OAAO;QACL,IAAI,EAAE,eAAe;QACrB,WAAW,EACT,sEAAsE;YACtE,uEAAuE;YACvE,uEAAuE;YACvE,mCAAmC;YACnC,kEAAkE;YAClE,yEAAyE;YACzE,wEAAwE;YACxE,uEAAuE;YACvE,gEAAgE;YAChE,mEAAmE;YACnE,uEAAuE;YACvE,oBAAoB;QACtB,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,E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C,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACrD,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAE/B,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,MAAM,EAAE,IAAI,CAAC,MAAM;wBACnB,EAAE,EAAE,IAAI,CAAC,EAAE;wBACX,OAAO,EAAE,WAAW;wBACpB,IAAI,EAAE,IAAI;qBACX,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,MAAM,GAAG,GAAG,CAAU,CAAC;QACvB,OAAO,WAAW,CAChB,GAAG,GAAG,CAAC,WAAW,CAAC,IAAI,KAAK,GAAG,CAAC,OAAO,EAAE,EACzC,qBAAqB,GAAG,CAAC,KAAK,CAAC,aAAa,0BAA0B;YACpE,+DAA+D;YAC/D,gCAAgC,CACnC,CAAC;IACJ,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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aifinpay/mcp",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "Pay-per-call MCP server for autonomous AI agents \u2014 installs in Claude Desktop / Cursor / Continue with one config block; on-chain settlement on Polygon and Solana via x402.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -26,22 +26,45 @@
26
26
  "prepublishOnly": "npm run build"
27
27
  },
28
28
  "keywords": [
29
+ "aifinpay",
29
30
  "mcp",
30
31
  "model-context-protocol",
31
32
  "mcp-server",
33
+ "mcp-payments",
34
+ "mcp-monetization",
35
+ "paid-mcp-tools",
36
+ "x402-mcp",
37
+ "pay-per-call",
38
+ "paid-ai-tools",
32
39
  "claude-desktop",
33
40
  "claude-mcp",
34
41
  "cursor",
35
42
  "windsurf",
36
43
  "ai-agent",
37
44
  "ai-agents",
45
+ "ai-payments",
46
+ "ai-agent-payments",
38
47
  "agentic-ai",
39
48
  "autonomous-agents",
49
+ "autonomous-payments",
40
50
  "agent-payments",
41
51
  "agent-commerce",
52
+ "agentic-commerce",
53
+ "agent-economy",
54
+ "ai-commerce",
55
+ "ai-payment-infrastructure",
56
+ "ai-financial-infrastructure",
42
57
  "x402",
58
+ "x402-payments",
59
+ "http-402",
43
60
  "payments",
61
+ "api-payments",
62
+ "api-monetization",
63
+ "machine-payments",
64
+ "m2m-payments",
65
+ "programmable-payments",
44
66
  "crypto-payments",
67
+ "stablecoin-payments",
45
68
  "polygon",
46
69
  "solana",
47
70
  "non-custodial",
@@ -58,7 +81,9 @@
58
81
  "bugs": "https://github.com/AiFinPay/sdk/issues",
59
82
  "dependencies": {
60
83
  "@aifinpay/agent": "^1.8.1",
61
- "@modelcontextprotocol/sdk": "^1.0.0"
84
+ "@modelcontextprotocol/sdk": "^1.0.0",
85
+ "bs58": "^6.0.0",
86
+ "tweetnacl": "^1.0.3"
62
87
  },
63
88
  "devDependencies": {
64
89
  "@types/node": "^20.0.0",