@guiie/buda-mcp 1.1.1 → 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.
- package/.github/workflows/publish.yml +15 -5
- package/CHANGELOG.md +14 -0
- package/dist/cache.d.ts +1 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +17 -3
- package/dist/client.js +3 -3
- package/dist/http.js +3 -3
- package/dist/index.js +1 -1
- package/dist/tools/price_history.d.ts.map +1 -1
- package/dist/tools/price_history.js +4 -1
- package/package.json +1 -1
- package/server.json +2 -2
- package/src/cache.ts +19 -3
- package/src/client.ts +3 -3
- package/src/http.ts +3 -3
- package/src/index.ts +1 -1
- package/src/tools/price_history.ts +7 -1
|
@@ -36,7 +36,15 @@ jobs:
|
|
|
36
36
|
cache: "npm"
|
|
37
37
|
- run: npm ci
|
|
38
38
|
- run: npm run build
|
|
39
|
-
-
|
|
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:
|
|
56
|
-
run:
|
|
57
|
-
|
|
58
|
-
|
|
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,20 @@ 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
|
+
|
|
10
24
|
## [1.1.1] – 2026-04-10
|
|
11
25
|
|
|
12
26
|
### Fixed
|
package/dist/cache.d.ts
CHANGED
package/dist/cache.d.ts.map
CHANGED
|
@@ -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;
|
|
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
|
-
|
|
9
|
-
this.
|
|
10
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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,
|
|
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
|
|
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);
|
package/package.json
CHANGED
package/server.json
CHANGED
|
@@ -6,12 +6,12 @@
|
|
|
6
6
|
"url": "https://github.com/gtorreal/buda-mcp",
|
|
7
7
|
"source": "github"
|
|
8
8
|
},
|
|
9
|
-
"version": "1.1.
|
|
9
|
+
"version": "1.1.2",
|
|
10
10
|
"packages": [
|
|
11
11
|
{
|
|
12
12
|
"registryType": "npm",
|
|
13
13
|
"identifier": "@guiie/buda-mcp",
|
|
14
|
-
"version": "1.1.
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|
@@ -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
|
|
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);
|