agent402-mcp 0.13.4 → 0.13.5
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 +2 -2
- package/index.js +15 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Your agent gets browser rendering, screenshots, PDF text extraction, URL→markd
|
|
|
10
10
|
MCP server - e.g. claude.ai → Settings → Connectors → Add custom connector. The
|
|
11
11
|
pure-CPU tools run free there (rate-limited), and the paid tools are payable
|
|
12
12
|
right on the connector over [MPP](https://agent402.tools/what-is-mpp): a paid
|
|
13
|
-
call answers
|
|
13
|
+
call answers with a tool result carrying the challenges in `_meta["org.paymentauth/payment-required"]` (`-32043` if a presented credential was refused), and an MCP client
|
|
14
14
|
wrapped with `mppx`'s `McpClient.wrap()` (USDC on Base/Celo, or native Tempo)
|
|
15
15
|
pays and retries on its own, receipt in `_meta`. For no rate limit, or to pay
|
|
16
16
|
over x402 or by card instead, run this package locally:
|
|
@@ -43,7 +43,7 @@ With prepaid card credits (no wallet) - buy a pack at https://agent402.tools/cre
|
|
|
43
43
|
}
|
|
44
44
|
```
|
|
45
45
|
|
|
46
|
-
Without a wallet or credits key - the
|
|
46
|
+
Without a wallet or credits key - the 150+ pure-CPU tools work free via proof-of-work (the network/browser/memory tools will ask for a wallet or a credits key):
|
|
47
47
|
|
|
48
48
|
```json
|
|
49
49
|
{
|
package/index.js
CHANGED
|
@@ -271,6 +271,20 @@ async function quotedUsd(url, init, listUsd) {
|
|
|
271
271
|
} catch { return listUsd; /* fail-open to the advertised price */ }
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
+
// A refused call's tool text. A 402 body from an x402 v2 seller may also carry
|
|
275
|
+
// the whole PaymentRequired offer (this server copies its PAYMENT-REQUIRED
|
|
276
|
+
// header into the body), which is kilobytes of accepts and extension schemas
|
|
277
|
+
// an agent cannot act on in text. Keep the refusal's own fields (error,
|
|
278
|
+
// reason, hint, retry) and say where the offer is; any other body is returned
|
|
279
|
+
// as it came.
|
|
280
|
+
function failureText(status, text) {
|
|
281
|
+
let doc;
|
|
282
|
+
try { doc = JSON.parse(text); } catch { return text; }
|
|
283
|
+
if (!doc || typeof doc !== "object" || Array.isArray(doc) || typeof doc.x402Version !== "number") return text;
|
|
284
|
+
const { x402Version: _v, resource: _r, accepts, extensions: _e, ...rest } = doc;
|
|
285
|
+
return JSON.stringify({ ...rest, status, paymentOptions: Array.isArray(accepts) ? accepts.length : 0, note: "The full offer is in the PAYMENT-REQUIRED header of this 402." });
|
|
286
|
+
}
|
|
287
|
+
|
|
274
288
|
async function callEndpoint(tool, args = {}) {
|
|
275
289
|
const url = new URL(`${BASE}${tool.path}`);
|
|
276
290
|
const init = { method: tool.method, headers: { Accept: "application/json" } };
|
|
@@ -349,7 +363,7 @@ async function callEndpoint(tool, args = {}) {
|
|
|
349
363
|
}
|
|
350
364
|
const text = await res.text();
|
|
351
365
|
if (res.status >= 400) {
|
|
352
|
-
return { content: [{ type: "text", text }], isError: true };
|
|
366
|
+
return { content: [{ type: "text", text: failureText(res.status, text) }], isError: true };
|
|
353
367
|
}
|
|
354
368
|
let parsed;
|
|
355
369
|
try { parsed = JSON.parse(text); } catch { parsed = { raw: text }; }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent402-mcp",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.5",
|
|
4
4
|
"mcpName": "io.github.MikeyPetrillo/agent402",
|
|
5
5
|
"author": "Havok Holdings LLC <mike@agent402.tools> (https://agent402.tools)",
|
|
6
6
|
"homepage": "https://agent402.tools",
|
|
@@ -69,12 +69,12 @@
|
|
|
69
69
|
],
|
|
70
70
|
"license": "MIT",
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@modelcontextprotocol/sdk": "^1.30.
|
|
72
|
+
"@modelcontextprotocol/sdk": "^1.30.1",
|
|
73
73
|
"@solana/kit": "^5.1.0",
|
|
74
|
-
"@x402/core": "2.
|
|
75
|
-
"@x402/evm": "2.
|
|
76
|
-
"@x402/fetch": "2.
|
|
77
|
-
"@x402/svm": "2.
|
|
74
|
+
"@x402/core": "2.27.0",
|
|
75
|
+
"@x402/evm": "2.27.0",
|
|
76
|
+
"@x402/fetch": "2.27.0",
|
|
77
|
+
"@x402/svm": "2.27.0",
|
|
78
78
|
"viem": "^2.21.0"
|
|
79
79
|
},
|
|
80
80
|
"overrides": {
|