z-zero-mcp-server 1.9.0 → 1.10.0
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 +56 -15
- package/dist/base_backend.js +50 -0
- package/dist/index.js +385 -155
- package/dist/ucp_bridge.d.ts +166 -0
- package/dist/ucp_bridge.js +886 -0
- package/package.json +4 -1
- package/dist/mock_backend.d.ts +0 -32
- package/dist/mock_backend.js +0 -150
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "z-zero-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
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": {
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"start": "node dist/index.js",
|
|
12
12
|
"dev": "npx tsx src/index.ts",
|
|
13
13
|
"test:mock-checkout": "npm run build && node --experimental-strip-types tests/backtest_mock_checkout_e2e.mts",
|
|
14
|
+
"test:ucp-offline": "npm run build && node --experimental-strip-types --test tests/ucp_bridge_offline.test.mts",
|
|
15
|
+
"test:ucp-dryrun:live": "npm run build && node --experimental-strip-types tests/ucp_dryrun_meanblvd.mts",
|
|
16
|
+
"test:ucp-smoke:live": "npm run build && node --experimental-strip-types tests/ucp_smoke_colourpop.mts",
|
|
14
17
|
"prepublishOnly": "npm run build"
|
|
15
18
|
},
|
|
16
19
|
"keywords": [
|
package/dist/mock_backend.d.ts
DELETED
|
@@ -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
|
-
}>;
|
package/dist/mock_backend.js
DELETED
|
@@ -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
|
-
}
|