agentpay-mcp 4.1.1 → 4.1.4

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.
Files changed (34) hide show
  1. package/README.md +262 -2
  2. package/dist/index.js +19 -0
  3. package/dist/index.js.map +1 -1
  4. package/dist/tools/otel-budget.d.ts +265 -0
  5. package/dist/tools/otel-budget.d.ts.map +1 -0
  6. package/dist/tools/otel-budget.js +399 -0
  7. package/dist/tools/otel-budget.js.map +1 -0
  8. package/dist/tools/session.d.ts.map +1 -1
  9. package/dist/tools/session.js +2 -0
  10. package/dist/tools/session.js.map +1 -1
  11. package/dist/tools/x402.d.ts.map +1 -1
  12. package/dist/tools/x402.js +58 -0
  13. package/dist/tools/x402.js.map +1 -1
  14. package/dist/utils/client.d.ts.map +1 -1
  15. package/dist/utils/client.js +8 -1
  16. package/dist/utils/client.js.map +1 -1
  17. package/dist/utils/x402-networks.d.ts +12 -0
  18. package/dist/utils/x402-networks.d.ts.map +1 -0
  19. package/dist/utils/x402-networks.js +30 -0
  20. package/dist/utils/x402-networks.js.map +1 -0
  21. package/docs/channel-agent-affiliate-controls.md +142 -0
  22. package/docs/hitl-reference-architecture.md +140 -0
  23. package/docs/security-posture.md +74 -0
  24. package/docs/trust-architecture.md +127 -0
  25. package/docs/vercel-deployment-hardening.md +115 -0
  26. package/docs/whatsapp-smb-agent-controls.md +130 -0
  27. package/docs/x402-batch-settlement-channels.md +199 -0
  28. package/docs/x402-bazaar-observability.md +209 -0
  29. package/docs/x402-chain-drift-compatibility.md +63 -0
  30. package/docs/x402-mcp-funding-ux-benchmark.md +36 -0
  31. package/docs/x402-multi-sdk-batch-settlement-parity.md +167 -0
  32. package/docs/x402-scanner-readiness.md +110 -0
  33. package/docs/x402-tvm-readiness.md +53 -0
  34. package/package.json +6 -5
@@ -0,0 +1,63 @@
1
+ # x402 chain-drift compatibility note and test plan
2
+
3
+ x402 paywall templates are moving faster than static client examples. The risk is simple: a paid-agent demo assumes yesterday's chain list, then a PaymentWrapper or paywall update emits payment metadata for a chain the client does not recognize.
4
+
5
+ AgentPay MCP must not silently coerce unknown x402 chains to Base. The package now depends on `viem` `^2.47.12`, matching or exceeding the x402 Foundation paywall-template baseline that added Mezo, MegaETH, Stable, and Radius chain definitions.
6
+
7
+ ## Current boundary
8
+
9
+ AgentPay MCP `4.1.4` supports Base Mainnet and Base Sepolia for the core configured wallet client. Other tools in the repo support broader token, bridge, and swap surfaces, but x402 payment execution should treat unsupported chains as a fail-closed condition until the chain is explicitly mapped, tested, and funded.
10
+
11
+ This is safer than guessing. A failed payment is recoverable. A wrong-chain signature is not.
12
+
13
+ ## Chains to watch
14
+
15
+ Track x402 Foundation paywall and PaymentWrapper changes for these chain definitions:
16
+
17
+ - Mezo
18
+ - MegaETH
19
+ - Stable
20
+ - Radius
21
+ - Any new `viem/chains` entry that appears in x402 paywall templates before AgentPay MCP docs or tests mention it
22
+
23
+ ## Compatibility requirements
24
+
25
+ - Parse the chain or network value from x402 payment metadata without assuming Base.
26
+ - Match known networks to explicit AgentPay MCP chain configuration.
27
+ - Reject unknown networks with a clear error that names the unsupported chain.
28
+ - Never fall back to `8453` when the server requested a different chain.
29
+ - Keep docs, tests, and package examples aligned with the current x402 Foundation template set.
30
+
31
+ ## Test coverage
32
+
33
+ `tests/chain-drift.test.ts` is the current smoke gate. It verifies that the installed `viem/chains` baseline exposes Mezo, MegaETH, Stable, and Radius, then verifies that AgentPay MCP still rejects those chain IDs instead of routing them through Base.
34
+
35
+ Future fixture-driven tests for x402 payment metadata should use this shape:
36
+
37
+ ```ts
38
+ const paymentRequirements = [
39
+ { network: "base", chainId: 8453, shouldPay: true },
40
+ { network: "base-sepolia", chainId: 84532, shouldPay: true },
41
+ { network: "mezo", shouldPay: false },
42
+ { network: "megaeth", shouldPay: false },
43
+ { network: "stable", shouldPay: false },
44
+ { network: "radius", shouldPay: false },
45
+ ];
46
+ ```
47
+
48
+ Expected results:
49
+
50
+ - `base` and `base-sepolia` route only when the configured wallet, token registry, RPC URL, and policy allow them.
51
+ - Mezo, MegaETH, Stable, and Radius return `Unsupported x402 network` until explicit support lands.
52
+ - The error includes the requested network and the configured network.
53
+ - Tests assert that the signing function is not called for unsupported networks.
54
+
55
+ ## Release gate
56
+
57
+ Before any future AgentPay MCP release claiming new x402 chain support:
58
+
59
+ 1. Update the chain map and explorer map.
60
+ 2. Add payment metadata fixtures from the current x402 Foundation paywall templates.
61
+ 3. Run unit tests for accept, deny, cancel, cap exceeded, and unknown chain paths.
62
+ 4. Run `npm run typecheck`, `npm test`, `npm run build`, and `npm pack --dry-run`.
63
+ 5. Update this document with the supported network set and validation date.
@@ -0,0 +1,36 @@
1
+ # x402 MCP funding UX benchmark
2
+
3
+ A new public repo, `yayashuxue/agent-marketplace-mcp`, is testing an x402-paid MCP server with hosted funding UX, local hot-wallet generation, optional Coinbase-managed mode, and Smithery hosting metadata. As of 2026-05-01 04:48 CT, `npm view agent-marketplace-mcp` returned 404, so this benchmark treats it as a public repo signal, not as a live npm package.
4
+
5
+ The signal matters because paid MCP builders are moving funding into the product pitch. AgentPay MCP should make the tradeoff clear: fast top-up is useful, but production agents need approval gates, daily caps, auditability, and a non-custodial posture before they can spend real budgets.
6
+
7
+ ## Comparison
8
+
9
+ | Area | AgentPay MCP | agent-marketplace-mcp signal |
10
+ |------|--------------|------------------------------|
11
+ | Funding model | Bring a funded non-custodial Agent Wallet. Funding can happen through any wallet workflow the operator approves. | Public README describes a hosted fund link and optional managed wallet mode. |
12
+ | Approval gates | Payment tools are designed to sit behind human approval, policy checks, and per-call caps before signing. | The repo emphasizes easier funding. Approval gating is not the main product claim in the observed public metadata. |
13
+ | Daily caps | AgentPay MCP exposes spend limits and budget checks as first-class controls before paid tool use. | Funding UX may reduce onboarding friction, but a funded wallet still needs enforceable spend caps. |
14
+ | Auditability | AgentPay MCP records payment amount, recipient, network, transaction hash, and history through wallet activity tools. | Hosted top-up can help users fund faster, but operators still need agent-level audit rows for every paid call. |
15
+ | Custody posture | Non-custodial by default. The agent signs with its configured wallet key and policy layer. | Optional Coinbase-managed mode may be easier for onboarding, but it changes custody and operational risk assumptions. |
16
+ | Failure mode | Unsupported chains and unsupported x402 requirements fail closed. | Hosted funding does not remove the need to reject unsupported networks, assets, payees, and settlement paths. |
17
+
18
+ ## Safe funding UX for AgentPay MCP
19
+
20
+ AgentPay MCP should keep funding easy without weakening spend controls:
21
+
22
+ 1. Show wallet funding status before a paid tool call.
23
+ 2. Link to operator-approved funding instructions, not an automatic top-up that bypasses review.
24
+ 3. Require an approval gate before the first payment to a new service or payee.
25
+ 4. Enforce per-call and daily caps before signing.
26
+ 5. Log each payment with service, URL, amount, asset, recipient, network, transaction hash, and policy version.
27
+ 6. Fail closed for unsupported networks, including TVM/TON exact-payment offers.
28
+ 7. Keep managed-wallet mode as an explicit integration choice, not a silent default.
29
+
30
+ ## Buyer guidance
31
+
32
+ Pick hosted funding when the goal is a fast demo and the budget is small.
33
+
34
+ Pick AgentPay MCP when a production agent needs to prove who approved the spend, how much it can spend per call, what daily ceiling applies, which wallet signed, and where the receipt lives.
35
+
36
+ Funding UX gets the wallet ready. Spend governance decides whether the agent is allowed to use it.
@@ -0,0 +1,167 @@
1
+ # x402 multi-SDK batch-settlement parity for AgentPay MCP
2
+
3
+ x402 Foundation PR #2164 extends the batch-settlement work from the TypeScript branch into Go client, server, facilitator, and e2e paths. That changes the AgentPay MCP compatibility bar. Paid MCP providers should not prove batch-settlement safety with one SDK only.
4
+
5
+ The minimum proof now needs TypeScript and Go clients to produce the same channel-state evidence for deposits, vouchers, recovery, refunds, claims, and final settlement.
6
+
7
+ ## Compatibility target
8
+
9
+ AgentPay MCP should treat multi-SDK batch settlement as one shared channel lifecycle with SDK-specific implementations.
10
+
11
+ A provider is compatible only when a TypeScript client and a Go client can both show:
12
+
13
+ - the same `channelId` derivation inputs for payer, `payerAuthorizer`, receiver, `receiverAuthorizer`, token, network, withdraw delay, and salt,
14
+ - the same policy approval gate before deposit or top-up,
15
+ - the same cumulative voucher cap checks before every voucher signature,
16
+ - the same recovery behavior after a corrective 402,
17
+ - the same refund and claim audit rows,
18
+ - the same proof bundle shape for paid MCP operators.
19
+
20
+ If one SDK emits less state than another, use the stricter shape. Do not let a Go integration skip an audit row that the TypeScript path already records, or vice versa.
21
+
22
+ ## Cross-SDK channel identity
23
+
24
+ PR #2164 adds Go batch-settlement examples and e2e wiring around `CHANNEL_SALT`. AgentPay MCP should use the salt as part of the channel identity record, not as a test-only detail.
25
+
26
+ Store this channel identity before signing any voucher:
27
+
28
+ ```json
29
+ {
30
+ "event_type": "x402_batch_sdk_parity_channel",
31
+ "sdk": "go",
32
+ "sdk_version": "pr-2164-head",
33
+ "channel_id": "0xchannel",
34
+ "network": "eip155:84532",
35
+ "token": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
36
+ "payer_hash": "sha256:...",
37
+ "payer_authorizer_hash": "sha256:...",
38
+ "receiver_hash": "sha256:...",
39
+ "receiver_authorizer_hash": "sha256:...",
40
+ "withdraw_delay_seconds": 86400,
41
+ "channel_salt_hash": "sha256:...",
42
+ "channel_config_hash": "sha256:...",
43
+ "policy_version": "agentpay-policy-2026-04-30"
44
+ }
45
+ ```
46
+
47
+ The `channel_config_hash` must be computed from the normalized config fields, not from a raw SDK struct dump. Field order and JSON tags differ across languages.
48
+
49
+ ## Phased e2e proof
50
+
51
+ PR #2164 adds fixed batch-settlement phases for e2e clients:
52
+
53
+ - `initial`: deposit plus first voucher,
54
+ - `recovery-refund`: corrective recovery voucher plus cooperative refund,
55
+ - `full`: deposit, voucher, and refund in one flow.
56
+
57
+ AgentPay MCP test evidence should preserve the same phase names. Each phase needs one proof row per SDK:
58
+
59
+ ```json
60
+ {
61
+ "event_type": "x402_batch_sdk_parity_phase",
62
+ "phase": "recovery-refund",
63
+ "sdk": "go",
64
+ "mcp_tool": "agentpay.x402_pay",
65
+ "channel_id": "0xchannel",
66
+ "deposit_tx": "0x...",
67
+ "voucher_signature_hash": "sha256:...",
68
+ "recovery_error_code": "batch_settlement_cumulative_amount_mismatch",
69
+ "refund_tx": "0x...",
70
+ "storage_version_before": "42",
71
+ "storage_version_after": "43",
72
+ "result": "passed"
73
+ }
74
+ ```
75
+
76
+ A provider can run more phases, but it should not rename these three. Stable phase names make cross-SDK failures searchable in CI and production incident logs.
77
+
78
+ ## Voucher signer separation
79
+
80
+ The Go client path adds optional `EVM_VOUCHER_SIGNER_PRIVATE_KEY`, matching the TypeScript direction where the payer key and voucher signer can be separated.
81
+
82
+ AgentPay MCP should record signer separation as a first-class policy fact:
83
+
84
+ - payer key signs deposits and channel funding authorizations,
85
+ - voucher signer signs repeat-call vouchers as `payerAuthorizer`,
86
+ - receiver authorizer signs claim and refund settlement actions,
87
+ - facilitator wallet submits on-chain settlement transactions.
88
+
89
+ A dedicated voucher signer is allowed only when policy records the delegated signer address and its scope. It must not inherit all payer permissions by accident.
90
+
91
+ Fail closed when:
92
+
93
+ - `payerAuthorizer` changes without a fresh approval,
94
+ - `EVM_VOUCHER_SIGNER_PRIVATE_KEY` appears in a provider runtime where voucher delegation is not expected,
95
+ - a voucher signer can also move funds directly from the payer wallet,
96
+ - the SDK reports a payer authorizer address that does not match the approved delegation.
97
+
98
+ ## Facilitator and receiver authorizer expectations
99
+
100
+ Go examples add facilitator and server authorizer paths. AgentPay MCP should distinguish three operational roles:
101
+
102
+ 1. Receiver: the payee address used for the channel.
103
+ 2. Receiver authorizer: the key that signs claim and refund payloads.
104
+ 3. Facilitator signer: the key that submits or sponsors on-chain settlement actions.
105
+
106
+ For production paid MCP providers, the safest path is a self-managed receiver authorizer controlled by the provider, with facilitator rotation treated as operational infrastructure. Delegating receiver authorization to a facilitator is acceptable for demos, but it should be logged as higher operational risk.
107
+
108
+ Audit rows must include hashed receiver authorizer and facilitator identity fields. A matching receiver address is not enough proof.
109
+
110
+ ## Refund and recovery visibility
111
+
112
+ The Go e2e path makes recovery and refund behavior explicit. AgentPay MCP should expose the same visibility in provider logs:
113
+
114
+ - corrective 402 code,
115
+ - server-reported cumulative charge,
116
+ - client-local cumulative charge before recovery,
117
+ - recovered voucher hash,
118
+ - refund amount requested,
119
+ - outstanding signed max claimable before refund,
120
+ - claim-before-refund decision,
121
+ - refund transaction or pending status.
122
+
123
+ A refund that hides outstanding voucher state is not production-safe. The operator needs to know whether the server claimed first, refunded the unclaimed remainder, retried, or failed.
124
+
125
+ ## Cross-SDK proof bundle
126
+
127
+ Before enabling batch-settlement for a paid MCP provider, require a proof bundle with this shape:
128
+
129
+ ```json
130
+ {
131
+ "provider": "paid-mcp-provider.example",
132
+ "x402_pr_reference": "https://github.com/x402-foundation/x402/pull/2164",
133
+ "agentpay_doc_reference": "docs/x402-multi-sdk-batch-settlement-parity.md",
134
+ "sdk_matrix": [
135
+ {
136
+ "sdk": "typescript",
137
+ "phases": ["initial", "recovery-refund", "full"],
138
+ "voucher_signer_separation": true,
139
+ "receiver_authorizer_pinned": true,
140
+ "cas_storage_proven": true,
141
+ "refund_recovery_rows_present": true
142
+ },
143
+ {
144
+ "sdk": "go",
145
+ "phases": ["initial", "recovery-refund", "full"],
146
+ "voucher_signer_separation": true,
147
+ "receiver_authorizer_pinned": true,
148
+ "cas_storage_proven": true,
149
+ "refund_recovery_rows_present": true
150
+ }
151
+ ],
152
+ "acceptance": "passed"
153
+ }
154
+ ```
155
+
156
+ The proof should link to CI output or a local validation artifact. Screenshots are not enough.
157
+
158
+ ## Acceptance checklist
159
+
160
+ - [ ] TypeScript and Go runs use the same normalized channel identity fields.
161
+ - [ ] `CHANNEL_SALT` is recorded in hashed form and tied to the `channelId` proof.
162
+ - [ ] `initial`, `recovery-refund`, and `full` phase results are logged per SDK.
163
+ - [ ] `EVM_VOUCHER_SIGNER_PRIVATE_KEY` or equivalent delegation is recorded as `payerAuthorizer` scope, not broad payer authority.
164
+ - [ ] Receiver authorizer and facilitator signer roles are logged separately.
165
+ - [ ] Corrective 402 recovery rows include before and after cumulative state.
166
+ - [ ] Refund rows include outstanding signed max claimable and claim-before-refund behavior.
167
+ - [ ] The provider can hand operators one proof bundle that compares TypeScript and Go results side by side.
@@ -0,0 +1,110 @@
1
+ # x402 scanner-readiness recipe for AgentPay MCP
2
+
3
+ External scanners now need a cheap way to answer one question before they spend engineering time on a paid endpoint: does this service speak x402, and where is the protected endpoint?
4
+
5
+ This recipe makes that answer machine-readable without giving agents unlimited spending authority.
6
+
7
+ ## What to expose
8
+
9
+ A scanner-ready AgentPay MCP demo should expose a dedicated, clean 402 probe route first:
10
+
11
+ 1. `/api/x402/demo` returns `402 Payment Required` with `PAYMENT-REQUIRED` and x402 payment metadata. This is the scanner target.
12
+ 2. `X-X402-Supported: true` on the service home page or docs landing page points humans and crawlers to x402 support.
13
+ 3. A `sitemap.xml`, docs page, or `Link` header lists `/api/x402/demo` so crawlers do not have to guess paths.
14
+
15
+ Do not rely on headers, sitemap entries, or Link headers alone. The x402 Foundation scanner path changed after `/protected`, sitemap discovery, `Link` headers, and `X-X402-Supported` did not give isitagentready.com a stable pass. A clean API-style 402 route is now the recommended readiness signal.
16
+
17
+ The scanner route is not the payment control. It is a discovery layer. AgentPay MCP still owns approval, policy checks, spend caps, wallet signing, settlement audit rows, and fail-closed behavior.
18
+
19
+ ## Minimal HTTP pattern
20
+
21
+ ```ts
22
+ import http from "node:http";
23
+
24
+ const demoUrl = "https://agentpay.example.com/api/x402/demo";
25
+
26
+ http.createServer((request, response) => {
27
+ response.setHeader("X-X402-Supported", "true");
28
+
29
+ if (request.url === "/sitemap.xml") {
30
+ response.setHeader("Content-Type", "application/xml");
31
+ response.end(`<?xml version="1.0" encoding="UTF-8"?>
32
+ <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
33
+ <url><loc>${demoUrl}</loc></url>
34
+ </urlset>`);
35
+ return;
36
+ }
37
+
38
+ if (request.url === "/api/x402/demo") {
39
+ response.writeHead(402, {
40
+ "Content-Type": "application/json",
41
+ "X-X402-Supported": "true",
42
+ });
43
+ response.end(JSON.stringify({
44
+ error: "Payment Required",
45
+ x402Version: "2",
46
+ accepts: [{
47
+ scheme: "exact",
48
+ network: "base",
49
+ amount: "10000",
50
+ asset: "USDC",
51
+ resource: demoUrl,
52
+ }],
53
+ }));
54
+ return;
55
+ }
56
+
57
+ response.writeHead(200, { "Content-Type": "text/plain" });
58
+ response.end("AgentPay MCP demo. See /sitemap.xml and /api/x402/demo.\n");
59
+ }).listen(8787);
60
+ ```
61
+
62
+ ## Runnable demo
63
+
64
+ A minimal Node route lives at `examples/x402-clean-demo/server.mjs`. It is intentionally small so teams can copy the scanner contract without copying wallet logic into the demo endpoint.
65
+
66
+ ```bash
67
+ node examples/x402-clean-demo/server.mjs
68
+ curl -si http://127.0.0.1:8787/api/x402/demo | head -n 12
69
+ ```
70
+
71
+ Expected result: HTTP `402`, `PAYMENT-REQUIRED: true`, `X-X402-Supported: true`, and a JSON body with x402 payment metadata.
72
+
73
+ ## AgentPay MCP payment flow
74
+
75
+ 1. Scanner calls `/api/x402/demo` and receives `402 Payment Required` plus x402 payment metadata.
76
+ 2. Human readers and crawlers can also see `X-X402-Supported: true` on `/`.
77
+ 3. Sitemap or `Link` metadata can point to `/api/x402/demo`, but the clean 402 route is the source of truth.
78
+ 4. The agent calls AgentPay MCP `x402_pay` with the protected URL.
79
+ 5. AgentPay MCP checks policy before signing: daily cap, task cap, recipient allowlist, approval mode, and kill switch.
80
+ 6. Only after approval does AgentPay MCP sign and retry the request.
81
+ 7. The transaction history records URL, amount, chain, token, approval status, and settlement reference.
82
+
83
+ ## Curl verification checklist
84
+
85
+ Run these commands against the demo or deployment:
86
+
87
+ ```bash
88
+ $ curl -si https://agentpay.example.com/ | grep -i '^x-x402-supported:'
89
+ X-X402-Supported: true
90
+
91
+ $ curl -s https://agentpay.example.com/sitemap.xml | grep '/api/x402/demo'
92
+ <url><loc>https://agentpay.example.com/api/x402/demo</loc></url>
93
+
94
+ $ curl -si https://agentpay.example.com/api/x402/demo | head -n 8
95
+ HTTP/2 402
96
+ content-type: application/json
97
+ x-x402-supported: true
98
+ payment-required: true
99
+ ```
100
+
101
+ A scanner pass means discovery works. A production pass means discovery plus AgentPay MCP policy gates both work.
102
+
103
+ ## Acceptance criteria
104
+
105
+ - `/api/x402/demo` returns HTTP 402 before payment.
106
+ - The 402 response includes `PAYMENT-REQUIRED` and x402 payment metadata.
107
+ - Home or docs route returns `X-X402-Supported: true`.
108
+ - Sitemap, docs, or `Link` metadata points to `/api/x402/demo`, but verification does not depend on metadata alone.
109
+ - `x402_pay` cannot sign until AgentPay MCP policy approves the request.
110
+ - Audit output includes resource URL, amount, chain, approval decision, and settlement reference.
@@ -0,0 +1,53 @@
1
+ # x402 TVM exact-payment readiness
2
+
3
+ x402 Foundation PR #1944 is adding Python exact-payment support for TVM and TON-style flows. AgentPay MCP treats that as a watch signal, not as production support.
4
+
5
+ AgentPay MCP currently signs x402 exact payments only on the configured Base network. If a paid endpoint returns a TVM requirement such as `network: "tvm:-3"`, AgentPay MCP fails closed. It does not coerce the payment to Base, it does not attempt a best-effort jetton transfer, and it returns guidance that TVM support must be added deliberately before signing.
6
+
7
+ ## Support matrix
8
+
9
+ | Rail | AgentPay MCP status | Current behavior |
10
+ |------|---------------------|------------------|
11
+ | Base EVM exact payment | Supported | `x402_pay` signs only the configured Base network, applies per-call caps, and records payment details. |
12
+ | Base Sepolia exact payment | Supported for test flows | Same signing path as Base mainnet when `CHAIN_ID=84532`. |
13
+ | Other EVM x402 networks | Watch state | The SDK baseline can see more chains, but AgentPay MCP restricts signing to the configured Base network until each chain has explicit wallet, asset, and audit support. |
14
+ | Solana x402 | Watch state | No AgentPay signing path is enabled. Requests must fail closed until a Solana wallet, token, receipt, and spend-policy path exists. |
15
+ | x402 batch settlement | Documentation and audit recipe | Batch deposit, voucher, refund, claim, recovery, and multi-SDK parity requirements are documented in `x402-batch-settlement-channels.md` and `x402-multi-sdk-batch-settlement-parity.md`. |
16
+ | TVM/TON exact payment | Watch state | Unsupported TVM requirements fail closed with guidance. No TVM signing, account deployment, faucet, gas, jetton, or facilitator settlement path is enabled. |
17
+
18
+ ## Fail-closed invariant
19
+
20
+ AgentPay MCP must never silently treat an unsupported x402 network as compatible.
21
+
22
+ Required behavior:
23
+
24
+ 1. Restrict `createX402Client` to the configured AgentPay network instead of accepting the SDK default network list.
25
+ 2. Return an error when a `402 Payment Required` response has only unsupported payment options.
26
+ 3. Include the offered network list and the supported AgentPay network list in the error.
27
+ 4. For TVM/TON offers, say that TVM is watch-only until signing, account deployment, gas, jettons, settlement, and audit rows are implemented.
28
+ 5. Do not call wallet signing or token transfer code for unsupported networks.
29
+
30
+ ## Current implementation proof
31
+
32
+ The `x402_pay` tool now passes `supportedNetworks` to the x402 client based on `CHAIN_ID`:
33
+
34
+ - `CHAIN_ID=8453` allows only `base:8453`.
35
+ - `CHAIN_ID=84532` allows only `base-sepolia:84532`.
36
+ - `CHAIN_ID=tvm:-3` is rejected during config load with TVM-specific fail-closed guidance.
37
+
38
+ If a server returns HTTP 402 with only `tvm:-3`, the tool returns `Unsupported x402 Payment Requirement - Failed Closed` and includes the offered network.
39
+
40
+ ## What must ship before TVM support turns on
41
+
42
+ TVM support should not be enabled by adding a string to a network list. It needs a complete payment path:
43
+
44
+ - TVM signer support with local key handling.
45
+ - Account deployment and funding checks.
46
+ - Gas and faucet handling for test networks.
47
+ - Jetton asset mapping and decimals.
48
+ - Facilitator verification and settlement-cache handling.
49
+ - Spend-policy checks before signing.
50
+ - Audit rows that record network, asset, amount, payee, facilitator, settlement result, and receipt.
51
+ - Tests for accept, decline, cap exceeded, bad asset, bad payee, settlement failure, and retry behavior.
52
+
53
+ Until those exist, TVM exact-payment requests stay blocked by design.
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "agentpay-mcp",
3
- "version": "4.1.1",
3
+ "version": "4.1.4",
4
4
  "mcpName": "io.github.up2itnow0822/agentpay",
5
- "description": "AgentPay MCP Server Non-custodial x402 payment layer for AI agents. Multi-chain wallets, spending limits, and machine-to-machine payments. Patent Pending.",
5
+ "description": "AgentPay MCP Server - Non-custodial x402 payment layer for AI agents. Multi-chain wallets, spending limits, and machine-to-machine payments. Patent Pending.",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
8
8
  "bin": {
@@ -12,7 +12,8 @@
12
12
  "dist",
13
13
  "README.md",
14
14
  "claude_desktop_config.json",
15
- ".env.example"
15
+ ".env.example",
16
+ "docs/*.md"
16
17
  ],
17
18
  "scripts": {
18
19
  "build": "tsc",
@@ -54,11 +55,11 @@
54
55
  "dependencies": {
55
56
  "@modelcontextprotocol/sdk": "^1.0.4",
56
57
  "agentwallet-sdk": "^6.1.0",
57
- "viem": "2.46.0",
58
+ "viem": "^2.47.12",
58
59
  "zod": "^3.22.4"
59
60
  },
60
61
  "overrides": {
61
- "viem": "2.46.0"
62
+ "viem": "^2.47.12"
62
63
  },
63
64
  "devDependencies": {
64
65
  "@types/node": "^20.11.0",