@guiie/buda-mcp 1.5.2 → 1.5.4

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 (53) hide show
  1. package/.github/workflows/publish.yml +17 -7
  2. package/CHANGELOG.md +52 -0
  3. package/PUBLISH_CHECKLIST.md +55 -42
  4. package/dist/client.d.ts.map +1 -1
  5. package/dist/client.js +6 -1
  6. package/dist/http.js +32 -17
  7. package/dist/tools/arbitrage.d.ts.map +1 -1
  8. package/dist/tools/arbitrage.js +11 -0
  9. package/dist/tools/batch_orders.d.ts +1 -1
  10. package/dist/tools/batch_orders.d.ts.map +1 -1
  11. package/dist/tools/batch_orders.js +2 -2
  12. package/dist/tools/cancel_all_orders.d.ts +1 -1
  13. package/dist/tools/cancel_all_orders.d.ts.map +1 -1
  14. package/dist/tools/cancel_all_orders.js +2 -2
  15. package/dist/tools/cancel_order.d.ts +1 -1
  16. package/dist/tools/cancel_order.d.ts.map +1 -1
  17. package/dist/tools/cancel_order.js +2 -2
  18. package/dist/tools/cancel_order_by_client_id.d.ts +1 -1
  19. package/dist/tools/cancel_order_by_client_id.d.ts.map +1 -1
  20. package/dist/tools/cancel_order_by_client_id.js +2 -2
  21. package/dist/tools/lightning.d.ts +1 -1
  22. package/dist/tools/lightning.d.ts.map +1 -1
  23. package/dist/tools/lightning.js +9 -3
  24. package/dist/tools/place_order.d.ts +1 -1
  25. package/dist/tools/place_order.d.ts.map +1 -1
  26. package/dist/tools/place_order.js +2 -2
  27. package/dist/tools/receive_addresses.d.ts +1 -1
  28. package/dist/tools/receive_addresses.d.ts.map +1 -1
  29. package/dist/tools/receive_addresses.js +2 -2
  30. package/dist/tools/remittances.d.ts +1 -1
  31. package/dist/tools/remittances.d.ts.map +1 -1
  32. package/dist/tools/remittances.js +3 -3
  33. package/dist/tools/withdrawals.d.ts +1 -1
  34. package/dist/tools/withdrawals.d.ts.map +1 -1
  35. package/dist/tools/withdrawals.js +7 -3
  36. package/dist/utils.d.ts +2 -0
  37. package/dist/utils.d.ts.map +1 -1
  38. package/dist/utils.js +10 -5
  39. package/package.json +2 -1
  40. package/server.json +2 -2
  41. package/src/client.ts +9 -1
  42. package/src/http.ts +33 -17
  43. package/src/tools/arbitrage.ts +12 -0
  44. package/src/tools/batch_orders.ts +6 -2
  45. package/src/tools/cancel_all_orders.ts +6 -2
  46. package/src/tools/cancel_order.ts +6 -2
  47. package/src/tools/cancel_order_by_client_id.ts +6 -2
  48. package/src/tools/lightning.ts +14 -4
  49. package/src/tools/place_order.ts +6 -2
  50. package/src/tools/receive_addresses.ts +6 -2
  51. package/src/tools/remittances.ts +7 -3
  52. package/src/tools/withdrawals.ts +11 -3
  53. package/src/utils.ts +10 -4
@@ -10,8 +10,8 @@ jobs:
10
10
  name: Build & test
11
11
  runs-on: ubuntu-latest
12
12
  steps:
13
- - uses: actions/checkout@v4
14
- - uses: actions/setup-node@v4
13
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
14
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
15
15
  with:
16
16
  node-version: "20"
17
17
  cache: "npm"
@@ -28,8 +28,8 @@ jobs:
28
28
  contents: read
29
29
  id-token: write
30
30
  steps:
31
- - uses: actions/checkout@v4
32
- - uses: actions/setup-node@v4
31
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32
+ - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
33
33
  with:
34
34
  node-version: "20"
35
35
  registry-url: "https://registry.npmjs.org"
@@ -53,15 +53,25 @@ jobs:
53
53
  name: Publish to MCP Registry
54
54
  needs: npm
55
55
  runs-on: ubuntu-latest
56
+ permissions:
57
+ contents: read
56
58
  env:
57
59
  MCP_REGISTRY_TOKEN: ${{ secrets.MCP_REGISTRY_TOKEN }}
58
60
  steps:
59
- - uses: actions/checkout@v4
61
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
60
62
  - name: Install mcp-publisher
61
63
  run: |
62
- curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" \
63
- | tar xz mcp-publisher
64
+ RELEASE_TAG=$(gh api repos/modelcontextprotocol/registry/releases/latest --jq '.tag_name')
65
+ VER="${RELEASE_TAG#v}"
66
+ curl -fsSL -o mcp-publisher.tar.gz \
67
+ "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz"
68
+ curl -fsSL -o checksums.txt \
69
+ "https://github.com/modelcontextprotocol/registry/releases/download/${RELEASE_TAG}/registry_${VER}_checksums.txt"
70
+ grep "mcp-publisher_linux_amd64.tar.gz" checksums.txt | sha256sum --check
71
+ tar xzf mcp-publisher.tar.gz mcp-publisher
64
72
  sudo mv mcp-publisher /usr/local/bin/
73
+ env:
74
+ GH_TOKEN: ${{ github.token }}
65
75
  - name: Authenticate and publish to MCP Registry
66
76
  run: |
67
77
  mcp-publisher login token "$MCP_REGISTRY_TOKEN"
package/CHANGELOG.md CHANGED
@@ -11,6 +11,58 @@ This project uses [Semantic Versioning](https://semver.org/).
11
11
 
12
12
  ---
13
13
 
14
+ ## [1.5.4] – 2026-04-11
15
+
16
+ ### Security
17
+
18
+ - **CI/CD supply-chain hardening** — `publish.yml` now verifies the SHA256 checksum of the `mcp-publisher` binary against the official `registry_*_checksums.txt` file before extraction. The download uses `curl -fsSL` (strict) and aborts if the checksum does not match. Previously the binary was piped directly from the network into `tar` without any integrity check.
19
+
20
+ - **GitHub Actions pinned to immutable commit SHAs** — all three `actions/checkout` and `actions/setup-node` usages in `publish.yml` are now pinned to their exact commit SHA (`11bd71901...` / `49933ea5...`) with the human-readable tag in a comment. Tag-based references (`@v4`) are mutable and could be silently redirected.
21
+
22
+ - **`DELETE /mcp` protected by rate limiter and auth middleware** — the endpoint was previously unprotected and returned 405 to anyone without any throttling. It now passes through the same `mcpRateLimiter` and `mcpAuthMiddleware` as the `POST`/`GET` `/mcp` handlers.
23
+
24
+ - **Version removed from unauthenticated `/health` response** — the `version` field was removed from the public health endpoint to prevent fingerprinting of the exact server version. `status`, `server`, and `auth_mode` are still returned.
25
+
26
+ - **`/.well-known/mcp/server-card.json` gated by auth when credentials are configured** — when `MCP_AUTH_TOKEN` is set, the server-card endpoint now requires the same Bearer token as `/mcp`, preventing unauthenticated enumeration of all tool schemas including authenticated ones.
27
+
28
+ - **`validateCurrency` added to `get_arbitrage_opportunities`** — the `base_currency` input was the only tool parameter that bypassed the shared currency validator. It now runs `validateCurrency()` before any business logic. The Zod schema in `register()` was also tightened with `.min(2).max(10).regex(/^[A-Z0-9]+$/i)`.
29
+
30
+ - **`network` field in `create_withdrawal` validated by regex** — the blockchain network identifier for crypto withdrawals is now validated against `/^[a-z][a-z0-9-]{1,29}$/` in the Zod schema, rejecting unexpected values before they reach the Buda API.
31
+
32
+ - **Audit log for `lightning_withdrawal` now includes amount** — `args_summary` was previously empty (`{}`), making the audit trail useless for this operation. The confirmed withdrawal amount (`amount_btc`) is now included so anomaly detection and post-incident review have meaningful context. The invoice string is still never logged.
33
+
34
+ - **`safeTokenEqual` now eliminates token-length timing oracle** — both strings are written into equal-length zero-padded `Buffer.alloc(maxLen)` before `timingSafeEqual`, so execution time no longer varies with the difference in string lengths. A final `aByteLen === bByteLen` guard prevents a padded match from returning `true`.
35
+
36
+ - **CORS policy documented explicitly** — an inline comment clarifies that CORS is intentionally not configured because `buda-mcp` is a server-to-server MCP transport, not a browser client target. `helmet()` already sets the relevant browser security headers.
37
+
38
+ ---
39
+
40
+ ## [1.5.3] – 2026-04-11
41
+
42
+ ### Security
43
+
44
+ - **Upstream API errors no longer forwarded to MCP clients** — `BudaClient.handleResponse` now logs the full Buda API error detail (status, path, message) to `process.stderr` as structured JSON and returns only a generic message to the MCP caller (e.g. `"Buda API error 404 on /path."`). Previously, raw upstream error messages including potential internal details were forwarded directly to clients.
45
+
46
+ - **Audit log transport field corrected for HTTP** — nine destructive tool handlers (`place_order`, `cancel_order`, `cancel_all_orders`, `cancel_order_by_client_id`, `place_batch_orders`, `create_withdrawal`, `lightning_withdrawal`, `create_receive_address`, `quote_remittance`, `accept_remittance_quote`) now correctly log `transport: "http"` when invoked via the HTTP server. Previously their `register()` functions defaulted to `"stdio"`, making all HTTP audit events appear as stdio traffic.
47
+
48
+ - **HTTP security headers via `helmet`** — Express HTTP server now applies `helmet()` as the first middleware, adding `X-Content-Type-Options`, `X-Frame-Options`, `Referrer-Policy`, `X-DNS-Prefetch-Control`, `X-Download-Options`, and removing `X-Powered-By`.
49
+
50
+ - **Request body size limit** — `express.json()` now enforces an explicit `limit: "10kb"` on the `/mcp` endpoint, reducing the memory/CPU surface for oversized body attacks in combination with the existing rate limiter.
51
+
52
+ - **Rate limiting extended to `/health` and `/.well-known/mcp/server-card.json`** — a `staticRateLimiter` (60 req/min) now protects these endpoints, which previously had no throttling. Sufficient for all legitimate uptime monitors and Smithery discovery.
53
+
54
+ - **`trust proxy` topology documented** — added inline comment to `app.set("trust proxy", 1)` explaining the single-hop assumption (Railway), the impact on `req.ip` and `express-rate-limit` client IP detection, and the action required if an additional proxy layer is added.
55
+
56
+ ### Pending (manual)
57
+
58
+ - **CI binary pinning** — `publish.yml` should pin `mcp-publisher` to a fixed version with SHA256 verification instead of downloading `releases/latest`. Target version: `v1.5.0`, SHA256: `79bbb73ba048c5906034f73ef6286d7763bd53cf368ea0b358fc593ed360cbd5`. See `PUBLISH_CHECKLIST.md` for the exact step.
59
+
60
+ ### Added
61
+
62
+ - `helmet` dependency (v8.x) — HTTP security headers middleware.
63
+
64
+ ---
65
+
14
66
  ## [1.5.2] – 2026-04-11
15
67
 
16
68
  ### Security
@@ -1,6 +1,6 @@
1
- # Publish Checklist — buda-mcp v1.5.2
1
+ # Publish Checklist — buda-mcp v1.5.4
2
2
 
3
- Steps to publish `v1.5.2` to npm, the MCP registry, and notify community directories.
3
+ Steps to publish `v1.5.4` to npm, the MCP registry, and notify community directories.
4
4
 
5
5
  ---
6
6
 
@@ -8,7 +8,7 @@ Steps to publish `v1.5.2` to npm, the MCP registry, and notify community directo
8
8
 
9
9
  ```bash
10
10
  # Confirm version
11
- node -e "console.log(require('./package.json').version)" # should print 1.5.2
11
+ node -e "console.log(require('./package.json').version)" # should print 1.5.4
12
12
 
13
13
  # Build and test
14
14
  npm run build
@@ -37,9 +37,9 @@ Verify: https://www.npmjs.com/package/@guiie/buda-mcp
37
37
 
38
38
  ## 3. GitHub release
39
39
 
40
- Tag and release already created via `gh release create v1.5.2`. Verify at:
40
+ Tag and release already created via `gh release create v1.5.4`. Verify at:
41
41
 
42
- https://github.com/gtorreal/buda-mcp/releases/tag/v1.5.2
42
+ https://github.com/gtorreal/buda-mcp/releases/tag/v1.5.4
43
43
 
44
44
  ---
45
45
 
@@ -64,23 +64,18 @@ Verify: https://smithery.ai/server/@guiie/buda-mcp
64
64
  **Email/message template:**
65
65
 
66
66
  ```
67
- Subject: [Update] buda-mcp v1.5.2 — Security hardening (second pass)
67
+ Subject: [Update] buda-mcp v1.5.3 — Security hardening (third pass)
68
68
 
69
69
  Hi mcp.so team,
70
70
 
71
- I've released v1.5.2 of buda-mcp (@guiie/buda-mcp on npm).
71
+ I've released v1.5.3 of buda-mcp (@guiie/buda-mcp on npm).
72
72
 
73
73
  Key changes (security hardening, no new tools):
74
- - Constant-time token comparison (timing-safe Bearer token auth)
75
- - Strict environment variable validation (PORT, MCP_RATE_LIMIT) with safe exit on bad config
76
- - MCP_AUTH_TOKEN entropy warning (< 32 chars)
77
- - trust proxy support for correct client IP detection behind reverse proxies
78
- - Audit logging for all 11 destructive tool handlers (structured JSON to stderr)
79
- - Dead man's switch: renew/disarm also blocked on HTTP transport
80
- - validateCurrency() added to compare_markets tool
81
- - Stronger BOLT-11 regex validation in lightning_withdrawal
82
- - Internal API paths redacted from all error responses (31 tool handlers)
83
- - 28 new unit tests (total now 184)
74
+ - Upstream API errors no longer forwarded to MCP clients (generic messages only, detail logged server-side)
75
+ - Audit log transport field corrected for HTTP (9 handlers previously showed "stdio" for HTTP traffic)
76
+ - HTTP security headers via helmet (X-Content-Type-Options, X-Frame-Options, Referrer-Policy, etc.)
77
+ - Request body size limit enforced (10kb) on /mcp endpoint
78
+ - Rate limiting extended to /health and /.well-known/mcp/server-card.json endpoints
84
79
 
85
80
  Links:
86
81
  - npm: https://www.npmjs.com/package/@guiie/buda-mcp
@@ -99,24 +94,22 @@ Thank you!
99
94
  **Message template:**
100
95
 
101
96
  ```
102
- Subject: [Update] buda-mcp v1.5.2
97
+ Subject: [Update] buda-mcp v1.5.3
103
98
 
104
99
  Hi Glama team,
105
100
 
106
- buda-mcp has been updated to v1.5.2.
101
+ buda-mcp has been updated to v1.5.3.
107
102
 
108
103
  Package: @guiie/buda-mcp (npm)
109
104
  Registry: io.github.gtorreal/buda-mcp (MCP Registry)
110
- Version: 1.5.2
111
-
112
- Changes (security hardening, second pass):
113
- - Constant-time token comparison (timing-safe auth)
114
- - Strict env var validation (PORT, MCP_RATE_LIMIT)
115
- - Audit logging for all destructive handlers
116
- - Dead man's switch: renew/disarm also blocked on HTTP
117
- - validateCurrency() in compare_markets
118
- - Stronger BOLT-11 regex
119
- - Internal paths redacted from error responses
105
+ Version: 1.5.3
106
+
107
+ Changes (security hardening, third pass):
108
+ - Upstream API errors no longer forwarded to MCP clients
109
+ - Audit log transport field corrected for HTTP (9 handlers)
110
+ - HTTP security headers via helmet
111
+ - Request body size limit (10kb) on /mcp endpoint
112
+ - Rate limiting on /health and server-card endpoints
120
113
  - 184 unit tests
121
114
 
122
115
  Quick start:
@@ -132,25 +125,45 @@ Thank you!
132
125
 
133
126
  ## 8. Post-publish verification
134
127
 
135
- - [ ] `npx @guiie/buda-mcp@1.5.2` starts successfully
136
- - [ ] `npm info @guiie/buda-mcp version` returns `1.5.2`
137
- - [ ] GitHub release tag `v1.5.2` is visible
138
- - [ ] MCP Registry entry reflects v1.5.2
128
+ - [ ] `npx @guiie/buda-mcp@1.5.3` starts successfully
129
+ - [ ] `npm info @guiie/buda-mcp version` returns `1.5.3`
130
+ - [ ] GitHub release tag `v1.5.3` is visible
131
+ - [ ] MCP Registry entry reflects v1.5.3
139
132
  - [ ] Smithery server card lists all tools
140
- - [ ] `GET /health` returns `"version":"1.5.2"` on Railway deployment
141
- - [ ] HTTP server exits if `BUDA_API_KEY` set but `MCP_AUTH_TOKEN` is absent
142
- - [ ] `create_withdrawal` rejects a truncated BTC address with `INVALID_ADDRESS`
143
- - [ ] `lightning_withdrawal` rejects a non-BOLT11 string with `INVALID_INVOICE`
144
- - [ ] `place_batch_orders` with `max_notional` rejects over-cap batch before API call
145
- - [ ] `schedule_cancel_all` via HTTP returns `TRANSPORT_NOT_SUPPORTED`
146
- - [ ] `renew_cancel_timer` via HTTP returns `TRANSPORT_NOT_SUPPORTED`
147
- - [ ] Error responses do NOT include internal `path` field
148
- - [ ] Audit events appear in stderr as JSON with `audit: true`
133
+ - [ ] `GET /health` returns `"version":"1.5.3"` on Railway deployment
134
+ - [ ] `GET /health` responds with `X-Content-Type-Options: nosniff` header (helmet active)
135
+ - [ ] `GET /health` rate-limited at 60 req/min
136
+ - [ ] Error responses from the MCP server show generic message (not raw Buda API detail)
137
+ - [ ] Audit log shows `"transport":"http"` for HTTP-triggered destructive tools
138
+ - [ ] Pending: manually apply CI binary pinning to `publish.yml` (see CHANGELOG v1.5.3)
149
139
  - [ ] mcp.so listing updated
150
140
  - [ ] Glama.ai listing updated
151
141
 
152
142
  ---
153
143
 
144
+ ---
145
+
146
+ ## 9. Pending manual fix — CI binary pinning
147
+
148
+ Edit `.github/workflows/publish.yml`, replace the `Install mcp-publisher` step with:
149
+
150
+ ```yaml
151
+ - name: Install mcp-publisher
152
+ env:
153
+ MCP_PUBLISHER_VERSION: "v1.5.0"
154
+ MCP_PUBLISHER_SHA256: "79bbb73ba048c5906034f73ef6286d7763bd53cf368ea0b358fc593ed360cbd5"
155
+ run: |
156
+ curl -fsSL "https://github.com/modelcontextprotocol/registry/releases/download/${MCP_PUBLISHER_VERSION}/mcp-publisher_linux_amd64.tar.gz" \
157
+ -o mcp-publisher.tar.gz
158
+ echo "${MCP_PUBLISHER_SHA256} mcp-publisher.tar.gz" | sha256sum --check
159
+ tar xz -f mcp-publisher.tar.gz mcp-publisher
160
+ sudo mv mcp-publisher /usr/local/bin/
161
+ ```
162
+
163
+ SHA256 verified against GitHub release `v1.5.0` on 2026-04-11. Update both values when bumping `mcp-publisher`.
164
+
165
+ ---
166
+
154
167
  ## ARCHIVED: previous checklists
155
168
 
156
169
  See git tags `v1.5.0`, `v1.5.1`, `v1.4.0`, `v1.4.1`, `v1.4.2` for previous release notes and verification steps.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAKA,qBAAa,YAAa,SAAQ,KAAK;aAEnB,MAAM,EAAE,MAAM;aACd,IAAI,EAAE,MAAM;aAEZ,YAAY,CAAC,EAAE,MAAM;gBAHrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EAC5B,OAAO,EAAE,MAAM,EACC,YAAY,CAAC,EAAE,MAAM,YAAA;CAKxC;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAqB;gBAG7C,OAAO,GAAE,MAAiB,EAC1B,MAAM,CAAC,EAAE,MAAM,EACf,SAAS,CAAC,EAAE,MAAM;IAOpB,OAAO,IAAI,OAAO;IAIlB,OAAO,CAAC,aAAa,CAAK;IAE1B,OAAO,CAAC,KAAK;IAIb,OAAO,CAAC,IAAI;IASZ,OAAO,CAAC,WAAW;IAWnB;;;;OAIG;IACH,OAAO,CAAC,iBAAiB;IAOzB;;;;OAIG;YACW,cAAc;YA2Bd,cAAc;IActB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE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sBtB,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAoB1E,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAmBnD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAmBlD,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAmBpF"}
package/dist/client.js CHANGED
@@ -90,7 +90,12 @@ export class BudaClient {
90
90
  catch {
91
91
  // ignore parse error, use statusText
92
92
  }
93
- throw new BudaApiError(response.status, path, `Buda API ${response.status}: ${detail}`);
93
+ // Log full upstream detail server-side only — never forward to MCP caller
94
+ process.stderr.write(JSON.stringify({ buda_api_error: true, status: response.status, path, detail }) + "\n");
95
+ const clientMsg = response.status === 429
96
+ ? `Rate limit exceeded on ${path}. Retry later.`
97
+ : `Buda API error ${response.status} on ${path}.`;
98
+ throw new BudaApiError(response.status, path, clientMsg);
94
99
  }
95
100
  return response.json();
96
101
  }
package/dist/http.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import express from "express";
2
+ import helmet from "helmet";
2
3
  import rateLimit from "express-rate-limit";
3
4
  import { McpServer, ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
4
5
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
@@ -127,22 +128,22 @@ function createServer() {
127
128
  if (authEnabled) {
128
129
  balances.register(server, client);
129
130
  orders.register(server, client);
130
- placeOrder.register(server, client);
131
- cancelOrder.register(server, client);
131
+ placeOrder.register(server, client, "http");
132
+ cancelOrder.register(server, client, "http");
132
133
  deadMansSwitch.register(server, client, "http");
133
134
  account.register(server, client);
134
135
  balance.register(server, client);
135
136
  orderLookup.register(server, client);
136
137
  networkFees.register(server, client);
137
138
  deposits.register(server, client);
138
- withdrawals.register(server, client);
139
- receiveAddresses.register(server, client);
140
- remittances.register(server, client);
139
+ withdrawals.register(server, client, "http");
140
+ receiveAddresses.register(server, client, "http");
141
+ remittances.register(server, client, "http");
141
142
  remittanceRecipients.register(server, client);
142
- cancelAllOrders.register(server, client);
143
- cancelOrderByClientId.register(server, client);
144
- batchOrders.register(server, client);
145
- lightning.register(server, client);
143
+ cancelAllOrders.register(server, client, "http");
144
+ cancelOrderByClientId.register(server, client, "http");
145
+ batchOrders.register(server, client, "http");
146
+ lightning.register(server, client, "http");
146
147
  }
147
148
  // MCP Resources
148
149
  server.resource("buda-markets", "buda://markets", async (uri) => {
@@ -195,10 +196,15 @@ function createServer() {
195
196
  return server;
196
197
  }
197
198
  const app = express();
198
- // Required for correct client IP detection behind Railway's reverse proxy.
199
- // Without this, express-rate-limit sees the proxy IP instead of the real client.
199
+ app.use(helmet());
200
+ // CORS: intentionally not configured. This server is designed for server-to-server MCP
201
+ // communication only (AI agents, Claude Desktop, etc.) — not for browser clients.
202
+ // Helmet already sets X-Content-Type-Options, X-Frame-Options, and related headers.
203
+ // trust proxy: 1 = trust exactly one hop (Railway's reverse proxy).
204
+ // If Cloudflare or another proxy is added in front, increment this value.
205
+ // Affects: req.ip and express-rate-limit client IP detection.
200
206
  app.set("trust proxy", 1);
201
- app.use(express.json());
207
+ app.use(express.json({ limit: "10kb" }));
202
208
  const MCP_AUTH_TOKEN = process.env.MCP_AUTH_TOKEN;
203
209
  if (authEnabled && !MCP_AUTH_TOKEN) {
204
210
  console.error("[buda-mcp] FATAL: BUDA_API_KEY/BUDA_API_SECRET are set but MCP_AUTH_TOKEN is not.\n" +
@@ -224,6 +230,13 @@ const mcpRateLimiter = rateLimit({
224
230
  legacyHeaders: false,
225
231
  message: { error: "Too many requests. Retry after 60 seconds.", code: "RATE_LIMITED" },
226
232
  });
233
+ const staticRateLimiter = rateLimit({
234
+ windowMs: 60_000,
235
+ max: 60,
236
+ standardHeaders: true,
237
+ legacyHeaders: false,
238
+ message: { error: "Too many requests.", code: "RATE_LIMITED" },
239
+ });
227
240
  function mcpAuthMiddleware(req, res, next) {
228
241
  if (!MCP_AUTH_TOKEN) {
229
242
  next();
@@ -236,18 +249,20 @@ function mcpAuthMiddleware(req, res, next) {
236
249
  }
237
250
  next();
238
251
  }
239
- // Health check for Railway / uptime monitors
240
- app.get("/health", (_req, res) => {
252
+ // Health check for Railway / uptime monitors.
253
+ // version is intentionally omitted to avoid fingerprinting by unauthenticated callers.
254
+ app.get("/health", staticRateLimiter, (_req, res) => {
241
255
  res.json({
242
256
  status: "ok",
243
257
  server: "buda-mcp",
244
- version: VERSION,
245
258
  auth_mode: authEnabled ? "authenticated" : "public",
246
259
  });
247
260
  });
248
261
  // Smithery static server card — assembled programmatically from tool definitions.
249
262
  // Adding a new tool only requires exporting its toolSchema; this handler needs no changes.
250
- app.get("/.well-known/mcp/server-card.json", (_req, res) => {
263
+ // When auth is enabled, the server card is gated behind the same bearer token as /mcp
264
+ // to avoid leaking the full tool schema to unauthenticated callers.
265
+ app.get("/.well-known/mcp/server-card.json", staticRateLimiter, mcpAuthMiddleware, (_req, res) => {
251
266
  res.json({
252
267
  serverInfo: { name: "buda-mcp", version: VERSION },
253
268
  authentication: { required: authEnabled },
@@ -284,7 +299,7 @@ app.get("/mcp", mcpRateLimiter, mcpAuthMiddleware, async (req, res) => {
284
299
  await server.connect(transport);
285
300
  await transport.handleRequest(req, res);
286
301
  });
287
- app.delete("/mcp", async (_req, res) => {
302
+ app.delete("/mcp", mcpRateLimiter, mcpAuthMiddleware, async (_req, res) => {
288
303
  res.status(405).json({ error: "Sessions not supported (stateless server)" });
289
304
  });
290
305
  app.listen(PORT, () => {
@@ -1 +1 @@
1
- {"version":3,"file":"arbitrage.d.ts","sourceRoot":"","sources":["../../src/tools/arbitrage.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;;;;;;;;;;;;;;;;;CAyBtB,CAAC;AAYF,UAAU,cAAc;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,4BAA4B,CAChD,EAAE,aAAa,EAAE,aAAmB,EAAE,EAAE,cAAc,EACtD,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,CAgIhF;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAmBxF"}
1
+ {"version":3,"file":"arbitrage.d.ts","sourceRoot":"","sources":["../../src/tools/arbitrage.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;;;;;;;;;;;;;;;;;CAyBtB,CAAC;AAYF,UAAU,cAAc;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAsB,4BAA4B,CAChD,EAAE,aAAa,EAAE,aAAmB,EAAE,EAAE,cAAc,EACtD,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,CAwIhF;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,GAAG,IAAI,CAsBxF"}
@@ -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: "get_arbitrage_opportunities",
6
7
  description: "Detects cross-country price discrepancies for a given asset across Buda's CLP, COP, and PEN markets, " +
@@ -26,6 +27,13 @@ export const toolSchema = {
26
27
  },
27
28
  };
28
29
  export async function handleArbitrageOpportunities({ base_currency, threshold_pct = 0.5 }, client, cache) {
30
+ const currencyError = validateCurrency(base_currency);
31
+ if (currencyError) {
32
+ return {
33
+ content: [{ type: "text", text: JSON.stringify({ error: currencyError, code: "INVALID_CURRENCY" }) }],
34
+ isError: true,
35
+ };
36
+ }
29
37
  try {
30
38
  const base = base_currency.toUpperCase();
31
39
  const data = await cache.getOrFetch("tickers:all", CACHE_TTL.TICKER, () => client.get("/tickers"));
@@ -130,6 +138,9 @@ export function register(server, client, cache) {
130
138
  server.tool(toolSchema.name, toolSchema.description, {
131
139
  base_currency: z
132
140
  .string()
141
+ .min(2)
142
+ .max(10)
143
+ .regex(/^[A-Z0-9]+$/i, "Must be 2–10 alphanumeric characters (e.g. 'BTC', 'ETH').")
133
144
  .describe("Base asset to scan (e.g. 'BTC', 'ETH', 'XRP')."),
134
145
  threshold_pct: z
135
146
  .number()
@@ -77,6 +77,6 @@ export declare function handlePlaceBatchOrders(args: BatchOrdersArgs, client: Bu
77
77
  }>;
78
78
  isError?: boolean;
79
79
  }>;
80
- export declare function register(server: McpServer, client: BudaClient): void;
80
+ export declare function register(server: McpServer, client: BudaClient, transport?: "http" | "stdio"): void;
81
81
  export {};
82
82
  //# sourceMappingURL=batch_orders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"batch_orders.d.ts","sourceRoot":"","sources":["../../src/tools/batch_orders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAKxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CtB,CAAC;AAEF,QAAA,MAAM,UAAU;;;;;;;;;;;;iBAMd,CAAC;AAEH,KAAK,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAWnD,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,eAAe,EACrB,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,CA2IhF;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CA2BpE"}
1
+ {"version":3,"file":"batch_orders.d.ts","sourceRoot":"","sources":["../../src/tools/batch_orders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAKxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0CtB,CAAC;AAEF,QAAA,MAAM,UAAU;;;;;;;;;;;;iBAMd,CAAC;AAEH,KAAK,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAC;AAWnD,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,eAAe,EACrB,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,CA2IhF;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,GAAE,MAAM,GAAG,OAAiB,GACpC,IAAI,CA2BN"}
@@ -176,7 +176,7 @@ export async function handlePlaceBatchOrders(args, client, transport = "stdio")
176
176
  isError,
177
177
  };
178
178
  }
179
- export function register(server, client) {
179
+ export function register(server, client, transport = "stdio") {
180
180
  server.tool(toolSchema.name, toolSchema.description, {
181
181
  orders: z
182
182
  .array(orderShape)
@@ -193,6 +193,6 @@ export function register(server, client) {
193
193
  confirmation_token: z
194
194
  .string()
195
195
  .describe("Safety confirmation. Must equal exactly 'CONFIRM' (case-sensitive) to execute."),
196
- }, (args) => handlePlaceBatchOrders(args, client));
196
+ }, (args) => handlePlaceBatchOrders(args, client, transport));
197
197
  }
198
198
  //# sourceMappingURL=batch_orders.js.map
@@ -29,6 +29,6 @@ export declare function handleCancelAllOrders(args: CancelAllOrdersArgs, client:
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_all_orders.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cancel_all_orders.d.ts","sourceRoot":"","sources":["../../src/tools/cancel_all_orders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAKxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAuBtB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,mBAAmB,EACzB,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,CAqDhF;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAkBpE"}
1
+ {"version":3,"file":"cancel_all_orders.d.ts","sourceRoot":"","sources":["../../src/tools/cancel_all_orders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AAKxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAuBtB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,mBAAmB,EACzB,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,CAqDhF;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,GAAE,MAAM,GAAG,OAAiB,GACpC,IAAI,CAkBN"}
@@ -71,7 +71,7 @@ export async function handleCancelAllOrders(args, client, transport = "stdio") {
71
71
  return result;
72
72
  }
73
73
  }
74
- export function register(server, client) {
74
+ export function register(server, client, transport = "stdio") {
75
75
  server.tool(toolSchema.name, toolSchema.description, {
76
76
  market_id: z
77
77
  .string()
@@ -81,6 +81,6 @@ export function register(server, client) {
81
81
  .string()
82
82
  .describe("Safety confirmation. Must equal exactly 'CONFIRM' (case-sensitive) to execute. " +
83
83
  "Any other value will reject the request without canceling."),
84
- }, (args) => handleCancelAllOrders(args, client));
84
+ }, (args) => handleCancelAllOrders(args, client, transport));
85
85
  }
86
86
  //# sourceMappingURL=cancel_all_orders.js.map
@@ -29,6 +29,6 @@ export declare function handleCancelOrder(args: CancelOrderArgs, client: BudaCli
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,UAAU,EAAgB,MAAM,cAAc,CAAC;AAIxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAuBtB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,eAAe,EACrB,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,CAsChF;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAAG,IAAI,CAmBpE"}
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,UAAU,EAAgB,MAAM,cAAc,CAAC;AAIxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;CAuBtB,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,eAAe,EACrB,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,CAsChF;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,GAAE,MAAM,GAAG,OAAiB,GACpC,IAAI,CAmBN"}
@@ -58,7 +58,7 @@ export async function handleCancelOrder(args, client, transport = "stdio") {
58
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
@@ -29,6 +29,6 @@ export declare function handleCancelOrderByClientId(args: CancelOrderByClientIdA
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;AAKxD,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;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,SAAS,GAAE,MAAM,GAAG,OAAiB,GACpC,IAAI,CAkBN"}
@@ -87,7 +87,7 @@ export async function handleCancelOrderByClientId(args, client, transport = "std
87
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
@@ -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;AAKxD,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;CAuBzC,CAAC;AAEF,eAAO,MAAM,gCAAgC;;;;;;;;;;;;;;;;;;;;;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,M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B,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,CAsFhF;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"}
@@ -103,7 +103,13 @@ export async function handleLightningWithdrawal(args, client, transport = "stdio
103
103
  },
104
104
  ],
105
105
  };
106
- logAudit({ ts: new Date().toISOString(), tool: "lightning_withdrawal", transport, args_summary: {}, success: true });
106
+ logAudit({
107
+ ts: new Date().toISOString(),
108
+ tool: "lightning_withdrawal",
109
+ transport,
110
+ args_summary: { amount_btc: amount.value },
111
+ success: true,
112
+ });
107
113
  return result;
108
114
  }
109
115
  catch (err) {
@@ -153,7 +159,7 @@ export async function handleCreateLightningInvoice(args, client) {
153
159
  };
154
160
  }
155
161
  }
156
- export function register(server, client) {
162
+ export function register(server, client, transport = "stdio") {
157
163
  server.tool(lightningWithdrawalToolSchema.name, lightningWithdrawalToolSchema.description, {
158
164
  invoice: z
159
165
  .string()
@@ -163,7 +169,7 @@ export function register(server, client) {
163
169
  .string()
164
170
  .describe("Safety confirmation. Must equal exactly 'CONFIRM' (case-sensitive) to execute. " +
165
171
  "Any other value will reject the request without paying."),
166
- }, (args) => handleLightningWithdrawal(args, client));
172
+ }, (args) => handleLightningWithdrawal(args, client, transport));
167
173
  server.tool(createLightningInvoiceToolSchema.name, createLightningInvoiceToolSchema.description, {
168
174
  amount_satoshis: z
169
175
  .number()
@@ -79,6 +79,6 @@ export declare function handlePlaceOrder(args: PlaceOrderArgs, client: BudaClien
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