@softeria/ms-365-mcp-server 0.79.2 → 0.79.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.
- package/dist/cli.js +10 -0
- package/dist/server.js +18 -6
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -65,6 +65,16 @@ function parseArgs() {
|
|
|
65
65
|
if (process.env.ENABLED_TOOLS) {
|
|
66
66
|
options.enabledTools = process.env.ENABLED_TOOLS;
|
|
67
67
|
}
|
|
68
|
+
if (options.enabledTools) {
|
|
69
|
+
try {
|
|
70
|
+
new RegExp(options.enabledTools, "i");
|
|
71
|
+
} catch {
|
|
72
|
+
console.error(
|
|
73
|
+
`Error: invalid --enabled-tools regex pattern: "${options.enabledTools}". Without a valid filter, all tools would be exposed.`
|
|
74
|
+
);
|
|
75
|
+
process.exit(1);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
68
78
|
if (process.env.MS365_MCP_ORG_MODE === "true" || process.env.MS365_MCP_ORG_MODE === "1") {
|
|
69
79
|
options.orgMode = true;
|
|
70
80
|
}
|
package/dist/server.js
CHANGED
|
@@ -225,18 +225,30 @@ class MicrosoftGraphServer {
|
|
|
225
225
|
if (clientCodeChallenge && state) {
|
|
226
226
|
const serverCodeVerifier = crypto.randomBytes(32).toString("base64url");
|
|
227
227
|
const serverCodeChallenge = crypto.createHash("sha256").update(serverCodeVerifier).digest("base64url");
|
|
228
|
+
const now = Date.now();
|
|
229
|
+
const maxAge = 10 * 60 * 1e3;
|
|
230
|
+
const maxEntries = 1e3;
|
|
231
|
+
for (const [key, value] of this.pkceStore) {
|
|
232
|
+
if (now - value.createdAt > maxAge) {
|
|
233
|
+
this.pkceStore.delete(key);
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (this.pkceStore.size >= maxEntries) {
|
|
237
|
+
logger.warn(
|
|
238
|
+
`PKCE store at capacity (${maxEntries} entries) \u2014 rejecting new authorization request`
|
|
239
|
+
);
|
|
240
|
+
res.status(503).json({
|
|
241
|
+
error: "server_busy",
|
|
242
|
+
error_description: "Too many pending authorization requests. Try again later."
|
|
243
|
+
});
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
228
246
|
this.pkceStore.set(state, {
|
|
229
247
|
clientCodeChallenge,
|
|
230
248
|
clientCodeChallengeMethod: clientCodeChallengeMethod || "S256",
|
|
231
249
|
serverCodeVerifier,
|
|
232
250
|
createdAt: Date.now()
|
|
233
251
|
});
|
|
234
|
-
const now = Date.now();
|
|
235
|
-
for (const [key, value] of this.pkceStore) {
|
|
236
|
-
if (now - value.createdAt > 10 * 60 * 1e3) {
|
|
237
|
-
this.pkceStore.delete(key);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
252
|
microsoftAuthUrl.searchParams.set("code_challenge", serverCodeChallenge);
|
|
241
253
|
microsoftAuthUrl.searchParams.set("code_challenge_method", "S256");
|
|
242
254
|
logger.info("Two-leg PKCE: stored client challenge, generated server challenge", {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softeria/ms-365-mcp-server",
|
|
3
|
-
"version": "0.79.
|
|
3
|
+
"version": "0.79.4",
|
|
4
4
|
"description": " A Model Context Protocol (MCP) server for interacting with Microsoft 365 and Office services through the Graph API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|