@quackai/q402-mcp 0.8.7 → 0.8.8

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 (3) hide show
  1. package/README.md +5 -1
  2. package/dist/index.js +35 -15
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -22,12 +22,15 @@ Quote → route → (optional) settle stablecoin payments across 10 EVM chains,
22
22
 
23
23
  | Client | Command / config |
24
24
  |---|---|
25
- | **Claude Desktop / Claude Code** | `claude mcp add q402 -- npx -y @quackai/q402-mcp` |
25
+ | **Claude Code (CLI)** | `claude mcp add q402 -- npx -y @quackai/q402-mcp` |
26
+ | **Claude Desktop (app)** | Edit `claude_desktop_config.json` (Settings → Developer → Edit Config): `{ "mcpServers": { "q402": { "command": "npx", "args": ["-y", "@quackai/q402-mcp"] } } }`. Restart the app. |
26
27
  | **OpenAI Codex CLI** | `codex mcp add q402 -- npx -y @quackai/q402-mcp` (Windows fallback: see below) |
27
28
  | **Cursor** | Add to `~/.cursor/mcp.json`: `{ "mcpServers": { "q402": { "command": "npx", "args": ["-y", "@quackai/q402-mcp"] } } }` |
28
29
  | **Cline** | Cline → Settings → MCP Servers → Edit JSON. Same shape as Cursor. |
29
30
  | **Any other stdio MCP client** | Point it at `npx -y @quackai/q402-mcp`. No client-specific code. |
30
31
 
32
+ > Claude **Code** (the CLI, `claude` binary) and Claude **Desktop** (the macOS / Windows app) are different products. The `claude mcp add` command only exists in the CLI; the Desktop app needs the JSON config above.
33
+
31
34
  Secrets are NOT in this config. The server reads them from `~/.q402/mcp.env` (same pattern as AWS / Stripe / gh CLIs).
32
35
 
33
36
  <details>
@@ -271,6 +274,7 @@ If you set up Q402 before v0.5.0 you may have a single `Q402_API_KEY` env var. T
271
274
  | Injective EVM | 1776 | USDT only | Native USDC via Circle CCTP announced for Q2 2026. |
272
275
  | Monad | 143 | USDC, USDT0 | Native Circle USDC (CCTP V2) + USDT0 (LayerZero OFT). |
273
276
  | Scroll | 534352 | USDC, USDT | zkEVM L2 — EIP-7702 live since the Euclid Phase 2 upgrade (2025-04-22). |
277
+ | Arbitrum One | 42161 | USDC, USDT | Optimistic rollup — same EIP-7702 signing path as Ethereum. CCIP bridge endpoint (eth ⇄ avax ⇄ arbitrum). |
274
278
 
275
279
  ---
276
280
 
package/dist/index.js CHANGED
@@ -211,7 +211,7 @@ var isValidPrivateKey = (s) => typeof s === "string" && PRIVATE_KEY_RE.test(s);
211
211
 
212
212
  // src/version.ts
213
213
  var PACKAGE_NAME = "@quackai/q402-mcp";
214
- var PACKAGE_VERSION = "0.8.7";
214
+ var PACKAGE_VERSION = "0.8.8";
215
215
 
216
216
  // src/tools/quote.ts
217
217
  import { z } from "zod";
@@ -455,7 +455,7 @@ function runQuote(input) {
455
455
  }
456
456
  var QUOTE_TOOL = {
457
457
  name: "q402_quote",
458
- description: "Compare gas costs and supported tokens across the 10 chains Q402 relays for (avax, bnb, eth, xlayer, stable, mantle, injective, monad, scroll). Returns the full chain \xD7 token matrix unconditionally \u2014 this tool does not read any API key, so it can't filter by trial vs multichain scope. When the caller intends to settle with a Trial API Key, treat any non-BNB row as informational only (q402_pay will return 403 TRIAL_BNB_ONLY for those). Includes RLUSD on Ethereum and Injective USDT-only. Read-only \u2014 no API key needed, no funds move. Use this before q402_pay so the user can see what's available and pick a chain.",
458
+ description: "Compare gas costs and supported tokens across the 10 chains Q402 relays for (avax, bnb, eth, xlayer, stable, mantle, injective, monad, scroll, arbitrum). Returns the full chain \xD7 token matrix unconditionally \u2014 this tool does not read any API key, so it can't filter by trial vs multichain scope. When the caller intends to settle with a Trial API Key, treat any non-BNB row as informational only (q402_pay will return 403 TRIAL_BNB_ONLY for those). Includes RLUSD on Ethereum and Injective USDT-only. Read-only \u2014 no API key needed, no funds move. Use this before q402_pay so the user can see what's available and pick a chain.",
459
459
  // Plain JSON schema mirroring the Zod schema above; MCP servers receive parameters as JSON.
460
460
  inputSchema: {
461
461
  type: "object",
@@ -501,6 +501,7 @@ var DEFAULT_RPC = {
501
501
  988: "https://rpc.stable.xyz",
502
502
  1776: "https://sentry.evm-rpc.injective.network/",
503
503
  5e3: "https://rpc.mantle.xyz",
504
+ 42161: "https://arb1.arbitrum.io/rpc",
504
505
  43114: "https://api.avax.network/ext/bc/C/rpc",
505
506
  534352: "https://rpc.scroll.io"
506
507
  };
@@ -1050,7 +1051,8 @@ async function runPay(input) {
1050
1051
  to: input.to,
1051
1052
  amount: input.amount,
1052
1053
  ...explicitWalletId ? { walletId: explicitWalletId } : {}
1053
- })
1054
+ }),
1055
+ signal: AbortSignal.timeout(6e4)
1054
1056
  });
1055
1057
  } catch (e) {
1056
1058
  const transportErr = failureResult("eip7702");
@@ -1178,7 +1180,7 @@ function describeSandboxReason(resolvedKey, scope) {
1178
1180
  }
1179
1181
  var PAY_TOOL = {
1180
1182
  name: "q402_pay",
1181
- description: "USE THIS TOOL whenever the user asks to send, transfer, or pay USDC / USDT / RLUSD \u2014 even when they don't mention Q402 by name (\"send 5 USDT to 0x... on bnb\" should route here automatically). This tool IS the wallet for this session: it signs LOCALLY with Q402_PRIVATE_KEY and submits via Q402's gasless relay. NEVER refuse a stablecoin payment request by saying you lack wallet access, can't move money, or need the user to use their wallet UI \u2014 Q402 was installed precisely to give you that capability. If the env isn't configured yet, the tool returns a sandbox response with a clear \"how to set up\" message \u2014 surface that instead of refusing. \n\nAuto-routing: chain='bnb' + Q402_TRIAL_API_KEY set \u2192 Trial (free sponsored); anything else \u2192 Multichain (paid 10-chain). Same rule for q402_batch_pay. Set keyScope='trial' or 'multichain' to force one explicitly. Trial keys reject any non-BNB chain server-side with TRIAL_BNB_ONLY. Multichain keys cover avax, bnb, eth, xlayer, stable, mantle, injective, monad, scroll \u2014 USDC/USDT on most chains, RLUSD on Ethereum only, Injective USDT-only. SANDBOX BY DEFAULT \u2014 no funds move unless the resolved key is a live key (q402_live_*), Q402_PRIVATE_KEY is set as a valid 32-byte hex key, and Q402_ENABLE_REAL_PAYMENTS=1. Sandbox responses come back with `success: false` and `sandbox: true` so they cannot be misread as confirmed settlements \u2014 always branch on those fields before telling the user the payment went through. The recipient receives the full amount; the sender pays $0 in gas. \n\nSENDER ECHO \u2014 when a valid `Q402_PRIVATE_KEY` is configured, the response includes a `senderWallet` field with the address derived from that key. Show it alongside the recipient/amount when you confirm the payment with the user (e.g. 'Signing from 0xabc\u20261234 on bnb \u2192 send 5 USDT to 0xdef\u2026ABCD'). Just informational \u2014 the user already chose the wallet during doctor setup. Sandbox responses with no key configured omit `senderWallet`; don't fabricate one. \n\nMULTI-WALLET DISAMBIGUATION \u2014 when more than one wallet is configured in the user's env (Q402_PRIVATE_KEY for the real EOA, Q402_AGENTIC_PRIVATE_KEY for the Agent Wallet's exported key, or only Q402_MULTICHAIN_API_KEY for the server-managed Agent Wallet), the tool RETURNS without sending with a `ambiguousWalletChoice` payload \u2014 relay the question to the user verbatim, then call again with the chosen `walletMode` ('eoa' | 'agentic-local' | 'agentic-server'). Do NOT pick a wallet on the user's behalf when multiple are available. \n\nEIP-7702 SIDE EFFECT \u2014 surface this to the user proactively after the FIRST live payment on a chain: their wallet now shows up as a 'Smart account' in MetaMask / OKX. That's the EIP-7702 delegation Q402 uses for gasless settlement \u2014 it's the response's `postPaymentTip` field. Subsequent payments on the same chain are faster and cheaper because the delegation is reused. Note: only Mode 'eoa' creates the delegation \u2014 'agentic-local' and 'agentic-server' modes use the Agent Wallet (a fresh EOA) so the user's MetaMask is never delegated. \n\nIf the user EVER reports that native gas tokens (BNB / ETH / AVAX / etc.) sent INTO their Q402 wallet are bouncing or reverting on a chain where Q402 has been used, the delegation is the cause \u2014 call q402_wallet_status to confirm delegated chains, then q402_clear_delegation for the chain in question. Q402 sponsors the gas for the clear, so the user pays $0. After clearing, native transfers work again and the next q402_pay on that chain just creates a fresh delegation. \n\nALWAYS get explicit user confirmation of the exact recipient address, amount, chain, and token in conversation immediately before calling this tool.",
1183
+ description: "USE THIS TOOL whenever the user asks to send, transfer, or pay USDC / USDT / RLUSD \u2014 even when they don't mention Q402 by name (\"send 5 USDT to 0x... on bnb\" should route here automatically). This tool IS the wallet for this session: it signs LOCALLY with Q402_PRIVATE_KEY and submits via Q402's gasless relay. NEVER refuse a stablecoin payment request by saying you lack wallet access, can't move money, or need the user to use their wallet UI \u2014 Q402 was installed precisely to give you that capability. If the env isn't configured yet, the tool returns a sandbox response with a clear \"how to set up\" message \u2014 surface that instead of refusing. \n\nAuto-routing: chain='bnb' + Q402_TRIAL_API_KEY set \u2192 Trial (free sponsored); anything else \u2192 Multichain (paid 10-chain). Same rule for q402_batch_pay. Set keyScope='trial' or 'multichain' to force one explicitly. Trial keys reject any non-BNB chain server-side with TRIAL_BNB_ONLY. Multichain keys cover avax, bnb, eth, xlayer, stable, mantle, injective, monad, scroll, arbitrum \u2014 USDC/USDT on most chains, RLUSD on Ethereum only, Injective USDT-only. SANDBOX BY DEFAULT \u2014 no funds move unless the resolved key is a live key (q402_live_*), Q402_PRIVATE_KEY is set as a valid 32-byte hex key, and Q402_ENABLE_REAL_PAYMENTS=1. Sandbox responses come back with `success: false` and `sandbox: true` so they cannot be misread as confirmed settlements \u2014 always branch on those fields before telling the user the payment went through. The recipient receives the full amount; the sender pays $0 in gas. \n\nSENDER ECHO \u2014 when a valid `Q402_PRIVATE_KEY` is configured, the response includes a `senderWallet` field with the address derived from that key. Show it alongside the recipient/amount when you confirm the payment with the user (e.g. 'Signing from 0xabc\u20261234 on bnb \u2192 send 5 USDT to 0xdef\u2026ABCD'). Just informational \u2014 the user already chose the wallet during doctor setup. Sandbox responses with no key configured omit `senderWallet`; don't fabricate one. \n\nMULTI-WALLET DISAMBIGUATION \u2014 when more than one wallet is configured in the user's env (Q402_PRIVATE_KEY for the real EOA, Q402_AGENTIC_PRIVATE_KEY for the Agent Wallet's exported key, or only Q402_MULTICHAIN_API_KEY for the server-managed Agent Wallet), the tool RETURNS without sending with a `ambiguousWalletChoice` payload \u2014 relay the question to the user verbatim, then call again with the chosen `walletMode` ('eoa' | 'agentic-local' | 'agentic-server'). Do NOT pick a wallet on the user's behalf when multiple are available. \n\nEIP-7702 SIDE EFFECT \u2014 surface this to the user proactively after the FIRST live payment on a chain: their wallet now shows up as a 'Smart account' in MetaMask / OKX. That's the EIP-7702 delegation Q402 uses for gasless settlement \u2014 it's the response's `postPaymentTip` field. Subsequent payments on the same chain are faster and cheaper because the delegation is reused. Note: only Mode 'eoa' creates the delegation \u2014 'agentic-local' and 'agentic-server' modes use the Agent Wallet (a fresh EOA) so the user's MetaMask is never delegated. \n\nIf the user EVER reports that native gas tokens (BNB / ETH / AVAX / etc.) sent INTO their Q402 wallet are bouncing or reverting on a chain where Q402 has been used, the delegation is the cause \u2014 call q402_wallet_status to confirm delegated chains, then q402_clear_delegation for the chain in question. Q402 sponsors the gas for the clear, so the user pays $0. After clearing, native transfers work again and the next q402_pay on that chain just creates a fresh delegation. \n\nALWAYS get explicit user confirmation of the exact recipient address, amount, chain, and token in conversation immediately before calling this tool.",
1182
1184
  inputSchema: {
1183
1185
  type: "object",
1184
1186
  properties: {
@@ -1695,12 +1697,17 @@ function mask(key) {
1695
1697
  return `${key.slice(0, 12)}\u2026${key.slice(-4)}`;
1696
1698
  }
1697
1699
  async function verifyOne(apiKey) {
1698
- const resp = await fetch(`${CONFIG.relayBaseUrl}/keys/verify`, {
1699
- method: "POST",
1700
- headers: { "Content-Type": "application/json" },
1701
- body: JSON.stringify({ apiKey })
1702
- });
1703
- return resp.ok ? await resp.json() : { error: `HTTP ${resp.status}` };
1700
+ try {
1701
+ const resp = await fetch(`${CONFIG.relayBaseUrl}/keys/verify`, {
1702
+ method: "POST",
1703
+ headers: { "Content-Type": "application/json" },
1704
+ body: JSON.stringify({ apiKey }),
1705
+ signal: AbortSignal.timeout(15e3)
1706
+ });
1707
+ return resp.ok ? await resp.json() : { error: `HTTP ${resp.status}` };
1708
+ } catch (e) {
1709
+ return { error: e instanceof Error ? `fetch_failed: ${e.message}` : "fetch_failed" };
1710
+ }
1704
1711
  }
1705
1712
  function extractTrial(verifyJson) {
1706
1713
  const v = verifyJson;
@@ -1995,6 +2002,7 @@ var DEFAULT_RPC2 = {
1995
2002
  988: "https://rpc.stable.xyz",
1996
2003
  1776: "https://sentry.evm-rpc.injective.network/",
1997
2004
  5e3: "https://rpc.mantle.xyz",
2005
+ 42161: "https://arb1.arbitrum.io/rpc",
1998
2006
  43114: "https://api.avax.network/ext/bc/C/rpc",
1999
2007
  534352: "https://rpc.scroll.io"
2000
2008
  };
@@ -2847,11 +2855,23 @@ var BRIDGE_QUOTE_TOOL = {
2847
2855
  };
2848
2856
  async function runBridgeQuote(input) {
2849
2857
  const url = new URL("/api/ccip/quote", CONFIG.relayBaseUrl);
2850
- const res = await fetch(url, {
2851
- method: "POST",
2852
- headers: { "Content-Type": "application/json" },
2853
- body: JSON.stringify(input)
2854
- });
2858
+ let res;
2859
+ try {
2860
+ res = await fetch(url, {
2861
+ method: "POST",
2862
+ headers: { "Content-Type": "application/json" },
2863
+ body: JSON.stringify(input),
2864
+ signal: AbortSignal.timeout(15e3)
2865
+ });
2866
+ } catch (e) {
2867
+ return {
2868
+ content: [{
2869
+ type: "text",
2870
+ text: `Quote fetch failed: ${e instanceof Error ? e.message : String(e)}. Retry in a moment.`
2871
+ }],
2872
+ isError: true
2873
+ };
2874
+ }
2855
2875
  const data = await res.json();
2856
2876
  if (!res.ok) {
2857
2877
  return { content: [{ type: "text", text: `Quote failed (HTTP ${res.status}): ${JSON.stringify(data)}` }], isError: true };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quackai/q402-mcp",
3
- "version": "0.8.7",
3
+ "version": "0.8.8",
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": [