younium-mcp 1.0.0 → 1.0.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/dist/auth.js +8 -13
- package/dist/spec-loader.js +6 -2
- package/package.json +1 -1
package/dist/auth.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getToken = getToken;
|
|
4
|
-
const TOKEN_URL = "https://
|
|
5
|
-
const REFRESH_BUFFER_SECS =
|
|
4
|
+
const TOKEN_URL = "https://api.younium.com/auth/token";
|
|
5
|
+
const REFRESH_BUFFER_SECS = 300;
|
|
6
6
|
let cached = null;
|
|
7
7
|
function getEnv(name) {
|
|
8
8
|
const val = process.env[name];
|
|
@@ -15,24 +15,19 @@ async function getToken() {
|
|
|
15
15
|
if (cached && cached.expiresAt > now + REFRESH_BUFFER_SECS) {
|
|
16
16
|
return cached.value;
|
|
17
17
|
}
|
|
18
|
-
const body = new URLSearchParams({
|
|
19
|
-
grant_type: "password",
|
|
20
|
-
scope: "youniumapi",
|
|
21
|
-
username: getEnv("YOUNIUM_USERNAME"),
|
|
22
|
-
password: getEnv("YOUNIUM_PASSWORD"),
|
|
23
|
-
client_id: getEnv("YOUNIUM_CLIENT_ID"),
|
|
24
|
-
client_secret: getEnv("YOUNIUM_CLIENT_SECRET"),
|
|
25
|
-
});
|
|
26
18
|
const res = await fetch(TOKEN_URL, {
|
|
27
19
|
method: "POST",
|
|
28
|
-
headers: { "Content-Type": "application/
|
|
29
|
-
body:
|
|
20
|
+
headers: { "Content-Type": "application/json" },
|
|
21
|
+
body: JSON.stringify({
|
|
22
|
+
clientId: getEnv("YOUNIUM_CLIENT_ID"),
|
|
23
|
+
secret: getEnv("YOUNIUM_SECRET"),
|
|
24
|
+
}),
|
|
30
25
|
});
|
|
31
26
|
if (!res.ok) {
|
|
32
27
|
const text = await res.text();
|
|
33
28
|
throw new Error(`Younium auth failed (${res.status}): ${text}`);
|
|
34
29
|
}
|
|
35
30
|
const data = (await res.json());
|
|
36
|
-
cached = { value: data.
|
|
31
|
+
cached = { value: data.accessToken, expiresAt: now + data.expiresIn };
|
|
37
32
|
return cached.value;
|
|
38
33
|
}
|
package/dist/spec-loader.js
CHANGED
|
@@ -131,9 +131,13 @@ function loadTools() {
|
|
|
131
131
|
continue;
|
|
132
132
|
const rawId = op.operationId ?? `${method}_${pathTemplate.replace(/[^a-zA-Z0-9]/g, "_")}`;
|
|
133
133
|
let name = operationIdToName(rawId);
|
|
134
|
-
//
|
|
134
|
+
// Enforce 64-char limit then deduplicate
|
|
135
|
+
if (name.length > 64) {
|
|
136
|
+
name = name.slice(0, 64).replace(/_+$/, "");
|
|
137
|
+
}
|
|
135
138
|
if (seen.has(name)) {
|
|
136
|
-
|
|
139
|
+
const suffix = `_${method}`;
|
|
140
|
+
name = name.slice(0, 64 - suffix.length).replace(/_+$/, "") + suffix;
|
|
137
141
|
}
|
|
138
142
|
seen.add(name);
|
|
139
143
|
const description = [op.summary, op.description]
|