monacloud-mcp 0.4.0 → 0.4.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.
Files changed (2) hide show
  1. package/dist/clients.js +5 -2
  2. package/package.json +1 -1
package/dist/clients.js CHANGED
@@ -75,8 +75,11 @@ export class CloudClients {
75
75
  const status = error instanceof CloudError ? error.status ?? 0 : 0;
76
76
  if (!(error instanceof CloudError) || ![401, 403, 404, 502, 503].includes(status))
77
77
  throw error;
78
- const me = asObject(unwrapData(await this.vibecloud('/api/me')));
79
- const balanceVnd = Number(me.balance_vnd ?? 0) + Number(me.promo_credit_vnd ?? 0);
78
+ const root = asObject(unwrapData(await this.vibecloud('/api/me')));
79
+ const me = asObject(root.user ?? root); // compute trả {user:{credit_vnd, promo_credit_vnd, total_credit_vnd}}
80
+ const balanceVnd = me.total_credit_vnd !== undefined
81
+ ? Number(me.total_credit_vnd)
82
+ : Number(me.credit_vnd ?? me.balance_vnd ?? 0) + Number(me.promo_credit_vnd ?? 0);
80
83
  return {
81
84
  balance_vnd: Number.isFinite(balanceVnd) ? balanceVnd : 0,
82
85
  currency: 'VND',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "monacloud-mcp",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Unified MCP server for MONA Cloud, MONA Pay and MONA Agent.",
5
5
  "license": "MIT",
6
6
  "type": "module",