agent402-mcp 0.10.1 → 0.11.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 +1 -0
- package/index.js +10 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -70,6 +70,7 @@ automatically:
|
|
|
70
70
|
| `AGENT402_TOOLS` | curated set | Comma-separated slugs to expose as first-class tools. |
|
|
71
71
|
| `AGENT402_MAX_PER_CALL` | unlimited | Refuse any single call priced above this many USD (e.g. `0.01`). |
|
|
72
72
|
| `AGENT402_BUDGET` | unlimited | Hard cap on total USDC spent per session (e.g. `1.00`). |
|
|
73
|
+
| `AGENT402_NETWORKS` | _(unset)_ | Restrict + order the chains to pay on — e.g. `robinhood` (USDG on Robinhood Chain), `base,solana`, or a raw CAIP-2 like `eip155:4663`. Unset = the client picks (effectively Base on multi-chain sellers). |
|
|
73
74
|
|
|
74
75
|
Spend controls are enforced **before a payment is signed** — a runaway model is
|
|
75
76
|
refused, not billed. `payment_info` reports the caps, what's been spent, and
|
package/index.js
CHANGED
|
@@ -18,7 +18,10 @@
|
|
|
18
18
|
// AGENT402_TOOLS comma-separated slugs to expose first-class (overrides default)
|
|
19
19
|
// AGENT402_MAX_PER_CALL refuse any single call priced above this many USD (e.g. 0.01)
|
|
20
20
|
// AGENT402_BUDGET hard cap on total USDC spent this session (e.g. 1.00)
|
|
21
|
+
// AGENT402_NETWORKS restrict + order the chains to pay on (e.g. "robinhood" for USDG on
|
|
22
|
+
// Robinhood Chain, "base,solana", or a raw CAIP-2 like eip155:4663) — optional
|
|
21
23
|
import { createHash } from "node:crypto";
|
|
24
|
+
import { parseNetworkPrefs, withNetworkPreference } from "./networks.js";
|
|
22
25
|
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
23
26
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
24
27
|
import {
|
|
@@ -35,7 +38,7 @@ const AGENT_KEY = process.env.AGENT_KEY || "";
|
|
|
35
38
|
// settle on whichever chain the seller offers (EVM accepts are tried first).
|
|
36
39
|
const SOLANA_AGENT_KEY = process.env.SOLANA_AGENT_KEY || "";
|
|
37
40
|
const HAS_WALLET = Boolean(AGENT_KEY || SOLANA_AGENT_KEY);
|
|
38
|
-
const VERSION = "0.
|
|
41
|
+
const VERSION = "0.11.0";
|
|
39
42
|
|
|
40
43
|
// Spend controls — enforced BEFORE a payment is ever signed, so a confused or
|
|
41
44
|
// runaway model cannot drain the wallet. Unset = unlimited (back-compat).
|
|
@@ -123,6 +126,12 @@ function getPayFetch() {
|
|
|
123
126
|
const { registerExactSvmScheme } = await import("@x402/svm/exact/client");
|
|
124
127
|
registerExactSvmScheme(client, { signer: await solanaSigner() });
|
|
125
128
|
}
|
|
129
|
+
// AGENT402_NETWORKS restricts + orders which chains this buyer will pay
|
|
130
|
+
// on (e.g. "robinhood" settles USDG on chain 4663; the accept carries the
|
|
131
|
+
// asset + EIP-712 domain, so the EVM signer needs no special handling).
|
|
132
|
+
// Without it the client effectively always picks Base on multi-chain
|
|
133
|
+
// sellers, leaving non-default rails unreachable.
|
|
134
|
+
withNetworkPreference(client, parseNetworkPrefs(process.env.AGENT402_NETWORKS));
|
|
126
135
|
return wrapFetchWithPayment(fetch, client);
|
|
127
136
|
})();
|
|
128
137
|
return payFetchPromise;
|
package/package.json
CHANGED