@guiie/buda-mcp 1.5.1 → 1.5.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.
Files changed (106) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/PUBLISH_CHECKLIST.md +56 -36
  3. package/dist/audit.d.ts +21 -0
  4. package/dist/audit.d.ts.map +1 -0
  5. package/dist/audit.js +14 -0
  6. package/dist/client.d.ts.map +1 -1
  7. package/dist/client.js +6 -1
  8. package/dist/http.js +47 -15
  9. package/dist/tools/account.js +1 -1
  10. package/dist/tools/arbitrage.js +1 -1
  11. package/dist/tools/balance.js +1 -1
  12. package/dist/tools/balances.js +1 -1
  13. package/dist/tools/banks.js +1 -1
  14. package/dist/tools/batch_orders.d.ts +2 -2
  15. package/dist/tools/batch_orders.d.ts.map +1 -1
  16. package/dist/tools/batch_orders.js +14 -4
  17. package/dist/tools/cancel_all_orders.d.ts +2 -2
  18. package/dist/tools/cancel_all_orders.d.ts.map +1 -1
  19. package/dist/tools/cancel_all_orders.js +12 -15
  20. package/dist/tools/cancel_order.d.ts +2 -2
  21. package/dist/tools/cancel_order.d.ts.map +1 -1
  22. package/dist/tools/cancel_order.js +11 -11
  23. package/dist/tools/cancel_order_by_client_id.d.ts +2 -2
  24. package/dist/tools/cancel_order_by_client_id.d.ts.map +1 -1
  25. package/dist/tools/cancel_order_by_client_id.js +11 -11
  26. package/dist/tools/compare_markets.d.ts +9 -0
  27. package/dist/tools/compare_markets.d.ts.map +1 -1
  28. package/dist/tools/compare_markets.js +63 -53
  29. package/dist/tools/dead_mans_switch.d.ts +1 -1
  30. package/dist/tools/dead_mans_switch.d.ts.map +1 -1
  31. package/dist/tools/dead_mans_switch.js +35 -3
  32. package/dist/tools/deposits.js +2 -2
  33. package/dist/tools/fees.js +1 -1
  34. package/dist/tools/lightning.d.ts +2 -2
  35. package/dist/tools/lightning.d.ts.map +1 -1
  36. package/dist/tools/lightning.js +13 -11
  37. package/dist/tools/market_sentiment.js +1 -1
  38. package/dist/tools/market_summary.js +1 -1
  39. package/dist/tools/markets.js +1 -1
  40. package/dist/tools/order_lookup.js +2 -2
  41. package/dist/tools/orderbook.js +1 -1
  42. package/dist/tools/orders.js +1 -1
  43. package/dist/tools/place_order.d.ts +2 -2
  44. package/dist/tools/place_order.d.ts.map +1 -1
  45. package/dist/tools/place_order.js +24 -6
  46. package/dist/tools/price_history.js +1 -1
  47. package/dist/tools/quotation.js +1 -1
  48. package/dist/tools/receive_addresses.d.ts +2 -2
  49. package/dist/tools/receive_addresses.d.ts.map +1 -1
  50. package/dist/tools/receive_addresses.js +13 -13
  51. package/dist/tools/remittance_recipients.js +2 -2
  52. package/dist/tools/remittances.d.ts +3 -3
  53. package/dist/tools/remittances.d.ts.map +1 -1
  54. package/dist/tools/remittances.js +22 -23
  55. package/dist/tools/simulate_order.js +1 -1
  56. package/dist/tools/spread.js +1 -1
  57. package/dist/tools/technical_indicators.js +1 -1
  58. package/dist/tools/ticker.js +1 -1
  59. package/dist/tools/trades.js +1 -1
  60. package/dist/tools/volume.js +1 -1
  61. package/dist/tools/withdrawals.d.ts +2 -2
  62. package/dist/tools/withdrawals.d.ts.map +1 -1
  63. package/dist/tools/withdrawals.js +12 -12
  64. package/dist/utils.d.ts +10 -0
  65. package/dist/utils.d.ts.map +1 -1
  66. package/dist/utils.js +25 -0
  67. package/package.json +2 -1
  68. package/server.json +2 -2
  69. package/src/audit.ts +24 -0
  70. package/src/client.ts +9 -1
  71. package/src/http.ts +50 -15
  72. package/src/tools/account.ts +1 -1
  73. package/src/tools/arbitrage.ts +1 -1
  74. package/src/tools/balance.ts +1 -1
  75. package/src/tools/balances.ts +1 -1
  76. package/src/tools/banks.ts +1 -1
  77. package/src/tools/batch_orders.ts +18 -3
  78. package/src/tools/cancel_all_orders.ts +16 -14
  79. package/src/tools/cancel_order.ts +15 -10
  80. package/src/tools/cancel_order_by_client_id.ts +15 -10
  81. package/src/tools/compare_markets.ts +78 -61
  82. package/src/tools/dead_mans_switch.ts +37 -2
  83. package/src/tools/deposits.ts +2 -2
  84. package/src/tools/fees.ts +1 -1
  85. package/src/tools/lightning.ts +18 -11
  86. package/src/tools/market_sentiment.ts +1 -1
  87. package/src/tools/market_summary.ts +1 -1
  88. package/src/tools/markets.ts +1 -1
  89. package/src/tools/order_lookup.ts +2 -2
  90. package/src/tools/orderbook.ts +1 -1
  91. package/src/tools/orders.ts +1 -1
  92. package/src/tools/place_order.ts +30 -7
  93. package/src/tools/price_history.ts +1 -1
  94. package/src/tools/quotation.ts +1 -1
  95. package/src/tools/receive_addresses.ts +17 -12
  96. package/src/tools/remittance_recipients.ts +2 -2
  97. package/src/tools/remittances.ts +26 -21
  98. package/src/tools/simulate_order.ts +1 -1
  99. package/src/tools/spread.ts +1 -1
  100. package/src/tools/technical_indicators.ts +1 -1
  101. package/src/tools/ticker.ts +1 -1
  102. package/src/tools/trades.ts +1 -1
  103. package/src/tools/volume.ts +1 -1
  104. package/src/tools/withdrawals.ts +16 -11
  105. package/src/utils.ts +33 -0
  106. package/test/unit.ts +362 -4
@@ -22,13 +22,13 @@ type CancelOrderArgs = {
22
22
  order_id: number;
23
23
  confirmation_token: string;
24
24
  };
25
- export declare function handleCancelOrder(args: CancelOrderArgs, client: BudaClient): Promise<{
25
+ export declare function handleCancelOrder(args: CancelOrderArgs, client: BudaClient, transport?: "http" | "stdio"): Promise<{
26
26
  content: Array<{
27
27
  type: "text";
28
28
  text: string;
29
29
  }>;
30
30
  isError?: boolean;
31
31
  }>;
32
- export declare function register(server: McpServer, client: BudaClient): void;
32
+ export declare function register(server: McpServer, client: BudaClient, transport?: "http" | "stdio"): void;
33
33
  export {};
34
34
  //# sourceMappingURL=cancel_order.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cancel_order.d.ts","sourceRoot":"","sources":["../../src/tools/cancel_order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,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U,EAClB,SAAS,GAAE,MAAM,GAAG,OAAiB,GACpC,IAAI,CAmBN"}
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { BudaApiError } from "../client.js";
3
+ import { logAudit } from "../audit.js";
3
4
  export const toolSchema = {
4
5
  name: "cancel_order",
5
6
  description: "Cancel an open order by ID on Buda.com. " +
@@ -22,7 +23,7 @@ export const toolSchema = {
22
23
  required: ["order_id", "confirmation_token"],
23
24
  },
24
25
  };
25
- export async function handleCancelOrder(args, client) {
26
+ export async function handleCancelOrder(args, client, transport = "stdio") {
26
27
  const { order_id, confirmation_token } = args;
27
28
  if (confirmation_token !== "CONFIRM") {
28
29
  return {
@@ -44,21 +45,20 @@ export async function handleCancelOrder(args, client) {
44
45
  const data = await client.put(`/orders/${order_id}`, {
45
46
  order: { state: "canceling" },
46
47
  });
47
- return {
48
- content: [{ type: "text", text: JSON.stringify(data.order, null, 2) }],
49
- };
48
+ const result = { content: [{ type: "text", text: JSON.stringify(data.order, null, 2) }] };
49
+ logAudit({ ts: new Date().toISOString(), tool: "cancel_order", transport, args_summary: { order_id }, success: true });
50
+ return result;
50
51
  }
51
52
  catch (err) {
52
53
  const msg = err instanceof BudaApiError
53
- ? { error: err.message, code: err.status, path: err.path }
54
+ ? { error: err.message, code: err.status }
54
55
  : { error: String(err), code: "UNKNOWN" };
55
- return {
56
- content: [{ type: "text", text: JSON.stringify(msg) }],
57
- isError: true,
58
- };
56
+ const result = { content: [{ type: "text", text: JSON.stringify(msg) }], isError: true };
57
+ logAudit({ ts: new Date().toISOString(), tool: "cancel_order", transport, args_summary: { order_id }, success: false, error_code: msg.code });
58
+ return result;
59
59
  }
60
60
  }
61
- export function register(server, client) {
61
+ export function register(server, client, transport = "stdio") {
62
62
  server.tool(toolSchema.name, toolSchema.description, {
63
63
  order_id: z
64
64
  .number()
@@ -69,6 +69,6 @@ export function register(server, client) {
69
69
  .string()
70
70
  .describe("Safety confirmation. Must equal exactly 'CONFIRM' (case-sensitive) to cancel the order. " +
71
71
  "Any other value will reject the request without canceling."),
72
- }, (args) => handleCancelOrder(args, client));
72
+ }, (args) => handleCancelOrder(args, client, transport));
73
73
  }
74
74
  //# sourceMappingURL=cancel_order.js.map
@@ -22,13 +22,13 @@ type CancelOrderByClientIdArgs = {
22
22
  client_id: string;
23
23
  confirmation_token: string;
24
24
  };
25
- export declare function handleCancelOrderByClientId(args: CancelOrderByClientIdArgs, client: BudaClient): Promise<{
25
+ export declare function handleCancelOrderByClientId(args: CancelOrderByClientIdArgs, client: BudaClient, transport?: "http" | "stdio"): Promise<{
26
26
  content: Array<{
27
27
  type: "text";
28
28
  text: string;
29
29
  }>;
30
30
  isError?: boolean;
31
31
  }>;
32
- export declare function register(server: McpServer, client: BudaClient): void;
32
+ export declare function register(server: McpServer, client: BudaClient, transport?: "http" | "stdio"): void;
33
33
  export {};
34
34
  //# sourceMappingURL=cancel_order_by_client_id.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cancel_order_by_client_id.d.ts","sourceRoot":"","sources":["../../src/tools/cancel_order_by_client_id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAIxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAsBtB,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAmCF,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,yBAAyB,EAC/B,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAwChF;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAkBpE"}
1
+ {"version":3,"file":"cancel_order_by_client_id.d.ts","sourceRoot":"","sources":["../../src/tools/cancel_order_by_client_id.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAKxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAsBtB,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAmCF,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE,yBAAyB,EAC/B,MAAM,EAAE,UAAU,EAClB,SAAS,GAAE,MAAM,GAAG,OAAiB,GACpC,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAuChF;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,GAAE,MAAM,GAAG,OAAiB,GACpC,IAAI,CAkBN"}
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { BudaApiError } from "../client.js";
3
3
  import { flattenAmount } from "../utils.js";
4
+ import { logAudit } from "../audit.js";
4
5
  export const toolSchema = {
5
6
  name: "cancel_order_by_client_id",
6
7
  description: "Cancel an open order by its client-assigned ID on Buda.com. " +
@@ -53,7 +54,7 @@ function normalizeOrder(o) {
53
54
  paid_fee_currency: paidFee.currency,
54
55
  };
55
56
  }
56
- export async function handleCancelOrderByClientId(args, client) {
57
+ export async function handleCancelOrderByClientId(args, client, transport = "stdio") {
57
58
  const { client_id, confirmation_token } = args;
58
59
  if (confirmation_token !== "CONFIRM") {
59
60
  return {
@@ -73,21 +74,20 @@ export async function handleCancelOrderByClientId(args, client) {
73
74
  }
74
75
  try {
75
76
  const data = await client.put(`/orders/by-client-id/${encodeURIComponent(client_id)}`, { order: { state: "canceling" } });
76
- return {
77
- content: [{ type: "text", text: JSON.stringify(normalizeOrder(data.order), null, 2) }],
78
- };
77
+ const result = { content: [{ type: "text", text: JSON.stringify(normalizeOrder(data.order), null, 2) }] };
78
+ logAudit({ ts: new Date().toISOString(), tool: "cancel_order_by_client_id", transport, args_summary: {}, success: true });
79
+ return result;
79
80
  }
80
81
  catch (err) {
81
82
  const msg = err instanceof BudaApiError
82
- ? { error: err.message, code: err.status, path: err.path }
83
+ ? { error: err.message, code: err.status }
83
84
  : { error: String(err), code: "UNKNOWN" };
84
- return {
85
- content: [{ type: "text", text: JSON.stringify(msg) }],
86
- isError: true,
87
- };
85
+ const result = { content: [{ type: "text", text: JSON.stringify(msg) }], isError: true };
86
+ logAudit({ ts: new Date().toISOString(), tool: "cancel_order_by_client_id", transport, args_summary: {}, success: false, error_code: msg.code });
87
+ return result;
88
88
  }
89
89
  }
90
- export function register(server, client) {
90
+ export function register(server, client, transport = "stdio") {
91
91
  server.tool(toolSchema.name, toolSchema.description, {
92
92
  client_id: z
93
93
  .string()
@@ -97,6 +97,6 @@ export function register(server, client) {
97
97
  .string()
98
98
  .describe("Safety confirmation. Must equal exactly 'CONFIRM' (case-sensitive) to execute. " +
99
99
  "Any other value will reject the request without canceling."),
100
- }, (args) => handleCancelOrderByClientId(args, client));
100
+ }, (args) => handleCancelOrderByClientId(args, client, transport));
101
101
  }
102
102
  //# sourceMappingURL=cancel_order_by_client_id.js.map
@@ -15,5 +15,14 @@ export declare const toolSchema: {
15
15
  required: string[];
16
16
  };
17
17
  };
18
+ export declare function handleCompareMarkets(args: {
19
+ base_currency: string;
20
+ }, client: BudaClient, cache: MemoryCache): Promise<{
21
+ content: Array<{
22
+ type: "text";
23
+ text: string;
24
+ }>;
25
+ isError?: boolean;
26
+ }>;
18
27
  export declare function register(server: McpServer, client: BudaClient, cache: MemoryCache): void;
19
28
  //# sourceMappingURL=compare_markets.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compare_markets.d.ts","sourceRoot":"","sources":["../../src/tools/compare_markets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,WAAW,EAAa,MAAM,aAAa,CAAC;AAGrD,eAAO,MAAM,UAAU;;;;;;;;;;;;;CAkBtB,CAAC;AAEF,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAyExF"}
1
+ {"version":3,"file":"compare_markets.d.ts","sourceRoot":"","sources":["../../src/tools/compare_markets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,WAAW,EAAa,MAAM,aAAa,CAAC;AAIrD,eAAO,MAAM,UAAU;;;;;;;;;;;;;CAkBtB,CAAC;AAEF,wBAAsB,oBAAoB,CACxC,IAAI,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,EAC/B,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,WAAW,GACjB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAsEhF;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAaxF"}
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { BudaApiError } from "../client.js";
3
3
  import { CACHE_TTL } from "../cache.js";
4
+ import { validateCurrency } from "../validation.js";
4
5
  export const toolSchema = {
5
6
  name: "compare_markets",
6
7
  description: "Returns side-by-side ticker data for all trading pairs of a given base currency across Buda.com's " +
@@ -18,63 +19,72 @@ export const toolSchema = {
18
19
  required: ["base_currency"],
19
20
  },
20
21
  };
22
+ export async function handleCompareMarkets(args, client, cache) {
23
+ const { base_currency } = args;
24
+ const currencyError = validateCurrency(base_currency);
25
+ if (currencyError) {
26
+ return {
27
+ content: [{ type: "text", text: JSON.stringify({ error: currencyError, code: "INVALID_CURRENCY" }) }],
28
+ isError: true,
29
+ };
30
+ }
31
+ try {
32
+ const base = base_currency.toUpperCase();
33
+ const data = await cache.getOrFetch("tickers:all", CACHE_TTL.TICKER, () => client.get("/tickers"));
34
+ const matching = data.tickers.filter((t) => {
35
+ const [tickerBase] = t.market_id.split("-");
36
+ return tickerBase === base;
37
+ });
38
+ if (matching.length === 0) {
39
+ return {
40
+ content: [
41
+ {
42
+ type: "text",
43
+ text: JSON.stringify({
44
+ error: `No markets found for base currency '${base}'.`,
45
+ code: "NOT_FOUND",
46
+ }),
47
+ },
48
+ ],
49
+ isError: true,
50
+ };
51
+ }
52
+ const result = {
53
+ base_currency: base,
54
+ markets: matching.map((t) => ({
55
+ market_id: t.market_id,
56
+ last_price: parseFloat(t.last_price[0]),
57
+ last_price_currency: t.last_price[1],
58
+ best_bid: t.max_bid ? parseFloat(t.max_bid[0]) : null,
59
+ best_ask: t.min_ask ? parseFloat(t.min_ask[0]) : null,
60
+ volume_24h: t.volume ? parseFloat(t.volume[0]) : null,
61
+ price_change_24h: t.price_variation_24h
62
+ ? parseFloat((parseFloat(t.price_variation_24h) * 100).toFixed(4))
63
+ : null,
64
+ price_change_7d: t.price_variation_7d
65
+ ? parseFloat((parseFloat(t.price_variation_7d) * 100).toFixed(4))
66
+ : null,
67
+ })),
68
+ };
69
+ return {
70
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
71
+ };
72
+ }
73
+ catch (err) {
74
+ const msg = err instanceof BudaApiError
75
+ ? { error: err.message, code: err.status }
76
+ : { error: String(err), code: "UNKNOWN" };
77
+ return {
78
+ content: [{ type: "text", text: JSON.stringify(msg) }],
79
+ isError: true,
80
+ };
81
+ }
82
+ }
21
83
  export function register(server, client, cache) {
22
84
  server.tool(toolSchema.name, toolSchema.description, {
23
85
  base_currency: z
24
86
  .string()
25
87
  .describe("Base currency to compare across all available markets (e.g. 'BTC', 'ETH', 'XRP')."),
26
- }, async ({ base_currency }) => {
27
- try {
28
- const base = base_currency.toUpperCase();
29
- const data = await cache.getOrFetch("tickers:all", CACHE_TTL.TICKER, () => client.get("/tickers"));
30
- const matching = data.tickers.filter((t) => {
31
- const [tickerBase] = t.market_id.split("-");
32
- return tickerBase === base;
33
- });
34
- if (matching.length === 0) {
35
- return {
36
- content: [
37
- {
38
- type: "text",
39
- text: JSON.stringify({
40
- error: `No markets found for base currency '${base}'.`,
41
- code: "NOT_FOUND",
42
- }),
43
- },
44
- ],
45
- isError: true,
46
- };
47
- }
48
- const result = {
49
- base_currency: base,
50
- markets: matching.map((t) => ({
51
- market_id: t.market_id,
52
- last_price: parseFloat(t.last_price[0]),
53
- last_price_currency: t.last_price[1],
54
- best_bid: t.max_bid ? parseFloat(t.max_bid[0]) : null,
55
- best_ask: t.min_ask ? parseFloat(t.min_ask[0]) : null,
56
- volume_24h: t.volume ? parseFloat(t.volume[0]) : null,
57
- price_change_24h: t.price_variation_24h
58
- ? parseFloat((parseFloat(t.price_variation_24h) * 100).toFixed(4))
59
- : null,
60
- price_change_7d: t.price_variation_7d
61
- ? parseFloat((parseFloat(t.price_variation_7d) * 100).toFixed(4))
62
- : null,
63
- })),
64
- };
65
- return {
66
- content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
67
- };
68
- }
69
- catch (err) {
70
- const msg = err instanceof BudaApiError
71
- ? { error: err.message, code: err.status, path: err.path }
72
- : { error: String(err), code: "UNKNOWN" };
73
- return {
74
- content: [{ type: "text", text: JSON.stringify(msg) }],
75
- isError: true,
76
- };
77
- }
78
- });
88
+ }, (args) => handleCompareMarkets(args, client, cache));
79
89
  }
80
90
  //# sourceMappingURL=compare_markets.js.map
@@ -55,7 +55,7 @@ type ScheduleArgs = {
55
55
  ttl_seconds: number;
56
56
  confirmation_token: string;
57
57
  };
58
- export declare function handleScheduleCancelAll(args: ScheduleArgs, client: BudaClient): Promise<{
58
+ export declare function handleScheduleCancelAll(args: ScheduleArgs, client: BudaClient, transport?: "http" | "stdio"): Promise<{
59
59
  content: Array<{
60
60
  type: "text";
61
61
  text: string;
@@ -1 +1 @@
1
- {"version":3,"file":"dead_mans_switch.d.ts","sourceRoot":"","sources":["../../src/tools/dead_mans_switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAiDxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;CA2BtB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;CAgB3B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CAgB5B,CAAC;AAIF,KAAK,YAAY,GAAG;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,YAAY,EAClB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA8DhF;AAED,KAAK,cAAc,GAAG;IAAE,SAAS,EAA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C,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA+DhF;AAED,KAAK,cAAc,GAAG;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5C,wBAAgB,sBAAsB,CACpC,EAAE,SAAS,EAAE,EAAE,cAAc,EAC7B,MAAM,EAAE,UAAU,GACjB;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CA0CvE;AAED,wBAAgB,uBAAuB,CACrC,EAAE,SAAS,EAAE,EAAE,cAAc,GAC5B;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAwCvE;AAID,wBAAgB,QAAQ,CACtB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,GAAE,OAAO,GAAG,MAAgB,GACpC,IAAI,CA2FN"}
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { validateMarketId } from "../validation.js";
3
+ import { logAudit } from "../audit.js";
3
4
  const timers = new Map();
4
5
  async function cancelAllOrdersForMarket(marketId, client) {
5
6
  try {
@@ -85,7 +86,7 @@ export const disarmToolSchema = {
85
86
  required: ["market_id"],
86
87
  },
87
88
  };
88
- export async function handleScheduleCancelAll(args, client) {
89
+ export async function handleScheduleCancelAll(args, client, transport = "stdio") {
89
90
  const { market_id, ttl_seconds, confirmation_token } = args;
90
91
  if (confirmation_token !== "CONFIRM") {
91
92
  return {
@@ -127,6 +128,7 @@ export async function handleScheduleCancelAll(args, client) {
127
128
  }
128
129
  const id = market_id.toLowerCase();
129
130
  const entry = armTimer(id, ttl_seconds, client);
131
+ logAudit({ ts: new Date().toISOString(), tool: "schedule_cancel_all", transport, args_summary: { market_id: market_id.toUpperCase(), ttl_seconds }, success: true });
130
132
  return {
131
133
  content: [
132
134
  {
@@ -256,11 +258,41 @@ export function register(server, client, transport = "stdio") {
256
258
  market_id: z
257
259
  .string()
258
260
  .describe("Market ID whose timer should be renewed (e.g. 'BTC-CLP')."),
259
- }, (args) => handleRenewCancelTimer(args, client));
261
+ }, (args) => {
262
+ if (transport === "http") {
263
+ return Promise.resolve({
264
+ content: [{
265
+ type: "text",
266
+ text: JSON.stringify({
267
+ error: "renew_cancel_timer is not available on the HTTP transport. " +
268
+ "Timer state is process-local and only meaningful in stdio mode on a persistent local process.",
269
+ code: "TRANSPORT_NOT_SUPPORTED",
270
+ }),
271
+ }],
272
+ isError: true,
273
+ });
274
+ }
275
+ return Promise.resolve(handleRenewCancelTimer(args, client));
276
+ });
260
277
  server.tool(disarmToolSchema.name, disarmToolSchema.description, {
261
278
  market_id: z
262
279
  .string()
263
280
  .describe("Market ID whose timer should be disarmed (e.g. 'BTC-CLP')."),
264
- }, (args) => handleDisarmCancelTimer(args));
281
+ }, (args) => {
282
+ if (transport === "http") {
283
+ return Promise.resolve({
284
+ content: [{
285
+ type: "text",
286
+ text: JSON.stringify({
287
+ error: "disarm_cancel_timer is not available on the HTTP transport. " +
288
+ "Timer state is process-local and only meaningful in stdio mode on a persistent local process.",
289
+ code: "TRANSPORT_NOT_SUPPORTED",
290
+ }),
291
+ }],
292
+ isError: true,
293
+ });
294
+ }
295
+ return Promise.resolve(handleDisarmCancelTimer(args));
296
+ });
265
297
  }
266
298
  //# sourceMappingURL=dead_mans_switch.js.map
@@ -80,7 +80,7 @@ export async function handleGetDepositHistory(args, client) {
80
80
  }
81
81
  catch (err) {
82
82
  const msg = err instanceof BudaApiError
83
- ? { error: err.message, code: err.status, path: err.path }
83
+ ? { error: err.message, code: err.status }
84
84
  : { error: String(err), code: "UNKNOWN" };
85
85
  return {
86
86
  content: [{ type: "text", text: JSON.stringify(msg) }],
@@ -144,7 +144,7 @@ export async function handleCreateFiatDeposit(args, client) {
144
144
  }
145
145
  catch (err) {
146
146
  const msg = err instanceof BudaApiError
147
- ? { error: err.message, code: err.status, path: err.path }
147
+ ? { error: err.message, code: err.status }
148
148
  : { error: String(err), code: "UNKNOWN" };
149
149
  return {
150
150
  content: [{ type: "text", text: JSON.stringify(msg) }],
@@ -55,7 +55,7 @@ export async function handleGetNetworkFees(args, client) {
55
55
  }
56
56
  catch (err) {
57
57
  const msg = err instanceof BudaApiError
58
- ? { error: err.message, code: err.status, path: err.path }
58
+ ? { error: err.message, code: err.status }
59
59
  : { error: String(err), code: "UNKNOWN" };
60
60
  return {
61
61
  content: [{ type: "text", text: JSON.stringify(msg) }],
@@ -49,7 +49,7 @@ type CreateLightningInvoiceArgs = {
49
49
  description?: string;
50
50
  expiry_seconds?: number;
51
51
  };
52
- export declare function handleLightningWithdrawal(args: LightningWithdrawalArgs, client: BudaClient): Promise<{
52
+ export declare function handleLightningWithdrawal(args: LightningWithdrawalArgs, client: BudaClient, transport?: "http" | "stdio"): Promise<{
53
53
  content: Array<{
54
54
  type: "text";
55
55
  text: string;
@@ -63,6 +63,6 @@ export declare function handleCreateLightningInvoice(args: CreateLightningInvoic
63
63
  }>;
64
64
  isError?: boolean;
65
65
  }>;
66
- export declare function register(server: McpServer, client: BudaClient): void;
66
+ export declare function register(server: McpServer, client: BudaClient, transport?: "http" | "stdio"): void;
67
67
  export {};
68
68
  //# sourceMappingURL=lightning.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"lightning.d.ts","sourceRoot":"","sources":["../../src/tools/lightning.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAIxD,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;;;;;;;;;;;;;;;;;;;;CAwB5C,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,wBAAsB,yBAAyB,CAC7C,IAAI,EAAE,uBAAuB,EAC7B,MAAM,EAAE,UAAU,EAClB,SAAS,GAAE,MAAM,GAAG,OAAiB,GACpC,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAgFhF;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,0BAA0B,EAChC,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CA8ChF;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,GAAE,MAAM,GAAG,OAAiB,GACpC,IAAI,CA2CN"}
@@ -1,6 +1,7 @@
1
1
  import { z } from "zod";
2
2
  import { BudaApiError } from "../client.js";
3
3
  import { flattenAmount } from "../utils.js";
4
+ import { logAudit } from "../audit.js";
4
5
  export const lightningWithdrawalToolSchema = {
5
6
  name: "lightning_withdrawal",
6
7
  description: "Pay a Bitcoin Lightning Network invoice from your Buda.com LN-BTC reserve. " +
@@ -47,7 +48,7 @@ export const createLightningInvoiceToolSchema = {
47
48
  required: ["amount_satoshis"],
48
49
  },
49
50
  };
50
- export async function handleLightningWithdrawal(args, client) {
51
+ export async function handleLightningWithdrawal(args, client, transport = "stdio") {
51
52
  const { invoice, confirmation_token } = args;
52
53
  if (confirmation_token !== "CONFIRM") {
53
54
  const preview = invoice.length > 20 ? invoice.substring(0, 20) + "..." : invoice;
@@ -66,7 +67,7 @@ export async function handleLightningWithdrawal(args, client) {
66
67
  isError: true,
67
68
  };
68
69
  }
69
- const BOLT11_RE = /^ln(bc|tb|bcrt)\d/i;
70
+ const BOLT11_RE = /^ln(bc|tb|bcrt)\d*[munp]?1[a-z0-9]{20,}$/i;
70
71
  if (!BOLT11_RE.test(invoice)) {
71
72
  return {
72
73
  content: [{
@@ -85,7 +86,7 @@ export async function handleLightningWithdrawal(args, client) {
85
86
  const lw = data.lightning_withdrawal;
86
87
  const amount = flattenAmount(lw.amount);
87
88
  const fee = flattenAmount(lw.fee);
88
- return {
89
+ const result = {
89
90
  content: [
90
91
  {
91
92
  type: "text",
@@ -102,15 +103,16 @@ export async function handleLightningWithdrawal(args, client) {
102
103
  },
103
104
  ],
104
105
  };
106
+ logAudit({ ts: new Date().toISOString(), tool: "lightning_withdrawal", transport, args_summary: {}, success: true });
107
+ return result;
105
108
  }
106
109
  catch (err) {
107
110
  const msg = err instanceof BudaApiError
108
- ? { error: err.message, code: err.status, path: err.path }
111
+ ? { error: err.message, code: err.status }
109
112
  : { error: String(err), code: "UNKNOWN" };
110
- return {
111
- content: [{ type: "text", text: JSON.stringify(msg) }],
112
- isError: true,
113
- };
113
+ const result = { content: [{ type: "text", text: JSON.stringify(msg) }], isError: true };
114
+ logAudit({ ts: new Date().toISOString(), tool: "lightning_withdrawal", transport, args_summary: {}, success: false, error_code: msg.code });
115
+ return result;
114
116
  }
115
117
  }
116
118
  export async function handleCreateLightningInvoice(args, client) {
@@ -143,7 +145,7 @@ export async function handleCreateLightningInvoice(args, client) {
143
145
  }
144
146
  catch (err) {
145
147
  const msg = err instanceof BudaApiError
146
- ? { error: err.message, code: err.status, path: err.path }
148
+ ? { error: err.message, code: err.status }
147
149
  : { error: String(err), code: "UNKNOWN" };
148
150
  return {
149
151
  content: [{ type: "text", text: JSON.stringify(msg) }],
@@ -151,7 +153,7 @@ export async function handleCreateLightningInvoice(args, client) {
151
153
  };
152
154
  }
153
155
  }
154
- export function register(server, client) {
156
+ export function register(server, client, transport = "stdio") {
155
157
  server.tool(lightningWithdrawalToolSchema.name, lightningWithdrawalToolSchema.description, {
156
158
  invoice: z
157
159
  .string()
@@ -161,7 +163,7 @@ export function register(server, client) {
161
163
  .string()
162
164
  .describe("Safety confirmation. Must equal exactly 'CONFIRM' (case-sensitive) to execute. " +
163
165
  "Any other value will reject the request without paying."),
164
- }, (args) => handleLightningWithdrawal(args, client));
166
+ }, (args) => handleLightningWithdrawal(args, client, transport));
165
167
  server.tool(createLightningInvoiceToolSchema.name, createLightningInvoiceToolSchema.description, {
166
168
  amount_satoshis: z
167
169
  .number()
@@ -86,7 +86,7 @@ export async function handleMarketSentiment({ market_id }, client, cache) {
86
86
  }
87
87
  catch (err) {
88
88
  const msg = err instanceof BudaApiError
89
- ? { error: err.message, code: err.status, path: err.path }
89
+ ? { error: err.message, code: err.status }
90
90
  : { error: String(err), code: "UNKNOWN" };
91
91
  return {
92
92
  content: [{ type: "text", text: JSON.stringify(msg) }],
@@ -63,7 +63,7 @@ export async function handleMarketSummary({ market_id }, client, cache) {
63
63
  }
64
64
  catch (err) {
65
65
  const msg = err instanceof BudaApiError
66
- ? { error: err.message, code: err.status, path: err.path }
66
+ ? { error: err.message, code: err.status }
67
67
  : { error: String(err), code: "UNKNOWN" };
68
68
  return {
69
69
  content: [{ type: "text", text: JSON.stringify(msg) }],
@@ -47,7 +47,7 @@ export function register(server, client, cache) {
47
47
  }
48
48
  catch (err) {
49
49
  const msg = err instanceof BudaApiError
50
- ? { error: err.message, code: err.status, path: err.path }
50
+ ? { error: err.message, code: err.status }
51
51
  : { error: String(err), code: "UNKNOWN" };
52
52
  return {
53
53
  content: [{ type: "text", text: JSON.stringify(msg) }],
@@ -76,7 +76,7 @@ export async function handleGetOrder(args, client) {
76
76
  }
77
77
  catch (err) {
78
78
  const msg = err instanceof BudaApiError
79
- ? { error: err.message, code: err.status, path: err.path }
79
+ ? { error: err.message, code: err.status }
80
80
  : { error: String(err), code: "UNKNOWN" };
81
81
  return {
82
82
  content: [{ type: "text", text: JSON.stringify(msg) }],
@@ -93,7 +93,7 @@ export async function handleGetOrderByClientId(args, client) {
93
93
  }
94
94
  catch (err) {
95
95
  const msg = err instanceof BudaApiError
96
- ? { error: err.message, code: err.status, path: err.path }
96
+ ? { error: err.message, code: err.status }
97
97
  : { error: String(err), code: "UNKNOWN" };
98
98
  return {
99
99
  content: [{ type: "text", text: JSON.stringify(msg) }],
@@ -66,7 +66,7 @@ export function register(server, client, cache) {
66
66
  }
67
67
  catch (err) {
68
68
  const msg = err instanceof BudaApiError
69
- ? { error: err.message, code: err.status, path: err.path }
69
+ ? { error: err.message, code: err.status }
70
70
  : { error: String(err), code: "UNKNOWN" };
71
71
  return {
72
72
  content: [{ type: "text", text: JSON.stringify(msg) }],
@@ -117,7 +117,7 @@ export function register(server, client) {
117
117
  }
118
118
  catch (err) {
119
119
  const msg = err instanceof BudaApiError
120
- ? { error: err.message, code: err.status, path: err.path }
120
+ ? { error: err.message, code: err.status }
121
121
  : { error: String(err), code: "UNKNOWN" };
122
122
  return {
123
123
  content: [{ type: "text", text: JSON.stringify(msg) }],
@@ -72,13 +72,13 @@ type PlaceOrderArgs = {
72
72
  stop_type?: ">=" | "<=";
73
73
  confirmation_token: string;
74
74
  };
75
- export declare function handlePlaceOrder(args: PlaceOrderArgs, client: BudaClient): Promise<{
75
+ export declare function handlePlaceOrder(args: PlaceOrderArgs, client: BudaClient, transport?: "http" | "stdio"): Promise<{
76
76
  content: Array<{
77
77
  type: "text";
78
78
  text: string;
79
79
  }>;
80
80
  isError?: boolean;
81
81
  }>;
82
- export declare function register(server: McpServer, client: BudaClient): void;
82
+ export declare function register(server: McpServer, client: BudaClient, transport?: "http" | "stdio"): void;
83
83
  export {};
84
84
  //# sourceMappingURL=place_order.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"place_order.d.ts","sourceRoot":"","sources":["../../src/tools/place_order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAIxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmEtB,CAAC;AAEF,KAAK,cAAc,GAAG;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,KAAK,GAAG,KAAK,CAAC;IACpB,UAAU,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IACxB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,CAqKhF;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CA4DpE"}
1
+ {"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