brightspace-mcp-server 3.7.5 → 3.7.6
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 +24 -7
- package/package.json +1 -1
package/build/utils/config.js
CHANGED
|
@@ -26,9 +26,9 @@ export async function loadConfig() {
|
|
|
26
26
|
? expandTilde(store.sessionDir)
|
|
27
27
|
: path.join(os.homedir(), ".d2l-session");
|
|
28
28
|
// Code-entry and other interactive MFA methods need a visible browser.
|
|
29
|
-
const headless = process.env.D2L_HEADLESS
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const headless = envBoolean(process.env.D2L_HEADLESS, "D2L_HEADLESS")
|
|
30
|
+
?? store?.headless
|
|
31
|
+
?? true;
|
|
32
32
|
// Resolve tokenTtl: env > store > default (3600)
|
|
33
33
|
const tokenTtl = positiveSeconds(process.env.D2L_TOKEN_TTL, "D2L_TOKEN_TTL")
|
|
34
34
|
?? positiveSeconds(store?.tokenTtl, "tokenTtl in config.json")
|
|
@@ -42,10 +42,9 @@ export async function loadConfig() {
|
|
|
42
42
|
? process.env.D2L_EXCLUDE_COURSES.split(',').map(s => parseInt(s.trim(), 10)).filter(n => !isNaN(n))
|
|
43
43
|
: store?.excludeCourses;
|
|
44
44
|
// Resolve activeOnly: env > store > default (true)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
45
|
+
const activeOnly = envBoolean(process.env.D2L_ACTIVE_ONLY, "D2L_ACTIVE_ONLY")
|
|
46
|
+
?? store?.activeOnly
|
|
47
|
+
?? true;
|
|
49
48
|
const configuredUrl = new URL(process.env.D2L_BASE_URL || store?.baseUrl || "https://purdue.brightspace.com");
|
|
50
49
|
if (configuredUrl.protocol !== "https:" || configuredUrl.username || configuredUrl.password) {
|
|
51
50
|
throw new Error("The Brightspace URL must be an HTTPS school URL without embedded credentials.");
|
|
@@ -93,6 +92,24 @@ function positiveSeconds(value, source) {
|
|
|
93
92
|
console.error(`[config] Ignoring ${source}=${JSON.stringify(value)}: expected a positive whole number of seconds`);
|
|
94
93
|
return undefined;
|
|
95
94
|
}
|
|
95
|
+
/**
|
|
96
|
+
* An on/off environment variable. Comparing against the exact string "false"
|
|
97
|
+
* read "0", "no", "False" and a typo as true, so D2L_HEADLESS=0 kept the
|
|
98
|
+
* browser hidden from a user who needed it to enter an MFA code. An empty
|
|
99
|
+
* value counts as unset, and anything unrecognized is ignored with a warning
|
|
100
|
+
* so config.json or the default applies, as positiveSeconds does.
|
|
101
|
+
*/
|
|
102
|
+
function envBoolean(value, source) {
|
|
103
|
+
const text = value?.trim().toLowerCase();
|
|
104
|
+
if (!text)
|
|
105
|
+
return undefined;
|
|
106
|
+
if (["true", "1", "yes", "on"].includes(text))
|
|
107
|
+
return true;
|
|
108
|
+
if (["false", "0", "no", "off"].includes(text))
|
|
109
|
+
return false;
|
|
110
|
+
console.error(`[config] Ignoring ${source}=${JSON.stringify(value)}: expected true or false`);
|
|
111
|
+
return undefined;
|
|
112
|
+
}
|
|
96
113
|
function expandTilde(filePath) {
|
|
97
114
|
if (filePath.startsWith("~")) {
|
|
98
115
|
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.6",
|
|
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",
|