milypay 0.2.5 → 0.2.6

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/dist/index.js CHANGED
@@ -1,141 +1,438 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // src/services.ts
4
- var SERVICES = [
3
+ // src/services.generated.ts
4
+ var GENERATED_SERVICES = [
5
+ {
6
+ "id": "au-business/abn",
7
+ "method": "GET",
8
+ "path": "/au-business/abn/{abn}",
9
+ "price": "0.002",
10
+ "description": "Australian business by ABN (entity name, status, type, ACN, GST, business names, location). Source: ABR."
11
+ },
12
+ {
13
+ "id": "au-business/acn",
14
+ "method": "GET",
15
+ "path": "/au-business/acn/{acn}",
16
+ "price": "0.002",
17
+ "description": "Australian business resolved from an ACN. Source: ABR."
18
+ },
19
+ {
20
+ "id": "au-business/search",
21
+ "method": "GET",
22
+ "path": "/au-business/search?name={name}",
23
+ "price": "0.004",
24
+ "description": "ABN name search by business or entity name. Source: ABR."
25
+ },
26
+ {
27
+ "id": "au-company/acn",
28
+ "method": "GET",
29
+ "path": "/au-company/acn/{acn}",
30
+ "price": "0.002",
31
+ "description": "ASIC company by ACN: status, type, class, registration dates, former names. Free open data."
32
+ },
33
+ {
34
+ "id": "au-company/search",
35
+ "method": "GET",
36
+ "path": "/au-company/search?name={name}",
37
+ "price": "0.004",
38
+ "description": "ASIC company name search (current and former names). Free open data."
39
+ },
40
+ {
41
+ "id": "au-asic-extract/search",
42
+ "method": "GET",
43
+ "path": "/au-asic-extract/search?name={name}",
44
+ "price": "0.005",
45
+ "description": "TEST MODE (Acceleon UAT): ASIC organisation name search. Returns NNIs."
46
+ },
47
+ {
48
+ "id": "au-asic-extract/company",
49
+ "method": "GET",
50
+ "path": "/au-asic-extract/company/{nni}",
51
+ "price": "0.005",
52
+ "description": "TEST MODE (Acceleon UAT): ASIC company details + canPurchase flags."
53
+ },
54
+ {
55
+ "id": "au-asic-extract/business",
56
+ "method": "GET",
57
+ "path": "/au-asic-extract/business/{nni}",
58
+ "price": "0.005",
59
+ "description": "TEST MODE (Acceleon UAT): ASIC business name details."
60
+ },
61
+ {
62
+ "id": "POST au-asic-extract/purchase",
63
+ "method": "POST",
64
+ "path": "/au-asic-extract/purchase",
65
+ "price": "0.10",
66
+ "description": "TEST MODE (Acceleon UAT): buy an ASIC extract ({nni,kind,type}); 0.10 current / 0.20 historical. Returns extractId + buyer token. Extract content is dummy UAT data."
67
+ },
68
+ {
69
+ "id": "au-company-report",
70
+ "method": "GET",
71
+ "path": "/au-company-report?acn={acn}",
72
+ "price": "12.00",
73
+ "description": "Official ASIC company extract (directors, office, share capital). Paid DSP only; not in free gov open data."
74
+ },
75
+ {
76
+ "id": "au-address/validate",
77
+ "method": "GET",
78
+ "path": "/au-address/validate?q={address}",
79
+ "price": "0.004",
80
+ "description": "Validate an Australian address against G-NAF. Returns canonical address, GNAF PID, geocode."
81
+ },
82
+ {
83
+ "id": "au-address/search",
84
+ "method": "GET",
85
+ "path": "/au-address/search?q={query}",
86
+ "price": "0.004",
87
+ "description": "Ranked Australian address matches (autocomplete) from G-NAF."
88
+ },
89
+ {
90
+ "id": "au-address/geocode",
91
+ "method": "GET",
92
+ "path": "/au-address/geocode?q={address}",
93
+ "price": "0.004",
94
+ "description": "Latitude and longitude for an Australian address from G-NAF."
95
+ },
96
+ {
97
+ "id": "au-super/abn",
98
+ "method": "GET",
99
+ "path": "/au-super/abn/{abn}",
100
+ "price": "0.002",
101
+ "description": "Super fund lookup by ABN: fund name, status, type, complying status, USIs. Source: ATO."
102
+ },
103
+ {
104
+ "id": "au-weather",
105
+ "method": "GET",
106
+ "path": "/au-weather?q={address}",
107
+ "price": "0.001",
108
+ "description": "Current conditions and forecast for an Australian address (BOM ACCESS-G via Open-Meteo)."
109
+ },
110
+ {
111
+ "id": "au-weather",
112
+ "method": "GET",
113
+ "path": "/au-weather?lat={lat}&lng={lng}",
114
+ "price": "0.001",
115
+ "description": "Current conditions and forecast for an Australian coordinate."
116
+ },
117
+ {
118
+ "id": "au-postage",
119
+ "method": "GET",
120
+ "path": "/au-postage?from={postcode}&to={postcode}&weight={kg}&length={cm}&width={cm}&height={cm}",
121
+ "price": "0.002",
122
+ "description": "Australia Post domestic parcel rates and services between two postcodes."
123
+ },
124
+ {
125
+ "id": "au-postage",
126
+ "method": "GET",
127
+ "path": "/au-postage?country={code}&weight={kg}",
128
+ "price": "0.002",
129
+ "description": "Australia Post international parcel rates and services."
130
+ },
131
+ {
132
+ "id": "au-bsb",
133
+ "method": "GET",
134
+ "path": "/au-bsb/{bsb}",
135
+ "price": "0.002",
136
+ "description": "BSB lookup: bank name, branch, address, state, postcode, and supported payment methods (paper/electronic/high-value). 17,000+ BSBs from AusPayNet."
137
+ },
138
+ {
139
+ "id": "au-bsb/search",
140
+ "method": "GET",
141
+ "path": "/au-bsb/search?q={query}",
142
+ "price": "0.004",
143
+ "description": "Search BSBs by bank name, branch name, or suburb."
144
+ },
145
+ {
146
+ "id": "au-abs/dataflows",
147
+ "method": "GET",
148
+ "path": "/au-abs/dataflows?q={query}",
149
+ "price": "0.002",
150
+ "description": "Search ABS SDMX dataflow catalogue (CPI, labour, ERP, census, \u2026). Source: ABS Data API."
151
+ },
152
+ {
153
+ "id": "au-abs/dataflow",
154
+ "method": "GET",
155
+ "path": "/au-abs/dataflow/{id}",
156
+ "price": "0.002",
157
+ "description": "ABS dataflow structure/metadata by id (e.g. CPI, WPI, RT)."
158
+ },
159
+ {
160
+ "id": "au-abs/data",
161
+ "method": "GET",
162
+ "path": "/au-abs/data/{dataflow}?key={key}&startPeriod={period}",
163
+ "price": "0.005",
164
+ "description": "Fetch ABS series observations (normalised JSON). Source: ABS Data API."
165
+ },
166
+ {
167
+ "id": "au-abs/cpi",
168
+ "method": "GET",
169
+ "path": "/au-abs/cpi?startPeriod={period}",
170
+ "price": "0.003",
171
+ "description": "Headline All groups CPI index (Australia, quarterly) with latest/QoQ/YoY. Catalogue 6401.0."
172
+ },
173
+ {
174
+ "id": "au-energy",
175
+ "method": "GET",
176
+ "path": "/au-energy",
177
+ "price": "0.001",
178
+ "description": "Australian energy products catalogue (NEM electricity; gas/water planned)."
179
+ },
180
+ {
181
+ "id": "au-energy/nem",
182
+ "method": "GET",
183
+ "path": "/au-energy/nem",
184
+ "price": "0.002",
185
+ "description": "Live AEMO NEM wholesale price + demand for all regions (NSW1/QLD1/SA1/TAS1/VIC1)."
186
+ },
187
+ {
188
+ "id": "au-energy/nem",
189
+ "method": "GET",
190
+ "path": "/au-energy/nem/{region}",
191
+ "price": "0.002",
192
+ "description": "Live AEMO NEM snapshot for one region (NSW1 or NSW, etc)."
193
+ },
194
+ {
195
+ "id": "au-energy/notices",
196
+ "method": "GET",
197
+ "path": "/au-energy/notices?limit=",
198
+ "price": "0.002",
199
+ "description": "Recent AEMO electricity market notices."
200
+ },
201
+ {
202
+ "id": "domains",
203
+ "method": "GET",
204
+ "path": "/domains",
205
+ "price": "0.001",
206
+ "description": "Domain catalogue (Dynadot x402 register proxy)."
207
+ },
5
208
  {
6
- id: "au-business/abn",
7
- path: "/au-business/abn/{abn}",
8
- price: "0.002",
9
- description: "Australian business by ABN (ABR)"
209
+ "id": "domains/check",
210
+ "method": "GET",
211
+ "path": "/domains/check?name=",
212
+ "price": "0.01",
213
+ "description": "Domain availability + registrar cost."
10
214
  },
11
215
  {
12
- id: "au-business/acn",
13
- path: "/au-business/acn/{acn}",
14
- price: "0.002",
15
- description: "Australian business by ACN (ABR)"
216
+ "id": "domains/quote",
217
+ "method": "GET",
218
+ "path": "/domains/quote?name=&years=",
219
+ "price": "0.01",
220
+ "description": "Domain agent checkout price (cost+markup)."
16
221
  },
17
222
  {
18
- id: "au-business/search",
19
- path: "/au-business/search?name={name}",
20
- price: "0.004",
21
- description: "ABN name search"
223
+ "id": "POST domains/register",
224
+ "method": "POST",
225
+ "path": "/domains/register",
226
+ "price": "variable",
227
+ "description": "Register domain after x402 payment for quote amount."
22
228
  },
23
229
  {
24
- id: "au-company/acn",
25
- path: "/au-company/acn/{acn}",
26
- price: "0.002",
27
- description: "ASIC company by ACN (open data)"
230
+ "id": "au-rides",
231
+ "method": "GET",
232
+ "path": "/au-rides",
233
+ "price": "0.001",
234
+ "description": "Rides catalogue (Uber quote-only, no booking)."
28
235
  },
29
236
  {
30
- id: "au-company/search",
31
- path: "/au-company/search?name={name}",
32
- price: "0.004",
33
- description: "ASIC company name search"
237
+ "id": "au-rides/quote",
238
+ "method": "GET",
239
+ "path": "/au-rides/quote?start_lat=&start_lng=&end_lat=&end_lng=",
240
+ "price": "0.01",
241
+ "description": "Uber price estimates between two points (quote only)."
34
242
  },
35
243
  {
36
- id: "au-company-report",
37
- path: "/au-company-report?acn={acn}",
38
- price: "12.00",
39
- description: "Official ASIC company extract (paid DSP)"
244
+ "id": "au-rides/eta",
245
+ "method": "GET",
246
+ "path": "/au-rides/eta?start_lat=&start_lng=",
247
+ "price": "0.01",
248
+ "description": "Uber pickup time estimates (quote only)."
40
249
  },
41
250
  {
42
- id: "au-address/validate",
43
- path: "/au-address/validate?q={address}",
44
- price: "0.004",
45
- description: "Validate Australian address (G-NAF)"
251
+ "id": "au-rides/products",
252
+ "method": "GET",
253
+ "path": "/au-rides/products?lat=&lng=",
254
+ "price": "0.005",
255
+ "description": "Uber products available at a location."
46
256
  },
47
257
  {
48
- id: "au-address/search",
49
- path: "/au-address/search?q={query}",
50
- price: "0.004",
51
- description: "Address autocomplete (G-NAF)"
258
+ "id": "au-phone",
259
+ "method": "GET",
260
+ "path": "/au-phone?number={e164}",
261
+ "price": "0.05",
262
+ "description": "Phone line intel: valid, type, carrier (not personal identity)."
52
263
  },
53
264
  {
54
- id: "au-address/geocode",
55
- path: "/au-address/geocode?q={address}",
56
- price: "0.004",
57
- description: "Geocode Australian address"
265
+ "id": "au-check",
266
+ "method": "GET",
267
+ "path": "/au-check",
268
+ "price": "0.001",
269
+ "description": "Checkify extras catalogue (postcode, reverse geo, names, sanctions, checksums)."
58
270
  },
59
271
  {
60
- id: "au-super/abn",
61
- path: "/au-super/abn/{abn}",
62
- price: "0.002",
63
- description: "Super fund by ABN (ATO)"
272
+ "id": "au-check/postcode",
273
+ "method": "GET",
274
+ "path": "/au-check/postcode?postcode=",
275
+ "price": "0.01",
276
+ "description": "Suburbs in a postcode (AU/NZ via Checkify)."
64
277
  },
65
278
  {
66
- id: "au-weather",
67
- path: "/au-weather?q={address}",
68
- price: "0.001",
69
- description: "Weather for Australian address"
279
+ "id": "au-check/reverse",
280
+ "method": "GET",
281
+ "path": "/au-check/reverse?lat=&lng=",
282
+ "price": "0.01",
283
+ "description": "Reverse geocode nearest address."
70
284
  },
71
285
  {
72
- id: "au-postage",
73
- path: "/au-postage?from={pc}&to={pc}&weight={kg}",
74
- price: "0.002",
75
- description: "Australia Post parcel rates"
286
+ "id": "au-check/suburb",
287
+ "method": "GET",
288
+ "path": "/au-check/suburb?q=",
289
+ "price": "0.005",
290
+ "description": "Suburb autocomplete."
76
291
  },
77
292
  {
78
- id: "au-bsb",
79
- path: "/au-bsb/{bsb}",
80
- price: "0.002",
81
- description: "BSB lookup (AusPayNet)"
293
+ "id": "au-check/activity",
294
+ "method": "GET",
295
+ "path": "/au-check/activity?q=",
296
+ "price": "0.005",
297
+ "description": "ANZSIC / business activity search."
82
298
  },
83
299
  {
84
- id: "au-bsb/search",
85
- path: "/au-bsb/search?q={query}",
86
- price: "0.004",
87
- description: "Search BSBs by bank/branch/suburb"
300
+ "id": "au-check/company-name",
301
+ "method": "GET",
302
+ "path": "/au-check/company-name?name=",
303
+ "price": "0.01",
304
+ "description": "ASIC company name availability."
88
305
  },
89
306
  {
90
- id: "abs-dataflows",
91
- path: "/au-abs/dataflows?q={query}",
92
- price: "0.002",
93
- description: "Search ABS dataflow catalogue"
307
+ "id": "au-check/business-name",
308
+ "method": "GET",
309
+ "path": "/au-check/business-name?name=",
310
+ "price": "0.01",
311
+ "description": "ASIC business name availability."
94
312
  },
95
313
  {
96
- id: "abs-dataflow",
97
- path: "/au-abs/dataflow/{id}",
98
- price: "0.002",
99
- description: "ABS dataflow metadata"
314
+ "id": "au-check/sanctions",
315
+ "method": "GET",
316
+ "path": "/au-check/sanctions?name=",
317
+ "price": "0.03",
318
+ "description": "Sanctions screening (11 lists)."
100
319
  },
101
320
  {
102
- id: "abs-data",
103
- path: "/au-abs/data/{dataflow}?key={key}&startPeriod={period}",
104
- price: "0.005",
105
- description: "ABS series data (normalised)"
321
+ "id": "au-check/director-id",
322
+ "method": "GET",
323
+ "path": "/au-check/director-id?id=",
324
+ "price": "0.01",
325
+ "description": "Director ID checksum (not live ABRS)."
106
326
  },
107
327
  {
108
- id: "abs-cpi",
109
- path: "/au-abs/cpi",
110
- price: "0.003",
111
- description: "Headline CPI index + QoQ/YoY"
328
+ "id": "au-check/tfn",
329
+ "method": "GET",
330
+ "path": "/au-check/tfn?tfn=",
331
+ "price": "0.01",
332
+ "description": "TFN checksum (not live ATO)."
112
333
  },
113
- { id: "transit-regions", path: "/au-transit/regions", price: "0.001", description: "AU transit regions" },
114
- { id: "transit-vehicles", path: "/au-transit/{region}/vehicles", price: "0.003", description: "Live vehicles (GTFS-RT)" },
115
- { id: "transit-trips", path: "/au-transit/{region}/trip-updates", price: "0.003", description: "Trip updates / delays" },
116
- { id: "transit-alerts", path: "/au-transit/{region}/alerts", price: "0.002", description: "Service alerts" },
117
- { id: "transit-summary", path: "/au-transit/{region}/summary", price: "0.002", description: "Region feed summary" },
118
- { id: "energy", path: "/au-energy", price: "0.001", description: "AU energy catalogue" },
119
- { id: "energy-nem", path: "/au-energy/nem", price: "0.002", description: "NEM live all regions" },
120
- { id: "energy-nem-region", path: "/au-energy/nem/{region}", price: "0.002", description: "NEM live one region" },
121
- { id: "energy-notices", path: "/au-energy/notices", price: "0.002", description: "AEMO market notices" },
122
- { id: "domains-check", path: "/domains/check", price: "0.01", description: "Domain availability" },
123
- { id: "domains-quote", path: "/domains/quote", price: "0.01", description: "Domain register quote" },
124
- { id: "rides-quote", path: "/au-rides/quote", price: "0.01", description: "Uber price estimate quote-only" },
125
- { id: "phone", path: "/au-phone?number={e164}", price: "0.05", description: "Phone line intel (valid/type/carrier)" },
126
334
  {
127
- id: "ramp-moneygram",
128
- path: "/ramp/moneygram",
129
- price: "0",
130
- description: "MoneyGram funding status (pre-x402 wallet top-up)"
335
+ "id": "au-check/email",
336
+ "method": "GET",
337
+ "path": "/au-check/email?email=",
338
+ "price": "0.01",
339
+ "description": "Email validation (format/MX/deliverability)."
131
340
  },
132
341
  {
133
- id: "ramp-moneygram-session",
134
- path: "POST /ramp/moneygram/session",
135
- price: "0",
136
- description: "Create MoneyGram sandbox session (on-ramp / off-ramp widget)"
342
+ "id": "au-phone",
343
+ "method": "GET",
344
+ "path": "/au-phone/{e164}",
345
+ "price": "0.05",
346
+ "description": "Phone line intel by path (URL-encode +)."
347
+ },
348
+ {
349
+ "id": "au-transit/regions",
350
+ "method": "GET",
351
+ "path": "/au-transit/regions",
352
+ "price": "0.001",
353
+ "description": "Australian public transport regions (live GTFS-RT + planned)."
354
+ },
355
+ {
356
+ "id": "au-transit/vehicles",
357
+ "method": "GET",
358
+ "path": "/au-transit/{region}/vehicles",
359
+ "price": "0.003",
360
+ "description": "Live vehicle positions (GTFS-RT). region=seq|sa. Optional routeId, limit."
361
+ },
362
+ {
363
+ "id": "au-transit/trip-updates",
364
+ "method": "GET",
365
+ "path": "/au-transit/{region}/trip-updates",
366
+ "price": "0.003",
367
+ "description": "Live trip delays/ETAs (GTFS-RT). Optional routeId, stopId, limit."
368
+ },
369
+ {
370
+ "id": "au-transit/alerts",
371
+ "method": "GET",
372
+ "path": "/au-transit/{region}/alerts",
373
+ "price": "0.002",
374
+ "description": "Service alerts (GTFS-RT)."
375
+ },
376
+ {
377
+ "id": "au-transit/summary",
378
+ "method": "GET",
379
+ "path": "/au-transit/{region}/summary",
380
+ "price": "0.002",
381
+ "description": "Feed health counts + sample for a region."
382
+ },
383
+ {
384
+ "id": "au-asic-extract",
385
+ "method": "GET",
386
+ "path": "/au-asic-extract",
387
+ "price": "0",
388
+ "description": "ASIC extract catalogue (Acceleon UAT test mode)."
389
+ },
390
+ {
391
+ "id": "au-asic-extract/status",
392
+ "method": "GET",
393
+ "path": "/au-asic-extract/status/{id}?token={token}",
394
+ "price": "0",
395
+ "description": "Extract status (buyer token from purchase)."
396
+ },
397
+ {
398
+ "id": "au-asic-extract/extract",
399
+ "method": "GET",
400
+ "path": "/au-asic-extract/extract/{id}?token={token}",
401
+ "price": "0",
402
+ "description": "Download extract JSON / PDF (buyer token from purchase)."
403
+ },
404
+ {
405
+ "id": "ramp/moneygram",
406
+ "method": "GET",
407
+ "path": "/ramp/moneygram",
408
+ "price": "0",
409
+ "description": "MoneyGram funding status (pre-x402 wallet top-up)."
410
+ },
411
+ {
412
+ "id": "POST ramp/moneygram/session",
413
+ "method": "POST",
414
+ "path": "/ramp/moneygram/session",
415
+ "price": "0",
416
+ "description": "Create MoneyGram sandbox session (on-ramp / off-ramp)."
417
+ },
418
+ {
419
+ "id": "status",
420
+ "method": "GET",
421
+ "path": "/status",
422
+ "price": "0",
423
+ "description": "Service health (JSON)."
424
+ },
425
+ {
426
+ "id": "stats",
427
+ "method": "GET",
428
+ "path": "/stats",
429
+ "price": "0",
430
+ "description": "Usage stats."
137
431
  }
138
432
  ];
433
+
434
+ // src/services.ts
435
+ var SERVICES = GENERATED_SERVICES;
139
436
  var DEMO_BASE = "https://milypay.xyz";
140
437
  var API_BASE = "https://api.milypay.xyz";
141
438
  var DOCS = "https://milypay.xyz/agents.md";
@@ -191,6 +488,10 @@ function walletHelp() {
191
488
  ].join("\n");
192
489
  }
193
490
 
491
+ // src/version.ts
492
+ var VERSION = "0.2.6";
493
+ var USER_AGENT = `milypay-cli/${VERSION}`;
494
+
194
495
  // src/client.ts
195
496
  function resolveBase(host, wallet, override) {
196
497
  if (override) return override.replace(/\/$/, "");
@@ -230,7 +531,7 @@ async function milypayFetch(path, opts2 = { host: "auto" }, init = {}) {
230
531
  const method = (init.method || "GET").toUpperCase();
231
532
  const headers = {
232
533
  accept: "application/json",
233
- "user-agent": "milypay-cli/0.2.5",
534
+ "user-agent": USER_AGENT,
234
535
  ...init.headers || {}
235
536
  };
236
537
  let body;
@@ -308,15 +609,13 @@ async function postJson(path, body, opts2) {
308
609
  return parseJsonResponse(res);
309
610
  }
310
611
 
612
+ // src/index.ts
613
+ import { writeFileSync } from "fs";
614
+
311
615
  // src/mcp.ts
312
616
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
313
617
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
314
618
  import { z } from "zod";
315
-
316
- // src/version.ts
317
- var VERSION = "0.2.5";
318
-
319
- // src/mcp.ts
320
619
  function hostFromEnv() {
321
620
  const h = (process.env.MILYPAY_HOST || "auto").toLowerCase();
322
621
  if (h === "demo" || h === "api" || h === "auto") return h;
@@ -333,15 +632,14 @@ function opts() {
333
632
  function digits(s) {
334
633
  return s.replace(/\D/g, "");
335
634
  }
635
+ var MAX_TEXT = Number(process.env.MILYPAY_MCP_MAX_CHARS || 2e5);
336
636
  function ok(data) {
337
- return {
338
- content: [
339
- {
340
- type: "text",
341
- text: typeof data === "string" ? data : JSON.stringify(data, null, 2)
342
- }
343
- ]
344
- };
637
+ let text = typeof data === "string" ? data : JSON.stringify(data);
638
+ if (text.length > MAX_TEXT) {
639
+ text = text.slice(0, MAX_TEXT) + `
640
+ \u2026[truncated ${text.length - MAX_TEXT} chars; narrow the query (e.g. key=, maxSeries, limit)]`;
641
+ }
642
+ return { content: [{ type: "text", text }] };
345
643
  }
346
644
  function fail(err) {
347
645
  const msg = err instanceof Error ? err.message : String(err);
@@ -632,7 +930,7 @@ async function startMcpServer() {
632
930
  "call",
633
931
  {
634
932
  title: "Raw API call",
635
- description: "GET an arbitrary Milypay path, e.g. /au-business/abn/51824753556. Prefer typed tools when possible.",
933
+ description: "GET an arbitrary Milypay path, e.g. /au-business/abn/55695484756. Prefer typed tools when possible.",
636
934
  inputSchema: {
637
935
  path: z.string().describe("API path starting with /, e.g. /au-bsb/012-002")
638
936
  }
@@ -701,11 +999,13 @@ async function startMcpServer() {
701
999
  dataflow: z.string().describe("e.g. CPI"),
702
1000
  key: z.string().optional().describe("SDMX key e.g. 1.10001.10.50.Q"),
703
1001
  startPeriod: z.string().optional().describe("e.g. 2020 or 2020-Q1"),
704
- endPeriod: z.string().optional()
1002
+ endPeriod: z.string().optional(),
1003
+ maxSeries: z.number().int().min(1).max(200).optional().describe("Max series returned (default 10). Use a specific key for one series.")
705
1004
  }
706
1005
  },
707
- async ({ dataflow, key, startPeriod, endPeriod }) => {
1006
+ async ({ dataflow, key, startPeriod, endPeriod, maxSeries }) => {
708
1007
  const qs = new URLSearchParams();
1008
+ qs.set("maxSeries", String(maxSeries ?? 10));
709
1009
  if (key) qs.set("key", key);
710
1010
  if (startPeriod) qs.set("startPeriod", startPeriod);
711
1011
  if (endPeriod) qs.set("endPeriod", endPeriod);
@@ -902,6 +1202,190 @@ async function startMcpServer() {
902
1202
  },
903
1203
  async ({ lat, lng }) => runJson(`/au-rides/products?lat=${encodeURIComponent(String(lat))}&lng=${encodeURIComponent(String(lng))}`)
904
1204
  );
1205
+ server.registerTool(
1206
+ "check_postcode",
1207
+ {
1208
+ description: "Suburbs in an AU/NZ postcode (Checkify).",
1209
+ inputSchema: { postcode: z.string(), country: z.string().optional() }
1210
+ },
1211
+ async ({ postcode, country }) => {
1212
+ const qs = new URLSearchParams({ postcode });
1213
+ if (country) qs.set("country", country);
1214
+ return runJson(`/au-check/postcode?${qs}`);
1215
+ }
1216
+ );
1217
+ server.registerTool(
1218
+ "check_company_name",
1219
+ {
1220
+ description: "ASIC company name availability.",
1221
+ inputSchema: { name: z.string() }
1222
+ },
1223
+ async ({ name }) => runJson(`/au-check/company-name?name=${encodeURIComponent(name)}`)
1224
+ );
1225
+ server.registerTool(
1226
+ "check_sanctions",
1227
+ {
1228
+ description: "Sanctions screening against 11 lists. Optional birth_year, country, city.",
1229
+ inputSchema: {
1230
+ name: z.string(),
1231
+ birth_year: z.string().optional(),
1232
+ country: z.string().optional(),
1233
+ city: z.string().optional()
1234
+ }
1235
+ },
1236
+ async ({ name, birth_year, country, city }) => {
1237
+ const qs = new URLSearchParams({ name });
1238
+ if (birth_year) qs.set("birth_year", birth_year);
1239
+ if (country) qs.set("country", country);
1240
+ if (city) qs.set("city", city);
1241
+ return runJson(`/au-check/sanctions?${qs}`);
1242
+ }
1243
+ );
1244
+ server.registerTool(
1245
+ "check_email",
1246
+ {
1247
+ description: "Email format/MX/deliverability (Checkify).",
1248
+ inputSchema: { email: z.string() }
1249
+ },
1250
+ async ({ email }) => runJson(`/au-check/email?email=${encodeURIComponent(email)}`)
1251
+ );
1252
+ server.registerTool(
1253
+ "check_catalogue",
1254
+ { description: "Checkify extras catalogue (postcode, reverse geo, names, sanctions, checksums).", inputSchema: {} },
1255
+ async () => runJson(`/au-check`)
1256
+ );
1257
+ server.registerTool(
1258
+ "check_reverse",
1259
+ {
1260
+ description: "Reverse geocode a lat/lng to the nearest Australian address (Checkify).",
1261
+ inputSchema: { lat: z.number(), lng: z.number() }
1262
+ },
1263
+ async ({ lat, lng }) => runJson(`/au-check/reverse?${new URLSearchParams({ lat: String(lat), lng: String(lng) })}`)
1264
+ );
1265
+ server.registerTool(
1266
+ "check_suburb",
1267
+ { description: "Suburb / locality autocomplete (Checkify).", inputSchema: { q: z.string() } },
1268
+ async ({ q }) => runJson(`/au-check/suburb?${new URLSearchParams({ q })}`)
1269
+ );
1270
+ server.registerTool(
1271
+ "check_activity",
1272
+ { description: "ANZSIC / business activity search (Checkify).", inputSchema: { q: z.string() } },
1273
+ async ({ q }) => runJson(`/au-check/activity?${new URLSearchParams({ q })}`)
1274
+ );
1275
+ server.registerTool(
1276
+ "check_business_name",
1277
+ { description: "ASIC business name availability.", inputSchema: { name: z.string() } },
1278
+ async ({ name }) => runJson(`/au-check/business-name?${new URLSearchParams({ name })}`)
1279
+ );
1280
+ server.registerTool(
1281
+ "check_director_id",
1282
+ {
1283
+ description: "Director ID checksum (15 digits). Structural validity only, not a live ABRS lookup.",
1284
+ inputSchema: { id: z.string() }
1285
+ },
1286
+ async ({ id }) => runJson(`/au-check/director-id?${new URLSearchParams({ id })}`)
1287
+ );
1288
+ server.registerTool(
1289
+ "check_tfn",
1290
+ {
1291
+ description: "TFN checksum. Structural validity only, not a live ATO lookup.",
1292
+ inputSchema: { tfn: z.string() }
1293
+ },
1294
+ async ({ tfn }) => runJson(`/au-check/tfn?${new URLSearchParams({ tfn })}`)
1295
+ );
1296
+ server.registerTool(
1297
+ "asic_extract_catalogue",
1298
+ { description: "ASIC extract catalogue and prices (Acceleon UAT test mode).", inputSchema: {} },
1299
+ async () => runJson(`/au-asic-extract`)
1300
+ );
1301
+ server.registerTool(
1302
+ "asic_extract_search",
1303
+ {
1304
+ description: "ASIC organisation name search via Acceleon (UAT test mode). Returns NNIs for details/purchase.",
1305
+ inputSchema: { name: z.string().describe("Organisation name, e.g. milysec") }
1306
+ },
1307
+ async ({ name }) => runJson(`/au-asic-extract/search?${new URLSearchParams({ name })}`)
1308
+ );
1309
+ server.registerTool(
1310
+ "asic_extract_company",
1311
+ {
1312
+ description: "ASIC company details + canPurchase flags by NNI (ACN for companies).",
1313
+ inputSchema: { nni: z.string().describe("NNI / ACN, e.g. 695484756") }
1314
+ },
1315
+ async ({ nni }) => runJson(`/au-asic-extract/company/${digits(nni)}`)
1316
+ );
1317
+ server.registerTool(
1318
+ "asic_extract_business",
1319
+ {
1320
+ description: "ASIC business name details by NNI.",
1321
+ inputSchema: { nni: z.string() }
1322
+ },
1323
+ async ({ nni }) => runJson(`/au-asic-extract/business/${digits(nni)}`)
1324
+ );
1325
+ server.registerTool(
1326
+ "asic_extract_purchase",
1327
+ {
1328
+ description: "Buy an ASIC extract (POST, always paid via x402: 0.10 current / 0.20 historical in UAT test mode). Returns extractId + buyer token. Needs a wallet (MILYPAY_PRIVATE_KEY).",
1329
+ inputSchema: {
1330
+ nni: z.string(),
1331
+ kind: z.enum(["company", "business"]).optional(),
1332
+ type: z.enum(["current", "historical"]).optional()
1333
+ }
1334
+ },
1335
+ async ({ nni, kind, type }) => {
1336
+ try {
1337
+ return ok(
1338
+ await postJson(
1339
+ `/au-asic-extract/purchase`,
1340
+ { nni: digits(nni), kind: kind || "company", type: type || "current" },
1341
+ opts()
1342
+ )
1343
+ );
1344
+ } catch (e) {
1345
+ return fail(e);
1346
+ }
1347
+ }
1348
+ );
1349
+ server.registerTool(
1350
+ "asic_extract_status",
1351
+ {
1352
+ description: "Extract status by extractId (buyer token from the purchase response required).",
1353
+ inputSchema: { id: z.string(), token: z.string() }
1354
+ },
1355
+ async ({ id, token }) => runJson(`/au-asic-extract/status/${digits(id)}?${new URLSearchParams({ token })}`)
1356
+ );
1357
+ server.registerTool(
1358
+ "asic_extract_download",
1359
+ {
1360
+ description: "Download a purchased extract as JSON (pdf=true adds pdfBase64). Buyer token required.",
1361
+ inputSchema: { id: z.string(), token: z.string(), pdf: z.boolean().optional() }
1362
+ },
1363
+ async ({ id, token, pdf }) => {
1364
+ const qs = new URLSearchParams({ token });
1365
+ if (pdf) qs.set("pdf", "1");
1366
+ return runJson(`/au-asic-extract/extract/${digits(id)}?${qs}`);
1367
+ }
1368
+ );
1369
+ server.registerTool(
1370
+ "energy_catalogue",
1371
+ { description: "Australian energy products catalogue.", inputSchema: {} },
1372
+ async () => runJson(`/au-energy`)
1373
+ );
1374
+ server.registerTool(
1375
+ "rides_catalogue",
1376
+ { description: "Rides catalogue (Uber quote-only, no booking).", inputSchema: {} },
1377
+ async () => runJson(`/au-rides`)
1378
+ );
1379
+ server.registerTool(
1380
+ "domains_catalogue",
1381
+ { description: "Domain catalogue (Dynadot x402 register proxy).", inputSchema: {} },
1382
+ async () => runJson(`/domains`)
1383
+ );
1384
+ server.registerTool(
1385
+ "service_status",
1386
+ { description: "Milypay service health, including degraded upstreams.", inputSchema: {} },
1387
+ async () => runJson(`/status`)
1388
+ );
905
1389
  server.registerTool(
906
1390
  "moneygram_status",
907
1391
  {
@@ -958,8 +1442,9 @@ function parseArgs(argv) {
958
1442
  out.base = argv[++i];
959
1443
  out.host = "api";
960
1444
  } else if (a === "--rpc") out.rpc = argv[++i];
961
- else if (a.startsWith("-")) {
962
- throw new Error(`Unknown flag: ${a}`);
1445
+ else if (a === "--") {
1446
+ out._.push(...argv.slice(i + 1));
1447
+ break;
963
1448
  } else out._.push(a);
964
1449
  }
965
1450
  return out;
@@ -981,7 +1466,7 @@ Usage:
981
1466
  Commands:
982
1467
  mcp Start MCP server (stdio) for Claude/Cursor
983
1468
  services List endpoints + prices
984
- call <path> Raw path, e.g. /au-business/abn/51824753556
1469
+ call <path> Raw path, e.g. /au-business/abn/55695484756
985
1470
  abn <abn> Business by ABN
986
1471
  acn <acn> Business by ACN
987
1472
  business search <name> ABN name search
@@ -995,6 +1480,19 @@ Commands:
995
1480
  bsb search <query> Search BSBs
996
1481
  postage --from <pc> --to <pc> --weight <kg> [--length --width --height]
997
1482
  postage --country <cc> --weight <kg>
1483
+ abs dataflows [q] | abs dataflow <id> | abs data <flow> --key <k> [--start p] [--max-series n]
1484
+ cpi [startPeriod] Headline CPI (ABS)
1485
+ transit regions | transit <region> vehicles|trips|alerts|summary [--limit n --route r --stop s]
1486
+ nem [region] | energy notices [n] | energy catalogue
1487
+ phone <number> Phone line intel
1488
+ check <postcode|reverse|suburb|activity|company-name|business-name|sanctions|director-id|tfn|email> <value>
1489
+ asic ASIC extract catalogue (Acceleon, UAT test mode)
1490
+ asic search <name> Organisation search (returns NNIs)
1491
+ asic company|business <nni> Details + purchasable flags
1492
+ asic purchase <nni> [--kind company|business] [--type current|historical] (paid, POST)
1493
+ asic status <id> --token <t> Extract status (buyer token from purchase)
1494
+ asic extract <id> --token <t> [--pdf] [--out file.pdf]
1495
+ status | stats Service health / usage
998
1496
  fund|moneygram [status|session] MoneyGram wallet funding (pre-x402)
999
1497
  domains check|quote <name> DNS availability / quote
1000
1498
  rides quote|eta|products \u2026 Uber estimates (quote-only)
@@ -1048,6 +1546,7 @@ function clientOpts(args) {
1048
1546
  async function cmdServices() {
1049
1547
  const rows = SERVICES.map((s) => ({
1050
1548
  id: s.id,
1549
+ method: s.method,
1051
1550
  path: s.path,
1052
1551
  priceAUD: s.price,
1053
1552
  description: s.description
@@ -1148,6 +1647,75 @@ async function cmdPostage(rest, args) {
1148
1647
  }
1149
1648
  print(await getJson(`/au-postage?${qs}`, clientOpts(args)), true);
1150
1649
  }
1650
+ function flagValue(rest, name) {
1651
+ const i = rest.indexOf(name);
1652
+ return i >= 0 ? rest[i + 1] : void 0;
1653
+ }
1654
+ function positionals(rest, valueFlags) {
1655
+ const out = [];
1656
+ for (let i = 0; i < rest.length; i++) {
1657
+ if (valueFlags.includes(rest[i])) {
1658
+ i++;
1659
+ continue;
1660
+ }
1661
+ if (rest[i].startsWith("--")) continue;
1662
+ out.push(rest[i]);
1663
+ }
1664
+ return out;
1665
+ }
1666
+ async function cmdAsic(rest, args) {
1667
+ const sub = String(rest[0] || "catalogue").toLowerCase();
1668
+ const tail = rest.slice(1);
1669
+ const pos = positionals(tail, ["--token", "--kind", "--type", "--out"]);
1670
+ const o = clientOpts(args);
1671
+ if (sub === "catalogue" || sub === "catalog") {
1672
+ print(await getJson(`/au-asic-extract`, o), true);
1673
+ return;
1674
+ }
1675
+ if (sub === "search") {
1676
+ const name = pos.join(" ");
1677
+ if (!name) throw new Error("Usage: milypay asic search <name>");
1678
+ print(await getJson(`/au-asic-extract/search?${new URLSearchParams({ name })}`, o), true);
1679
+ return;
1680
+ }
1681
+ if (sub === "company" || sub === "business") {
1682
+ const nni = digitsOnly(pos[0] || "");
1683
+ if (!nni) throw new Error(`Usage: milypay asic ${sub} <nni>`);
1684
+ print(await getJson(`/au-asic-extract/${sub}/${nni}`, o), true);
1685
+ return;
1686
+ }
1687
+ if (sub === "purchase" || sub === "buy") {
1688
+ const nni = digitsOnly(pos[0] || "");
1689
+ if (!nni) throw new Error("Usage: milypay asic purchase <nni> [--kind company|business] [--type current|historical]");
1690
+ const kind = (flagValue(tail, "--kind") || "company").toLowerCase();
1691
+ const type = (flagValue(tail, "--type") || "current").toLowerCase();
1692
+ print(await postJson(`/au-asic-extract/purchase`, { nni, kind, type }, o), true);
1693
+ return;
1694
+ }
1695
+ if (sub === "status" || sub === "extract" || sub === "download") {
1696
+ const id = digitsOnly(pos[0] || "");
1697
+ const token = flagValue(tail, "--token") || process.env.MILYPAY_EXTRACT_TOKEN;
1698
+ if (!id || !token) {
1699
+ throw new Error(`Usage: milypay asic ${sub} <extractId> --token <buyer token from purchase>`);
1700
+ }
1701
+ const qs = new URLSearchParams({ token });
1702
+ if (sub === "status") {
1703
+ print(await getJson(`/au-asic-extract/status/${id}?${qs}`, o), true);
1704
+ return;
1705
+ }
1706
+ const out = flagValue(tail, "--out");
1707
+ if (tail.includes("--pdf") || out) qs.set("pdf", "1");
1708
+ const data = await getJson(`/au-asic-extract/extract/${id}?${qs}`, o);
1709
+ if (out && typeof data.pdfBase64 === "string") {
1710
+ writeFileSync(out, Buffer.from(data.pdfBase64, "base64"));
1711
+ delete data.pdfBase64;
1712
+ data.savedPdf = out;
1713
+ }
1714
+ print(data, true);
1715
+ return;
1716
+ }
1717
+ throw new Error("Usage: milypay asic [search|company|business|purchase|status|extract] \u2026");
1718
+ }
1151
1719
  async function main() {
1152
1720
  const rawArgv = process.argv.slice(2);
1153
1721
  if (rawArgv[0] === "mcp") {
@@ -1258,14 +1826,17 @@ async function main() {
1258
1826
  if (!flow) throw new Error("Usage: milypay abs data <dataflow> [--key k] [--start period]");
1259
1827
  let key = "";
1260
1828
  let start = "";
1829
+ let maxSeries = "";
1261
1830
  const rest2 = args._.slice(3);
1262
1831
  for (let i = 0; i < rest2.length; i++) {
1263
1832
  if (rest2[i] === "--key") key = String(rest2[++i] || "");
1264
- else if (rest2[i] === "--start") start = String(rest2[++i] || "");
1833
+ else if (rest2[i] === "--start" || rest2[i] === "--start-period") start = String(rest2[++i] || "");
1834
+ else if (rest2[i] === "--max-series") maxSeries = String(rest2[++i] || "");
1265
1835
  }
1266
1836
  const qs = new URLSearchParams();
1267
1837
  if (key) qs.set("key", key);
1268
1838
  if (start) qs.set("startPeriod", start);
1839
+ if (maxSeries) qs.set("maxSeries", maxSeries);
1269
1840
  if (!key && !start) qs.set("startPeriod", "2020");
1270
1841
  const q = qs.toString();
1271
1842
  print(await getJson(`/au-abs/data/${encodeURIComponent(flow)}${q ? `?${q}` : ""}`, clientOpts(args)), args.json);
@@ -1321,6 +1892,10 @@ async function main() {
1321
1892
  print(await getJson(`/au-energy/notices${q}`, clientOpts(args)), args.json);
1322
1893
  break;
1323
1894
  }
1895
+ if (sub === "catalogue" || sub === "catalog" || sub === "products") {
1896
+ print(await getJson(`/au-energy`, clientOpts(args)), args.json);
1897
+ break;
1898
+ }
1324
1899
  if (!sub || sub === "all" || sub === "summary") {
1325
1900
  print(await getJson(`/au-energy/nem`, clientOpts(args)), args.json);
1326
1901
  break;
@@ -1339,6 +1914,10 @@ async function main() {
1339
1914
  case "domain": {
1340
1915
  const sub = String(args._[1] || "check").toLowerCase();
1341
1916
  const name = String(args._[2] || args._[1] || "");
1917
+ if (sub === "catalogue" || sub === "catalog") {
1918
+ print(await getJson(`/domains`, clientOpts(args)), args.json);
1919
+ break;
1920
+ }
1342
1921
  if (sub === "check" || sub.includes(".") && !["check", "quote", "register"].includes(sub)) {
1343
1922
  const n = sub.includes(".") ? sub : name;
1344
1923
  if (!n || !n.includes(".")) throw new Error("Usage: milypay domains check example.com");
@@ -1360,6 +1939,10 @@ async function main() {
1360
1939
  case "ride":
1361
1940
  case "uber": {
1362
1941
  const sub = String(args._[1] || "quote").toLowerCase();
1942
+ if (sub === "catalogue" || sub === "catalog") {
1943
+ print(await getJson(`/au-rides`, clientOpts(args)), args.json);
1944
+ break;
1945
+ }
1363
1946
  if (sub === "products") {
1364
1947
  const lat = args._[2];
1365
1948
  const lng = args._[3];
@@ -1438,6 +2021,60 @@ Demo UI: https://milypay.xyz/fund
1438
2021
  }
1439
2022
  throw new Error("Usage: milypay fund status|session [on-ramp|off-ramp]");
1440
2023
  }
2024
+ case "status":
2025
+ print(await getJson(`/status`, clientOpts(args)), true);
2026
+ break;
2027
+ case "stats":
2028
+ print(await getJson(`/stats`, clientOpts(args)), true);
2029
+ break;
2030
+ case "asic":
2031
+ case "asic-extract": {
2032
+ await cmdAsic(args._.slice(1), args);
2033
+ break;
2034
+ }
2035
+ case "check":
2036
+ case "checkify": {
2037
+ const sub = String(args._[1] || "catalogue").toLowerCase();
2038
+ const arg = args._[2];
2039
+ if (sub === "catalogue" || sub === "status" || sub === "help") {
2040
+ print(await getJson(`/au-check`, clientOpts(args)), args.json);
2041
+ break;
2042
+ }
2043
+ if (sub === "reverse") {
2044
+ const lat = args._[2];
2045
+ const lng = args._[3];
2046
+ if (lat == null || lng == null) throw new Error("Usage: milypay check reverse <lat> <lng>");
2047
+ print(
2048
+ await getJson(
2049
+ `/au-check/reverse?lat=${encodeURIComponent(String(lat))}&lng=${encodeURIComponent(String(lng))}`,
2050
+ clientOpts(args)
2051
+ ),
2052
+ args.json
2053
+ );
2054
+ break;
2055
+ }
2056
+ const map = {
2057
+ postcode: ["/au-check/postcode", "postcode"],
2058
+ suburb: ["/au-check/suburb", "q"],
2059
+ activity: ["/au-check/activity", "q"],
2060
+ "company-name": ["/au-check/company-name", "name"],
2061
+ "business-name": ["/au-check/business-name", "name"],
2062
+ sanctions: ["/au-check/sanctions", "name"],
2063
+ "director-id": ["/au-check/director-id", "id"],
2064
+ tfn: ["/au-check/tfn", "tfn"],
2065
+ email: ["/au-check/email", "email"]
2066
+ };
2067
+ const spec = map[sub];
2068
+ if (!spec) {
2069
+ throw new Error(
2070
+ "Usage: milypay check <catalogue|postcode|reverse|suburb|activity|company-name|business-name|sanctions|director-id|tfn|email>"
2071
+ );
2072
+ }
2073
+ if (arg == null) throw new Error(`Usage: milypay check ${sub} <value>`);
2074
+ const [path, param] = spec;
2075
+ print(await getJson(`${path}?${param}=${encodeURIComponent(String(arg))}`, clientOpts(args)), args.json);
2076
+ break;
2077
+ }
1441
2078
  default:
1442
2079
  throw new Error(`Unknown command: ${cmd}
1443
2080