@quackai/q402-mcp 0.8.33 → 0.8.34

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 (2) hide show
  1. package/dist/index.js +21 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -211,7 +211,7 @@ var isValidPrivateKey = (s) => typeof s === "string" && PRIVATE_KEY_RE.test(s);
211
211
  // package.json
212
212
  var package_default = {
213
213
  name: "@quackai/q402-mcp",
214
- version: "0.8.33",
214
+ version: "0.8.34",
215
215
  description: "MCP server for Q402 \u2014 gasless USDC/USDT/RLUSD payments on 10 EVM chains + Chainlink CCIP USDC bridge on the eth/avax/arbitrum triangle, callable from Claude (Desktop / Code), OpenAI Codex CLI, and any other Model Context Protocol client.",
216
216
  mcpName: "io.github.bitgett/q402-mcp",
217
217
  keywords: [
@@ -1424,6 +1424,10 @@ var PAY_TOOL = {
1424
1424
  const: true,
1425
1425
  description: "MUST be true and only set after the user has confirmed this exact payment in chat. When hookParams is set, confirm what it does to the money too: the split RECIPIENTS and shares (funds go there, not `to`) and any oracle condition gating settlement \u2014 not just the top-level recipient + amount."
1426
1426
  },
1427
+ consentToken: {
1428
+ type: "string",
1429
+ description: "Two-phase consent. Omit on the FIRST call to get a needs_confirmation preview plus a consentToken (no funds move); re-call with the SAME args plus this token to execute. Re-derived from the payment params, so a previewed payment cannot be swapped for a different one. confirm:true alone does NOT send."
1430
+ },
1427
1431
  hookParams: {
1428
1432
  type: "object",
1429
1433
  description: "Q402 Hook params (server-managed Agent Wallet only). recipientAgentId (ReputationGate), condition (ConditionalOracle price/time gate), or splits (MultiPayeeSplit fan-out, bps sum 10000).",
@@ -1960,6 +1964,10 @@ TWO-PHASE CONSENT: confirm:true alone does NOT send. Call this tool first WITHOU
1960
1964
  type: "boolean",
1961
1965
  const: true,
1962
1966
  description: "MUST be true and only set after the user has confirmed the entire batch in chat."
1967
+ },
1968
+ consentToken: {
1969
+ type: "string",
1970
+ description: "Two-phase consent. Omit on the FIRST call to get a needs_confirmation preview of every recipient + amount plus a consentToken (no funds move); re-call with the SAME args plus this token to execute. Re-derived from the batch, so the previewed batch cannot be swapped. confirm:true alone does NOT send."
1963
1971
  }
1964
1972
  },
1965
1973
  required: ["chain", "token", "recipients", "confirm"],
@@ -4984,10 +4992,16 @@ async function runRequestPay(input) {
4984
4992
  to: req.recipient.toLowerCase(),
4985
4993
  amount: req.amount,
4986
4994
  token: req.token,
4987
- chain: req.chain
4995
+ chain: req.chain,
4996
+ // Bind the funding source too — the user is consenting to pay from THIS
4997
+ // wallet, so swapping walletId after the preview must void consent. Mirrors
4998
+ // q402_pay's consentIntent. Empty string = the server-default Agent Wallet
4999
+ // (resolved at settle time); pinning a specific wallet re-triggers consent.
5000
+ wid: (input.walletId ?? "").toLowerCase()
4988
5001
  };
4989
5002
  const consent = checkConsent(consentIntent, input.consentToken);
4990
5003
  if (!consent.ok) {
5004
+ const fromNote = input.walletId ? ` from wallet ${input.walletId}` : "";
4991
5005
  return {
4992
5006
  ok: false,
4993
5007
  status: "needs_consent",
@@ -4998,7 +5012,7 @@ async function runRequestPay(input) {
4998
5012
  message: "Relay this preview to the user and get an explicit yes, then re-call with the same requestId plus consentToken. No funds moved.",
4999
5013
  needsConsent: {
5000
5014
  status: "needs_confirmation",
5001
- preview: `Pay ${req.amount} ${req.token} to ${req.recipient} on ${req.chain} (request ${req.id}).`,
5015
+ preview: `Pay ${req.amount} ${req.token} to ${req.recipient} on ${req.chain}${fromNote} (request ${req.id}).`,
5002
5016
  consentToken: consent.expected
5003
5017
  }
5004
5018
  };
@@ -5069,6 +5083,10 @@ var REQUEST_PAY_TOOL = {
5069
5083
  walletId: {
5070
5084
  type: "string",
5071
5085
  description: "Optional. Agent Wallet address to pay from. Defaults to the configured / server-default wallet."
5086
+ },
5087
+ consentToken: {
5088
+ type: "string",
5089
+ description: "Two-phase consent. Omit on the FIRST call to get a needs_confirmation preview plus a consentToken (no funds move); re-call with the SAME requestId plus this token to execute. Re-derived from the request terms + funding wallet, so a previewed payment cannot be swapped for a different one."
5072
5090
  }
5073
5091
  },
5074
5092
  required: ["requestId", "confirm"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quackai/q402-mcp",
3
- "version": "0.8.33",
3
+ "version": "0.8.34",
4
4
  "description": "MCP server for Q402 — gasless USDC/USDT/RLUSD payments on 10 EVM chains + Chainlink CCIP USDC bridge on the eth/avax/arbitrum triangle, callable from Claude (Desktop / Code), OpenAI Codex CLI, and any other Model Context Protocol client.",
5
5
  "mcpName": "io.github.bitgett/q402-mcp",
6
6
  "keywords": [