brightspace-mcp-server 3.8.9 → 3.8.11
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/setup.js +42 -29
- package/package.json +1 -1
package/build/setup.js
CHANGED
|
@@ -80,6 +80,34 @@ function ask(rl, question) {
|
|
|
80
80
|
rl.question(question, (answer) => resolve(answer.trim()));
|
|
81
81
|
});
|
|
82
82
|
}
|
|
83
|
+
/**
|
|
84
|
+
* Apply one raw-mode stdin chunk to the password typed so far. A paste
|
|
85
|
+
* arrives as a single chunk, possibly wrapped in bracketed-paste markers and
|
|
86
|
+
* ending in a copied newline, so the chunk is read one character at a time
|
|
87
|
+
* and escape sequences (paste markers, arrow keys) never reach the password.
|
|
88
|
+
*/
|
|
89
|
+
export function readPasswordInput(password, chunk) {
|
|
90
|
+
let echo = "";
|
|
91
|
+
const text = chunk.replace(/\x1b\[[0-9;?]*[ -/]*[@-~]/g, "");
|
|
92
|
+
for (const ch of text) {
|
|
93
|
+
if (ch === "\x03")
|
|
94
|
+
return { password, echo, outcome: "cancel" };
|
|
95
|
+
if (ch === "\r" || ch === "\n")
|
|
96
|
+
return { password, echo, outcome: "submit" };
|
|
97
|
+
if (ch === "\x7f" || ch === "\b") {
|
|
98
|
+
if (password.length > 0) {
|
|
99
|
+
password = [...password].slice(0, -1).join("");
|
|
100
|
+
echo += "\b \b";
|
|
101
|
+
}
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (ch < " ")
|
|
105
|
+
continue;
|
|
106
|
+
password += ch;
|
|
107
|
+
echo += "*";
|
|
108
|
+
}
|
|
109
|
+
return { password, echo, outcome: "pending" };
|
|
110
|
+
}
|
|
83
111
|
/**
|
|
84
112
|
* Prompt for a password without echoing characters to the terminal.
|
|
85
113
|
* We swap stdout.write to suppress the default echo, then print
|
|
@@ -114,37 +142,22 @@ function askPassword(prompt) {
|
|
|
114
142
|
process.stdin.setRawMode?.(true);
|
|
115
143
|
process.stdin.resume();
|
|
116
144
|
const onData = (key) => {
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
145
|
+
const input = readPasswordInput(password, key.toString("utf-8"));
|
|
146
|
+
if (input.echo)
|
|
147
|
+
origWrite(input.echo);
|
|
148
|
+
password = input.password;
|
|
149
|
+
if (input.outcome === "pending")
|
|
150
|
+
return;
|
|
151
|
+
process.stdout.write = origWrite;
|
|
152
|
+
process.stdin.setRawMode?.(false);
|
|
153
|
+
process.stdin.removeListener("data", onData);
|
|
154
|
+
rl.close();
|
|
155
|
+
if (input.outcome === "cancel") {
|
|
124
156
|
console.log("");
|
|
125
157
|
process.exit(0);
|
|
126
158
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
process.stdout.write = origWrite;
|
|
130
|
-
process.stdin.setRawMode?.(false);
|
|
131
|
-
process.stdin.removeListener("data", onData);
|
|
132
|
-
rl.close();
|
|
133
|
-
origWrite("\n");
|
|
134
|
-
resolve(password);
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
// Backspace
|
|
138
|
-
if (ch === "\x7f" || ch === "\b") {
|
|
139
|
-
if (password.length > 0) {
|
|
140
|
-
password = password.slice(0, -1);
|
|
141
|
-
origWrite("\b \b");
|
|
142
|
-
}
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
// Normal character
|
|
146
|
-
password += ch;
|
|
147
|
-
origWrite("*");
|
|
159
|
+
origWrite("\n");
|
|
160
|
+
resolve(password);
|
|
148
161
|
};
|
|
149
162
|
process.stdin.on("data", onData);
|
|
150
163
|
});
|
|
@@ -406,7 +419,7 @@ async function main() {
|
|
|
406
419
|
// Close the rl temporarily since askPassword manages its own
|
|
407
420
|
rl.close();
|
|
408
421
|
const passwordPrompt = preset
|
|
409
|
-
? `What is your ${preset.
|
|
422
|
+
? `What is your ${preset.name} password? `
|
|
410
423
|
: "What is your Brightspace password? ";
|
|
411
424
|
let password = "";
|
|
412
425
|
while (!password) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brightspace-mcp-server",
|
|
3
|
-
"version": "3.8.
|
|
3
|
+
"version": "3.8.11",
|
|
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",
|