thebuyside-x402-agent 0.4.0 → 0.4.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 +77 -29
- package/dist/policy/confirm.d.ts.map +1 -1
- package/dist/policy/confirm.js +33 -0
- package/dist/policy/confirm.js.map +1 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,37 +1,56 @@
|
|
|
1
1
|
# thebuyside-x402-agent
|
|
2
2
|
|
|
3
|
-
The MCP gateway that lets any AI agent discover and pay x402-priced APIs — without the user wiring payments themselves.
|
|
3
|
+
The MCP gateway that lets any AI agent discover and pay x402-priced APIs on Base or Solana — without the user wiring payments themselves.
|
|
4
4
|
|
|
5
5
|
`thebuyside-x402-agent` is the canonical buyer-side reference implementation for [x402](https://x402.org), the HTTP 402 payment standard stewarded by the Linux Foundation. Drop it into Claude Code, Claude Desktop, Cursor, or any MCP client, and your agent gains three tools:
|
|
6
6
|
|
|
7
|
-
- **`x402.discover`** — search
|
|
8
|
-
- **`x402.fetch`** — call one (the gateway pays the 402 challenge automatically)
|
|
9
|
-
- **`x402.wallet_status`** — show the gateway's wallet, today's spend, and caps
|
|
7
|
+
- **`x402.discover`** — search the curated registry plus three federated indexes (CDP Bazaar, agentic.market, x402watch) for x402-priced APIs
|
|
8
|
+
- **`x402.fetch`** — call one (the gateway pays the 402 challenge automatically, on whichever chain you have a key for)
|
|
9
|
+
- **`x402.wallet_status`** — show the gateway's wallet(s), today's spend, and caps
|
|
10
10
|
|
|
11
11
|
The agent never sees the 402, never sees a wallet, never holds a private key.
|
|
12
12
|
|
|
13
13
|
## Status
|
|
14
14
|
|
|
15
|
-
**v0
|
|
15
|
+
**v0.4.1 published to npm 2026-05-10.** Validated end-to-end on both supported chains:
|
|
16
16
|
|
|
17
|
-
> `$0.005 USDC`
|
|
17
|
+
> Base mainnet · `$0.005 USDC` · tx [`0xd0917b35…`](https://basescan.org/tx/0xd0917b35d8b778cf8d0249cc1b107a48ff7125b9fcaf7b4b257d823f73cc6aac)
|
|
18
|
+
>
|
|
19
|
+
> Solana mainnet · `$0.005 USDC` · tx [`4DYWUMEx…`](https://solscan.io/tx/4DYWUMExSrMNxYLjUuH9G8feN4fmYXm4ToCx7gGaAEjJRf2QNrE8LsvoFSGhXwQJrchhgrnGpUFwjxrci9PRLF71)
|
|
18
20
|
|
|
19
|
-
-
|
|
21
|
+
- 122 unit tests + MCP smoke test, all green
|
|
20
22
|
- x402 v1 + v2 dual wire support (handles both transports)
|
|
21
|
-
-
|
|
23
|
+
- Multi-chain: configure either Base (EVM/EIP-3009) or Solana (SVM/SPL-TransferChecked) — or both. Sellers offering multiple chains are routed to whichever you have a signer for. On Solana, the seller's facilitator covers SOL gas — buyer wallet only needs USDC.
|
|
24
|
+
- Federated discovery: `x402.discover` queries the curated `seed.json` + CDP Bazaar + agentic.market + x402watch in parallel and dedupes by canonical endpoint URL
|
|
25
|
+
- Spend caps, host allowlist, receipts log, self-transfer guard
|
|
26
|
+
- Confirm-before-pay via MCP elicitation, with graceful fallback for clients lacking task-creation support (Claude Code)
|
|
22
27
|
- Apache 2.0, DCO not CLA
|
|
23
28
|
|
|
24
29
|
## Quickstart
|
|
25
30
|
|
|
26
|
-
Two steps. You need Node 20+ and a
|
|
31
|
+
Two steps. You need Node 20+ and a wallet funded with USDC on whichever chain you want to pay on.
|
|
27
32
|
|
|
28
|
-
### 1. Set
|
|
33
|
+
### 1. Set at least one wallet key in your environment
|
|
34
|
+
|
|
35
|
+
For Base / EVM:
|
|
29
36
|
|
|
30
37
|
```bash
|
|
31
38
|
export X402_PAYER_PRIVATE_KEY=0x...
|
|
32
39
|
```
|
|
33
40
|
|
|
34
|
-
|
|
41
|
+
0x-prefixed 64-hex-char private key. Fund the wallet with at least `$0.01 USDC` on Base mainnet.
|
|
42
|
+
|
|
43
|
+
For Solana:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
export X402_PAYER_SOLANA_KEY=<base58 secret key>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Accepts either base58 (Phantom's "Show Private Key" export) or the JSON-array format `solana-keygen new` writes. Fund the wallet with at least `$0.01 USDC` (mint `EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v`) on Solana mainnet. **Buyer wallet does not need SOL** — facilitators cover network fees as the transaction's `feePayer`.
|
|
50
|
+
|
|
51
|
+
You can configure either, both, or neither. With neither, the gateway boots and lists tools but can't pay anything. With both, sellers offering multi-chain options are routed by accept order (typically EVM first); to force a specific chain, configure only that key.
|
|
52
|
+
|
|
53
|
+
Use a fresh wallet, not your main one. (You can also pass these via your MCP client's `env` block — see below.)
|
|
35
54
|
|
|
36
55
|
### 2. Register the gateway with your MCP client
|
|
37
56
|
|
|
@@ -57,27 +76,54 @@ Once connected, ask the model:
|
|
|
57
76
|
|
|
58
77
|
> *"Use x402.fetch to get https://news-ep.com/api/v1/stories?market=houston&limit=5"*
|
|
59
78
|
|
|
60
|
-
The first returns the registry. The second pays `$0.005 USDC` and returns Houston news.
|
|
79
|
+
The first returns the registry plus federated matches from CDP Bazaar, agentic.market, and x402watch (each result tagged with its `source`). The second pays `$0.005 USDC` and returns Houston news. news-ep advertises both Base and Solana — the gateway picks whichever chain you have a key for.
|
|
61
80
|
|
|
62
|
-
After a successful call, ask `x402.wallet_status` and you'll see today's spend reflected.
|
|
81
|
+
After a successful call, ask `x402.wallet_status` and you'll see today's spend reflected (and which chains have signers configured).
|
|
63
82
|
|
|
64
83
|
## Configuration
|
|
65
84
|
|
|
66
85
|
Spend controls have safe defaults. Override via env if needed.
|
|
67
86
|
|
|
87
|
+
**Wallet keys** (configure at least one to pay):
|
|
88
|
+
|
|
89
|
+
| Var | Default | What it does |
|
|
90
|
+
| --- | --- | --- |
|
|
91
|
+
| `X402_PAYER_PRIVATE_KEY` | *(unset)* | Base / EVM private key (0x-prefixed, 64 hex chars) |
|
|
92
|
+
| `X402_PAYER_SOLANA_KEY` | *(unset)* | Solana secret key — base58 (Phantom export) or JSON-array (`solana-keygen`) format |
|
|
93
|
+
| `X402_SOLANA_RPC` | `api.mainnet-beta.solana.com` | Solana RPC for fetching a recent blockhash at sign time |
|
|
94
|
+
|
|
95
|
+
**Spend caps and confirm-before-pay:**
|
|
96
|
+
|
|
68
97
|
| Var | Default | What it does |
|
|
69
98
|
| --- | --- | --- |
|
|
70
|
-
| `X402_PAYER_PRIVATE_KEY` | *(required for payment)* | Base-mainnet wallet key (0x-prefixed) |
|
|
71
99
|
| `X402_DAILY_LIMIT` | `1.00` | Max USDC spent per rolling 24h window |
|
|
72
100
|
| `X402_PER_CALL_LIMIT` | `0.05` | Max USDC per single call |
|
|
73
|
-
| `X402_ALLOWLIST` | hosts in `seed.json` | Comma-separated
|
|
101
|
+
| `X402_ALLOWLIST` | hosts in `seed.json` | Comma-separated allowed hostnames (replaces default) |
|
|
74
102
|
| `X402_ALLOW_UNVERIFIED` | *(off)* | `1` allows any host — dev only |
|
|
75
103
|
| `X402_REQUIRE_CONFIRM` | `always` | `always`, `never`, or a USDC threshold (e.g. `0.01`). Asks the user to approve via MCP elicitation before signing |
|
|
76
|
-
| `X402_CONFIRM_STRICT` | *(off)* | `1` refuses payment when the client
|
|
104
|
+
| `X402_CONFIRM_STRICT` | *(off)* | `1` refuses payment when the client lacks elicitation OR advertises elicitation but lacks tasks/create (e.g. Claude Code as of 2026-05). Default: log a one-time warning and proceed |
|
|
77
105
|
| `X402_RECEIPTS_PATH` | `.local/receipts.jsonl` | Where the receipts log is written |
|
|
78
|
-
| `X402_TEST_URL` | news-ep stories | Override target for `pnpm pay-newsep` |
|
|
79
106
|
|
|
80
|
-
|
|
107
|
+
**Federated discovery** (`x402.discover` queries these in parallel and merges with the local `seed.json`):
|
|
108
|
+
|
|
109
|
+
| Var | Default | What it does |
|
|
110
|
+
| --- | --- | --- |
|
|
111
|
+
| `X402_FEDERATION` | `on` | `off` disables all external indexes; discover returns local-only results |
|
|
112
|
+
| `X402_FEDERATION_TIMEOUT_MS` | `1500` | Per-source timeout. A slow source produces zero entries (and a warning), never blocks discover |
|
|
113
|
+
| `X402_BAZAAR_URL` | `api.cdp.coinbase.com/platform/v2/x402/discovery/search` | CDP Bazaar endpoint override |
|
|
114
|
+
| `X402_AGENTIC_URL` | `api.agentic.market/v1/services/search` | agentic.market endpoint override |
|
|
115
|
+
| `X402_X402WATCH_URL` | GitHub raw snapshot URL | x402watch daily snapshot URL (the `{date}` placeholder is filled at request time) |
|
|
116
|
+
| `X402_DISABLE_BAZAAR` | *(off)* | `1` skips CDP Bazaar |
|
|
117
|
+
| `X402_DISABLE_AGENTIC` | *(off)* | `1` skips agentic.market |
|
|
118
|
+
| `X402_DISABLE_X402WATCH` | *(off)* | `1` skips x402watch |
|
|
119
|
+
|
|
120
|
+
**Dev / test:**
|
|
121
|
+
|
|
122
|
+
| Var | Default | What it does |
|
|
123
|
+
| --- | --- | --- |
|
|
124
|
+
| `X402_TEST_URL` | news-ep stories | Override target for `pnpm pay-newsep` and `pnpm pay-solana` |
|
|
125
|
+
|
|
126
|
+
Limit values accept either decimal USDC (`0.05`) or atomic units (`50000`). See [docs/configuring-spend-limits.md](docs/configuring-spend-limits.md) for the full spend-controls guide.
|
|
81
127
|
|
|
82
128
|
## How it works
|
|
83
129
|
|
|
@@ -90,18 +136,19 @@ Limit values accept either decimal USDC (`0.05`) or atomic units (`50000`). See
|
|
|
90
136
|
│ Gateway │ ← src/server.ts (this repo)
|
|
91
137
|
└─────┬─────┘
|
|
92
138
|
│
|
|
93
|
-
│ HTTPS GET → 402 challenge →
|
|
94
|
-
│
|
|
95
|
-
│
|
|
96
|
-
│
|
|
97
|
-
|
|
98
|
-
│
|
|
99
|
-
│
|
|
100
|
-
│
|
|
139
|
+
│ HTTPS GET → 402 challenge → pick chain by signer →
|
|
140
|
+
│ EVM: EIP-3009 typed-data sign ─┐
|
|
141
|
+
│ SVM: partial-sign Solana tx ─┤
|
|
142
|
+
│ → retry with PAYMENT-SIGNATURE │
|
|
143
|
+
│ → 200 + body │
|
|
144
|
+
┌─────▼──────┐ ┌──────────────────┐ │
|
|
145
|
+
│ x402 server│ ──────→ │ Facilitator │ ─→ chain settle
|
|
146
|
+
│ (e.g. │ │ (verify + submit │ (Base USDC
|
|
147
|
+
│ news-ep) │ ←────── │ tx) │ or Solana USDC)
|
|
101
148
|
└────────────┘ └──────────────────┘
|
|
102
149
|
```
|
|
103
150
|
|
|
104
|
-
The gateway holds the wallet, drives the 402 → sign → 200 loop, enforces spend caps, writes a receipts log. The agent stays at the MCP layer and never deals with payment plumbing.
|
|
151
|
+
The gateway holds the wallet(s), drives the 402 → sign → 200 loop, picks the right chain adapter per challenge, enforces spend caps, and writes a receipts log. The agent stays at the MCP layer and never deals with payment plumbing.
|
|
105
152
|
|
|
106
153
|
## Run from source
|
|
107
154
|
|
|
@@ -116,10 +163,11 @@ cp .env.example .env # then paste your key into X402_PAYER_PRIVATE_KEY
|
|
|
116
163
|
|
|
117
164
|
Useful scripts:
|
|
118
165
|
|
|
119
|
-
- **`pnpm pay-newsep`** — standalone script that pays news-ep `$0.005` end-to-end without MCP.
|
|
166
|
+
- **`pnpm pay-newsep`** — standalone script that pays news-ep `$0.005` on Base end-to-end without MCP. Verifies your EVM wallet + protocol setup.
|
|
167
|
+
- **`pnpm pay-solana`** — same idea on Solana. Registers ONLY the Solana adapter so it routes via SVM even when the seller offers Base too. Defaults to a target that advertises Solana; override with `X402_TEST_URL`.
|
|
120
168
|
- **`pnpm smoke`** — spawns the MCP server in a subprocess and round-trips a few tool calls. CI-safe; no real payments.
|
|
121
169
|
- **`pnpm verify-seed`** — hits each registry entry's example URL and asserts a valid 402 with the advertised price. Run nightly in CI.
|
|
122
|
-
- **`pnpm test`** — the full vitest unit-test suite.
|
|
170
|
+
- **`pnpm test`** — the full vitest unit-test suite (122 tests as of v0.4.1).
|
|
123
171
|
- **`pnpm build`** — compiles to `dist/`. Used by `npm publish`.
|
|
124
172
|
|
|
125
173
|
To point your MCP client at the local source instead of the published npm package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KG;IACG,GAAG,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;CA+E7E"}
|
package/dist/policy/confirm.js
CHANGED
|
@@ -96,6 +96,25 @@ export class ConfirmPolicy {
|
|
|
96
96
|
}
|
|
97
97
|
catch (err) {
|
|
98
98
|
const msg = err instanceof Error ? err.message : String(err);
|
|
99
|
+
// Some clients (notably Claude Code as of 2026-05) advertise the
|
|
100
|
+
// elicitation capability in their MCP handshake but lack the
|
|
101
|
+
// tasks/create machinery that elicitInput needs under the hood,
|
|
102
|
+
// so the call throws -32603. Treat that as a capability gap —
|
|
103
|
+
// same fallback path as a client that declared no elicitation
|
|
104
|
+
// at all (warn-and-proceed unless strict mode is set).
|
|
105
|
+
if (isCapabilityGap(msg)) {
|
|
106
|
+
if (this.config.strict) {
|
|
107
|
+
return {
|
|
108
|
+
ok: false,
|
|
109
|
+
reason: `client advertised elicitation but tasks/create unsupported: ${msg}`,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
if (!this.warnedNoElicitation) {
|
|
113
|
+
logger.warn('client advertised elicitation but lacks tasks/create; payments will proceed without per-call confirmation (caps still enforced)', { err: msg });
|
|
114
|
+
this.warnedNoElicitation = true;
|
|
115
|
+
}
|
|
116
|
+
return { ok: true };
|
|
117
|
+
}
|
|
99
118
|
logger.warn('elicitation request failed', { err: msg });
|
|
100
119
|
return { ok: false, reason: `confirmation failed: ${msg}` };
|
|
101
120
|
}
|
|
@@ -132,6 +151,20 @@ function formatPrompt(args) {
|
|
|
132
151
|
lines.push(meta);
|
|
133
152
|
return lines.join('\n');
|
|
134
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Detect MCP-level errors that signal "the client said it supports
|
|
156
|
+
* elicitation but actually doesn't" — `-32603` (server-internal error
|
|
157
|
+
* Claude Code returns for missing task support), `Method not found`
|
|
158
|
+
* (-32601), and a few common phrasings. Anything else is treated as a
|
|
159
|
+
* real failure (transport closed, schema rejection, etc).
|
|
160
|
+
*/
|
|
161
|
+
function isCapabilityGap(msg) {
|
|
162
|
+
return (/-32603/.test(msg) ||
|
|
163
|
+
/tasks?\/create/i.test(msg) ||
|
|
164
|
+
/method not found/i.test(msg) ||
|
|
165
|
+
/does not support/i.test(msg) ||
|
|
166
|
+
/not implemented/i.test(msg));
|
|
167
|
+
}
|
|
135
168
|
/**
|
|
136
169
|
* Render `extensions.*` metadata for the prompt. Currently knows the
|
|
137
170
|
* `bazaar` namespace (CDP Bazaar listings); other namespaces fall through
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"confirm.js","sourceRoot":"","sources":["../../src/policy/confirm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAY/D,MAAM,CAAC,MAAM,oBAAoB,GAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;AAoBpE,MAAM,OAAO,aAAa;IAGI;IAFpB,mBAAmB,GAAG,KAAK,CAAC;IAEpC,YAA4B,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAErD,MAAM,CAAC,OAAO;QACZ,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QACnE,IAAI,IAAiB,CAAC;QACtB,IAAI,GAAG,KAAK,SAAS,IAAI,GAAG,KAAK,EAAE,IAAI,GAAG,KAAK,QAAQ,EAAE,CAAC;YACxD,IAAI,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAC5B,CAAC;aAAM,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,KAAK,EAAE,CAAC;YAC5C,IAAI,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;QAC3B,CAAC;aAAM,CAA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C;IAED,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC;SACpC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,OAAO,CAAC,KAAK,QAAQ,CAAC;SACjE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;SACX,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO,eAAe,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "thebuyside-x402-agent",
|
|
3
|
-
"version": "0.4.
|
|
4
|
-
"description": "Buyer-side x402 MCP gateway — let any agent pay any x402 API without seeing a 402 or a wallet.",
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"description": "Buyer-side x402 MCP gateway — let any agent pay any x402 API on Base or Solana without seeing a 402 or a wallet.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Joshua Harrington",
|
|
7
7
|
"type": "module",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"agents",
|
|
25
25
|
"usdc",
|
|
26
26
|
"base",
|
|
27
|
+
"solana",
|
|
27
28
|
"stablecoin",
|
|
28
29
|
"agent-payments"
|
|
29
30
|
],
|