brightspace-mcp-server 5.0.13 → 5.1.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.
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Purdue Brightspace MCP Server
3
+ * Copyright (c) 2026 Rohan Muppa. All rights reserved.
4
+ * Licensed under MIT — see LICENSE file for details.
5
+ *
6
+ * A diagnostic category for a failed tool call, chosen from a closed set this
7
+ * package controls. Derived from the error's type and status only, never from
8
+ * its message, so the dev activity log can say why a call failed without
9
+ * recording paths, URLs, arguments, or content.
10
+ */
11
+ import { ZodError } from "zod";
12
+ import { ApiError, NetworkError } from "../api/errors.js";
13
+ import { AuthProcessError } from "../auth/auth-runner.js";
14
+ import { DownloadError } from "./download-errors.js";
15
+ export const ERROR_KINDS = ["invalidInput", "destination", "notFound", "permission", "auth", "rateLimited", "http",
16
+ "transport", "providerBlocked", "unsupportedFormat", "rejectedFile", "unknown"];
17
+ const API_STATUS_KINDS = {
18
+ 401: "auth", 403: "permission", 404: "notFound", 429: "rateLimited",
19
+ };
20
+ export function errorKind(error) {
21
+ if (error instanceof ZodError)
22
+ return "invalidInput";
23
+ if (error instanceof AuthProcessError)
24
+ return "auth";
25
+ if (error instanceof ApiError)
26
+ return API_STATUS_KINDS[error.status] ?? "http";
27
+ if (error instanceof NetworkError)
28
+ return "transport";
29
+ if (error instanceof DownloadError) {
30
+ return error.kind === "unsupportedType" || error.kind === "undetectableType" ? "unsupportedFormat" : "rejectedFile";
31
+ }
32
+ return "unknown";
33
+ }
34
+ const resultKinds = new WeakMap();
35
+ /** Remembers which error a returned tool result describes. */
36
+ export function withErrorKind(result, error) {
37
+ return tagErrorKind(result, errorKind(error));
38
+ }
39
+ /** Records the category of an error result a tool built itself. */
40
+ export function tagErrorKind(result, kind) {
41
+ resultKinds.set(result, kind);
42
+ return result;
43
+ }
44
+ /** The category of a returned error result; "unknown" when no error was attached. */
45
+ export function resultErrorKind(result) {
46
+ return (typeof result === "object" && result !== null && resultKinds.get(result)) || "unknown";
47
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Purdue Brightspace MCP Server
3
+ * Copyright (c) 2026 Rohan Muppa. All rights reserved.
4
+ * Licensed under MIT — see LICENSE file for details.
5
+ */
6
+ import { log } from "./logger.js";
7
+ /** How long a phase may run before one "still waiting" warning is logged. */
8
+ const SLOW_PHASE_MS = 10_000;
9
+ /**
10
+ * Run one startup step with timestamped stderr lines around it: one before
11
+ * the work starts, one with its duration when it ends, and a single warning
12
+ * if it is still running after SLOW_PHASE_MS. A client whose initialize
13
+ * request times out can then see which step the server was stuck in.
14
+ *
15
+ * The phase name is printed verbatim, so it must never carry a username,
16
+ * URL, or any other account detail.
17
+ */
18
+ export async function startupPhase(name, work) {
19
+ log("INFO", `Startup: ${name}...`);
20
+ const started = Date.now();
21
+ const slow = setTimeout(() => {
22
+ log("WARN", `Startup: still ${name} after ${SLOW_PHASE_MS / 1000} s`);
23
+ }, SLOW_PHASE_MS);
24
+ slow.unref?.();
25
+ try {
26
+ const result = await work();
27
+ log("INFO", `Startup: ${name} done in ${Date.now() - started} ms`);
28
+ return result;
29
+ }
30
+ catch (error) {
31
+ log("WARN", `Startup: ${name} failed after ${Date.now() - started} ms`);
32
+ throw error;
33
+ }
34
+ finally {
35
+ clearTimeout(slow);
36
+ }
37
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brightspace-mcp-server",
3
- "version": "5.0.13",
3
+ "version": "5.1.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",