@guiie/buda-mcp 1.1.0 → 1.1.2

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.
@@ -36,7 +36,15 @@ jobs:
36
36
  cache: "npm"
37
37
  - run: npm ci
38
38
  - run: npm run build
39
- - run: npm publish --access public --provenance
39
+ - name: Publish (skip if version already exists)
40
+ run: |
41
+ PKG=$(node -e "console.log(require('./package.json').name)")
42
+ VER=$(node -e "console.log(require('./package.json').version)")
43
+ if npm view "${PKG}@${VER}" version &>/dev/null; then
44
+ echo "Version ${VER} already published — skipping npm publish."
45
+ else
46
+ npm publish --access public --provenance
47
+ fi
40
48
  env:
41
49
  NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42
50
 
@@ -45,6 +53,8 @@ jobs:
45
53
  name: Publish to MCP Registry
46
54
  needs: npm
47
55
  runs-on: ubuntu-latest
56
+ env:
57
+ MCP_REGISTRY_TOKEN: ${{ secrets.MCP_REGISTRY_TOKEN }}
48
58
  steps:
49
59
  - uses: actions/checkout@v4
50
60
  - name: Install mcp-publisher
@@ -52,7 +62,7 @@ jobs:
52
62
  curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_linux_amd64.tar.gz" \
53
63
  | tar xz mcp-publisher
54
64
  sudo mv mcp-publisher /usr/local/bin/
55
- - name: Publish to MCP Registry
56
- run: mcp-publisher publish
57
- env:
58
- MCP_REGISTRY_TOKEN: ${{ secrets.MCP_REGISTRY_TOKEN }}
65
+ - name: Authenticate and publish to MCP Registry
66
+ run: |
67
+ mcp-publisher login token "$MCP_REGISTRY_TOKEN"
68
+ mcp-publisher publish
package/CHANGELOG.md CHANGED
@@ -7,6 +7,29 @@ This project uses [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ---
9
9
 
10
+ ## [1.1.2] – 2026-04-10
11
+
12
+ ### Fixed
13
+
14
+ - **`get_price_history` OHLCV open/close reversed**: Buda returns trades newest-first; entries
15
+ are now sorted ascending by timestamp before candle aggregation so `open` is the
16
+ chronologically first price and `close` is the chronologically last price in each bucket.
17
+ - **Cache double-fetch race condition**: `MemoryCache.getOrFetch` now deduplicates concurrent
18
+ requests for the same expired/missing key by storing the in-flight `Promise` and returning it
19
+ to all concurrent callers instead of spawning a second fetch.
20
+ - **`User-Agent` version string**: corrected from `buda-mcp/1.1.0` to `buda-mcp/1.1.1` (and now `1.1.2`).
21
+
22
+ ---
23
+
24
+ ## [1.1.1] – 2026-04-10
25
+
26
+ ### Fixed
27
+
28
+ - `server.json` version corrected to `1.1.1` (was stuck at `1.0.0`, breaking MCP Registry sync).
29
+ - npm package name corrected from `@gtorreal/buda-mcp` to `@guiie/buda-mcp` in README, marketplace files, and PUBLISH_CHECKLIST.md.
30
+
31
+ ---
32
+
10
33
  ## [1.1.0] – 2026-04-10
11
34
 
12
35
  ### Added
@@ -28,7 +28,7 @@ npm login # if not already logged in
28
28
  npm publish --access public --provenance
29
29
  ```
30
30
 
31
- Verify: https://www.npmjs.com/package/@gtorreal/buda-mcp
31
+ Verify: https://www.npmjs.com/package/@guiie/buda-mcp
32
32
 
33
33
  ---
34
34
 
@@ -78,7 +78,7 @@ Then create a GitHub Release from the tag with the following release notes:
78
78
  - Updated README with npx quickstart and per-tool examples
79
79
 
80
80
  ```bash
81
- npx @gtorreal/buda-mcp
81
+ npx @guiie/buda-mcp
82
82
  ```
83
83
  ```
84
84
 
@@ -105,7 +105,7 @@ MCP_REGISTRY_TOKEN=<token> ./mcp-publisher publish
105
105
 
106
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
107
 
108
- Verify: https://smithery.ai/server/@gtorreal/buda-mcp
108
+ Verify: https://smithery.ai/server/@guiie/buda-mcp
109
109
 
110
110
  ---
111
111
 
@@ -120,7 +120,7 @@ Subject: [Update] buda-mcp v1.1.0 — new tools + auth
120
120
 
121
121
  Hi mcp.so team,
122
122
 
123
- I've released v1.1.0 of buda-mcp (@gtorreal/buda-mcp on npm).
123
+ I've released v1.1.0 of buda-mcp (@guiie/buda-mcp on npm).
124
124
 
125
125
  Key changes:
126
126
  - 3 new public tools: get_spread, compare_markets, get_price_history (OHLCV)
@@ -130,11 +130,11 @@ Key changes:
130
130
  - Structured error responses
131
131
 
132
132
  Links:
133
- - npm: https://www.npmjs.com/package/@gtorreal/buda-mcp
133
+ - npm: https://www.npmjs.com/package/@guiie/buda-mcp
134
134
  - GitHub: https://github.com/gtorreal/buda-mcp
135
135
  - Changelog: https://github.com/gtorreal/buda-mcp/blob/main/CHANGELOG.md
136
136
 
137
- Quick start: npx @gtorreal/buda-mcp
137
+ Quick start: npx @guiie/buda-mcp
138
138
 
139
139
  Thank you!
140
140
  ```
@@ -154,7 +154,7 @@ Hi Glama team,
154
154
 
155
155
  buda-mcp has been updated to v1.1.0. Here's a summary of what's new:
156
156
 
157
- Package: @gtorreal/buda-mcp (npm)
157
+ Package: @guiie/buda-mcp (npm)
158
158
  Registry: io.github.gtorreal/buda-mcp (MCP Registry)
159
159
  Version: 1.1.0
160
160
 
@@ -170,7 +170,7 @@ New capabilities:
170
170
  - Structured error responses (isError: true)
171
171
 
172
172
  Quick start:
173
- npx @gtorreal/buda-mcp
173
+ npx @guiie/buda-mcp
174
174
 
175
175
  Changelog: https://github.com/gtorreal/buda-mcp/blob/main/CHANGELOG.md
176
176
  GitHub: https://github.com/gtorreal/buda-mcp
@@ -182,8 +182,8 @@ Thank you!
182
182
 
183
183
  ## 8. Post-publish verification
184
184
 
185
- - [ ] `npx @gtorreal/buda-mcp@1.1.0` starts successfully
186
- - [ ] `npm info @gtorreal/buda-mcp version` returns `1.1.0`
185
+ - [ ] `npx @guiie/buda-mcp@1.1.0` starts successfully
186
+ - [ ] `npm info @guiie/buda-mcp version` returns `1.1.0`
187
187
  - [ ] GitHub release tag `v1.1.0` is visible
188
188
  - [ ] MCP Registry entry reflects v1.1.0
189
189
  - [ ] Smithery server card lists 8 public tools
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # buda-mcp
2
2
 
3
- [![npm version](https://img.shields.io/npm/v/@gtorreal/buda-mcp)](https://www.npmjs.com/package/@gtorreal/buda-mcp)
3
+ [![npm version](https://img.shields.io/npm/v/@guiie/buda-mcp)](https://www.npmjs.com/package/@guiie/buda-mcp)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Node.js >=18](https://img.shields.io/badge/node-%3E%3D18-brightgreen)](https://nodejs.org/)
6
6
 
@@ -11,13 +11,13 @@ MCP server for [Buda.com](https://www.buda.com/) — the leading cryptocurrency
11
11
  ## Quick Start
12
12
 
13
13
  ```bash
14
- npx @gtorreal/buda-mcp
14
+ npx @guiie/buda-mcp
15
15
  ```
16
16
 
17
17
  Or install permanently:
18
18
 
19
19
  ```bash
20
- npm install -g @gtorreal/buda-mcp
20
+ npm install -g @guiie/buda-mcp
21
21
  buda-mcp
22
22
  ```
23
23
 
@@ -28,7 +28,7 @@ buda-mcp
28
28
  ### Claude Code
29
29
 
30
30
  ```bash
31
- claude mcp add buda-mcp -- npx -y @gtorreal/buda-mcp
31
+ claude mcp add buda-mcp -- npx -y @guiie/buda-mcp
32
32
  ```
33
33
 
34
34
  ### Claude Desktop (`claude_desktop_config.json`)
@@ -38,7 +38,7 @@ claude mcp add buda-mcp -- npx -y @gtorreal/buda-mcp
38
38
  "mcpServers": {
39
39
  "buda-mcp": {
40
40
  "command": "npx",
41
- "args": ["-y", "@gtorreal/buda-mcp"]
41
+ "args": ["-y", "@guiie/buda-mcp"]
42
42
  }
43
43
  }
44
44
  }
@@ -51,7 +51,7 @@ claude mcp add buda-mcp -- npx -y @gtorreal/buda-mcp
51
51
  "mcpServers": {
52
52
  "buda-mcp": {
53
53
  "command": "npx",
54
- "args": ["-y", "@gtorreal/buda-mcp"]
54
+ "args": ["-y", "@guiie/buda-mcp"]
55
55
  }
56
56
  }
57
57
  }
@@ -255,7 +255,7 @@ The server defaults to **public-only mode** — no API key needed, no breaking c
255
255
  To enable authenticated tools, set environment variables before running:
256
256
 
257
257
  ```bash
258
- BUDA_API_KEY=your_api_key BUDA_API_SECRET=your_api_secret npx @gtorreal/buda-mcp
258
+ BUDA_API_KEY=your_api_key BUDA_API_SECRET=your_api_secret npx @guiie/buda-mcp
259
259
  ```
260
260
 
261
261
  Or in Claude Desktop config:
@@ -265,7 +265,7 @@ Or in Claude Desktop config:
265
265
  "mcpServers": {
266
266
  "buda-mcp": {
267
267
  "command": "npx",
268
- "args": ["-y", "@gtorreal/buda-mcp"],
268
+ "args": ["-y", "@guiie/buda-mcp"],
269
269
  "env": {
270
270
  "BUDA_API_KEY": "your_api_key",
271
271
  "BUDA_API_SECRET": "your_api_secret"
package/dist/cache.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export declare class MemoryCache {
2
2
  private store;
3
+ private inflight;
3
4
  getOrFetch<T>(key: string, ttlMs: number, fetcher: () => Promise<T>): Promise<T>;
4
5
  invalidate(key: string): void;
5
6
  clear(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAKA,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAA0C;IAEjD,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAUtF,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI7B,KAAK,IAAI,IAAI;CAGd;AAED,eAAO,MAAM,SAAS;;;;CAIZ,CAAC;AAEX,eAAO,MAAM,KAAK,aAAoB,CAAC"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAKA,qBAAa,WAAW;IACtB,OAAO,CAAC,KAAK,CAA0C;IACvD,OAAO,CAAC,QAAQ,CAAuC;IAEjD,UAAU,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAyBtF,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAI7B,KAAK,IAAI,IAAI;CAGd;AAED,eAAO,MAAM,SAAS;;;;CAIZ,CAAC;AAEX,eAAO,MAAM,KAAK,aAAoB,CAAC"}
package/dist/cache.js CHANGED
@@ -1,13 +1,27 @@
1
1
  export class MemoryCache {
2
2
  store = new Map();
3
+ inflight = new Map();
3
4
  async getOrFetch(key, ttlMs, fetcher) {
4
5
  const entry = this.store.get(key);
5
6
  if (entry && Date.now() < entry.expiry) {
6
7
  return entry.data;
7
8
  }
8
- const data = await fetcher();
9
- this.store.set(key, { data, expiry: Date.now() + ttlMs });
10
- return data;
9
+ // Deduplicate concurrent requests for the same expired/missing key.
10
+ const pending = this.inflight.get(key);
11
+ if (pending)
12
+ return pending;
13
+ const promise = fetcher()
14
+ .then((data) => {
15
+ this.store.set(key, { data, expiry: Date.now() + ttlMs });
16
+ this.inflight.delete(key);
17
+ return data;
18
+ })
19
+ .catch((err) => {
20
+ this.inflight.delete(key);
21
+ throw err;
22
+ });
23
+ this.inflight.set(key, promise);
24
+ return promise;
11
25
  }
12
26
  invalidate(key) {
13
27
  this.store.delete(key);
package/dist/client.js CHANGED
@@ -55,7 +55,7 @@ export class BudaClient {
55
55
  const urlPath = url.pathname + url.search;
56
56
  const headers = {
57
57
  Accept: "application/json",
58
- "User-Agent": "buda-mcp/1.1.0",
58
+ "User-Agent": "buda-mcp/1.1.1",
59
59
  ...this.authHeaders("GET", urlPath),
60
60
  };
61
61
  const response = await fetch(url.toString(), { headers });
@@ -80,7 +80,7 @@ export class BudaClient {
80
80
  const headers = {
81
81
  Accept: "application/json",
82
82
  "Content-Type": "application/json",
83
- "User-Agent": "buda-mcp/1.1.0",
83
+ "User-Agent": "buda-mcp/1.1.1",
84
84
  ...this.authHeaders("POST", urlPath, bodyStr),
85
85
  };
86
86
  const response = await fetch(url.toString(), {
@@ -109,7 +109,7 @@ export class BudaClient {
109
109
  const headers = {
110
110
  Accept: "application/json",
111
111
  "Content-Type": "application/json",
112
- "User-Agent": "buda-mcp/1.1.0",
112
+ "User-Agent": "buda-mcp/1.1.1",
113
113
  ...this.authHeaders("PUT", urlPath, bodyStr),
114
114
  };
115
115
  const response = await fetch(url.toString(), {
package/dist/http.js CHANGED
@@ -19,7 +19,7 @@ const PORT = parseInt(process.env.PORT ?? "3000", 10);
19
19
  const client = new BudaClient(undefined, process.env.BUDA_API_KEY, process.env.BUDA_API_SECRET);
20
20
  const authEnabled = client.hasAuth();
21
21
  function createServer() {
22
- const server = new McpServer({ name: "buda-mcp", version: "1.1.0" });
22
+ const server = new McpServer({ name: "buda-mcp", version: "1.1.2" });
23
23
  // Per-request cache so caching works correctly for stateless HTTP
24
24
  const reqCache = new MemoryCache();
25
25
  markets.register(server, client, reqCache);
@@ -68,7 +68,7 @@ const app = express();
68
68
  app.use(express.json());
69
69
  // Health check for Railway / uptime monitors
70
70
  app.get("/health", (_req, res) => {
71
- res.json({ status: "ok", server: "buda-mcp", version: "1.1.0", auth_mode: authEnabled ? "authenticated" : "public" });
71
+ res.json({ status: "ok", server: "buda-mcp", version: "1.1.2", auth_mode: authEnabled ? "authenticated" : "public" });
72
72
  });
73
73
  // Smithery static server card — lets Smithery scan tools without running the server
74
74
  app.get("/.well-known/mcp/server-card.json", (_req, res) => {
@@ -216,7 +216,7 @@ app.get("/.well-known/mcp/server-card.json", (_req, res) => {
216
216
  ]
217
217
  : [];
218
218
  res.json({
219
- serverInfo: { name: "buda-mcp", version: "1.1.0" },
219
+ serverInfo: { name: "buda-mcp", version: "1.1.2" },
220
220
  authentication: { required: authEnabled },
221
221
  tools: [...publicTools, ...authTools],
222
222
  resources: [
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import * as cancelOrder from "./tools/cancel_order.js";
18
18
  const client = new BudaClient(undefined, process.env.BUDA_API_KEY, process.env.BUDA_API_SECRET);
19
19
  const server = new McpServer({
20
20
  name: "buda-mcp",
21
- version: "1.1.0",
21
+ version: "1.1.2",
22
22
  });
23
23
  // Public tools
24
24
  markets.register(server, client, cache);
@@ -1 +1 @@
1
- {"version":3,"file":"price_history.d.ts","sourceRoot":"","sources":["../../src/tools/price_history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAmB1C,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CAqGzF"}
1
+ {"version":3,"file":"price_history.d.ts","sourceRoot":"","sources":["../../src/tools/price_history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,UAAU,EAAgB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAmB1C,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,WAAW,GAAG,IAAI,CA2GzF"}
@@ -40,9 +40,12 @@ export function register(server, client, _cache) {
40
40
  ],
41
41
  };
42
42
  }
43
+ // Buda returns trades newest-first; sort ascending so open = first chronological price
44
+ // and close = last chronological price within each candle bucket.
45
+ const sortedEntries = [...entries].sort(([a], [b]) => parseInt(a, 10) - parseInt(b, 10));
43
46
  const periodMs = PERIOD_MS[period];
44
47
  const buckets = new Map();
45
- for (const [tsMs, amount, price, _direction] of entries) {
48
+ for (const [tsMs, amount, price, _direction] of sortedEntries) {
46
49
  const ts = parseInt(tsMs, 10);
47
50
  const bucketStart = Math.floor(ts / periodMs) * periodMs;
48
51
  const p = parseFloat(price);
@@ -3,7 +3,7 @@
3
3
  **Category:** Finance / Cryptocurrency
4
4
  **Auth:** Optional (public mode requires no key; authenticated mode needs `BUDA_API_KEY` + `BUDA_API_SECRET`)
5
5
  **Transport:** stdio
6
- **npm:** `@gtorreal/buda-mcp`
6
+ **npm:** `@guiie/buda-mcp`
7
7
  **Registry name:** `io.github.gtorreal/buda-mcp`
8
8
 
9
9
  ---
@@ -101,12 +101,12 @@ Cancel an open order by ID. Requires `confirmation_token="CONFIRM"`.
101
101
 
102
102
  **Quick start (npx)**
103
103
  ```bash
104
- npx @gtorreal/buda-mcp
104
+ npx @guiie/buda-mcp
105
105
  ```
106
106
 
107
107
  **Claude Code (claude CLI)**
108
108
  ```bash
109
- claude mcp add buda-mcp -- npx -y @gtorreal/buda-mcp
109
+ claude mcp add buda-mcp -- npx -y @guiie/buda-mcp
110
110
  ```
111
111
 
112
112
  **Claude Desktop (`claude_desktop_config.json`)**
@@ -115,7 +115,7 @@ claude mcp add buda-mcp -- npx -y @gtorreal/buda-mcp
115
115
  "mcpServers": {
116
116
  "buda-mcp": {
117
117
  "command": "npx",
118
- "args": ["-y", "@gtorreal/buda-mcp"]
118
+ "args": ["-y", "@guiie/buda-mcp"]
119
119
  }
120
120
  }
121
121
  }
@@ -127,7 +127,7 @@ claude mcp add buda-mcp -- npx -y @gtorreal/buda-mcp
127
127
  "mcpServers": {
128
128
  "buda-mcp": {
129
129
  "command": "npx",
130
- "args": ["-y", "@gtorreal/buda-mcp"],
130
+ "args": ["-y", "@guiie/buda-mcp"],
131
131
  "env": {
132
132
  "BUDA_API_KEY": "your_api_key",
133
133
  "BUDA_API_SECRET": "your_api_secret"
@@ -161,5 +161,5 @@ node dist/index.js
161
161
  ## Source
162
162
 
163
163
  - GitHub: https://github.com/gtorreal/buda-mcp
164
- - npm: https://www.npmjs.com/package/@gtorreal/buda-mcp
164
+ - npm: https://www.npmjs.com/package/@guiie/buda-mcp
165
165
  - Buda.com API docs: https://api.buda.com/en/
@@ -2,7 +2,7 @@
2
2
  "mcpServers": {
3
3
  "buda-mcp": {
4
4
  "command": "npx",
5
- "args": ["-y", "@gtorreal/buda-mcp"],
5
+ "args": ["-y", "@guiie/buda-mcp"],
6
6
  "description": "Buda.com cryptocurrency exchange — real-time market data, spreads, OHLCV history, and account tools for Chile, Colombia, and Peru"
7
7
  }
8
8
  }
@@ -9,7 +9,7 @@ info:
9
9
 
10
10
  **Note:** This spec describes a deployed HTTP wrapper around the buda-mcp
11
11
  stdio server. Deploy locally with mcp-proxy:
12
- mcp-proxy --port 8000 -- npx -y @gtorreal/buda-mcp
12
+ mcp-proxy --port 8000 -- npx -y @guiie/buda-mcp
13
13
  Or point `servers[0].url` at your hosted instance.
14
14
  version: 1.1.0
15
15
  contact:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guiie/buda-mcp",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "mcpName": "io.github.gtorreal/buda-mcp",
5
5
  "description": "MCP server for Buda.com's public cryptocurrency exchange API (Chile, Colombia, Peru)",
6
6
  "type": "module",
package/server.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
3
  "name": "io.github.gtorreal/buda-mcp",
4
- "description": "Buda.com market data: prices, order books, trades, and volume for crypto markets in CLP, COP, PEN.",
4
+ "description": "Buda.com market data: prices, spreads, OHLCV, order books, trades, and volume for CLP, COP, PEN.",
5
5
  "repository": {
6
6
  "url": "https://github.com/gtorreal/buda-mcp",
7
7
  "source": "github"
8
8
  },
9
- "version": "1.0.0",
9
+ "version": "1.1.2",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "@guiie/buda-mcp",
14
- "version": "1.0.0",
14
+ "version": "1.1.2",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  }
package/src/cache.ts CHANGED
@@ -5,15 +5,31 @@ interface CacheEntry<T> {
5
5
 
6
6
  export class MemoryCache {
7
7
  private store = new Map<string, CacheEntry<unknown>>();
8
+ private inflight = new Map<string, Promise<unknown>>();
8
9
 
9
10
  async getOrFetch<T>(key: string, ttlMs: number, fetcher: () => Promise<T>): Promise<T> {
10
11
  const entry = this.store.get(key) as CacheEntry<T> | undefined;
11
12
  if (entry && Date.now() < entry.expiry) {
12
13
  return entry.data;
13
14
  }
14
- const data = await fetcher();
15
- this.store.set(key, { data, expiry: Date.now() + ttlMs });
16
- return data;
15
+
16
+ // Deduplicate concurrent requests for the same expired/missing key.
17
+ const pending = this.inflight.get(key) as Promise<T> | undefined;
18
+ if (pending) return pending;
19
+
20
+ const promise = fetcher()
21
+ .then((data) => {
22
+ this.store.set(key, { data, expiry: Date.now() + ttlMs });
23
+ this.inflight.delete(key);
24
+ return data;
25
+ })
26
+ .catch((err: unknown) => {
27
+ this.inflight.delete(key);
28
+ throw err;
29
+ });
30
+
31
+ this.inflight.set(key, promise as Promise<unknown>);
32
+ return promise;
17
33
  }
18
34
 
19
35
  invalidate(key: string): void {
package/src/client.ts CHANGED
@@ -68,7 +68,7 @@ export class BudaClient {
68
68
  const urlPath = url.pathname + url.search;
69
69
  const headers: Record<string, string> = {
70
70
  Accept: "application/json",
71
- "User-Agent": "buda-mcp/1.1.0",
71
+ "User-Agent": "buda-mcp/1.1.1",
72
72
  ...this.authHeaders("GET", urlPath),
73
73
  };
74
74
 
@@ -95,7 +95,7 @@ export class BudaClient {
95
95
  const headers: Record<string, string> = {
96
96
  Accept: "application/json",
97
97
  "Content-Type": "application/json",
98
- "User-Agent": "buda-mcp/1.1.0",
98
+ "User-Agent": "buda-mcp/1.1.1",
99
99
  ...this.authHeaders("POST", urlPath, bodyStr),
100
100
  };
101
101
 
@@ -126,7 +126,7 @@ export class BudaClient {
126
126
  const headers: Record<string, string> = {
127
127
  Accept: "application/json",
128
128
  "Content-Type": "application/json",
129
- "User-Agent": "buda-mcp/1.1.0",
129
+ "User-Agent": "buda-mcp/1.1.1",
130
130
  ...this.authHeaders("PUT", urlPath, bodyStr),
131
131
  };
132
132
 
package/src/http.ts CHANGED
@@ -28,7 +28,7 @@ const client = new BudaClient(
28
28
  const authEnabled = client.hasAuth();
29
29
 
30
30
  function createServer(): McpServer {
31
- const server = new McpServer({ name: "buda-mcp", version: "1.1.0" });
31
+ const server = new McpServer({ name: "buda-mcp", version: "1.1.2" });
32
32
 
33
33
  // Per-request cache so caching works correctly for stateless HTTP
34
34
  const reqCache = new MemoryCache();
@@ -101,7 +101,7 @@ app.use(express.json());
101
101
 
102
102
  // Health check for Railway / uptime monitors
103
103
  app.get("/health", (_req, res) => {
104
- res.json({ status: "ok", server: "buda-mcp", version: "1.1.0", auth_mode: authEnabled ? "authenticated" : "public" });
104
+ res.json({ status: "ok", server: "buda-mcp", version: "1.1.2", auth_mode: authEnabled ? "authenticated" : "public" });
105
105
  });
106
106
 
107
107
  // Smithery static server card — lets Smithery scan tools without running the server
@@ -252,7 +252,7 @@ app.get("/.well-known/mcp/server-card.json", (_req, res) => {
252
252
  : [];
253
253
 
254
254
  res.json({
255
- serverInfo: { name: "buda-mcp", version: "1.1.0" },
255
+ serverInfo: { name: "buda-mcp", version: "1.1.2" },
256
256
  authentication: { required: authEnabled },
257
257
  tools: [...publicTools, ...authTools],
258
258
  resources: [
package/src/index.ts CHANGED
@@ -25,7 +25,7 @@ const client = new BudaClient(
25
25
 
26
26
  const server = new McpServer({
27
27
  name: "buda-mcp",
28
- version: "1.1.0",
28
+ version: "1.1.2",
29
29
  });
30
30
 
31
31
  // Public tools
@@ -65,10 +65,16 @@ export function register(server: McpServer, client: BudaClient, _cache: MemoryCa
65
65
  };
66
66
  }
67
67
 
68
+ // Buda returns trades newest-first; sort ascending so open = first chronological price
69
+ // and close = last chronological price within each candle bucket.
70
+ const sortedEntries = [...entries].sort(
71
+ ([a], [b]) => parseInt(a, 10) - parseInt(b, 10),
72
+ );
73
+
68
74
  const periodMs = PERIOD_MS[period];
69
75
  const buckets = new Map<number, OhlcvCandle>();
70
76
 
71
- for (const [tsMs, amount, price, _direction] of entries) {
77
+ for (const [tsMs, amount, price, _direction] of sortedEntries) {
72
78
  const ts = parseInt(tsMs, 10);
73
79
  const bucketStart = Math.floor(ts / periodMs) * periodMs;
74
80
  const p = parseFloat(price);