@nullpay/mcp 1.0.0 → 1.0.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 +186 -19
- package/dist/aleo.d.ts +16 -0
- package/dist/aleo.js +125 -5
- package/dist/backend-client.d.ts +1 -2
- package/dist/backend-client.js +2 -14
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +35 -0
- package/dist/env.d.ts +12 -0
- package/dist/env.js +75 -0
- package/dist/server.d.ts +1 -1
- package/dist/server.js +36 -85
- package/dist/service.js +78 -9
- package/dist/setup.d.ts +1 -0
- package/dist/setup.js +140 -0
- package/dist/utils/crypto.d.ts +3 -3
- package/dist/utils/crypto.js +66 -66
- package/dist/utils/env.d.ts +6 -6
- package/dist/utils/env.js +15 -15
- package/dist/utils/esm.d.ts +1 -1
- package/dist/utils/esm.js +7 -7
- package/dist/utils/formatters.d.ts +14 -14
- package/dist/utils/formatters.js +132 -132
- package/package.json +32 -37
package/dist/utils/formatters.js
CHANGED
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.normalizeCurrency = normalizeCurrency;
|
|
4
|
-
exports.normalizePaymentCurrency = normalizePaymentCurrency;
|
|
5
|
-
exports.normalizeInvoiceType = normalizeInvoiceType;
|
|
6
|
-
exports.tokenTypeLabel = tokenTypeLabel;
|
|
7
|
-
exports.invoiceTypeLabel = invoiceTypeLabel;
|
|
8
|
-
exports.currencyToTokenType = currencyToTokenType;
|
|
9
|
-
exports.linkTokenToCurrency = linkTokenToCurrency;
|
|
10
|
-
exports.linkTypeToInvoiceType = linkTypeToInvoiceType;
|
|
11
|
-
exports.parseAmount = parseAmount;
|
|
12
|
-
exports.shouldMarkInvoiceSettled = shouldMarkInvoiceSettled;
|
|
13
|
-
exports.formatInvoiceSummary = formatInvoiceSummary;
|
|
14
|
-
exports.getAmountSource = getAmountSource;
|
|
15
|
-
exports.buildAmountLookupHint = buildAmountLookupHint;
|
|
16
|
-
function normalizeCurrency(value) {
|
|
17
|
-
const normalized = (value || 'CREDITS').toUpperCase();
|
|
18
|
-
if (normalized === 'USDCX' || normalized === 'USAD' || normalized === 'ANY') {
|
|
19
|
-
return normalized;
|
|
20
|
-
}
|
|
21
|
-
return 'CREDITS';
|
|
22
|
-
}
|
|
23
|
-
function normalizePaymentCurrency(value) {
|
|
24
|
-
if (!value) {
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
const normalized = value.toUpperCase();
|
|
28
|
-
if (normalized === 'USDCX' || normalized === 'USAD') {
|
|
29
|
-
return normalized;
|
|
30
|
-
}
|
|
31
|
-
return 'CREDITS';
|
|
32
|
-
}
|
|
33
|
-
function normalizeInvoiceType(value) {
|
|
34
|
-
if (value === 'multipay' || value === 'donation')
|
|
35
|
-
return value;
|
|
36
|
-
return 'standard';
|
|
37
|
-
}
|
|
38
|
-
function tokenTypeLabel(tokenType) {
|
|
39
|
-
if (tokenType === 1)
|
|
40
|
-
return 'USDCX';
|
|
41
|
-
if (tokenType === 2)
|
|
42
|
-
return 'USAD';
|
|
43
|
-
if (tokenType === 3)
|
|
44
|
-
return 'ANY';
|
|
45
|
-
return 'CREDITS';
|
|
46
|
-
}
|
|
47
|
-
function invoiceTypeLabel(invoiceType) {
|
|
48
|
-
if (invoiceType === 1)
|
|
49
|
-
return 'multipay';
|
|
50
|
-
if (invoiceType === 2)
|
|
51
|
-
return 'donation';
|
|
52
|
-
return 'standard';
|
|
53
|
-
}
|
|
54
|
-
function currencyToTokenType(currency) {
|
|
55
|
-
if (currency === 'USDCX')
|
|
56
|
-
return 1;
|
|
57
|
-
if (currency === 'USAD')
|
|
58
|
-
return 2;
|
|
59
|
-
if (currency === 'ANY')
|
|
60
|
-
return 3;
|
|
61
|
-
return 0;
|
|
62
|
-
}
|
|
63
|
-
function linkTokenToCurrency(token) {
|
|
64
|
-
if (!token) {
|
|
65
|
-
return undefined;
|
|
66
|
-
}
|
|
67
|
-
const normalized = token.trim().toLowerCase();
|
|
68
|
-
if (normalized === 'usdcx')
|
|
69
|
-
return 'USDCX';
|
|
70
|
-
if (normalized === 'usad')
|
|
71
|
-
return 'USAD';
|
|
72
|
-
if (normalized === 'any')
|
|
73
|
-
return 'ANY';
|
|
74
|
-
return 'CREDITS';
|
|
75
|
-
}
|
|
76
|
-
function linkTypeToInvoiceType(type) {
|
|
77
|
-
if (type === 'multipay' || type === 'donation') {
|
|
78
|
-
return type;
|
|
79
|
-
}
|
|
80
|
-
return 'standard';
|
|
81
|
-
}
|
|
82
|
-
function parseAmount(value) {
|
|
83
|
-
if (typeof value === 'number') {
|
|
84
|
-
return Number.isFinite(value) ? value : undefined;
|
|
85
|
-
}
|
|
86
|
-
if (!value) {
|
|
87
|
-
return undefined;
|
|
88
|
-
}
|
|
89
|
-
const parsed = Number(value);
|
|
90
|
-
return Number.isFinite(parsed) ? parsed : undefined;
|
|
91
|
-
}
|
|
92
|
-
function shouldMarkInvoiceSettled(invoiceType) {
|
|
93
|
-
return invoiceType !== 1 && invoiceType !== 2;
|
|
94
|
-
}
|
|
95
|
-
function formatInvoiceSummary(invoice) {
|
|
96
|
-
const paymentIds = Array.isArray(invoice.payment_tx_ids) && invoice.payment_tx_ids.length > 0
|
|
97
|
-
? invoice.payment_tx_ids.join(', ')
|
|
98
|
-
: 'none';
|
|
99
|
-
const amount = invoice.amount ?? 0;
|
|
100
|
-
return [
|
|
101
|
-
`invoice=${invoice.invoice_hash}`,
|
|
102
|
-
`status=${invoice.status}`,
|
|
103
|
-
`amount=${amount}`,
|
|
104
|
-
`token=${tokenTypeLabel(invoice.token_type)}`,
|
|
105
|
-
`type=${invoiceTypeLabel(invoice.invoice_type)}`,
|
|
106
|
-
`created=${invoice.created_at || 'unknown'}`,
|
|
107
|
-
`invoice_tx=${invoice.invoice_transaction_id || 'none'}`,
|
|
108
|
-
`payment_txs=${paymentIds}`
|
|
109
|
-
].join(' | ');
|
|
110
|
-
}
|
|
111
|
-
function getAmountSource(invoice) {
|
|
112
|
-
if (typeof invoice.amount_micro === 'number') {
|
|
113
|
-
return 'record';
|
|
114
|
-
}
|
|
115
|
-
if (typeof invoice.amount === 'number' && invoice.amount > 0) {
|
|
116
|
-
return 'database';
|
|
117
|
-
}
|
|
118
|
-
return 'missing';
|
|
119
|
-
}
|
|
120
|
-
function buildAmountLookupHint(invoice, hasInvoiceLookupKey) {
|
|
121
|
-
const amountSource = getAmountSource(invoice);
|
|
122
|
-
if (amountSource === 'record') {
|
|
123
|
-
return ' | amount_source=record';
|
|
124
|
-
}
|
|
125
|
-
if (amountSource === 'database') {
|
|
126
|
-
return ' | amount_source=database';
|
|
127
|
-
}
|
|
128
|
-
if (hasInvoiceLookupKey) {
|
|
129
|
-
return ' | amount_source=missing | record_lookup=not_found_or_unreadable_for_selected_wallet';
|
|
130
|
-
}
|
|
131
|
-
return ' | amount_source=db_only (private key missing to fetch record-backed amount)';
|
|
132
|
-
}
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeCurrency = normalizeCurrency;
|
|
4
|
+
exports.normalizePaymentCurrency = normalizePaymentCurrency;
|
|
5
|
+
exports.normalizeInvoiceType = normalizeInvoiceType;
|
|
6
|
+
exports.tokenTypeLabel = tokenTypeLabel;
|
|
7
|
+
exports.invoiceTypeLabel = invoiceTypeLabel;
|
|
8
|
+
exports.currencyToTokenType = currencyToTokenType;
|
|
9
|
+
exports.linkTokenToCurrency = linkTokenToCurrency;
|
|
10
|
+
exports.linkTypeToInvoiceType = linkTypeToInvoiceType;
|
|
11
|
+
exports.parseAmount = parseAmount;
|
|
12
|
+
exports.shouldMarkInvoiceSettled = shouldMarkInvoiceSettled;
|
|
13
|
+
exports.formatInvoiceSummary = formatInvoiceSummary;
|
|
14
|
+
exports.getAmountSource = getAmountSource;
|
|
15
|
+
exports.buildAmountLookupHint = buildAmountLookupHint;
|
|
16
|
+
function normalizeCurrency(value) {
|
|
17
|
+
const normalized = (value || 'CREDITS').toUpperCase();
|
|
18
|
+
if (normalized === 'USDCX' || normalized === 'USAD' || normalized === 'ANY') {
|
|
19
|
+
return normalized;
|
|
20
|
+
}
|
|
21
|
+
return 'CREDITS';
|
|
22
|
+
}
|
|
23
|
+
function normalizePaymentCurrency(value) {
|
|
24
|
+
if (!value) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const normalized = value.toUpperCase();
|
|
28
|
+
if (normalized === 'USDCX' || normalized === 'USAD') {
|
|
29
|
+
return normalized;
|
|
30
|
+
}
|
|
31
|
+
return 'CREDITS';
|
|
32
|
+
}
|
|
33
|
+
function normalizeInvoiceType(value) {
|
|
34
|
+
if (value === 'multipay' || value === 'donation')
|
|
35
|
+
return value;
|
|
36
|
+
return 'standard';
|
|
37
|
+
}
|
|
38
|
+
function tokenTypeLabel(tokenType) {
|
|
39
|
+
if (tokenType === 1)
|
|
40
|
+
return 'USDCX';
|
|
41
|
+
if (tokenType === 2)
|
|
42
|
+
return 'USAD';
|
|
43
|
+
if (tokenType === 3)
|
|
44
|
+
return 'ANY';
|
|
45
|
+
return 'CREDITS';
|
|
46
|
+
}
|
|
47
|
+
function invoiceTypeLabel(invoiceType) {
|
|
48
|
+
if (invoiceType === 1)
|
|
49
|
+
return 'multipay';
|
|
50
|
+
if (invoiceType === 2)
|
|
51
|
+
return 'donation';
|
|
52
|
+
return 'standard';
|
|
53
|
+
}
|
|
54
|
+
function currencyToTokenType(currency) {
|
|
55
|
+
if (currency === 'USDCX')
|
|
56
|
+
return 1;
|
|
57
|
+
if (currency === 'USAD')
|
|
58
|
+
return 2;
|
|
59
|
+
if (currency === 'ANY')
|
|
60
|
+
return 3;
|
|
61
|
+
return 0;
|
|
62
|
+
}
|
|
63
|
+
function linkTokenToCurrency(token) {
|
|
64
|
+
if (!token) {
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
const normalized = token.trim().toLowerCase();
|
|
68
|
+
if (normalized === 'usdcx')
|
|
69
|
+
return 'USDCX';
|
|
70
|
+
if (normalized === 'usad')
|
|
71
|
+
return 'USAD';
|
|
72
|
+
if (normalized === 'any')
|
|
73
|
+
return 'ANY';
|
|
74
|
+
return 'CREDITS';
|
|
75
|
+
}
|
|
76
|
+
function linkTypeToInvoiceType(type) {
|
|
77
|
+
if (type === 'multipay' || type === 'donation') {
|
|
78
|
+
return type;
|
|
79
|
+
}
|
|
80
|
+
return 'standard';
|
|
81
|
+
}
|
|
82
|
+
function parseAmount(value) {
|
|
83
|
+
if (typeof value === 'number') {
|
|
84
|
+
return Number.isFinite(value) ? value : undefined;
|
|
85
|
+
}
|
|
86
|
+
if (!value) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
const parsed = Number(value);
|
|
90
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
91
|
+
}
|
|
92
|
+
function shouldMarkInvoiceSettled(invoiceType) {
|
|
93
|
+
return invoiceType !== 1 && invoiceType !== 2;
|
|
94
|
+
}
|
|
95
|
+
function formatInvoiceSummary(invoice) {
|
|
96
|
+
const paymentIds = Array.isArray(invoice.payment_tx_ids) && invoice.payment_tx_ids.length > 0
|
|
97
|
+
? invoice.payment_tx_ids.join(', ')
|
|
98
|
+
: 'none';
|
|
99
|
+
const amount = invoice.amount ?? 0;
|
|
100
|
+
return [
|
|
101
|
+
`invoice=${invoice.invoice_hash}`,
|
|
102
|
+
`status=${invoice.status}`,
|
|
103
|
+
`amount=${amount}`,
|
|
104
|
+
`token=${tokenTypeLabel(invoice.token_type)}`,
|
|
105
|
+
`type=${invoiceTypeLabel(invoice.invoice_type)}`,
|
|
106
|
+
`created=${invoice.created_at || 'unknown'}`,
|
|
107
|
+
`invoice_tx=${invoice.invoice_transaction_id || 'none'}`,
|
|
108
|
+
`payment_txs=${paymentIds}`
|
|
109
|
+
].join(' | ');
|
|
110
|
+
}
|
|
111
|
+
function getAmountSource(invoice) {
|
|
112
|
+
if (typeof invoice.amount_micro === 'number') {
|
|
113
|
+
return 'record';
|
|
114
|
+
}
|
|
115
|
+
if (typeof invoice.amount === 'number' && invoice.amount > 0) {
|
|
116
|
+
return 'database';
|
|
117
|
+
}
|
|
118
|
+
return 'missing';
|
|
119
|
+
}
|
|
120
|
+
function buildAmountLookupHint(invoice, hasInvoiceLookupKey) {
|
|
121
|
+
const amountSource = getAmountSource(invoice);
|
|
122
|
+
if (amountSource === 'record') {
|
|
123
|
+
return ' | amount_source=record';
|
|
124
|
+
}
|
|
125
|
+
if (amountSource === 'database') {
|
|
126
|
+
return ' | amount_source=database';
|
|
127
|
+
}
|
|
128
|
+
if (hasInvoiceLookupKey) {
|
|
129
|
+
return ' | amount_source=missing | record_lookup=not_found_or_unreadable_for_selected_wallet';
|
|
130
|
+
}
|
|
131
|
+
return ' | amount_source=db_only (private key missing to fetch record-backed amount)';
|
|
132
|
+
}
|
package/package.json
CHANGED
|
@@ -1,39 +1,34 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"devDependencies": {
|
|
35
|
-
"@types/node": "^25.4.0",
|
|
36
|
-
"ts-node": "^10.9.2",
|
|
37
|
-
"typescript": "^5.9.3"
|
|
38
|
-
}
|
|
2
|
+
"name": "@nullpay/mcp",
|
|
3
|
+
"version": "1.0.3",
|
|
4
|
+
"description": "NullPay MCP server and Claude setup wizard for conversational payment flows",
|
|
5
|
+
"type": "commonjs",
|
|
6
|
+
"main": "dist/server.js",
|
|
7
|
+
"types": "dist/server.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"nullpay-mcp": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc -p tsconfig.json",
|
|
17
|
+
"start": "node dist/cli.js server",
|
|
18
|
+
"dev": "ts-node src/cli.ts server",
|
|
19
|
+
"setup": "ts-node src/cli.ts setup",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@provablehq/sdk": "^0.9.18",
|
|
27
|
+
"@provablehq/wasm": "^0.9.18"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^25.4.0",
|
|
31
|
+
"ts-node": "^10.9.2",
|
|
32
|
+
"typescript": "^5.9.3"
|
|
33
|
+
}
|
|
39
34
|
}
|