@softeria/ms-365-mcp-server 0.24.0 → 0.24.1

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/auth.js CHANGED
@@ -31,9 +31,23 @@ const SCOPE_HIERARCHY = {
31
31
  "Tasks.ReadWrite": ["Tasks.Read"],
32
32
  "Contacts.ReadWrite": ["Contacts.Read"]
33
33
  };
34
- function buildScopesFromEndpoints(includeWorkAccountScopes = false) {
34
+ function buildScopesFromEndpoints(includeWorkAccountScopes = false, enabledToolsPattern) {
35
35
  const scopesSet = /* @__PURE__ */ new Set();
36
+ let enabledToolsRegex;
37
+ if (enabledToolsPattern) {
38
+ try {
39
+ enabledToolsRegex = new RegExp(enabledToolsPattern, "i");
40
+ logger.info(`Building scopes with tool filter pattern: ${enabledToolsPattern}`);
41
+ } catch (error) {
42
+ logger.error(
43
+ `Invalid tool filter regex pattern: ${enabledToolsPattern}. Building scopes without filter.`
44
+ );
45
+ }
46
+ }
36
47
  endpoints.default.forEach((endpoint) => {
48
+ if (enabledToolsRegex && !enabledToolsRegex.test(endpoint.toolName)) {
49
+ return;
50
+ }
37
51
  if (!includeWorkAccountScopes && !endpoint.scopes && endpoint.workScopes) {
38
52
  return;
39
53
  }
@@ -50,7 +64,11 @@ function buildScopesFromEndpoints(includeWorkAccountScopes = false) {
50
64
  scopesSet.add(higherScope);
51
65
  }
52
66
  });
53
- return Array.from(scopesSet);
67
+ const scopes = Array.from(scopesSet);
68
+ if (enabledToolsPattern) {
69
+ logger.info(`Built ${scopes.length} scopes for filtered tools: ${scopes.join(", ")}`);
70
+ }
71
+ return scopes;
54
72
  }
55
73
  class AuthManager {
56
74
  constructor(config = DEFAULT_CONFIG, scopes = buildScopesFromEndpoints()) {
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ async function main() {
12
12
  if (includeWorkScopes) {
13
13
  logger.info("Organization mode enabled - including work account scopes");
14
14
  }
15
- const scopes = buildScopesFromEndpoints(includeWorkScopes);
15
+ const scopes = buildScopesFromEndpoints(includeWorkScopes, args.enabledTools);
16
16
  const authManager = new AuthManager(void 0, scopes);
17
17
  await authManager.loadTokenCache();
18
18
  if (args.login) {
package/dist/server.js CHANGED
@@ -78,7 +78,7 @@ class MicrosoftGraphServer {
78
78
  app.get("/.well-known/oauth-authorization-server", async (req, res) => {
79
79
  const protocol = req.secure ? "https" : "http";
80
80
  const url = new URL(`${protocol}://${req.get("host")}`);
81
- const scopes = buildScopesFromEndpoints(this.options.orgMode);
81
+ const scopes = buildScopesFromEndpoints(this.options.orgMode, this.options.enabledTools);
82
82
  res.json({
83
83
  issuer: url.origin,
84
84
  authorization_endpoint: `${url.origin}/authorize`,
@@ -95,7 +95,7 @@ class MicrosoftGraphServer {
95
95
  app.get("/.well-known/oauth-protected-resource", async (req, res) => {
96
96
  const protocol = req.secure ? "https" : "http";
97
97
  const url = new URL(`${protocol}://${req.get("host")}`);
98
- const scopes = buildScopesFromEndpoints(this.options.orgMode);
98
+ const scopes = buildScopesFromEndpoints(this.options.orgMode, this.options.enabledTools);
99
99
  res.json({
100
100
  resource: `${url.origin}/mcp`,
101
101
  authorization_servers: [url.origin],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softeria/ms-365-mcp-server",
3
- "version": "0.24.0",
3
+ "version": "0.24.1",
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",