brightspace-mcp-server 3.7.3 → 3.7.4
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/build/utils/config.js +17 -3
- package/package.json +1 -1
package/build/utils/config.js
CHANGED
|
@@ -30,9 +30,9 @@ export async function loadConfig() {
|
|
|
30
30
|
? process.env.D2L_HEADLESS !== "false"
|
|
31
31
|
: store?.headless ?? true;
|
|
32
32
|
// Resolve tokenTtl: env > store > default (3600)
|
|
33
|
-
const tokenTtl = process.env.D2L_TOKEN_TTL
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const tokenTtl = positiveSeconds(process.env.D2L_TOKEN_TTL, "D2L_TOKEN_TTL")
|
|
34
|
+
?? positiveSeconds(store?.tokenTtl, "tokenTtl in config.json")
|
|
35
|
+
?? 3600;
|
|
36
36
|
// Resolve includeCourseIds: env > store > undefined
|
|
37
37
|
const includeCourseIds = process.env.D2L_INCLUDE_COURSES
|
|
38
38
|
? process.env.D2L_INCLUDE_COURSES.split(',').map(s => parseInt(s.trim(), 10)).filter(n => !isNaN(n))
|
|
@@ -79,6 +79,20 @@ export function accountSessionDirectory(root, baseUrl, username) {
|
|
|
79
79
|
const account = createHash("sha256").update(JSON.stringify([new URL(baseUrl).origin, username])).digest("hex");
|
|
80
80
|
return path.join(root, "accounts", account);
|
|
81
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* A token lifetime must be a whole, positive number of seconds. NaN, zero, a
|
|
84
|
+
* negative number, or "1h" read as 1 second would all produce a token that is
|
|
85
|
+
* already inside the refresh buffer, so every tool call would mint again.
|
|
86
|
+
*/
|
|
87
|
+
function positiveSeconds(value, source) {
|
|
88
|
+
if (value === undefined || value === "")
|
|
89
|
+
return undefined;
|
|
90
|
+
const text = String(value).trim();
|
|
91
|
+
if (/^\d+$/.test(text) && Number(text) > 0)
|
|
92
|
+
return Number(text);
|
|
93
|
+
console.error(`[config] Ignoring ${source}=${JSON.stringify(value)}: expected a positive whole number of seconds`);
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
82
96
|
function expandTilde(filePath) {
|
|
83
97
|
if (filePath.startsWith("~")) {
|
|
84
98
|
return path.join(os.homedir(), filePath.slice(1));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brightspace-mcp-server",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.4",
|
|
4
4
|
"mcpName": "io.github.rohanmuppa/brightspace",
|
|
5
5
|
"description": "MCP server for Brightspace (D2L). Check grades, due dates, assignments, announcements, syllabus, rosters and more via Claude, ChatGPT, Cursor, Windsurf, or any MCP client.",
|
|
6
6
|
"type": "module",
|