brightspace-mcp-server 5.0.1 → 5.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.
@@ -99,6 +99,10 @@ export function readLtiLaunchPage(html, origin) {
99
99
  const consumerKey = inputs.find(input => input.get("name") === "oauth_consumer_key")?.get("value");
100
100
  const candidates = [
101
101
  ...tagAttributes(html, "form").map(form => form.get("action")),
102
+ // Brightspace's own quickLink page renders the tool as a web component
103
+ // whose lti-launch-url is the tool launch (/d2l/le/lti/…/toolLaunch/…),
104
+ // not a form or an iframe.
105
+ ...tagAttributes(html, "d2l-lti-launch").map(element => element.get("lti-launch-url")),
102
106
  ...tagAttributes(html, "iframe").map(frame => frame.get("src")),
103
107
  ...inputs.map(input => input.get("value")),
104
108
  ].filter((candidate) => Boolean(candidate));
@@ -62,6 +62,16 @@ export function detectVideoPlatform(url) {
62
62
  return "kaltura";
63
63
  return "unknown";
64
64
  }
65
+ /**
66
+ * Kaltura's hosted KAF front ends are named after the school's partner ID:
67
+ * `983291-6.kaf.kaltura.com` is partner 983291 (instance 6). An LTI 1.3
68
+ * launch's target_link_uri points there with only the entry ID in the path,
69
+ * so the host is the one place the partner ID appears.
70
+ */
71
+ function kafHostPartnerId(hostname) {
72
+ const match = /^(\d+)(?:-\d+)?\.kaf\.kaltura\.com$/i.exec(hostname);
73
+ return match ? match[1] : null;
74
+ }
65
75
  /** Kaltura embeds carry the entry and partner ID as query params or path segments; naming varies by embed generator. */
66
76
  export function extractKalturaIds(url) {
67
77
  let parsed;
@@ -85,7 +95,7 @@ export function extractKalturaIds(url) {
85
95
  params.get("pid") ??
86
96
  pathSegmentParam(pathname, "wid") ??
87
97
  pathSegmentParam(pathname, "partner_id");
88
- const partnerId = widParam ? widParam.replace(/^_/, "") : null;
98
+ const partnerId = widParam ? widParam.replace(/^_/, "") : kafHostPartnerId(parsed.hostname);
89
99
  if (!entryId || !partnerId)
90
100
  return null;
91
101
  return { partnerId, entryId };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brightspace-mcp-server",
3
- "version": "5.0.1",
3
+ "version": "5.0.2",
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",