@softeria/ms-365-mcp-server 0.26.0 → 0.27.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/README.md CHANGED
@@ -308,13 +308,13 @@ registration:
308
308
  4. **Get Credentials**:
309
309
 
310
310
  - Copy the **Application (client) ID** from Overview page
311
- - Go to Certificates & secrets → New client secret → Copy the secret value
311
+ - Go to Certificates & secrets → New client secret → Copy the secret value (optional for public apps)
312
312
 
313
313
  5. **Configure Environment Variables**:
314
314
  Create a `.env` file in your project root:
315
315
  ```env
316
316
  MS365_MCP_CLIENT_ID=your-azure-ad-app-client-id-here
317
- MS365_MCP_CLIENT_SECRET=your-azure-ad-app-client-secret-here
317
+ MS365_MCP_CLIENT_SECRET=your-secret-here # Optional for public apps
318
318
  MS365_MCP_TENANT_ID=common
319
319
  ```
320
320
 
@@ -340,6 +340,19 @@ This method:
340
340
  > **Authentication Tools**: In HTTP mode, login/logout tools are disabled by default since OAuth handles authentication.
341
341
  > Use `--enable-auth-tools` if you need them available.
342
342
 
343
+ ## Tool Presets
344
+
345
+ To reduce initial connection overhead, use preset tool categories instead of loading all 90+ tools:
346
+
347
+ ```bash
348
+ npx @softeria/ms-365-mcp-server --preset mail
349
+ npx @softeria/ms-365-mcp-server --list-presets # See all available presets
350
+ ```
351
+
352
+ Available presets: `mail`, `calendar`, `files`, `personal`, `work`, `excel`, `contacts`, `tasks`, `onenote`, `search`, `users`, `all`
353
+
354
+ **Experimental:** `--discovery` starts with only 2 tools (`search-tools`, `execute-tool`) for minimal token usage.
355
+
343
356
  ## CLI Options
344
357
 
345
358
  The following options can be used when running ms-365-mcp-server directly from the command line:
@@ -364,7 +377,10 @@ When running as an MCP server, the following options can be used:
364
377
  Starts Express.js server with MCP endpoint at /mcp
365
378
  --enable-auth-tools Enable login/logout tools when using HTTP mode (disabled by default in HTTP mode)
366
379
  --enabled-tools <pattern> Filter tools using regex pattern (e.g., "excel|contact" to enable Excel and Contact tools)
380
+ --preset <names> Use preset tool categories (comma-separated). See "Tool Presets" section above
381
+ --list-presets List all available presets and exit
367
382
  --toon (experimental) Enable TOON output format for 30-60% token reduction
383
+ --discovery (experimental) Start with search-tools + execute-tool only
368
384
  ```
369
385
 
370
386
  Environment variables:
@@ -33,6 +33,10 @@ export function generateMcpTools(openApiSpec, outputDir) {
33
33
  (match) => match.replace(/\.strict\(\);/, '.passthrough();')
34
34
  );
35
35
 
36
+ console.log('Stripping unused errors arrays from endpoint definitions...');
37
+ // I didn't make up this crazy regex myself; you know who did. It seems works though.
38
+ clientCode = clientCode.replace(/,?\s*errors:\s*\[[\s\S]*?],?(?=\s*})/g, '');
39
+
36
40
  fs.writeFileSync(clientFilePath, clientCode);
37
41
 
38
42
  return true;
package/dist/cli.js CHANGED
@@ -2,6 +2,7 @@ import { Command } from "commander";
2
2
  import { readFileSync } from "fs";
3
3
  import path from "path";
4
4
  import { fileURLToPath } from "url";
5
+ import { getCombinedPresetPattern, listPresets, presetRequiresOrgMode } from "./tool-categories.js";
5
6
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
7
  const packageJsonPath = path.join(__dirname, "..", "package.json");
7
8
  const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
@@ -17,12 +18,35 @@ program.name("ms-365-mcp-server").description("Microsoft 365 MCP Server").versio
17
18
  "--enabled-tools <pattern>",
18
19
  'Filter tools using regex pattern (e.g., "excel|contact" to enable Excel and Contact tools)'
19
20
  ).option(
21
+ "--preset <names>",
22
+ "Use preset tool categories (comma-separated). Available: mail, calendar, files, personal, work, excel, contacts, tasks, onenote, search, users, all"
23
+ ).option("--list-presets", "List all available presets and exit").option(
20
24
  "--org-mode",
21
25
  "Enable organization/work mode from start (includes Teams, SharePoint, etc.)"
22
- ).option("--work-mode", "Alias for --org-mode").option("--force-work-scopes", "Backwards compatibility alias for --org-mode (deprecated)").option("--toon", "(experimental) Enable TOON output format for 30-60% token reduction");
26
+ ).option("--work-mode", "Alias for --org-mode").option("--force-work-scopes", "Backwards compatibility alias for --org-mode (deprecated)").option("--toon", "(experimental) Enable TOON output format for 30-60% token reduction").option("--discovery", "Enable runtime tool discovery and loading (experimental feature)");
23
27
  function parseArgs() {
24
28
  program.parse();
25
29
  const options = program.opts();
30
+ if (options.listPresets) {
31
+ const presets = listPresets();
32
+ console.log(JSON.stringify({ presets }, null, 2));
33
+ process.exit(0);
34
+ }
35
+ if (options.preset) {
36
+ const presetNames = options.preset.split(",").map((p) => p.trim());
37
+ try {
38
+ options.enabledTools = getCombinedPresetPattern(presetNames);
39
+ const requiresOrgMode = presetNames.some((preset) => presetRequiresOrgMode(preset));
40
+ if (requiresOrgMode && !options.orgMode) {
41
+ console.warn(
42
+ `Warning: Preset(s) [${presetNames.filter((p) => presetRequiresOrgMode(p)).join(", ")}] require --org-mode to function properly`
43
+ );
44
+ }
45
+ } catch (error) {
46
+ console.error(`Error: ${error.message}`);
47
+ process.exit(1);
48
+ }
49
+ }
26
50
  if (process.env.READ_ONLY === "true" || process.env.READ_ONLY === "1") {
27
51
  options.readOnly = true;
28
52
  }