@softeria/ms-365-mcp-server 0.189.0 → 0.190.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/PRESETS.md CHANGED
@@ -10,7 +10,7 @@ Every preset also includes the account tools (`login`, `logout`, `verify-login`,
10
10
 
11
11
  | Preset | Mode | Tools | Scopes | Org mode | Description |
12
12
  | ------------- | ---------------------------------------------------------------- | ---------: | -------: | -------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
13
- | `all` | [full](#all-full)<br>[read only](#all-read-only) | 371<br>181 | 65<br>38 | -<br>- | All available tools |
13
+ | `all` | [full](#all-full)<br>[read only](#all-read-only) | 372<br>182 | 65<br>38 | -<br>- | All available tools |
14
14
  | `calendar` | [full](#calendar-full)<br>[read only](#calendar-read-only) | 48<br>23 | 7<br>5 | -<br>- | Calendar and event management |
15
15
  | `contacts` | [full](#contacts-full)<br>[read only](#contacts-read-only) | 15<br>7 | 1<br>1 | -<br>- | Outlook contacts management |
16
16
  | `excel` | [full](#excel-full)<br>[read only](#excel-read-only) | 25<br>9 | 1<br>1 | -<br>- | Excel spreadsheet operations |
@@ -20,18 +20,18 @@ Every preset also includes the account tools (`login`, `logout`, `verify-login`,
20
20
  | `onenote` | [full](#onenote-full)<br>[read only](#onenote-read-only) | 29<br>17 | 5<br>2 | -<br>- | OneNote notebook operations |
21
21
  | `outlook` | [full](#outlook-full)<br>[read only](#outlook-read-only) | 97<br>37 | 8<br>6 | -<br>- | Outlook app only: mail, calendar and contacts |
22
22
  | `personal` | [full](#personal-full)<br>[read only](#personal-read-only) | 178<br>74 | 20<br>15 | -<br>- | Personal productivity tools (mail, calendar, files, contacts, tasks, notes, search) |
23
- | `search` | [full](#search-full)<br>[read only](#search-read-only) | 7<br>7 | 8<br>8 | -<br>- | Microsoft Search capabilities |
23
+ | `search` | [full](#search-full)<br>[read only](#search-read-only) | 8<br>8 | 8<br>8 | -<br>- | Microsoft Search capabilities |
24
24
  | `tasks` | [full](#tasks-full)<br>[read only](#tasks-read-only) | 35<br>16 | 1<br>1 | -<br>- | Task and planning tools (To Do, Planner) |
25
25
  | `teams` | [full](#teams-full)<br>[read only](#teams-read-only) | 73<br>43 | 31<br>18 | required<br>required | Teams app only: chats, channels, meetings and presence |
26
26
  | `teams-write` | [full](#teams-write-full)<br>[read only](#teams-write-read-only) | 11<br>7 | 6<br>3 | required<br>required | Teams send-only: send/reply in chats and channels, list chats/teams/channels by name, activity notifications - no message reading |
27
27
  | `users` | [full](#users-full)<br>[read only](#users-read-only) | 11<br>11 | 4<br>4 | required<br>required | User directory access |
28
- | `work` | [full](#work-full)<br>[read only](#work-read-only) | 191<br>111 | 55<br>33 | required<br>required | Organization/work tools (Teams, SharePoint, shared mailboxes, search) |
28
+ | `work` | [full](#work-full)<br>[read only](#work-read-only) | 192<br>112 | 55<br>33 | required<br>required | Organization/work tools (Teams, SharePoint, shared mailboxes, search) |
29
29
 
30
30
  ## `all` full
31
31
 
32
32
  All available tools
33
33
 
34
- Tools (371):
34
+ Tools (372):
35
35
 
36
36
  - `accept-calendar-event`
37
37
  - `add-calendar-event-attachment`
@@ -344,6 +344,7 @@ Tools (371):
344
344
  - `reply-to-channel-message`
345
345
  - `reply-to-chat-message`
346
346
  - `reply-to-group-thread`
347
+ - `search-files`
347
348
  - `search-onedrive-files`
348
349
  - `search-query`
349
350
  - `search-sharepoint-sites`
@@ -477,7 +478,7 @@ Scopes (65):
477
478
 
478
479
  All available tools
479
480
 
480
- Tools (181):
481
+ Tools (182):
481
482
 
482
483
  - `copilot-retrieve`
483
484
  - `download-bytes`
@@ -657,6 +658,7 @@ Tools (181):
657
658
  - `list-webinar-sessions`
658
659
  - `parse-teams-url`
659
660
  - `read-mail-text`
661
+ - `search-files`
660
662
  - `search-onedrive-files`
661
663
  - `search-query`
662
664
  - `search-sharepoint-sites`
@@ -1678,12 +1680,13 @@ Scopes (15):
1678
1680
 
1679
1681
  Microsoft Search capabilities
1680
1682
 
1681
- Tools (7):
1683
+ Tools (8):
1682
1684
 
1683
1685
  - `copilot-retrieve`
1684
1686
  - `download-bytes`
1685
1687
  - `download-bytes-to-file`
1686
1688
  - `get-download-url`
1689
+ - `search-files`
1687
1690
  - `search-onedrive-files`
1688
1691
  - `search-query`
1689
1692
  - `search-sharepoint-sites`
@@ -1703,12 +1706,13 @@ Scopes (8):
1703
1706
 
1704
1707
  Microsoft Search capabilities
1705
1708
 
1706
- Tools (7):
1709
+ Tools (8):
1707
1710
 
1708
1711
  - `copilot-retrieve`
1709
1712
  - `download-bytes`
1710
1713
  - `download-bytes-to-file`
1711
1714
  - `get-download-url`
1715
+ - `search-files`
1712
1716
  - `search-onedrive-files`
1713
1717
  - `search-query`
1714
1718
  - `search-sharepoint-sites`
@@ -2097,7 +2101,7 @@ Organization/work tools (Teams, SharePoint, shared mailboxes, search)
2097
2101
 
2098
2102
  Requires `--org-mode`.
2099
2103
 
2100
- Tools (191):
2104
+ Tools (192):
2101
2105
 
2102
2106
  - `add-group-member`
2103
2107
  - `add-group-owner`
@@ -2258,6 +2262,7 @@ Tools (191):
2258
2262
  - `reply-to-channel-message`
2259
2263
  - `reply-to-chat-message`
2260
2264
  - `reply-to-group-thread`
2265
+ - `search-files`
2261
2266
  - `search-query`
2262
2267
  - `search-sharepoint-sites`
2263
2268
  - `send-channel-message`
@@ -2355,7 +2360,7 @@ Organization/work tools (Teams, SharePoint, shared mailboxes, search)
2355
2360
 
2356
2361
  Requires `--org-mode`.
2357
2362
 
2358
- Tools (111):
2363
+ Tools (112):
2359
2364
 
2360
2365
  - `copilot-retrieve`
2361
2366
  - `download-bytes`
@@ -2466,6 +2471,7 @@ Tools (111):
2466
2471
  - `list-webinar-sessions`
2467
2472
  - `parse-teams-url`
2468
2473
  - `read-mail-text`
2474
+ - `search-files`
2469
2475
  - `search-query`
2470
2476
  - `search-sharepoint-sites`
2471
2477
 
@@ -1961,6 +1961,7 @@
1961
1961
  "presets": ["teams", "teams-write", "work"],
1962
1962
  "workScopes": ["Chat.ReadBasic"],
1963
1963
  "maxTop": 50,
1964
+ "queryParams": ["top", "filter", "expand", "orderby", "skiptoken"],
1964
1965
  "llmTip": "Lists the signed-in user's chats. Only $filter, $top (max 50), $expand (members, lastMessagePreview) and $orderby are supported; $orderby accepts just lastMessagePreview/createdDateTime in descending order. Other options are rejected: $search returns 400 'Query option Search is not allowed', and ordering by lastUpdatedDateTime returns 400 BadRequest. Meeting chats have chatType=meeting and carry the meeting subject in topic."
1965
1966
  },
1966
1967
  {
@@ -2574,6 +2575,41 @@
2574
2575
  "ChannelMessage.Read.All"
2575
2576
  ]
2576
2577
  },
2578
+ {
2579
+ "pathPattern": "/search/query",
2580
+ "method": "post",
2581
+ "toolName": "search-files",
2582
+ "descriptionOverride": "Find files by keyword across the OneDrive and SharePoint files the signed-in user can read, without knowing the site or drive. The search is KQL keyword matching, not semantic: give a few keywords, not a sentence. A hit's resource.parentReference.driveId and resource.id go to get-drive-item.",
2583
+ "presets": ["search", "work"],
2584
+ "readOnly": true,
2585
+ "workScopes": [["Sites.Read.All"], ["Files.Read.All"]],
2586
+ "queryParams": [],
2587
+ "fixedBody": {
2588
+ "requests": [
2589
+ { "entityTypes": ["driveItem"], "query": { "queryString": "" }, "from": 0, "size": 10 }
2590
+ ]
2591
+ },
2592
+ "bodyParams": {
2593
+ "queryString": {
2594
+ "target": ["requests", 0, "query", "queryString"],
2595
+ "type": "string",
2596
+ "required": true,
2597
+ "description": "Keywords to look for in file names, metadata and content, in KQL."
2598
+ },
2599
+ "size": {
2600
+ "target": ["requests", 0, "size"],
2601
+ "type": "integer",
2602
+ "minimum": 1,
2603
+ "description": "How many hits to return. Defaults to 10."
2604
+ },
2605
+ "from": {
2606
+ "target": ["requests", 0, "from"],
2607
+ "type": "integer",
2608
+ "minimum": 0,
2609
+ "description": "Offset of the first hit, 0 by default. While moreResultsAvailable is true, the next page starts at the previous from plus the previous size."
2610
+ }
2611
+ }
2612
+ },
2577
2613
  {
2578
2614
  "pathPattern": "/copilot/retrieval",
2579
2615
  "method": "post",
@@ -93,6 +93,7 @@ import {
93
93
  targetsUserProfile,
94
94
  userFieldEnforcement
95
95
  } from "./lib/user-field-policy.js";
96
+ import { bodyParamSchemas, buildFixedBody } from "./lib/body-params.js";
96
97
  import logger from "./logger.js";
97
98
  import {
98
99
  mcpAppResultWithoutBody,
@@ -2152,6 +2153,9 @@ async function executeGraphTool(tool, config, graphClient, params, authManager,
2152
2153
  if (paramName === "fileName" && config?.blobOutput) continue;
2153
2154
  if (paramName === "name" && config?.nameFilter) continue;
2154
2155
  if (paramName === "token" && config?.deltaToken) continue;
2156
+ if (config?.bodyParams && Object.prototype.hasOwnProperty.call(config.bodyParams, paramName)) {
2157
+ continue;
2158
+ }
2155
2159
  if ([
2156
2160
  "account",
2157
2161
  "confirm",
@@ -2430,7 +2434,14 @@ async function executeGraphTool(tool, config, graphClient, params, authManager,
2430
2434
  ...acceptFallback ? { acceptFallback } : {}
2431
2435
  };
2432
2436
  if (config?.fixedBody) {
2433
- body = { ...config.fixedBody };
2437
+ const built = buildFixedBody(config.fixedBody, config.bodyParams ?? {}, params);
2438
+ if ("error" in built) {
2439
+ return {
2440
+ content: [{ type: "text", text: JSON.stringify({ error: built.error }) }],
2441
+ isError: true
2442
+ };
2443
+ }
2444
+ body = built.body;
2434
2445
  }
2435
2446
  if (config?.blobOutput && isBlobOutputEnabled()) {
2436
2447
  options.forceBinary = true;
@@ -2723,6 +2734,9 @@ function registerGraphToolWithMcp(server, tool, endpointConfig, graphClient, opt
2723
2734
  }
2724
2735
  }
2725
2736
  }
2737
+ if (endpointConfig?.bodyParams) {
2738
+ Object.assign(paramSchema, bodyParamSchemas(endpointConfig.bodyParams));
2739
+ }
2726
2740
  const pathParamMatches = tool.path.matchAll(/:([a-zA-Z]+)/g);
2727
2741
  for (const match of pathParamMatches) {
2728
2742
  const pathParamName = match[1];
@@ -0,0 +1,39 @@
1
+ import { z } from "zod";
2
+ function bodyParamSchema(config) {
3
+ let schema;
4
+ if (config.type === "integer") {
5
+ const whole = z.number().int().min(config.minimum ?? Number.MIN_SAFE_INTEGER);
6
+ schema = z.union([whole, z.string().regex(/^\d+$/).transform(Number).pipe(whole)]);
7
+ } else {
8
+ schema = z.string();
9
+ if (config.required) schema = schema.min(1);
10
+ }
11
+ schema = schema.describe(config.description);
12
+ return config.required ? schema : schema.optional();
13
+ }
14
+ function bodyParamSchemas(bodyParams) {
15
+ return Object.fromEntries(
16
+ Object.entries(bodyParams).map(([name, config]) => [name, bodyParamSchema(config)])
17
+ );
18
+ }
19
+ function buildFixedBody(fixedBody, bodyParams, params) {
20
+ const body = structuredClone(fixedBody);
21
+ const schemas = bodyParamSchemas(bodyParams);
22
+ for (const [name, config] of Object.entries(bodyParams)) {
23
+ const parsed = schemas[name].safeParse(params[name]);
24
+ if (!parsed.success) {
25
+ return { error: `Invalid ${name}: ${parsed.error.issues.map((i) => i.message).join("; ")}` };
26
+ }
27
+ if (parsed.data === void 0) continue;
28
+ let node = body;
29
+ for (const step of config.target.slice(0, -1)) {
30
+ node = node[step];
31
+ }
32
+ node[config.target[config.target.length - 1]] = parsed.data;
33
+ }
34
+ return { body };
35
+ }
36
+ export {
37
+ bodyParamSchemas,
38
+ buildFixedBody
39
+ };
@@ -2,6 +2,7 @@ import { z } from "zod";
2
2
  import { queryParameterSchema } from "./query-parameter-schema.js";
3
3
  import { tidyToolJsonSchema, zodToToolJsonSchema } from "../normalize-tool-schema.js";
4
4
  import { isDestructiveOperation } from "./destructive-ops.js";
5
+ import { bodyParamSchemas } from "./body-params.js";
5
6
  import { ACCEPT_VALUE_JSON_SCHEMA } from "./media-type.js";
6
7
  import {
7
8
  isFetchAllPagesApplicable,
@@ -70,6 +71,18 @@ function describeToolSchema(tool, config, ctx = {}) {
70
71
  }
71
72
  ];
72
73
  });
74
+ if (config?.bodyParams) {
75
+ for (const [name, schema] of Object.entries(bodyParamSchemas(config.bodyParams))) {
76
+ const { inner, optional } = unwrapOptional(schema);
77
+ params.push({
78
+ name,
79
+ in: "Query",
80
+ required: !optional,
81
+ description: schema.description ?? inner.description,
82
+ schema: toParamJsonSchema(inner)
83
+ });
84
+ }
85
+ }
73
86
  if (isDestructiveOperation(tool.method, config)) {
74
87
  params.push({
75
88
  name: "confirm",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@softeria/ms-365-mcp-server",
3
3
  "mcpName": "io.github.Softeria/ms-365-mcp-server",
4
- "version": "0.189.0",
4
+ "version": "0.190.1",
5
5
  "description": " A Model Context Protocol (MCP) server for interacting with Microsoft 365 and Office services through the Graph API",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -1961,6 +1961,7 @@
1961
1961
  "presets": ["teams", "teams-write", "work"],
1962
1962
  "workScopes": ["Chat.ReadBasic"],
1963
1963
  "maxTop": 50,
1964
+ "queryParams": ["top", "filter", "expand", "orderby", "skiptoken"],
1964
1965
  "llmTip": "Lists the signed-in user's chats. Only $filter, $top (max 50), $expand (members, lastMessagePreview) and $orderby are supported; $orderby accepts just lastMessagePreview/createdDateTime in descending order. Other options are rejected: $search returns 400 'Query option Search is not allowed', and ordering by lastUpdatedDateTime returns 400 BadRequest. Meeting chats have chatType=meeting and carry the meeting subject in topic."
1965
1966
  },
1966
1967
  {
@@ -2574,6 +2575,41 @@
2574
2575
  "ChannelMessage.Read.All"
2575
2576
  ]
2576
2577
  },
2578
+ {
2579
+ "pathPattern": "/search/query",
2580
+ "method": "post",
2581
+ "toolName": "search-files",
2582
+ "descriptionOverride": "Find files by keyword across the OneDrive and SharePoint files the signed-in user can read, without knowing the site or drive. The search is KQL keyword matching, not semantic: give a few keywords, not a sentence. A hit's resource.parentReference.driveId and resource.id go to get-drive-item.",
2583
+ "presets": ["search", "work"],
2584
+ "readOnly": true,
2585
+ "workScopes": [["Sites.Read.All"], ["Files.Read.All"]],
2586
+ "queryParams": [],
2587
+ "fixedBody": {
2588
+ "requests": [
2589
+ { "entityTypes": ["driveItem"], "query": { "queryString": "" }, "from": 0, "size": 10 }
2590
+ ]
2591
+ },
2592
+ "bodyParams": {
2593
+ "queryString": {
2594
+ "target": ["requests", 0, "query", "queryString"],
2595
+ "type": "string",
2596
+ "required": true,
2597
+ "description": "Keywords to look for in file names, metadata and content, in KQL."
2598
+ },
2599
+ "size": {
2600
+ "target": ["requests", 0, "size"],
2601
+ "type": "integer",
2602
+ "minimum": 1,
2603
+ "description": "How many hits to return. Defaults to 10."
2604
+ },
2605
+ "from": {
2606
+ "target": ["requests", 0, "from"],
2607
+ "type": "integer",
2608
+ "minimum": 0,
2609
+ "description": "Offset of the first hit, 0 by default. While moreResultsAvailable is true, the next page starts at the previous from plus the previous size."
2610
+ }
2611
+ }
2612
+ },
2577
2613
  {
2578
2614
  "pathPattern": "/copilot/retrieval",
2579
2615
  "method": "post",