@softeria/ms-365-mcp-server 0.180.1 → 0.180.3

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,16 +10,16 @@ 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) | 369<br>180 | 63<br>37 | -<br>- | All available tools |
13
+ | `all` | [full](#all-full)<br>[read only](#all-read-only) | 370<br>180 | 63<br>37 | -<br>- | All available tools |
14
14
  | `calendar` | [full](#calendar-full)<br>[read only](#calendar-read-only) | 47<br>22 | 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 |
17
17
  | `files` | [full](#files-full)<br>[read only](#files-read-only) | 25<br>14 | 3<br>2 | -<br>- | OneDrive file and folder operations |
18
- | `mail` | [full](#mail-full)<br>[read only](#mail-read-only) | 49<br>19 | 5<br>3 | -<br>- | Email operations (read, send, manage folders, attachments) |
18
+ | `mail` | [full](#mail-full)<br>[read only](#mail-read-only) | 50<br>19 | 5<br>3 | -<br>- | Email operations (read, send, manage folders, attachments) |
19
19
  | `onedrive` | [full](#onedrive-full)<br>[read only](#onedrive-read-only) | 23<br>12 | 2<br>1 | -<br>- | OneDrive app only: drive and file operations, excluding Excel |
20
20
  | `onenote` | [full](#onenote-full)<br>[read only](#onenote-read-only) | 29<br>17 | 3<br>1 | -<br>- | OneNote notebook operations |
21
- | `outlook` | [full](#outlook-full)<br>[read only](#outlook-read-only) | 96<br>37 | 8<br>6 | -<br>- | Outlook app only: mail, calendar and contacts |
22
- | `personal` | [full](#personal-full)<br>[read only](#personal-read-only) | 177<br>74 | 20<br>15 | -<br>- | Personal productivity tools (mail, calendar, files, contacts, tasks, notes, search) |
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
+ | `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
23
  | `search` | [full](#search-full)<br>[read only](#search-read-only) | 7<br>7 | 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 |
@@ -31,7 +31,7 @@ Every preset also includes the account tools (`login`, `logout`, `verify-login`,
31
31
 
32
32
  All available tools
33
33
 
34
- Tools (369):
34
+ Tools (370):
35
35
 
36
36
  - `accept-calendar-event`
37
37
  - `add-calendar-event-attachment`
@@ -118,6 +118,7 @@ Tools (369):
118
118
  - `delete-mail-attachment`
119
119
  - `delete-mail-folder`
120
120
  - `delete-mail-message`
121
+ - `delete-mail-message-skip-deleted-items`
121
122
  - `delete-mail-rule`
122
123
  - `delete-my-calendar-permission`
123
124
  - `delete-onedrive-file`
@@ -965,7 +966,7 @@ Scopes (2):
965
966
 
966
967
  Email operations (read, send, manage folders, attachments)
967
968
 
968
- Tools (49):
969
+ Tools (50):
969
970
 
970
971
  - `add-mail-attachment`
971
972
  - `copy-mail-message`
@@ -983,6 +984,7 @@ Tools (49):
983
984
  - `delete-mail-attachment`
984
985
  - `delete-mail-folder`
985
986
  - `delete-mail-message`
987
+ - `delete-mail-message-skip-deleted-items`
986
988
  - `delete-mail-rule`
987
989
  - `download-bytes`
988
990
  - `download-bytes-to-file`
@@ -1189,7 +1191,7 @@ Scopes (1):
1189
1191
 
1190
1192
  Outlook app only: mail, calendar and contacts
1191
1193
 
1192
- Tools (96):
1194
+ Tools (97):
1193
1195
 
1194
1196
  - `accept-calendar-event`
1195
1197
  - `add-calendar-event-attachment`
@@ -1223,6 +1225,7 @@ Tools (96):
1223
1225
  - `delete-mail-attachment`
1224
1226
  - `delete-mail-folder`
1225
1227
  - `delete-mail-message`
1228
+ - `delete-mail-message-skip-deleted-items`
1226
1229
  - `delete-mail-rule`
1227
1230
  - `delete-my-calendar-permission`
1228
1231
  - `delete-outlook-contact`
@@ -1356,7 +1359,7 @@ Scopes (6):
1356
1359
 
1357
1360
  Personal productivity tools (mail, calendar, files, contacts, tasks, notes, search)
1358
1361
 
1359
- Tools (177):
1362
+ Tools (178):
1360
1363
 
1361
1364
  - `accept-calendar-event`
1362
1365
  - `add-calendar-event-attachment`
@@ -1410,6 +1413,7 @@ Tools (177):
1410
1413
  - `delete-mail-attachment`
1411
1414
  - `delete-mail-folder`
1412
1415
  - `delete-mail-message`
1416
+ - `delete-mail-message-skip-deleted-items`
1413
1417
  - `delete-mail-rule`
1414
1418
  - `delete-my-calendar-permission`
1415
1419
  - `delete-onedrive-file`
package/README.md CHANGED
@@ -553,7 +553,8 @@ With these configured, the server will use your custom Azure app instead of the
553
553
  > **Note**: `.env` is read from the directory the server is started in, and the MCP client decides what
554
554
  > that is. Only `MS365_MCP_CLIENT_ID`, `MS365_MCP_CLIENT_SECRET`, `MS365_MCP_TENANT_ID` and
555
555
  > `MS365_MCP_CLOUD_TYPE` are read from it. Every other variable listed above must be set in your shell
556
- > or MCP client config; anything else found in a `.env` is ignored with a warning on stderr.
556
+ > or MCP client config - `READ_ONLY`, `ENABLED_TOOLS` and `ENABLED_TOOLS_FILE` included, so a `.env`
557
+ > cannot restrict the tools either. Any of them found in a `.env` is ignored with a warning on stderr.
557
558
 
558
559
  #### 3. Bring Your Own Token (BYOT)
559
560
 
@@ -10,8 +10,11 @@ export function createAndSaveSimplifiedOpenAPI(
10
10
  const allEndpoints = JSON.parse(fs.readFileSync(endpointsFile, 'utf8'));
11
11
  // Each spec is trimmed against only the endpoints targeting its version. Entries
12
12
  // without an explicit apiVersion default to v1.0, so existing endpoints are unchanged.
13
+ // An entry with fixedBody shares another tool's operation (see EndpointConfig in
14
+ // src/graph-tools.ts), so it adds nothing to the spec.
13
15
  const endpoints = allEndpoints.filter(
14
- (endpoint) => !endpoint.disabled && (endpoint.apiVersion ?? 'v1.0') === apiVersion
16
+ (endpoint) =>
17
+ !endpoint.disabled && !endpoint.fixedBody && (endpoint.apiVersion ?? 'v1.0') === apiVersion
15
18
  );
16
19
 
17
20
  const spec = fs.readFileSync(openapiFile, 'utf8');
@@ -294,14 +294,22 @@
294
294
  "presets": ["mail", "outlook", "personal"],
295
295
  "scopes": ["Mail.ReadWrite"]
296
296
  },
297
+ {
298
+ "pathPattern": "/me/messages/{message-id}/move",
299
+ "method": "post",
300
+ "toolName": "delete-mail-message",
301
+ "fixedBody": { "destinationId": "deleteditems" },
302
+ "descriptionOverride": "Delete an Outlook email message by its message ID, the way Delete in Outlook does: the message moves to the Deleted Items folder, where the user can see and restore it. Returns the moved message, which has a new id. A message already in Deleted Items stays there; to remove it from Deleted Items, use delete-mail-message-skip-deleted-items.",
303
+ "presets": ["mail", "outlook", "personal"],
304
+ "scopes": ["Mail.ReadWrite"]
305
+ },
297
306
  {
298
307
  "pathPattern": "/me/messages/{message-id}",
299
308
  "method": "delete",
300
- "toolName": "delete-mail-message",
301
- "descriptionOverride": "Delete an Outlook email message by its message ID. This is a soft delete that moves the message to Deleted Items.",
309
+ "toolName": "delete-mail-message-skip-deleted-items",
310
+ "descriptionOverride": "Delete an Outlook email message by its message ID without moving it to Deleted Items, the way Shift+Delete in Outlook does: the message goes to Recoverable Items, is no longer shown in the mailbox, and the user can only restore it with Recover Deleted Items until the retention period ends. Also removes a message from Deleted Items. For an ordinary delete, use delete-mail-message.",
302
311
  "presets": ["mail", "outlook", "personal"],
303
- "scopes": ["Mail.ReadWrite"],
304
- "llmTip": "Soft delete — moves to Deleted Items. To permanently delete, delete again from Deleted Items."
312
+ "scopes": ["Mail.ReadWrite"]
305
313
  },
306
314
  {
307
315
  "pathPattern": "/me/messages/{message-id}/move",
@@ -10638,7 +10638,7 @@ having to fetch the entire set of messages from the server every time.`,
10638
10638
  {
10639
10639
  method: "delete",
10640
10640
  path: "/me/messages/:messageId",
10641
- alias: "delete-mail-message",
10641
+ alias: "delete-mail-message-skip-deleted-items",
10642
10642
  description: `Delete eventMessage.`,
10643
10643
  requestFormat: "json",
10644
10644
  parameters: [
@@ -84,12 +84,47 @@ import {
84
84
  import logger from "./logger.js";
85
85
  import { getRequestTokens } from "./request-context.js";
86
86
  import { TOOL_CATEGORIES } from "./tool-categories.js";
87
- const allEndpoints = [...api.endpoints, ...betaApi.endpoints];
88
87
  const __filename = fileURLToPath(import.meta.url);
89
88
  const __dirname = path.dirname(__filename);
90
89
  const endpointsData = JSON.parse(
91
90
  readFileSync(path.join(__dirname, "endpoints.json"), "utf8")
92
91
  );
92
+ function generatedPathFor(pathPattern) {
93
+ return pathPattern.replace(
94
+ /\{([^}]+)\}/g,
95
+ (_, name) => `:${name.replace(/-([a-z])/g, (_m, c) => c.toUpperCase())}`
96
+ );
97
+ }
98
+ function deriveFixedBodyEndpoints(configs, generated, report) {
99
+ const derived = [];
100
+ for (const e of configs) {
101
+ if (!e.fixedBody || e.disabled) continue;
102
+ const source = e.apiVersion === "beta" ? generated.beta : generated.v1;
103
+ const wantedPath = generatedPathFor(e.pathPattern);
104
+ const base = source.find((t) => t.method === e.method.toLowerCase() && t.path === wantedPath);
105
+ if (!base) {
106
+ report(
107
+ `endpoints.json: ${e.toolName} has fixedBody but no generated operation for ${e.method.toUpperCase()} ${e.pathPattern}; tool not registered`
108
+ );
109
+ continue;
110
+ }
111
+ derived.push({
112
+ ...base,
113
+ alias: e.toolName,
114
+ parameters: (base.parameters ?? []).filter((p) => p.type !== "Body")
115
+ });
116
+ }
117
+ return derived;
118
+ }
119
+ const allEndpoints = [
120
+ ...api.endpoints,
121
+ ...betaApi.endpoints,
122
+ ...deriveFixedBodyEndpoints(
123
+ endpointsData,
124
+ { v1: api.endpoints, beta: betaApi.endpoints },
125
+ (m) => logger.error(m)
126
+ )
127
+ ];
93
128
  function withApiVersionPrefix(description, config) {
94
129
  return config?.apiVersion === "beta" ? `[beta] ${description}` : description;
95
130
  }
@@ -2070,6 +2105,9 @@ async function executeGraphTool(tool, config, graphClient, params, authManager,
2070
2105
  method: tool.method.toUpperCase(),
2071
2106
  headers
2072
2107
  };
2108
+ if (config?.fixedBody) {
2109
+ body = { ...config.fixedBody };
2110
+ }
2073
2111
  if (config?.blobOutput && isBlobOutputEnabled()) {
2074
2112
  options.forceBinary = true;
2075
2113
  options.maxBytes = getBlobMaxBytes();
@@ -2987,7 +3025,9 @@ export {
2987
3025
  UTILITY_TOOLS,
2988
3026
  buildDiscoverySearchIndex,
2989
3027
  buildToolsRegistry,
3028
+ deriveFixedBodyEndpoints,
2990
3029
  filterMembersByName,
3030
+ generatedPathFor,
2991
3031
  isDestructiveOperation,
2992
3032
  isUtilityToolAvailable,
2993
3033
  registerDiscoveryTools,
package/dist/load-env.js CHANGED
@@ -7,6 +7,17 @@ const ENV_FILE_ALLOWLIST = [
7
7
  "MS365_MCP_TENANT_ID",
8
8
  "MS365_MCP_CLOUD_TYPE"
9
9
  ];
10
+ const UNPREFIXED_SERVER_VARIABLES = [
11
+ "READ_ONLY",
12
+ "ENABLED_TOOLS",
13
+ "ENABLED_TOOLS_FILE",
14
+ "LOG_LEVEL",
15
+ "SILENT"
16
+ ];
17
+ const RESTRICTING_VARIABLES = ["READ_ONLY", "ENABLED_TOOLS", "ENABLED_TOOLS_FILE"];
18
+ function joinNames(names) {
19
+ return names.length < 2 ? names.join("") : `${names.slice(0, -1).join(", ")} and ${names[names.length - 1]}`;
20
+ }
10
21
  function loadEnvFile(options = {}) {
11
22
  const file = options.path ?? path.resolve(process.cwd(), ".env");
12
23
  let fromFile = {};
@@ -27,15 +38,19 @@ function loadEnvFile(options = {}) {
27
38
  process.env[key] = value;
28
39
  applied.push(key);
29
40
  }
30
- const ignoredOwn = ignored.filter((key) => key.startsWith("MS365_MCP_"));
41
+ const ignoredOwn = ignored.filter(
42
+ (key) => key.startsWith("MS365_MCP_") || UNPREFIXED_SERVER_VARIABLES.includes(key)
43
+ );
31
44
  if (ignoredOwn.length > 0) {
45
+ const restricting = ignoredOwn.filter((key) => RESTRICTING_VARIABLES.includes(key));
32
46
  console.error(
33
- `[ms365-mcp] Ignored ${ignoredOwn.length} variable(s) from .env: ${[...ignoredOwn].sort().join(", ")}. Only ${ENV_FILE_ALLOWLIST.join(", ")} are read from .env - set anything else in your shell or MCP client config.`
47
+ `[ms365-mcp] Ignored ${ignoredOwn.length} variable(s) from .env: ${[...ignoredOwn].sort().join(", ")}. Only ${ENV_FILE_ALLOWLIST.join(", ")} are read from .env - set anything else in your shell or MCP client config.` + (restricting.length === 0 ? "" : ` ${joinNames(restricting.sort())} from .env ${restricting.length === 1 ? "does" : "do"} not restrict the tools.`)
34
48
  );
35
49
  }
36
50
  return { applied, ignored };
37
51
  }
38
52
  export {
39
53
  ENV_FILE_ALLOWLIST,
54
+ UNPREFIXED_SERVER_VARIABLES,
40
55
  loadEnvFile
41
56
  };
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.180.1",
4
+ "version": "0.180.3",
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",
@@ -294,14 +294,22 @@
294
294
  "presets": ["mail", "outlook", "personal"],
295
295
  "scopes": ["Mail.ReadWrite"]
296
296
  },
297
+ {
298
+ "pathPattern": "/me/messages/{message-id}/move",
299
+ "method": "post",
300
+ "toolName": "delete-mail-message",
301
+ "fixedBody": { "destinationId": "deleteditems" },
302
+ "descriptionOverride": "Delete an Outlook email message by its message ID, the way Delete in Outlook does: the message moves to the Deleted Items folder, where the user can see and restore it. Returns the moved message, which has a new id. A message already in Deleted Items stays there; to remove it from Deleted Items, use delete-mail-message-skip-deleted-items.",
303
+ "presets": ["mail", "outlook", "personal"],
304
+ "scopes": ["Mail.ReadWrite"]
305
+ },
297
306
  {
298
307
  "pathPattern": "/me/messages/{message-id}",
299
308
  "method": "delete",
300
- "toolName": "delete-mail-message",
301
- "descriptionOverride": "Delete an Outlook email message by its message ID. This is a soft delete that moves the message to Deleted Items.",
309
+ "toolName": "delete-mail-message-skip-deleted-items",
310
+ "descriptionOverride": "Delete an Outlook email message by its message ID without moving it to Deleted Items, the way Shift+Delete in Outlook does: the message goes to Recoverable Items, is no longer shown in the mailbox, and the user can only restore it with Recover Deleted Items until the retention period ends. Also removes a message from Deleted Items. For an ordinary delete, use delete-mail-message.",
302
311
  "presets": ["mail", "outlook", "personal"],
303
- "scopes": ["Mail.ReadWrite"],
304
- "llmTip": "Soft delete — moves to Deleted Items. To permanently delete, delete again from Deleted Items."
312
+ "scopes": ["Mail.ReadWrite"]
305
313
  },
306
314
  {
307
315
  "pathPattern": "/me/messages/{message-id}/move",