@guiie/buda-mcp 1.0.0 → 1.1.0

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 (77) hide show
  1. package/CHANGELOG.md +87 -0
  2. package/PUBLISH_CHECKLIST.md +192 -0
  3. package/README.md +308 -70
  4. package/dist/cache.d.ts +13 -0
  5. package/dist/cache.d.ts.map +1 -0
  6. package/dist/cache.js +25 -0
  7. package/dist/client.d.ts +9 -8
  8. package/dist/client.d.ts.map +1 -1
  9. package/dist/client.js +95 -12
  10. package/dist/http.d.ts +2 -0
  11. package/dist/http.d.ts.map +1 -0
  12. package/dist/http.js +262 -0
  13. package/dist/index.js +53 -9
  14. package/dist/tools/balances.d.ts +4 -0
  15. package/dist/tools/balances.d.ts.map +1 -0
  16. package/dist/tools/balances.js +23 -0
  17. package/dist/tools/cancel_order.d.ts +4 -0
  18. package/dist/tools/cancel_order.d.ts.map +1 -0
  19. package/dist/tools/cancel_order.js +53 -0
  20. package/dist/tools/compare_markets.d.ts +5 -0
  21. package/dist/tools/compare_markets.d.ts.map +1 -0
  22. package/dist/tools/compare_markets.js +65 -0
  23. package/dist/tools/markets.d.ts +2 -1
  24. package/dist/tools/markets.d.ts.map +1 -1
  25. package/dist/tools/markets.js +22 -8
  26. package/dist/tools/orderbook.d.ts +2 -1
  27. package/dist/tools/orderbook.d.ts.map +1 -1
  28. package/dist/tools/orderbook.js +27 -13
  29. package/dist/tools/orders.d.ts +4 -0
  30. package/dist/tools/orders.d.ts.map +1 -0
  31. package/dist/tools/orders.js +57 -0
  32. package/dist/tools/place_order.d.ts +4 -0
  33. package/dist/tools/place_order.d.ts.map +1 -0
  34. package/dist/tools/place_order.js +88 -0
  35. package/dist/tools/price_history.d.ts +5 -0
  36. package/dist/tools/price_history.d.ts.map +1 -0
  37. package/dist/tools/price_history.js +97 -0
  38. package/dist/tools/spread.d.ts +5 -0
  39. package/dist/tools/spread.d.ts.map +1 -0
  40. package/dist/tools/spread.js +55 -0
  41. package/dist/tools/ticker.d.ts +2 -1
  42. package/dist/tools/ticker.d.ts.map +1 -1
  43. package/dist/tools/ticker.js +19 -5
  44. package/dist/tools/trades.d.ts +2 -1
  45. package/dist/tools/trades.d.ts.map +1 -1
  46. package/dist/tools/trades.js +22 -10
  47. package/dist/tools/volume.d.ts +2 -1
  48. package/dist/tools/volume.d.ts.map +1 -1
  49. package/dist/tools/volume.js +17 -5
  50. package/dist/types.d.ts +42 -1
  51. package/dist/types.d.ts.map +1 -1
  52. package/marketplace/claude-listing.md +76 -8
  53. package/marketplace/cursor-mcp.json +2 -2
  54. package/marketplace/gemini-tools.json +51 -1
  55. package/marketplace/openapi.yaml +204 -4
  56. package/package.json +6 -2
  57. package/railway.json +12 -0
  58. package/server.json +1 -1
  59. package/src/cache.ts +34 -0
  60. package/src/client.ts +107 -12
  61. package/src/http.ts +305 -0
  62. package/src/index.ts +77 -9
  63. package/src/tools/balances.ts +30 -0
  64. package/src/tools/cancel_order.ts +65 -0
  65. package/src/tools/compare_markets.ts +82 -0
  66. package/src/tools/markets.ts +30 -11
  67. package/src/tools/orderbook.ts +31 -16
  68. package/src/tools/orders.ts +68 -0
  69. package/src/tools/place_order.ts +107 -0
  70. package/src/tools/price_history.ts +124 -0
  71. package/src/tools/spread.ts +71 -0
  72. package/src/tools/ticker.ts +23 -8
  73. package/src/tools/trades.ts +24 -12
  74. package/src/tools/volume.ts +20 -8
  75. package/src/types.ts +52 -1
  76. package/test/run-all.ts +122 -1
  77. package/tsconfig.json +1 -1
package/CHANGELOG.md ADDED
@@ -0,0 +1,87 @@
1
+ # Changelog
2
+
3
+ All notable changes to `buda-mcp` are documented in this file.
4
+
5
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
6
+ This project uses [Semantic Versioning](https://semver.org/).
7
+
8
+ ---
9
+
10
+ ## [1.1.0] – 2026-04-10
11
+
12
+ ### Added
13
+
14
+ **Phase 1: New public tools**
15
+
16
+ - **`get_spread`** — calculates the bid/ask spread (absolute and as a percentage of the ask price) for any market using the ticker endpoint. Cached with the same 5-second TTL as tickers.
17
+ - **`compare_markets`** — receives a base currency (e.g. `BTC`) and returns side-by-side ticker data for all its pairs across CLP, COP, PEN, USDC, and BTC quote currencies. Uses `GET /tickers` (all-tickers endpoint).
18
+ - **`get_price_history`** — returns OHLCV (open/high/low/close/volume) candles for a market and period (`1h`, `4h`, `1d`). Buda has no native candlestick endpoint; candles are aggregated client-side from up to 100 raw trades fetched via the trades endpoint.
19
+
20
+ **Input validation and error handling**
21
+
22
+ - All tools now wrap their handlers in `try/catch` and return structured `{ error, code, path }` JSON with `isError: true` on failure, instead of letting unhandled exceptions propagate.
23
+ - Zod schemas on all tool inputs remain the primary validation layer.
24
+
25
+ **In-memory TTL caching** (`src/cache.ts`)
26
+
27
+ - New `MemoryCache` class with `getOrFetch<T>(key, ttlMs, fetcher)` pattern.
28
+ - TTLs: markets list = 60 s, tickers = 5 s, order books = 3 s.
29
+ - Shared singleton for stdio; per-request instance for the stateless HTTP transport.
30
+
31
+ **Phase 2: Authentication scaffold**
32
+
33
+ - **`BudaClient`** extended with optional `apiKey` / `apiSecret` constructor params.
34
+ - `hasAuth()` method returns true when both env vars are set.
35
+ - HMAC-SHA384 signing implemented per [Buda API auth docs](https://api.buda.com/en/#authentication): nonce (microseconds), sign string `{METHOD} {path.json?query} {base64body} {nonce}`, headers `X-SBTC-APIKEY`, `X-SBTC-NONCE`, `X-SBTC-SIGNATURE`.
36
+ - `post<T>()` and `put<T>()` methods added to `BudaClient` for private endpoints.
37
+ - Credentials are read from `BUDA_API_KEY` / `BUDA_API_SECRET` environment variables. If not set, server runs in **public-only mode** — no breaking change for existing users.
38
+
39
+ **Authenticated tools** (only registered when API keys are present)
40
+
41
+ - **`get_balances`** — all currency balances (`GET /balances`).
42
+ - **`get_orders`** — orders for a given market, filterable by state (`GET /markets/{id}/orders`).
43
+ - **`place_order`** — places a limit or market order (`POST /markets/{id}/orders`). Requires `confirmation_token="CONFIRM"` to prevent accidental execution from ambiguous prompts.
44
+ - **`cancel_order`** — cancels an order by ID (`PUT /orders/{id}`). Requires `confirmation_token="CONFIRM"`.
45
+
46
+ **Phase 3: DX improvements**
47
+
48
+ - **MCP Resources protocol**: two resources registered in both stdio and HTTP transports:
49
+ - `buda://markets` — JSON list of all markets (60 s cache).
50
+ - `buda://ticker/{market}` — JSON ticker for a specific market (5 s cache).
51
+ - **README** rewritten: npx quick-start, npm/license/node badges, per-tool example prompts, authentication mode documentation, resources section.
52
+ - **`CHANGELOG.md`** introduced (this file).
53
+ - **`PUBLISH_CHECKLIST.md`** added with steps and message templates for notifying mcp.so and Glama.ai of the v1.1.0 release.
54
+ - **`marketplace/`** files updated: `claude-listing.md`, `cursor-mcp.json`, `gemini-tools.json`, `openapi.yaml` all reflect new tools, auth mode, npx quick-start, and MCP Resources.
55
+
56
+ ### Changed
57
+
58
+ - `BudaClient` `User-Agent` header updated from `buda-mcp/1.0.0` to `buda-mcp/1.1.0`.
59
+ - All 5 existing tool `register()` functions updated to accept a `MemoryCache` parameter and apply TTL caching.
60
+ - Server version string in `McpServer`, `http.ts` health endpoint, and server-card JSON updated to `1.1.0`.
61
+ - `package.json` version bumped to `1.1.0`.
62
+ - `marketplace/cursor-mcp.json` npm package name corrected to `@gtorreal/buda-mcp`.
63
+ - `marketplace/claude-listing.md` npm package name corrected to `@gtorreal/buda-mcp`.
64
+
65
+ ### Security
66
+
67
+ - API credentials (`BUDA_API_KEY`, `BUDA_API_SECRET`) are never logged at any level. All `console.log` / `console.error` calls in `http.ts` and `client.ts` were audited to confirm this.
68
+ - Authenticated instances are documented as **local-only** — never to be exposed publicly.
69
+
70
+ ---
71
+
72
+ ## [1.0.0] – 2025-01-01
73
+
74
+ ### Added
75
+
76
+ - Initial release: 5 public MCP tools for Buda.com market data.
77
+ - `get_markets` — list all trading pairs or get details for one.
78
+ - `get_ticker` — current price, bid/ask, volume, and price change.
79
+ - `get_orderbook` — full order book with bid/ask levels.
80
+ - `get_trades` — recent trade history with pagination.
81
+ - `get_market_volume` — 24h and 7-day volume by side.
82
+ - Dual transports: **stdio** (`index.ts`) and **Streamable HTTP** (`http.ts`).
83
+ - Railway deployment with health check at `GET /health`.
84
+ - Smithery-compatible static server card at `GET /.well-known/mcp/server-card.json`.
85
+ - Published to npm as `@gtorreal/buda-mcp`.
86
+ - Registered on MCP Registry as `io.github.gtorreal/buda-mcp`.
87
+ - Listed on Smithery, mcp.so, Glama.ai, PulseMCP, and awesome-mcp-servers.
@@ -0,0 +1,192 @@
1
+ # Publish Checklist — buda-mcp v1.1.0
2
+
3
+ Steps to publish `v1.1.0` to npm, the MCP registry, and notify community directories.
4
+
5
+ ---
6
+
7
+ ## 1. Pre-publish verification
8
+
9
+ ```bash
10
+ # Confirm version
11
+ node -e "console.log(require('./package.json').version)" # should print 1.1.0
12
+
13
+ # Build and test
14
+ npm run build
15
+ npm test
16
+
17
+ # Verify no credentials are logged (audit)
18
+ grep -r "apiKey\|apiSecret\|BUDA_API" dist/ --include="*.js" | grep -v "process.env\|hasAuth\|X-SBTC-APIKEY\|authHeaders\|constructor"
19
+ # Should return empty or only header name strings — never credential values
20
+ ```
21
+
22
+ ---
23
+
24
+ ## 2. npm publish
25
+
26
+ ```bash
27
+ npm login # if not already logged in
28
+ npm publish --access public --provenance
29
+ ```
30
+
31
+ Verify: https://www.npmjs.com/package/@gtorreal/buda-mcp
32
+
33
+ ---
34
+
35
+ ## 3. GitHub release
36
+
37
+ ```bash
38
+ git add -A
39
+ git commit -m "chore: release v1.1.0
40
+
41
+ - 3 new public tools: get_spread, compare_markets, get_price_history
42
+ - HMAC-SHA384 auth scaffold (BUDA_API_KEY / BUDA_API_SECRET)
43
+ - 4 auth-gated tools: get_balances, get_orders, place_order, cancel_order
44
+ - TTL caching (markets 60s, tickers 5s, orderbooks 3s)
45
+ - MCP Resources: buda://markets, buda://ticker/{market}
46
+ - Structured error responses for all tools
47
+ - Updated README, marketplace files, CHANGELOG"
48
+
49
+ git tag v1.1.0
50
+ git push origin main --tags
51
+ ```
52
+
53
+ Then create a GitHub Release from the tag with the following release notes:
54
+
55
+ ---
56
+
57
+ **Release notes template (GitHub):**
58
+
59
+ ```
60
+ ## buda-mcp v1.1.0
61
+
62
+ ### What's new
63
+
64
+ **3 new public tools**
65
+ - `get_spread` — bid/ask spread (absolute and %) for any market
66
+ - `compare_markets` — side-by-side ticker data for a base currency across all quote currencies
67
+ - `get_price_history` — OHLCV candles derived from recent trades (1h / 4h / 1d)
68
+
69
+ **HMAC auth scaffold**
70
+ - Set `BUDA_API_KEY` + `BUDA_API_SECRET` to unlock 4 authenticated tools
71
+ - `get_balances`, `get_orders`, `place_order`, `cancel_order`
72
+ - Public-only mode unchanged when no credentials are set
73
+
74
+ **Platform improvements**
75
+ - TTL caching: markets (60s), tickers (5s), order books (3s)
76
+ - MCP Resources: `buda://markets` and `buda://ticker/{market}`
77
+ - Structured `isError: true` responses for all tools
78
+ - Updated README with npx quickstart and per-tool examples
79
+
80
+ ```bash
81
+ npx @gtorreal/buda-mcp
82
+ ```
83
+ ```
84
+
85
+ ---
86
+
87
+ ## 4. MCP Registry update
88
+
89
+ The GitHub Actions workflow (`.github/workflows/publish.yml`) runs automatically on GitHub release. It runs `mcp publish` via `mcp-publisher`. Verify the registry entry at:
90
+
91
+ https://registry.modelcontextprotocol.io/servers/io.github.gtorreal/buda-mcp
92
+
93
+ If the workflow doesn't trigger, run manually:
94
+
95
+ ```bash
96
+ # Download mcp-publisher from GitHub releases (check for latest version)
97
+ curl -L https://github.com/modelcontextprotocol/mcp-publisher/releases/latest/download/mcp-publisher-macos -o mcp-publisher
98
+ chmod +x mcp-publisher
99
+ MCP_REGISTRY_TOKEN=<token> ./mcp-publisher publish
100
+ ```
101
+
102
+ ---
103
+
104
+ ## 5. Smithery
105
+
106
+ Smithery auto-detects updates via the `/.well-known/mcp/server-card.json` endpoint on the Railway deployment. No manual action required after deploying.
107
+
108
+ Verify: https://smithery.ai/server/@gtorreal/buda-mcp
109
+
110
+ ---
111
+
112
+ ## 6. Notify mcp.so
113
+
114
+ **Method:** Submit via the mcp.so listing update form or open a PR to their repository.
115
+
116
+ **Email/message template:**
117
+
118
+ ```
119
+ Subject: [Update] buda-mcp v1.1.0 — new tools + auth
120
+
121
+ Hi mcp.so team,
122
+
123
+ I've released v1.1.0 of buda-mcp (@gtorreal/buda-mcp on npm).
124
+
125
+ Key changes:
126
+ - 3 new public tools: get_spread, compare_markets, get_price_history (OHLCV)
127
+ - Optional HMAC auth scaffold (BUDA_API_KEY / BUDA_API_SECRET) unlocks 4 private tools: get_balances, get_orders, place_order, cancel_order
128
+ - TTL caching for all repeated data fetches
129
+ - MCP Resources: buda://markets and buda://ticker/{market}
130
+ - Structured error responses
131
+
132
+ Links:
133
+ - npm: https://www.npmjs.com/package/@gtorreal/buda-mcp
134
+ - GitHub: https://github.com/gtorreal/buda-mcp
135
+ - Changelog: https://github.com/gtorreal/buda-mcp/blob/main/CHANGELOG.md
136
+
137
+ Quick start: npx @gtorreal/buda-mcp
138
+
139
+ Thank you!
140
+ ```
141
+
142
+ ---
143
+
144
+ ## 7. Notify Glama.ai
145
+
146
+ **Method:** Use Glama's submission form at https://glama.ai/mcp/servers or open an issue/PR on their directory repository.
147
+
148
+ **Message template:**
149
+
150
+ ```
151
+ Subject: [Update] buda-mcp v1.1.0
152
+
153
+ Hi Glama team,
154
+
155
+ buda-mcp has been updated to v1.1.0. Here's a summary of what's new:
156
+
157
+ Package: @gtorreal/buda-mcp (npm)
158
+ Registry: io.github.gtorreal/buda-mcp (MCP Registry)
159
+ Version: 1.1.0
160
+
161
+ New tools added:
162
+ - get_spread: bid/ask spread for any market
163
+ - compare_markets: cross-currency price comparison for a base asset
164
+ - get_price_history: OHLCV candles from trade history (1h/4h/1d)
165
+ - get_balances, get_orders, place_order, cancel_order (authenticated, local-only)
166
+
167
+ New capabilities:
168
+ - MCP Resources protocol: buda://markets, buda://ticker/{market}
169
+ - TTL caching (60s/5s/3s by data type)
170
+ - Structured error responses (isError: true)
171
+
172
+ Quick start:
173
+ npx @gtorreal/buda-mcp
174
+
175
+ Changelog: https://github.com/gtorreal/buda-mcp/blob/main/CHANGELOG.md
176
+ GitHub: https://github.com/gtorreal/buda-mcp
177
+
178
+ Thank you!
179
+ ```
180
+
181
+ ---
182
+
183
+ ## 8. Post-publish verification
184
+
185
+ - [ ] `npx @gtorreal/buda-mcp@1.1.0` starts successfully
186
+ - [ ] `npm info @gtorreal/buda-mcp version` returns `1.1.0`
187
+ - [ ] GitHub release tag `v1.1.0` is visible
188
+ - [ ] MCP Registry entry reflects v1.1.0
189
+ - [ ] Smithery server card lists 8 public tools
190
+ - [ ] mcp.so listing updated
191
+ - [ ] Glama.ai listing updated
192
+ - [ ] Railway deployment health check returns `"version":"1.1.0"` at `/health`