@pmaxis/mcp-server 1.0.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.
- package/dist/client.js +29 -0
- package/dist/index.js +21530 -0
- package/dist/tools/market.js +74 -0
- package/dist/tools/markets.js +54 -0
- package/dist/tools/platform.js +23 -0
- package/dist/tools/taxonomy.js +40 -0
- package/dist/tools/wallets.js +37 -0
- package/package.json +33 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pmaxisGet = pmaxisGet;
|
|
4
|
+
exports.toText = toText;
|
|
5
|
+
const BASE_URL = process.env.PMAXIS_API_URL ?? "https://api.pmaxis.trade";
|
|
6
|
+
const API_KEY = process.env.PMAXIS_API_KEY ?? "";
|
|
7
|
+
async function pmaxisGet(path, params) {
|
|
8
|
+
if (!API_KEY) {
|
|
9
|
+
throw new Error("PMAXIS_API_KEY environment variable is not set");
|
|
10
|
+
}
|
|
11
|
+
const url = new URL(`${BASE_URL}/v1${path}`);
|
|
12
|
+
if (params) {
|
|
13
|
+
for (const [k, v] of Object.entries(params)) {
|
|
14
|
+
if (v !== undefined)
|
|
15
|
+
url.searchParams.set(k, String(v));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const res = await fetch(url.toString(), {
|
|
19
|
+
headers: { "X-API-Key": API_KEY },
|
|
20
|
+
});
|
|
21
|
+
if (!res.ok) {
|
|
22
|
+
const body = await res.text();
|
|
23
|
+
throw new Error(`PMAxis API error ${res.status}: ${body}`);
|
|
24
|
+
}
|
|
25
|
+
return res.json();
|
|
26
|
+
}
|
|
27
|
+
function toText(data) {
|
|
28
|
+
return JSON.stringify(data, null, 2);
|
|
29
|
+
}
|