z-zero-mcp-server 1.10.2 β†’ 1.10.3

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 CHANGED
@@ -14,7 +14,7 @@ npx z-zero-mcp-server
14
14
 
15
15
  **What makes it different:**
16
16
  - πŸ” **Zero-trust by design** β€” the AI never sees PAN, CVV, or expiry. Card data exists only in RAM, injected via Playwright at the last step, then wiped.
17
- - β›½ **Gasless USDC on Base** β€” auto-detects crypto checkout (EIP-681) and settles as a gasless USDC transfer sponsored by Coinbase Paymaster. The agent holds only USDC β€” no ETH, no gas UX.
17
+ - β›½ **Gasless USDC on Base** β€” auto-detects crypto checkout (EIP-681) and settles as a gasless USDC transfer sponsored by Coinbase Paymaster. The agent holds only USDC β€” no ETH, no gas UX. **Opt-in:** off unless you set `Z_ZERO_ENABLE_WEB3_PAY=1`, because an on-chain send to an address read off a web page cannot be reversed.
18
18
  - πŸ’³ **JIT single-use virtual cards** β€” amount-locked, 1-hour TTL, burned after a single use. Fiat fallback for the rest of the web.
19
19
  - 🧠 **Smart Routing + checkout intelligence** β€” `get_merchant_hints` serves platform-specific checkout playbooks (Shopify, Etsy, WooCommerce…).
20
20
  - ✍️ **Linked purpose + outcome** β€” the server signs the criteria the agent records at issuance. Before checkout, `execute_payment` hands those criteria back and requires a second call with `go` or `pause`; a confirmed purchase seals the answer into the signed receipt. The record is inspectable without pretending the platform judged whether the agent told the truth.
@@ -71,7 +71,7 @@ npx z-zero-mcp-server
71
71
 
72
72
  *The AI agent never touches card data β€” it only handles single-use tokens. Real card details are injected by Playwright at the last step and wiped from RAM.*
73
73
 
74
- > **Crypto checkout branch:** when `auto_pay_checkout` detects a crypto-native checkout (EIP-681), it skips the card flow entirely and settles as a **gasless USDC transfer on Base** β€” see above.
74
+ > **Crypto checkout branch:** when `auto_pay_checkout` detects a crypto-native checkout (EIP-681), it skips the card flow entirely and settles as a **gasless USDC transfer on Base** β€” see above. Off by default; enable with `Z_ZERO_ENABLE_WEB3_PAY=1`.
75
75
 
76
76
  ---
77
77
 
@@ -162,7 +162,7 @@ Older self-hosted backends without the rotate endpoint keep working β€” the past
162
162
 
163
163
  | Tool | Description |
164
164
  |------|-------------|
165
- | `auto_pay_checkout` | Fully autonomous checkout β€” auto-detects Web3 or Fiat and completes payment |
165
+ | `auto_pay_checkout` | Fully autonomous checkout β€” issues a JIT card and completes payment (crypto checkout only with `Z_ZERO_ENABLE_WEB3_PAY=1`) |
166
166
  | `get_merchant_hints` | Fetch platform-specific checkout playbook (pre-steps + selectors) from Knowledge Base |
167
167
  | `report_checkout_fail` | Report a failed checkout with a **structured `failure_class`** (14-class enum) β€” feeds the self-healing loop |
168
168
  | `verify_receipt` | Verify a signed receipt by id β€” prove a purchase happened instead of claiming it |
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ const getBalanceRemote = activeBackend.getBalanceRemote;
58
58
  const listCardsRemote = activeBackend.listCardsRemote;
59
59
  const getDepositAddressesRemote = activeBackend.getDepositAddressesRemote;
60
60
  const getTokenPurposeRemote = activeBackend.getTokenPurposeRemote;
61
- console.error(`[Z-ZERO MCP] πŸš€ Base + USDC (non-custodial, gasless)`);
61
+ console.error(`[Z-ZERO MCP] πŸš€ Base + USDC (gasless)`);
62
62
  // ────────────────────────────────────────────────────────────────────────────
63
63
  const playwright_bridge_js_1 = require("./playwright_bridge.js");
64
64
  const ucp_bridge_js_1 = require("./ucp_bridge.js");
@@ -283,7 +283,7 @@ server.registerTool("get_deposit_addresses", {
283
283
  // ============================================================
284
284
  server.registerTool("request_payment_token", {
285
285
  title: "Issue JIT Card (spends $0.10 fee)",
286
- description: "Request a single-use JIT virtual card ($1–$100) locked to one amount + merchant. ⚠️ Read mcp://resources/sop first. Only call once the FINAL total is visible β€” for physical goods that is AFTER shipping is submitted (use get_merchant_hints to navigate there). For digital goods with the price already visible, prefer auto_pay_checkout instead. " +
286
+ description: "Request a single-use JIT virtual card ($1–$50) locked to one amount + merchant. ⚠️ Read mcp://resources/sop first. Only call once the FINAL total is visible β€” for physical goods that is AFTER shipping is submitted (use get_merchant_hints to navigate there). For digital goods with the price already visible, prefer auto_pay_checkout instead. " +
287
287
  "BEFORE requesting: look at the checkout page one more time and compare it against what the user actually asked for β€” same items, same quantity, same variant, same destination? If anything differs, do NOT request a token; fix the cart or check with the user first. A mismatch you catch here costs nothing; after this point it costs a card. If you pass `cart`, the server signs your declared intent and binds the card to it β€” the user gets cryptographic proof of what this card was authorized for. Pass `criteria` too: the few things the owner actually cared about, which this purchase gets scored against at payment time.",
288
288
  inputSchema: {
289
289
  card_alias: zod_1.z
@@ -292,8 +292,8 @@ server.registerTool("request_payment_token", {
292
292
  amount: zod_1.z
293
293
  .number()
294
294
  .min(1, "Minimum amount is $1.00")
295
- .max(100, "Maximum amount is $100.00")
296
- .describe("Amount in USD to authorize (min: $1, max: $100)"),
295
+ .max(50, "Maximum amount is $50.00")
296
+ .describe("Amount in USD to authorize (min: $1, max: $50)"),
297
297
  merchant: zod_1.z
298
298
  .string()
299
299
  .describe("Name or URL of the merchant/service being purchased"),
@@ -373,7 +373,7 @@ server.registerTool("request_payment_token", {
373
373
  {
374
374
  type: "text",
375
375
  text: balance !== undefined
376
- ? `Insufficient balance. Card "${card_alias}" has $${balance} but you requested $${amount}. Or amount is outside the $1-$100 limit.`
376
+ ? `Insufficient balance. Card "${card_alias}" has $${balance} but you requested $${amount}. Or amount is outside the $1-$50 limit.`
377
377
  : `Card "${card_alias}" not found, API key is invalid, or amount limit exceeded.`,
378
378
  },
379
379
  ],
@@ -1102,7 +1102,7 @@ server.registerTool("show_api_key_status", {
1102
1102
  });
1103
1103
  server.registerTool("auto_pay_checkout", {
1104
1104
  title: "Auto-Pay Checkout (charges the card)",
1105
- description: "⚠️ MANDATORY: Read mcp://resources/sop first. Only use on PAYMENT pages where final total is visible. Auto-detects Web3 or Fiat and completes payment. For physical goods (Shopify, Etsy), get_merchant_hints first.",
1105
+ description: "⚠️ MANDATORY: Read mcp://resources/sop first. Only use on PAYMENT pages where final total is visible. Issues a JIT card and completes the payment (paying a crypto address found on the page is OFF unless the owner set Z_ZERO_ENABLE_WEB3_PAY=1). For physical goods (Shopify, Etsy), get_merchant_hints first.",
1106
1106
  inputSchema: {
1107
1107
  checkout_url: zod_1.z
1108
1108
  .string()
@@ -1126,7 +1126,7 @@ server.registerTool("auto_pay_checkout", {
1126
1126
  // no human-authorized token to cross-check against β€” this range IS the only amount guard.
1127
1127
  // It bounds the blast radius if price extraction or a payment link is wrong/malicious.
1128
1128
  const AUTO_PAY_MIN_USD = 1;
1129
- const AUTO_PAY_MAX_USD = 100;
1129
+ const AUTO_PAY_MAX_USD = 50;
1130
1130
  if (!API_KEY) {
1131
1131
  return {
1132
1132
  content: [{ type: "text", text: JSON.stringify({
@@ -1143,10 +1143,19 @@ server.registerTool("auto_pay_checkout", {
1143
1143
  const context = await browser.newContext();
1144
1144
  const page = await context.newPage();
1145
1145
  try {
1146
- // STEP 1: Web3 Detection
1147
- console.error(`[SMART ROUTE] Scanning ${checkout_url} for Web3...`);
1148
- const web3Result = await (0, web3_detector_js_1.detectWeb3Payment)(page, checkout_url);
1149
- if (web3Result.detected && web3Result.params) {
1146
+ // STEP 1: Web3 Detection β€” OFF unless the machine's owner opts in.
1147
+ // The recipient is read off the page (any visible "ethereum:0x…" text
1148
+ // matches, a review or comment included) and an on-chain send cannot be
1149
+ // reversed, so paying it stays shut by default (decision 23/10/2026).
1150
+ let web3Result = null;
1151
+ if (process.env.Z_ZERO_ENABLE_WEB3_PAY === "1") {
1152
+ console.error(`[SMART ROUTE] Scanning ${checkout_url} for Web3...`);
1153
+ web3Result = await (0, web3_detector_js_1.detectWeb3Payment)(page, checkout_url);
1154
+ }
1155
+ else {
1156
+ await page.goto(checkout_url, { waitUntil: "domcontentloaded", timeout: 20_000 });
1157
+ }
1158
+ if (web3Result?.detected && web3Result.params) {
1150
1159
  const { to, eip681_amount, data } = web3Result.params;
1151
1160
  let amount = eip681_amount ?? 0;
1152
1161
  if (!amount && data && data.length >= 138) {
@@ -1174,7 +1183,7 @@ server.registerTool("auto_pay_checkout", {
1174
1183
  }
1175
1184
  const resp = await fetch(`${ZZERO_API}/api/wallet/transfer`, {
1176
1185
  method: "POST",
1177
- headers: { "Content-Type": "application/json", "Authorization": `Bearer ${API_KEY}` },
1186
+ headers: { "Content-Type": "application/json", "Authorization": `Bearer ${API_KEY}`, "x-mcp-version": version_js_2.CURRENT_MCP_VERSION },
1178
1187
  body: JSON.stringify({ to, amount, card_alias }),
1179
1188
  });
1180
1189
  const txResult = await resp.json();
@@ -1470,9 +1479,9 @@ Tools: \`check_balance\`, \`list_cards\`, \`get_deposit_addresses\`, \`set_api_k
1470
1479
  ## PATH A β€” Digital goods / SaaS / API (price already visible)
1471
1480
 
1472
1481
  Call \`auto_pay_checkout(checkout_url, card_alias)\` β€” one call:
1473
- - Auto-detects on-chain (sends USDC on Base, gasless via Coinbase Paymaster) vs fiat (issues a JIT
1474
- card + fills the form).
1475
- - Amount is read from the page and capped to $1–$100.
1482
+ - Issues a JIT card + fills the form. (Paying on-chain to an address found on the page is OFF by
1483
+ default β€” the owner must set Z_ZERO_ENABLE_WEB3_PAY=1. Without it, a crypto-only page is not paid.)
1484
+ - Amount is read from the page and capped to $1–$50.
1476
1485
  - Read the returned \`status\` β†’ see **PAYMENT OUTCOMES** below.
1477
1486
 
1478
1487
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "z-zero-mcp-server",
3
- "version": "1.10.2",
3
+ "version": "1.10.3",
4
4
  "description": "Z-ZERO MCP Server β€” Secure JIT Virtual Card Payment tools for AI Agents (Claude, Cursor, AutoGPT) β€” Real Single-Use Virtual Cards, settled in USDC on Base",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -1,32 +0,0 @@
1
- import type { PaymentToken, CardData } from "./types.js";
2
- /**
3
- * Issue a temporary payment token for a specific card and amount.
4
- * Token is valid for `ttlSeconds` (default: 900 = 15 minutes).
5
- */
6
- export declare function issueToken(cardAlias: string, amount: number, merchant: string, ttlSeconds?: number): PaymentToken | null;
7
- /**
8
- * Resolve a token to real card data.
9
- * CRITICAL: The returned CardData object lives ONLY in RAM.
10
- * It must NEVER be logged, serialized, or returned to the AI.
11
- */
12
- export declare function resolveToken(tokenId: string): CardData | null;
13
- /**
14
- * Burn a token after use - makes it permanently invalid.
15
- * Also deducts the amount from the card balance.
16
- */
17
- export declare function burnToken(tokenId: string): boolean;
18
- /**
19
- * Check balance of a card (safe to expose to AI).
20
- */
21
- export declare function getBalance(cardAlias: string): {
22
- balance: number;
23
- currency: string;
24
- } | null;
25
- /**
26
- * List available card aliases (safe to expose to AI - no sensitive data).
27
- */
28
- export declare function listCards(): Array<{
29
- alias: string;
30
- balance: number;
31
- currency: string;
32
- }>;
@@ -1,150 +0,0 @@
1
- "use strict";
2
- // Mock Neobank Backend - Simulates the card vault and token issuing system
3
- // In production, this would be replaced by your real Neobank API
4
- var __importDefault = (this && this.__importDefault) || function (mod) {
5
- return (mod && mod.__esModule) ? mod : { "default": mod };
6
- };
7
- Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.issueToken = issueToken;
9
- exports.resolveToken = resolveToken;
10
- exports.burnToken = burnToken;
11
- exports.getBalance = getBalance;
12
- exports.listCards = listCards;
13
- const crypto_1 = __importDefault(require("crypto"));
14
- // ============================================================
15
- // CARD VAULT (In-memory store - simulates encrypted database)
16
- // ============================================================
17
- const cardVault = new Map([
18
- [
19
- "Card_01",
20
- {
21
- alias: "Card_01",
22
- number: "4242424242424242", // Stripe test card
23
- exp_month: "12",
24
- exp_year: "2030",
25
- cvv: "123",
26
- name: "AI Agent Card 01",
27
- balance: 50.0,
28
- currency: "USD",
29
- },
30
- ],
31
- [
32
- "Card_02",
33
- {
34
- alias: "Card_02",
35
- number: "5555555555554444", // Mastercard test
36
- exp_month: "06",
37
- exp_year: "2029",
38
- cvv: "456",
39
- name: "AI Agent Card 02",
40
- balance: 100.0,
41
- currency: "USD",
42
- },
43
- ],
44
- ]);
45
- // ============================================================
46
- // TOKEN STORE (Active JIT tokens)
47
- // ============================================================
48
- const tokenStore = new Map();
49
- // ============================================================
50
- // PUBLIC API
51
- // ============================================================
52
- /**
53
- * Issue a temporary payment token for a specific card and amount.
54
- * Token is valid for `ttlSeconds` (default: 900 = 15 minutes).
55
- */
56
- function issueToken(cardAlias, amount, merchant, ttlSeconds = 900) {
57
- const card = cardVault.get(cardAlias);
58
- if (!card) {
59
- return null;
60
- }
61
- if (card.balance < amount) {
62
- return null;
63
- }
64
- const token = {
65
- token: `temp_auth_${crypto_1.default.randomBytes(4).toString("hex")}`,
66
- card_alias: cardAlias,
67
- amount,
68
- merchant,
69
- created_at: Date.now(),
70
- ttl_seconds: ttlSeconds,
71
- used: false,
72
- };
73
- tokenStore.set(token.token, token);
74
- return token;
75
- }
76
- /**
77
- * Resolve a token to real card data.
78
- * CRITICAL: The returned CardData object lives ONLY in RAM.
79
- * It must NEVER be logged, serialized, or returned to the AI.
80
- */
81
- function resolveToken(tokenId) {
82
- const token = tokenStore.get(tokenId);
83
- if (!token) {
84
- return null; // Token doesn't exist
85
- }
86
- if (token.used) {
87
- return null; // Already burned
88
- }
89
- // Check TTL expiration
90
- const age = (Date.now() - token.created_at) / 1000;
91
- if (age > token.ttl_seconds) {
92
- tokenStore.delete(tokenId); // Expired, clean up
93
- return null;
94
- }
95
- const card = cardVault.get(token.card_alias);
96
- if (!card) {
97
- return null;
98
- }
99
- // Return card data (RAM only - never log this!)
100
- return {
101
- number: card.number,
102
- exp_month: card.exp_month,
103
- exp_year: card.exp_year,
104
- cvv: card.cvv,
105
- name: card.name,
106
- };
107
- }
108
- /**
109
- * Burn a token after use - makes it permanently invalid.
110
- * Also deducts the amount from the card balance.
111
- */
112
- function burnToken(tokenId) {
113
- const token = tokenStore.get(tokenId);
114
- if (!token)
115
- return false;
116
- token.used = true;
117
- // Deduct balance
118
- const card = cardVault.get(token.card_alias);
119
- if (card) {
120
- card.balance -= token.amount;
121
- }
122
- // Schedule complete removal from memory
123
- setTimeout(() => {
124
- tokenStore.delete(tokenId);
125
- }, 5000);
126
- return true;
127
- }
128
- /**
129
- * Check balance of a card (safe to expose to AI).
130
- */
131
- function getBalance(cardAlias) {
132
- const card = cardVault.get(cardAlias);
133
- if (!card)
134
- return null;
135
- return { balance: card.balance, currency: card.currency };
136
- }
137
- /**
138
- * List available card aliases (safe to expose to AI - no sensitive data).
139
- */
140
- function listCards() {
141
- const result = [];
142
- for (const card of cardVault.values()) {
143
- result.push({
144
- alias: card.alias,
145
- balance: card.balance,
146
- currency: card.currency,
147
- });
148
- }
149
- return result;
150
- }