z-zero-mcp-server 1.2.0 → 1.2.1
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 +64 -15
- package/dist/index.js +126 -127
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,14 +1,47 @@
|
|
|
1
1
|
# OpenClaw: Z-ZERO AI Agent MCP Server
|
|
2
2
|
|
|
3
|
-
[
|
|
4
|
-
[](../../LICENSE)
|
|
5
|
-
[](https://wdk.tether.to)
|
|
3
|
+
A Zero-Trust Payment Protocol built for AI Agents using the [Model Context Protocol (MCP)](https://modelcontextprotocol.io). Give your agents (Claude, Cursor, Antigravity) the ability to make real-world purchases — securely, without ever seeing a real card number.
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
**What makes it different:**
|
|
6
|
+
- 🔐 **Zero-trust** — AI never sees PAN, CVV, or expiry. Card data exists only in RAM, injected via Playwright, then wiped.
|
|
7
|
+
- 🌐 **Web3 + Fiat** — Auto-detects crypto checkout (EIP-681) and routes to on-chain USDT transfer. Falls back to JIT Visa for fiat.
|
|
8
|
+
- 🧠 **Smart Routing** — Cloud Knowledge Base (`get_merchant_hints`) provides platform-specific checkout playbooks for Shopify, Etsy, WooCommerce, and more.
|
|
9
|
+
- 🔄 **Self-Healing** — Failed checkouts are logged via `report_checkout_fail` for admin review, improving future success rates.
|
|
10
|
+
|
|
11
|
+
---
|
|
8
12
|
|
|
9
13
|
## How It Works
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
```mermaid
|
|
16
|
+
sequenceDiagram
|
|
17
|
+
actor User
|
|
18
|
+
participant AI as AI Agent
|
|
19
|
+
participant MCP as MCP Tools
|
|
20
|
+
participant API as Z-ZERO API
|
|
21
|
+
participant DB as Supabase DB
|
|
22
|
+
|
|
23
|
+
User->>AI: "Buy me this Shopify item"
|
|
24
|
+
Note over AI: Scans available MCP Tools
|
|
25
|
+
AI->>MCP: Reads description of auto_pay_checkout
|
|
26
|
+
MCP-->>AI: "⚠️ MANDATORY: Read mcp://resources/sop first"
|
|
27
|
+
Note over AI: Fetches SOP before proceeding
|
|
28
|
+
AI->>MCP: Fetch resource mcp://resources/sop
|
|
29
|
+
MCP-->>AI: Platform rules + 3-Group payment SOP
|
|
30
|
+
Note over AI: "Shopify = physical goods. Must collect shipping first."
|
|
31
|
+
AI->>MCP: get_merchant_hints("_platform_shopify")
|
|
32
|
+
MCP->>API: GET /api/checkout-hints?domain=_platform_shopify&fields=merchant
|
|
33
|
+
API->>DB: Query checkout_hints table
|
|
34
|
+
DB-->>API: Platform hints data
|
|
35
|
+
API-->>MCP: Returns pre_steps + notes only
|
|
36
|
+
MCP-->>AI: "Fill shipping form first, click Next..."
|
|
37
|
+
Note over AI: Navigates checkout, fills shipping, waits for payment page
|
|
38
|
+
AI->>MCP: request_payment_token(amount, card_alias)
|
|
39
|
+
MCP-->>AI: Token: temp_auth_XYZ (1hr TTL)
|
|
40
|
+
AI->>MCP: execute_payment(token, checkout_url)
|
|
41
|
+
Note over MCP: Playwright auto-fills card form, burns token after use
|
|
42
|
+
MCP-->>AI: Success — payment complete
|
|
43
|
+
AI-->>User: "Done! Your Shopify item has been ordered."
|
|
44
|
+
```
|
|
12
45
|
|
|
13
46
|
---
|
|
14
47
|
|
|
@@ -47,18 +80,34 @@ Get your Passport Key at: **[clawcard.store/dashboard/agents](https://www.clawca
|
|
|
47
80
|
|
|
48
81
|
## Available MCP Tools
|
|
49
82
|
|
|
83
|
+
### Group 1 — Wallet Config (Passive)
|
|
84
|
+
|
|
50
85
|
| Tool | Description |
|
|
51
86
|
|------|-------------|
|
|
52
|
-
| `list_cards` |
|
|
53
|
-
| `check_balance` |
|
|
54
|
-
| `get_deposit_addresses` | Get deposit addresses to top up
|
|
55
|
-
| `
|
|
56
|
-
| `
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
|
61
|
-
|
|
87
|
+
| `list_cards` | List all virtual card aliases and balances |
|
|
88
|
+
| `check_balance` | Check spendable USD balance for a card alias |
|
|
89
|
+
| `get_deposit_addresses` | Get crypto deposit addresses (EVM + Tron) to top up balance |
|
|
90
|
+
| `set_api_key` | Activate a new Passport Key instantly, no restart needed |
|
|
91
|
+
| `show_api_key_status` | Check if a Passport Key is currently loaded (prefix only) |
|
|
92
|
+
|
|
93
|
+
### Group 2 — Manual 4-Step Payment (Active)
|
|
94
|
+
|
|
95
|
+
| Tool | Description |
|
|
96
|
+
|------|-------------|
|
|
97
|
+
| `request_payment_token` | Issue a JIT single-use Visa token for a specific amount (1hr TTL) |
|
|
98
|
+
| `execute_payment` | Auto-fill checkout form using a payment token via Playwright |
|
|
99
|
+
| `cancel_payment_token` | Cancel an unused token and refund to wallet |
|
|
100
|
+
| `request_human_approval` | Pause and request human confirmation before proceeding |
|
|
101
|
+
|
|
102
|
+
### Group 3 — Smart Autopilot
|
|
103
|
+
|
|
104
|
+
| Tool | Description |
|
|
105
|
+
|------|-------------|
|
|
106
|
+
| `auto_pay_checkout` | Fully autonomous checkout — auto-detects Web3 or Fiat and completes payment |
|
|
107
|
+
| `get_merchant_hints` | Fetch platform-specific checkout playbook (pre-steps + selectors) from Knowledge Base |
|
|
108
|
+
| `report_checkout_fail` | Log a failed checkout URL for admin review (self-healing feedback loop) |
|
|
109
|
+
|
|
110
|
+
> 📖 **Note:** Version checking is handled automatically in each API call. No separate tool needed.
|
|
62
111
|
|
|
63
112
|
---
|
|
64
113
|
|
package/dist/index.js
CHANGED
|
@@ -115,7 +115,7 @@ server.tool("list_cards", "List all available virtual card aliases and their bal
|
|
|
115
115
|
// ============================================================
|
|
116
116
|
// TOOL 2: Check card balance (safe)
|
|
117
117
|
// ============================================================
|
|
118
|
-
server.tool("check_balance", "Check
|
|
118
|
+
server.tool("check_balance", "Check spendable USD balance for a card alias. For active token limits, use list_cards instead.", {
|
|
119
119
|
card_alias: zod_1.z
|
|
120
120
|
.string()
|
|
121
121
|
.describe("The alias of the card to check, e.g. 'Card_01'"),
|
|
@@ -155,7 +155,7 @@ server.tool("check_balance", "Check the wallet balance (human-level total). This
|
|
|
155
155
|
// ============================================================
|
|
156
156
|
// TOOL 2.5: Get deposit addresses (Phase 14 feature)
|
|
157
157
|
// ============================================================
|
|
158
|
-
server.tool("get_deposit_addresses", "Get
|
|
158
|
+
server.tool("get_deposit_addresses", "Get crypto deposit addresses (EVM + Tron) to top up wallet balance.", {}, async () => {
|
|
159
159
|
const data = await getDepositAddressesRemote();
|
|
160
160
|
if (data?.error === "AUTH_REQUIRED") {
|
|
161
161
|
return {
|
|
@@ -201,7 +201,7 @@ server.tool("get_deposit_addresses", "Get your unique deposit addresses for EVM
|
|
|
201
201
|
// ============================================================
|
|
202
202
|
// TOOL 3: Request a temporary payment token (issues secure JIT card)
|
|
203
203
|
// ============================================================
|
|
204
|
-
server.tool("request_payment_token", "
|
|
204
|
+
server.tool("request_payment_token", "⚠️ MANDATORY: Read mcp://resources/sop first. Collect shipping info and check get_merchant_hints before calling. Request a JIT virtual card ($1-$100).", {
|
|
205
205
|
card_alias: zod_1.z
|
|
206
206
|
.string()
|
|
207
207
|
.describe("Which card to charge, e.g. 'Card_01'"),
|
|
@@ -274,7 +274,7 @@ server.tool("request_payment_token", "Request a temporary payment token for a sp
|
|
|
274
274
|
// Agent MUST call this before execute_payment if unsure about a checkout page.
|
|
275
275
|
// Returns domain-specific selectors and pre-steps from Z-ZERO cloud DB.
|
|
276
276
|
// ============================================================
|
|
277
|
-
server.tool("get_merchant_hints", "
|
|
277
|
+
server.tool("get_merchant_hints", "Get merchant navigation flow for a domain or platform key (e.g. '_platform_etsy'). Returns pre_steps (how to navigate checkout) and platform notes. Call BEFORE starting checkout to understand the multi-step flow.", {
|
|
278
278
|
domain: zod_1.z
|
|
279
279
|
.string()
|
|
280
280
|
.describe("The main domain of the checkout page, e.g. 'amazon.com' or 'shopify.com'. Strip 'www.' prefix."),
|
|
@@ -282,7 +282,7 @@ server.tool("get_merchant_hints", "Fetch checkout hints for a specific domain fr
|
|
|
282
282
|
const ZZERO_API = process.env.Z_ZERO_API_BASE || "https://www.clawcard.store";
|
|
283
283
|
const INTERNAL_SECRET = process.env.Z_ZERO_INTERNAL_SECRET || "";
|
|
284
284
|
try {
|
|
285
|
-
const resp = await fetch(`${ZZERO_API}/api/checkout-hints?domain=${encodeURIComponent(domain)}`, {
|
|
285
|
+
const resp = await fetch(`${ZZERO_API}/api/checkout-hints?domain=${encodeURIComponent(domain)}&fields=merchant`, {
|
|
286
286
|
headers: {
|
|
287
287
|
"x-internal-secret": INTERNAL_SECRET,
|
|
288
288
|
"x-mcp-version": version_js_2.CURRENT_MCP_VERSION,
|
|
@@ -304,60 +304,6 @@ server.tool("get_merchant_hints", "Fetch checkout hints for a specific domain fr
|
|
|
304
304
|
}
|
|
305
305
|
});
|
|
306
306
|
// ============================================================
|
|
307
|
-
// TOOL 4b: Report Checkout Fail (Self-Healing Feedback Loop)
|
|
308
|
-
// Agent calls this when a purchase task could not be completed.
|
|
309
|
-
// Logs the checkout URL for admin review → future hints creation.
|
|
310
|
-
// ============================================================
|
|
311
|
-
server.tool("report_checkout_fail", "Report a checkout URL that you could not complete. Call this when you failed to finish a purchase — for any reason (field not found, bot blocked, timeout, unknown form). The URL will be logged for admin review to improve future checkout success rates. This is part of Z-ZERO's self-healing loop.", {
|
|
312
|
-
url: zod_1.z
|
|
313
|
-
.string()
|
|
314
|
-
.url()
|
|
315
|
-
.describe("The checkout/payment page URL where the purchase failed."),
|
|
316
|
-
error_type: zod_1.z
|
|
317
|
-
.string()
|
|
318
|
-
.optional()
|
|
319
|
-
.describe("Short error category: 'field_not_found', 'timeout', 'bot_blocked', 'unknown_form', 'price_mismatch', or 'other'."),
|
|
320
|
-
error_message: zod_1.z
|
|
321
|
-
.string()
|
|
322
|
-
.optional()
|
|
323
|
-
.describe("Brief description of what went wrong, e.g. 'Could not find card number field' or 'Page redirected to CAPTCHA'."),
|
|
324
|
-
}, async ({ url, error_type, error_message }) => {
|
|
325
|
-
const ZZERO_API = process.env.Z_ZERO_API_BASE || "https://www.clawcard.store";
|
|
326
|
-
const INTERNAL_SECRET = process.env.Z_ZERO_INTERNAL_SECRET || "";
|
|
327
|
-
try {
|
|
328
|
-
const resp = await fetch(`${ZZERO_API}/api/checkout-hints`, {
|
|
329
|
-
method: "POST",
|
|
330
|
-
headers: {
|
|
331
|
-
"Content-Type": "application/json",
|
|
332
|
-
"x-internal-secret": INTERNAL_SECRET,
|
|
333
|
-
"x-mcp-version": version_js_2.CURRENT_MCP_VERSION,
|
|
334
|
-
},
|
|
335
|
-
body: JSON.stringify({
|
|
336
|
-
url,
|
|
337
|
-
error_type: error_type || "other",
|
|
338
|
-
error_message: error_message || null,
|
|
339
|
-
mcp_version: version_js_2.CURRENT_MCP_VERSION,
|
|
340
|
-
}),
|
|
341
|
-
});
|
|
342
|
-
const data = await resp.json();
|
|
343
|
-
return {
|
|
344
|
-
content: [{ type: "text", text: JSON.stringify({
|
|
345
|
-
reported: true,
|
|
346
|
-
message: "Checkout failure logged. An admin will review this URL to create or update hints for future agents. Thank you for contributing to the self-healing loop.",
|
|
347
|
-
...data,
|
|
348
|
-
}, null, 2) }],
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
catch (err) {
|
|
352
|
-
return {
|
|
353
|
-
content: [{ type: "text", text: JSON.stringify({
|
|
354
|
-
reported: false,
|
|
355
|
-
message: `Could not reach fail-report API: ${err?.message || "unknown error"}. Please inform the user manually.`,
|
|
356
|
-
}, null, 2) }],
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
|
-
});
|
|
360
|
-
// ============================================================
|
|
361
307
|
// TOOL 4b: Execute payment (The "Invisible Hand")
|
|
362
308
|
// ============================================================
|
|
363
309
|
server.tool("execute_payment", "Execute a payment using a temporary token. This tool will securely fill the checkout form on the target website. You will NEVER see the real card number - it is handled securely in the background.", {
|
|
@@ -454,7 +400,6 @@ server.tool("execute_payment", "Execute a payment using a temporary token. This
|
|
|
454
400
|
message: result.message || "Payment was declined by merchant.",
|
|
455
401
|
token_status: "ACTIVE",
|
|
456
402
|
note: "Token NOT burned. Funds will be refunded automatically via webhook within minutes.",
|
|
457
|
-
self_heal_hint: "If this failure was caused by the checkout form (wrong selector, unknown iframe, CAPTCHA, etc.), call report_checkout_fail(checkout_url) to help improve future checkouts. Do NOT report if the user cancelled or had insufficient balance.",
|
|
458
403
|
}, null, 2),
|
|
459
404
|
},
|
|
460
405
|
],
|
|
@@ -484,7 +429,7 @@ server.tool("execute_payment", "Execute a payment using a temporary token. This
|
|
|
484
429
|
// ============================================================
|
|
485
430
|
// TOOL 5: Cancel payment token (returns funds to wallet)
|
|
486
431
|
// ============================================================
|
|
487
|
-
server.tool("cancel_payment_token", "Cancel
|
|
432
|
+
server.tool("cancel_payment_token", "Cancel unused token and refund instantly. Use when user cancels the purchase or to free up a card slot.", {
|
|
488
433
|
token: zod_1.z
|
|
489
434
|
.string()
|
|
490
435
|
.describe("The payment token to cancel"),
|
|
@@ -531,7 +476,7 @@ server.tool("cancel_payment_token", "Cancel a payment token that has not been us
|
|
|
531
476
|
// ============================================================
|
|
532
477
|
// TOOL 6: Request human approval (Human-in-the-loop)
|
|
533
478
|
// ============================================================
|
|
534
|
-
server.tool("request_human_approval", "
|
|
479
|
+
server.tool("request_human_approval", "Pause and ask the user for approval before risky actions (price mismatch, large amount, unusual request).", {
|
|
535
480
|
situation: zod_1.z
|
|
536
481
|
.string()
|
|
537
482
|
.describe("Clear description of what the bot found, e.g. 'Checkout shows $20 total (includes $3 tax) but current token is only $15'"),
|
|
@@ -574,7 +519,7 @@ server.tool("request_human_approval", "Request human approval before proceeding
|
|
|
574
519
|
// ============================================================
|
|
575
520
|
// TOOL 6.5: Set API Key (Hot-Swap Passport Key — NO restart needed)
|
|
576
521
|
// ============================================================
|
|
577
|
-
server.tool("set_api_key", "
|
|
522
|
+
server.tool("set_api_key", "Activate a new Passport Key instantly, no restart needed. Only call when user explicitly provides a key.", {
|
|
578
523
|
api_key: zod_1.z
|
|
579
524
|
.string()
|
|
580
525
|
.describe("The new Passport Key to activate. Must start with 'zk_live_' or 'zk_test_'. Get from: https://www.clawcard.store/dashboard/agents"),
|
|
@@ -601,7 +546,7 @@ server.tool("set_api_key", "Update the Z-ZERO Passport Key immediately WITHOUT r
|
|
|
601
546
|
// ============================================================
|
|
602
547
|
// TOOL 6.6: Show current API Key status (for debugging)
|
|
603
548
|
// ============================================================
|
|
604
|
-
server.tool("show_api_key_status", "
|
|
549
|
+
server.tool("show_api_key_status", "Check if Passport Key is configured. Shows prefix only, for debugging.", {}, async () => {
|
|
605
550
|
const key = (0, key_store_js_1.getPassportKey)();
|
|
606
551
|
const hasKey = key.length > 0;
|
|
607
552
|
return {
|
|
@@ -618,14 +563,7 @@ server.tool("show_api_key_status", "Show whether a Passport Key is currently con
|
|
|
618
563
|
}],
|
|
619
564
|
};
|
|
620
565
|
});
|
|
621
|
-
server.tool("auto_pay_checkout", "
|
|
622
|
-
"1. Scan the page to detect if it supports Web3 (Crypto) payments via window.ethereum or EIP-681 links.\n" +
|
|
623
|
-
"2. SCENARIO A (Web3): If detected, automatically send USDT on-chain via WDK (gas ~$0.001). No Visa card needed.\n" +
|
|
624
|
-
"3. SCENARIO B (Fiat): If no Web3 detected, scan DOM for total price, issue a JIT Visa card for exact amount, auto-fill form.\n" +
|
|
625
|
-
"WARNING: For PHYSICAL GOODS (Shopify, multi-step checkout), this tool may return PRICE_NOT_FOUND because the final price " +
|
|
626
|
-
"(including shipping) only appears after filling th shipping info. In that case, use browser tools to navigate manually, " +
|
|
627
|
-
"call get_merchant_hints to get platform-specific card selectors, fill shipping info first, then call " +
|
|
628
|
-
"request_payment_token + execute_payment once card fields are visible and the final total is confirmed.", {
|
|
566
|
+
server.tool("auto_pay_checkout", "⚠️ 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.", {
|
|
629
567
|
checkout_url: zod_1.z
|
|
630
568
|
.string()
|
|
631
569
|
.url()
|
|
@@ -777,82 +715,143 @@ server.tool("auto_pay_checkout", "[Phase 2] Autonomous Smart Routing checkout to
|
|
|
777
715
|
}
|
|
778
716
|
});
|
|
779
717
|
// ============================================================
|
|
718
|
+
// TOOL: Report a failed checkout URL (Group 3 self-healing feedback)
|
|
719
|
+
// Call when Group 3 navigation was started but could not complete.
|
|
720
|
+
// Triggers: stuck mid pre_steps, bot blocked, selector not found, etc.
|
|
721
|
+
// Does NOT apply to: user cancelled, insufficient balance, price mismatch.
|
|
722
|
+
// ============================================================
|
|
723
|
+
server.tool("report_checkout_fail", "Report a checkout URL that you could not complete. Call this when you failed to finish a purchase — for any reason (field not found, bot blocked, timeout, unknown form). The URL will be logged for admin review to improve future checkout success rates. This is part of Z-ZERO's self-healing loop.", {
|
|
724
|
+
url: zod_1.z
|
|
725
|
+
.string()
|
|
726
|
+
.url()
|
|
727
|
+
.describe("The checkout/payment page URL where the purchase failed."),
|
|
728
|
+
error_type: zod_1.z
|
|
729
|
+
.string()
|
|
730
|
+
.describe("Short error category: 'field_not_found', 'timeout', 'bot_blocked', 'unknown_form', 'price_mismatch', or 'other'."),
|
|
731
|
+
error_message: zod_1.z
|
|
732
|
+
.string()
|
|
733
|
+
.optional()
|
|
734
|
+
.describe("Brief description of what went wrong, e.g. 'Could not find card number field' or 'Page redirected to CAPTCHA'."),
|
|
735
|
+
}, async ({ url, error_type, error_message }) => {
|
|
736
|
+
const ZZERO_API = process.env.Z_ZERO_API_BASE || "https://www.clawcard.store";
|
|
737
|
+
const INTERNAL_SECRET = process.env.Z_ZERO_INTERNAL_SECRET || "";
|
|
738
|
+
try {
|
|
739
|
+
await fetch(`${ZZERO_API}/api/checkout-hints`, {
|
|
740
|
+
method: "POST",
|
|
741
|
+
headers: {
|
|
742
|
+
"Content-Type": "application/json",
|
|
743
|
+
"x-internal-secret": INTERNAL_SECRET,
|
|
744
|
+
"x-mcp-version": version_js_2.CURRENT_MCP_VERSION,
|
|
745
|
+
},
|
|
746
|
+
body: JSON.stringify({ url, error_type, error_message, mcp_version: version_js_2.CURRENT_MCP_VERSION }),
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
catch {
|
|
750
|
+
// Fire-and-forget — never block the agent on a logging call
|
|
751
|
+
}
|
|
752
|
+
return {
|
|
753
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
754
|
+
logged: true,
|
|
755
|
+
url,
|
|
756
|
+
error_type,
|
|
757
|
+
message: "Checkout failure logged. Admin will review and improve hints for this domain.",
|
|
758
|
+
}, null, 2) }],
|
|
759
|
+
};
|
|
760
|
+
});
|
|
761
|
+
// ============================================================
|
|
780
762
|
// RESOURCE: Z-ZERO Autonomous Payment SOP
|
|
781
763
|
// ============================================================
|
|
782
764
|
server.resource("Standard Operating Procedure (SOP) for Autonomous Payments", "mcp://resources/sop", {
|
|
783
765
|
description: "A comprehensive guide on how AI agents should use the Z-ZERO tools to execute secure, zero-trust payments."
|
|
784
766
|
}, async (uri) => {
|
|
785
767
|
const sopContent = `
|
|
786
|
-
# Z-ZERO Autonomous Payment Skill SOP (
|
|
768
|
+
# Z-ZERO Autonomous Payment Skill SOP (v2.0.0)
|
|
769
|
+
|
|
770
|
+
This SOP tells the AI Agent how to use Z-ZERO tools to autonomously purchase goods on behalf of the user — without ever handling raw credit card data.
|
|
771
|
+
|
|
772
|
+
---
|
|
773
|
+
|
|
774
|
+
## Group 1: Wallet Config (READ FIRST)
|
|
775
|
+
|
|
776
|
+
Tools: \`check_balance\`, \`list_cards\`, \`get_deposit_addresses\`, \`set_api_key\`, \`show_api_key_status\`
|
|
777
|
+
|
|
778
|
+
Before ANY purchase:
|
|
779
|
+
1. Confirm exactly what the user wants to buy and the expected price (in USD).
|
|
780
|
+
2. Call \`check_balance\` using your default \`card_alias\` to verify sufficient funds.
|
|
781
|
+
- If balance is insufficient → STOP. Ask the human to deposit USDT to their wallet.
|
|
782
|
+
3. Use \`list_cards\` to see available card aliases, NOT to check spendable balance.
|
|
783
|
+
4. Never ask for the API key proactively — only call \`set_api_key\` when the user explicitly gives you one.
|
|
784
|
+
|
|
785
|
+
---
|
|
786
|
+
|
|
787
|
+
## Group 2: Manual 4-Step Payment (Core Flow)
|
|
788
|
+
|
|
789
|
+
Tools: \`request_payment_token\`, \`execute_payment\`, \`cancel_payment_token\`, \`request_human_approval\`
|
|
787
790
|
|
|
788
|
-
|
|
791
|
+
Execute in this exact order:
|
|
789
792
|
|
|
790
|
-
|
|
791
|
-
|
|
793
|
+
### Step 1 — Verify
|
|
794
|
+
Confirm item, price, and check balance (see Group 1).
|
|
792
795
|
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
796
|
+
### Step 2 — Navigate to Payment Page
|
|
797
|
+
Use browser tools to navigate to the final payment page where card fields are visible and the FINAL total (including shipping + tax) is displayed.
|
|
798
|
+
- ⛔ DO NOT call \`request_payment_token\` until BOTH conditions are true:
|
|
799
|
+
1. Shipping/personal info submitted successfully
|
|
800
|
+
2. Card input fields are visible on screen
|
|
797
801
|
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
802
|
+
### Step 3 — Request Token
|
|
803
|
+
Call \`request_payment_token\` with exact final amount and merchant name.
|
|
804
|
+
Receive a single-use \`token\` (valid 1 hour, locked to that amount).
|
|
801
805
|
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
806
|
+
### Step 4 — Blind Execution
|
|
807
|
+
Call \`execute_payment\` with the token + checkout URL.
|
|
808
|
+
Z-ZERO opens a headless browser, injects the card securely, clicks Pay. Token burns instantly after success.
|
|
805
809
|
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
3. Burn: The token self-destructs instantly after use.
|
|
810
|
+
### Error Rules
|
|
811
|
+
- NEVER print raw tokens in chat.
|
|
812
|
+
- NO MANUAL ENTRY: If a site asks you to type a card number into a text box — REFUSE.
|
|
813
|
+
- FAIL GRACEFULLY: If \`execute_payment\` returns \`success: false\` → report it. Do NOT retry blindly.
|
|
814
|
+
- PRICE MISMATCH: If actual checkout total > token amount → call \`cancel_payment_token\` + \`request_human_approval\` for new amount.
|
|
812
815
|
|
|
813
|
-
|
|
814
|
-
- NEVER print full tokens in the human chat logs.
|
|
815
|
-
- NO MANUAL ENTRY: If a merchant asks you to type a credit card number into a text box, REFUSE.
|
|
816
|
-
- FAIL GRACEFULLY: If \`execute_payment\` returns \`success: false\`, report the error message to the human. Do not try again.
|
|
816
|
+
---
|
|
817
817
|
|
|
818
|
-
##
|
|
819
|
-
For most purchases, use \`auto_pay_checkout\` instead of the 4-step flow above.
|
|
820
|
-
It auto-detects Web3 checkout (pay on-chain with USDT) vs Fiat checkout (JIT Visa card), all in a single call.
|
|
821
|
-
- Web3 route: sends USDT directly on-chain to merchant wallet
|
|
822
|
-
- Fiat route: issues JIT card + fills checkout form automatically
|
|
823
|
-
Call \`auto_pay_checkout\` with just \`checkout_url\` and \`card_alias\`. The tool handles the rest.
|
|
818
|
+
## Group 3: Smart Autopilot (Fast Route)
|
|
824
819
|
|
|
825
|
-
|
|
820
|
+
Tools: \`auto_pay_checkout\`, \`get_merchant_hints\`
|
|
826
821
|
|
|
827
|
-
|
|
828
|
-
|
|
822
|
+
### Option A — Digital Goods / SaaS / APIs (Use auto_pay_checkout directly)
|
|
823
|
+
For pages where the final total is already visible, call \`auto_pay_checkout\`:
|
|
824
|
+
- It auto-detects Web3 (sends USDT on-chain via WDK) vs Fiat (issues JIT Visa card + auto-fills form).
|
|
825
|
+
- One call handles everything.
|
|
829
826
|
|
|
830
|
-
###
|
|
831
|
-
|
|
832
|
-
2. Card input fields (or payment iframe) are visible on the current page
|
|
827
|
+
### Option B — Physical Goods (Shopify, Etsy, WooCommerce)
|
|
828
|
+
⛔ DO NOT call \`auto_pay_checkout\` directly. The final price is only visible AFTER shipping is submitted.
|
|
833
829
|
|
|
834
|
-
|
|
830
|
+
Recommended flow:
|
|
831
|
+
1. Call \`get_merchant_hints\` with checkout domain or platform key (e.g. \`_platform_shopify\`).
|
|
832
|
+
- Returns \`pre_steps\` (navigation instructions) + \`notes\` + \`platform\`.
|
|
833
|
+
2. Follow the \`pre_steps\` — navigate, add to cart, fill shipping form.
|
|
834
|
+
- Ask user for shipping info via \`request_human_approval\` if not already known.
|
|
835
|
+
3. Wait for payment/card section to appear + FINAL total is visible.
|
|
836
|
+
4. Call \`request_payment_token\` with the exact final amount (Group 2).
|
|
837
|
+
5. Call \`execute_payment\` with token + checkout URL (Group 2).
|
|
835
838
|
|
|
836
839
|
### Platform Detection Signals
|
|
837
|
-
| Platform |
|
|
838
|
-
|
|
839
|
-
| Shopify |
|
|
840
|
-
| Etsy | URL
|
|
841
|
-
| WooCommerce |
|
|
840
|
+
| Platform | Detection Signal |
|
|
841
|
+
|---|---|
|
|
842
|
+
| Shopify | JS object \`window.Shopify\` exists, OR \`<script src="cdn.shopify.com">\`, OR \`<meta name="shopify-checkout-api-token">\` |
|
|
843
|
+
| Etsy | URL matches \`*.etsy.com\` (any path) |
|
|
844
|
+
| WooCommerce | \`<body class="... woocommerce ...\`>\`, OR script/link tags from \`wp-content/plugins/woocommerce\` |
|
|
842
845
|
|
|
843
|
-
###
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
3. Fill shipping info (ask human via \`request_human_approval\` if not already known)
|
|
847
|
-
4. Wait for payment/card fields section to appear
|
|
848
|
-
5. Call \`get_merchant_hints\` with checkout domain (or \`_platform_shopify\` if Shopify detected)
|
|
849
|
-
6. Read the FINAL total (after shipping + tax — hover over/scroll to order summary)
|
|
850
|
-
7. Call \`request_payment_token\` with exact final amount
|
|
851
|
-
8. Call \`execute_payment\` with token + checkout URL + hints
|
|
846
|
+
### Known Limitations
|
|
847
|
+
- Cloudflare-protected sites (e.g. TeePublic) may block headless browser → inform user.
|
|
848
|
+
- Card fields inside iframes: \`execute_payment\` handles this via \`iframe_selector\` in hints automatically.
|
|
852
849
|
|
|
853
|
-
###
|
|
854
|
-
|
|
855
|
-
|
|
850
|
+
### Failure Reporting (Self-Healing Loop)
|
|
851
|
+
If you started Group 3 (called \`get_merchant_hints\` and began following \`pre_steps\`) but CANNOT complete the checkout due to a technical reason:
|
|
852
|
+
→ Call \`report_checkout_fail(url, error_type, error_message)\` before giving up.
|
|
853
|
+
→ Use \`url\` = the page you were on when stuck.
|
|
854
|
+
→ Do NOT call this if user cancelled or balance was insufficient — those are not technical failures.
|
|
856
855
|
`;
|
|
857
856
|
return {
|
|
858
857
|
contents: [
|
|
@@ -872,6 +871,6 @@ async function main() {
|
|
|
872
871
|
await server.connect(transport);
|
|
873
872
|
console.error(`🔐 OpenClaw MCP Server v${version_js_2.CURRENT_MCP_VERSION} running (Phase 2: Smart Routing enabled)...`);
|
|
874
873
|
console.error("Status: Secure & Connected to Z-ZERO Gateway");
|
|
875
|
-
console.error("Tools: list_cards, check_balance, request_payment_token, execute_payment, cancel_payment_token, request_human_approval, auto_pay_checkout");
|
|
874
|
+
console.error("Tools: list_cards, check_balance, request_payment_token, execute_payment, cancel_payment_token, request_human_approval, auto_pay_checkout, report_checkout_fail");
|
|
876
875
|
}
|
|
877
876
|
main().catch(console.error);
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const CURRENT_MCP_VERSION = "1.2
|
|
1
|
+
export declare const CURRENT_MCP_VERSION = "1.1.2";
|
package/dist/version.js
CHANGED
|
@@ -3,4 +3,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CURRENT_MCP_VERSION = void 0;
|
|
4
4
|
// Single source of truth for MCP version
|
|
5
5
|
// Imported by both index.ts and wdk_backend.ts to avoid circular dependency
|
|
6
|
-
exports.CURRENT_MCP_VERSION = "1.2
|
|
6
|
+
exports.CURRENT_MCP_VERSION = "1.1.2";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "z-zero-mcp-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Z-ZERO MCP Server — Secure JIT Virtual Card Payment tools for AI Agents (Claude, Cursor, AutoGPT) — Real Single-Use Visa Cards",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": "dist/index.js",
|