brightspace-mcp-server 5.1.13 → 5.1.14

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.
@@ -102,13 +102,11 @@ export async function loadConfig({ credentials = true } = {}) {
102
102
  ?? positiveSeconds(store?.tokenTtl, "tokenTtl in config.json")
103
103
  ?? 3600;
104
104
  // Resolve includeCourseIds: env > store > undefined
105
- const includeCourseIds = process.env.D2L_INCLUDE_COURSES
106
- ? process.env.D2L_INCLUDE_COURSES.split(',').map(s => parseInt(s.trim(), 10)).filter(n => !isNaN(n))
107
- : store?.includeCourses;
105
+ const includeCourseIds = courseIdList(process.env.D2L_INCLUDE_COURSES, "D2L_INCLUDE_COURSES")
106
+ ?? store?.includeCourses;
108
107
  // Resolve excludeCourseIds: env > store > undefined
109
- const excludeCourseIds = process.env.D2L_EXCLUDE_COURSES
110
- ? process.env.D2L_EXCLUDE_COURSES.split(',').map(s => parseInt(s.trim(), 10)).filter(n => !isNaN(n))
111
- : store?.excludeCourses;
108
+ const excludeCourseIds = courseIdList(process.env.D2L_EXCLUDE_COURSES, "D2L_EXCLUDE_COURSES")
109
+ ?? store?.excludeCourses;
112
110
  // Resolve activeOnly: env > store > default (true)
113
111
  const activeOnly = envBoolean(process.env.D2L_ACTIVE_ONLY, "D2L_ACTIVE_ONLY")
114
112
  ?? store?.activeOnly
@@ -195,6 +193,30 @@ function positiveSeconds(value, source) {
195
193
  console.error(`[config] Ignoring ${source}=${JSON.stringify(value)}: expected a positive whole number of seconds`);
196
194
  return undefined;
197
195
  }
196
+ /**
197
+ * A comma-separated list of course (org unit) ids. parseInt read "123x" as
198
+ * 123 and dropped "CS180" without a word, so a whitelist of course codes
199
+ * became empty and an empty whitelist filters nothing: every course showed.
200
+ * Each entry must be a positive whole number or it is ignored with a warning,
201
+ * and a list with no valid id is ignored outright so config.json applies, as
202
+ * positiveSeconds does. Empty entries from a stray comma are skipped quietly.
203
+ */
204
+ function courseIdList(value, source) {
205
+ const entries = (value ?? "").split(",").map((entry) => entry.trim()).filter((entry) => entry.length > 0);
206
+ if (entries.length === 0)
207
+ return undefined;
208
+ const ids = [];
209
+ for (const entry of entries) {
210
+ if (/^\d+$/.test(entry) && Number(entry) > 0)
211
+ ids.push(Number(entry));
212
+ else
213
+ console.error(`[config] Ignoring ${JSON.stringify(entry)} in ${source}: expected a numeric course id`);
214
+ }
215
+ if (ids.length > 0)
216
+ return ids;
217
+ console.error(`[config] Ignoring ${source}=${JSON.stringify(value)}: no valid course id`);
218
+ return undefined;
219
+ }
198
220
  /**
199
221
  * An on/off environment variable. Comparing against the exact string "false"
200
222
  * read "0", "no", "False" and a typo as true, so D2L_HEADLESS=0 kept the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brightspace-mcp-server",
3
- "version": "5.1.13",
3
+ "version": "5.1.14",
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",