@zeam-labs/x402-mcp-bridge 2.0.5 → 2.0.6
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 -1
- package/index.mjs +8 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -158,7 +158,7 @@ time and an overlapping tick is refused as `channel_busy`.
|
|
|
158
158
|
| `X402_STATE_DIR` | `~/.x402-mcp-bridge/<host>/<address>` | channel state |
|
|
159
159
|
| `X402_SALT` | scheme default | open a distinct channel. Any string; it is hashed to bytes32 |
|
|
160
160
|
| `X402_MAX_SPEND` | `10000000` (=$10) | ceiling on what **this run** may spend, in micro-USD. `0` removes it — see below |
|
|
161
|
-
| `X402_DEPOSIT_MULTIPLIER` |
|
|
161
|
+
| `X402_DEPOSIT_MULTIPLIER` | *scheme default* | how much **refundable** collateral to lock, as a multiple of the seller's quote for the opening call. Unset, the x402 scheme sizes it (minimum 3); raise it to top up less often, lower it to commit less. It leaves your wallet when you open the channel and comes back on refund — it is not the price. |
|
|
162
162
|
|
|
163
163
|
## It stops spending when you stop watching
|
|
164
164
|
|
package/index.mjs
CHANGED
|
@@ -42,10 +42,9 @@ if (has('--help') || has('-h')) {
|
|
|
42
42
|
'',
|
|
43
43
|
'Env: X402_PRIVATE_KEY (required), X402_MCP_URL (X402_UPSTREAM also accepted),',
|
|
44
44
|
' X402_MAX_SPEND (0 = no cap; base units of the paid asset if the server publishes no price),',
|
|
45
|
-
' X402_DEPOSIT_MULTIPLIER (
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
' fee), X402_LINE=auto|on|off,',
|
|
45
|
+
' X402_DEPOSIT_MULTIPLIER (refundable collateral to lock, as a multiple of',
|
|
46
|
+
' the opening quote; unset uses the x402 scheme default, minimum 3),',
|
|
47
|
+
' X402_LINE=auto|on|off,',
|
|
49
48
|
' X402_SALT.',
|
|
50
49
|
' auto: buy per-call minimum holds until calls arrive faster than the',
|
|
51
50
|
' server minimum hold, then hold a line while that lasts. A held line',
|
|
@@ -103,7 +102,9 @@ try {
|
|
|
103
102
|
if (f) channelId = f.replace(/\.json$/, '')
|
|
104
103
|
} catch {}
|
|
105
104
|
|
|
106
|
-
const depositPolicy =
|
|
105
|
+
const depositPolicy = process.env.X402_DEPOSIT_MULTIPLIER
|
|
106
|
+
? { depositMultiplier: Number(process.env.X402_DEPOSIT_MULTIPLIER) }
|
|
107
|
+
: {}
|
|
107
108
|
|
|
108
109
|
const MAX_SPEND = Number(process.env.X402_MAX_SPEND ?? 10_000_000)
|
|
109
110
|
let capReached = false
|
|
@@ -264,7 +265,7 @@ const explainPermit2 = (out) => {
|
|
|
264
265
|
if (!token || approvalToldFor === token) return true
|
|
265
266
|
approvalToldFor = token
|
|
266
267
|
const per = Number(chosenAccept?.amount ?? 0)
|
|
267
|
-
const mult = Number(process.env.X402_DEPOSIT_MULTIPLIER ??
|
|
268
|
+
const mult = Number(process.env.X402_DEPOSIT_MULTIPLIER ?? 5)
|
|
268
269
|
const suggested = per > 0 ? BigInt(Math.ceil(per * mult * 4)) : 0n
|
|
269
270
|
log(`${token} moves through Permit2 and your wallet has not approved it.`)
|
|
270
271
|
log(` send once, from your wallet: approve(${PERMIT2}, ${suggested || '<amount>'}) on ${token}`)
|
|
@@ -421,7 +422,7 @@ const callOnLine = async (name, args) => {
|
|
|
421
422
|
dropLine(reasonFrom(out) ?? 'refused by the server')
|
|
422
423
|
if (attempt === 2) {
|
|
423
424
|
log('the line was refused twice; paying for this call directly. If the reason above ' +
|
|
424
|
-
'is collateral, raise X402_DEPOSIT_MULTIPLIER — the minimum
|
|
425
|
+
'is collateral, raise X402_DEPOSIT_MULTIPLIER — the scheme minimum is 3.')
|
|
425
426
|
}
|
|
426
427
|
}
|
|
427
428
|
return payFirst(name, args)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeam-labs/x402-mcp-bridge",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "Put a wallet in front of any x402-paid MCP server, and hold a metered line on the ones that sell time. Stock MCP clients cannot construct x402 payments; this one does, and proxies your existing client through it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|