brightspace-mcp-server 5.0.7 → 5.0.8
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/README.md +1 -0
- package/build/index.js +1 -1
- package/build/update.js +5 -0
- package/build/utils/update-checker.js +42 -11
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,6 +136,7 @@ Things that change:
|
|
|
136
136
|
- **Settings go to the server, not to Codex.** A URL entry has no process to pass an `env` table to, so `D2L_*` settings (the [table above](#settings-you-might-want)) are set in the terminal that runs `http`, in a `.env` file in the directory you start it from, or saved by `setup`.
|
|
137
137
|
- **Sign-in messages show up in the server's terminal.** The number to approve still comes back in the chat's answer, and, in clients that show tool progress, while the question is running.
|
|
138
138
|
- **Stopping it:** press Ctrl+C. Questions already running finish first; press Ctrl+C again to stop at once.
|
|
139
|
+
- **Updating it:** restart the server, not Codex. Restarting a client only reconnects it to the server that is already running the old version. Stop the server and start the same `http` command again with the same `D2L_HTTP_TOKEN`, port, and settings; from a source checkout, run `npm run update` first. Update notices from a shared server say this too.
|
|
139
140
|
|
|
140
141
|
Any other MCP client that can connect to a Streamable HTTP URL with a bearer token can share the same server. To go back to one copy per chat, put the `command`/`args` entry back (rerunning `setup` does it) and stop the shared server.
|
|
141
142
|
|
package/build/index.js
CHANGED
|
@@ -75,7 +75,7 @@ else {
|
|
|
75
75
|
// Check for updates now, then every few hours. A stdio server can stay
|
|
76
76
|
// alive for days, so a boot-only check would never see a release. The
|
|
77
77
|
// interval is unref'd and cannot hold the process open.
|
|
78
|
-
startUpdateChecks();
|
|
78
|
+
startUpdateChecks({ transport: http ? "http" : "stdio" });
|
|
79
79
|
// Log active course filter config if any filter is set
|
|
80
80
|
if (config.courseFilter.includeCourseIds || config.courseFilter.excludeCourseIds || !config.courseFilter.activeOnly) {
|
|
81
81
|
log("DEBUG", "Course filter config", {
|
package/build/update.js
CHANGED
|
@@ -312,6 +312,11 @@ export function main() {
|
|
|
312
312
|
}
|
|
313
313
|
console.log("");
|
|
314
314
|
console.log(" Restart your MCP client to use the latest version.");
|
|
315
|
+
console.log(" If you run the shared HTTP server, restart the server instead: a client restart only");
|
|
316
|
+
console.log(" reconnects to the old process. Stop it, start node build/index.js http again with the");
|
|
317
|
+
console.log(" same D2L_HTTP_TOKEN, port, and D2L_* settings, and reconnect any client that does not.");
|
|
318
|
+
console.log(dim(" A chat already connected over stdio keeps its own copy and cannot move onto the shared"));
|
|
319
|
+
console.log(dim(" server mid-session; restart its client to load the new build."));
|
|
315
320
|
console.log("");
|
|
316
321
|
}
|
|
317
322
|
// `npm run update` runs this file directly. VITEST is set only by the test
|
|
@@ -20,7 +20,11 @@
|
|
|
20
20
|
*
|
|
21
21
|
* A source checkout gets different advice: installing the npm package would
|
|
22
22
|
* update some other copy, and for a fork it would mean leaving its changes
|
|
23
|
-
* behind. Such a checkout is told to
|
|
23
|
+
* behind. Such a checkout is told to run its own updater, or to opt out.
|
|
24
|
+
*
|
|
25
|
+
* What to restart depends on the transport: a stdio server dies with its
|
|
26
|
+
* client, but the shared HTTP server outlives every client and must itself be
|
|
27
|
+
* restarted.
|
|
24
28
|
*
|
|
25
29
|
* Set D2L_NO_UPDATE_CHECK to any value to switch the check off entirely.
|
|
26
30
|
*/
|
|
@@ -162,13 +166,37 @@ export async function fetchLatestVersion(fetchImpl = fetch) {
|
|
|
162
166
|
return null;
|
|
163
167
|
}
|
|
164
168
|
}
|
|
169
|
+
/** The command that starts the shared HTTP server from each kind of install. */
|
|
170
|
+
const HTTP_START_COMMAND = {
|
|
171
|
+
"npx-cache": `npx -y ${PACKAGE_NAME}@latest http`,
|
|
172
|
+
"npm-install": `${PACKAGE_NAME} http`,
|
|
173
|
+
"source-checkout": "node build/index.js http",
|
|
174
|
+
};
|
|
175
|
+
/**
|
|
176
|
+
* What to restart so the new version actually runs. A stdio server lives as
|
|
177
|
+
* long as its client, so restarting the client is enough. The shared HTTP
|
|
178
|
+
* server outlives every client: restarting one only reconnects it to the same
|
|
179
|
+
* old process, so the server itself has to be restarted, with the token and
|
|
180
|
+
* port its clients already use.
|
|
181
|
+
*/
|
|
182
|
+
function reloadStep(installKind, transport, to, afterAStep) {
|
|
183
|
+
// "Then" only follows an update step; an npx install with no stale cache to
|
|
184
|
+
// clear has none, so the restart is the first thing to do.
|
|
185
|
+
const restart = afterAStep ? "Then restart" : "Restart";
|
|
186
|
+
if (transport === "stdio")
|
|
187
|
+
return `${restart} your MCP client to pick up v${to}.`;
|
|
188
|
+
return `${restart} the shared HTTP server to pick up v${to}: restarting an MCP client only reconnects it ` +
|
|
189
|
+
`to this running server. Stop it (Ctrl+C where it runs, or stop its service), then start it again with ` +
|
|
190
|
+
`${HTTP_START_COMMAND[installKind]}, using the same D2L_HTTP_TOKEN, port, and D2L_* settings, ` +
|
|
191
|
+
`and reconnect any client that does not reconnect on its own.`;
|
|
192
|
+
}
|
|
165
193
|
/**
|
|
166
194
|
* Run one update check. Never throws and never blocks the caller for long:
|
|
167
195
|
* the registry request is bounded by a timeout and every failure is
|
|
168
196
|
* swallowed, because a version check must not affect the server.
|
|
169
197
|
*/
|
|
170
198
|
export async function initUpdateChecker(deps = {}) {
|
|
171
|
-
const { fetchImpl = fetch, env = process.env, installedVersion = getInstalledVersion(), installKind = installKindOf(), clearCaches = () => clearAllNpxCaches(), } = deps;
|
|
199
|
+
const { fetchImpl = fetch, env = process.env, installedVersion = getInstalledVersion(), installKind = installKindOf(), clearCaches = () => clearAllNpxCaches(), transport = "stdio", } = deps;
|
|
172
200
|
if (env.D2L_NO_UPDATE_CHECK)
|
|
173
201
|
return;
|
|
174
202
|
try {
|
|
@@ -180,24 +208,27 @@ export async function initUpdateChecker(deps = {}) {
|
|
|
180
208
|
const from = safeVersionLabel(installedVersion);
|
|
181
209
|
const to = safeVersionLabel(latest);
|
|
182
210
|
const headline = `Update available: v${from} to v${to}.`;
|
|
183
|
-
let
|
|
211
|
+
let update;
|
|
184
212
|
if (installKind === "npx-cache") {
|
|
185
213
|
const count = await clearCaches();
|
|
186
|
-
|
|
214
|
+
update = count > 0
|
|
187
215
|
? `Cleared ${count} stale npx cache director${count === 1 ? "y" : "ies"} for ${PACKAGE_NAME} ` +
|
|
188
|
-
`(kept the one this server is running from)
|
|
216
|
+
`(kept the one this server is running from).`
|
|
189
217
|
: "";
|
|
190
|
-
text = `${headline} ${cleanup}Restart your MCP client to pick up v${to}.`;
|
|
191
218
|
}
|
|
192
219
|
else if (installKind === "source-checkout") {
|
|
193
|
-
|
|
194
|
-
`(
|
|
195
|
-
`If it is a fork you maintain, set D2L_NO_UPDATE_CHECK=1 to turn off upstream update notices.`;
|
|
220
|
+
update = `This server runs from a source checkout, so update that checkout with npm run update ` +
|
|
221
|
+
`(it pulls, installs dependencies, and rebuilds).`;
|
|
196
222
|
}
|
|
197
223
|
else {
|
|
198
|
-
|
|
199
|
-
`, then ${CLEAR_NPX_CACHE_COMMAND} and restart your MCP client.`;
|
|
224
|
+
update = `Run: ${GLOBAL_INSTALL_COMMAND}, then ${CLEAR_NPX_CACHE_COMMAND}.`;
|
|
200
225
|
}
|
|
226
|
+
const optOut = installKind === "source-checkout"
|
|
227
|
+
? " If it is a fork you maintain, set D2L_NO_UPDATE_CHECK=1 to turn off upstream update notices."
|
|
228
|
+
: "";
|
|
229
|
+
const text = [headline, update, `${reloadStep(installKind, transport, to, update !== "")}${optOut}`]
|
|
230
|
+
.filter(Boolean)
|
|
231
|
+
.join(" ");
|
|
201
232
|
// Preserve lastShownAt when the text is unchanged, so a periodic re-check
|
|
202
233
|
// does not reset the throttle and start repeating the same line.
|
|
203
234
|
state = state?.text === text ? state : { text, lastShownAt: null };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brightspace-mcp-server",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.8",
|
|
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",
|