@softeria/ms-365-mcp-server 0.11.3 → 0.11.5

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 CHANGED
@@ -1,40 +1,39 @@
1
- import { Command } from 'commander';
2
- import { readFileSync } from 'fs';
3
- import path from 'path';
4
- import { fileURLToPath } from 'url';
1
+ import { Command } from "commander";
2
+ import { readFileSync } from "fs";
3
+ import path from "path";
4
+ import { fileURLToPath } from "url";
5
5
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
6
- const packageJsonPath = path.join(__dirname, '..', 'package.json');
7
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
6
+ const packageJsonPath = path.join(__dirname, "..", "package.json");
7
+ const packageJson = JSON.parse(readFileSync(packageJsonPath, "utf8"));
8
8
  const version = packageJson.version;
9
9
  const program = new Command();
10
- program
11
- .name('ms-365-mcp-server')
12
- .description('Microsoft 365 MCP Server')
13
- .version(version)
14
- .option('-v', 'Enable verbose logging')
15
- .option('--login', 'Login using device code flow')
16
- .option('--logout', 'Log out and clear saved credentials')
17
- .option('--verify-login', 'Verify login without starting the server')
18
- .option('--list-accounts', 'List all cached accounts')
19
- .option('--select-account <accountId>', 'Select a specific account by ID')
20
- .option('--remove-account <accountId>', 'Remove a specific account by ID')
21
- .option('--read-only', 'Start server in read-only mode, disabling write operations')
22
- .option('--http [port]', 'Use Streamable HTTP transport instead of stdio (optionally specify port, default: 3000)')
23
- .option('--enable-auth-tools', 'Enable login/logout tools when using HTTP mode (disabled by default in HTTP mode)')
24
- .option('--enabled-tools <pattern>', 'Filter tools using regex pattern (e.g., "excel|contact" to enable Excel and Contact tools)')
25
- .option('--force-work-scopes', 'Force inclusion of work account scopes during login (includes Teams, SharePoint, etc.)');
26
- export function parseArgs() {
27
- program.parse();
28
- const options = program.opts();
29
- if (process.env.READ_ONLY === 'true' || process.env.READ_ONLY === '1') {
30
- options.readOnly = true;
31
- }
32
- if (process.env.ENABLED_TOOLS) {
33
- options.enabledTools = process.env.ENABLED_TOOLS;
34
- }
35
- if (process.env.MS365_MCP_FORCE_WORK_SCOPES === 'true' ||
36
- process.env.MS365_MCP_FORCE_WORK_SCOPES === '1') {
37
- options.forceWorkScopes = true;
38
- }
39
- return options;
10
+ program.name("ms-365-mcp-server").description("Microsoft 365 MCP Server").version(version).option("-v", "Enable verbose logging").option("--login", "Login using device code flow").option("--logout", "Log out and clear saved credentials").option("--verify-login", "Verify login without starting the server").option("--list-accounts", "List all cached accounts").option("--select-account <accountId>", "Select a specific account by ID").option("--remove-account <accountId>", "Remove a specific account by ID").option("--read-only", "Start server in read-only mode, disabling write operations").option(
11
+ "--http [port]",
12
+ "Use Streamable HTTP transport instead of stdio (optionally specify port, default: 3000)"
13
+ ).option(
14
+ "--enable-auth-tools",
15
+ "Enable login/logout tools when using HTTP mode (disabled by default in HTTP mode)"
16
+ ).option(
17
+ "--enabled-tools <pattern>",
18
+ 'Filter tools using regex pattern (e.g., "excel|contact" to enable Excel and Contact tools)'
19
+ ).option(
20
+ "--force-work-scopes",
21
+ "Force inclusion of work account scopes during login (includes Teams, SharePoint, etc.)"
22
+ );
23
+ function parseArgs() {
24
+ program.parse();
25
+ const options = program.opts();
26
+ if (process.env.READ_ONLY === "true" || process.env.READ_ONLY === "1") {
27
+ options.readOnly = true;
28
+ }
29
+ if (process.env.ENABLED_TOOLS) {
30
+ options.enabledTools = process.env.ENABLED_TOOLS;
31
+ }
32
+ if (process.env.MS365_MCP_FORCE_WORK_SCOPES === "true" || process.env.MS365_MCP_FORCE_WORK_SCOPES === "1") {
33
+ options.forceWorkScopes = true;
34
+ }
35
+ return options;
40
36
  }
37
+ export {
38
+ parseArgs
39
+ };
@@ -0,0 +1,490 @@
1
+ [
2
+ {
3
+ "pathPattern": "/me/messages",
4
+ "method": "get",
5
+ "toolName": "list-mail-messages",
6
+ "scopes": ["Mail.Read"]
7
+ },
8
+ {
9
+ "pathPattern": "/me/mailFolders",
10
+ "method": "get",
11
+ "toolName": "list-mail-folders",
12
+ "scopes": ["Mail.Read"]
13
+ },
14
+ {
15
+ "pathPattern": "/me/mailFolders/{mailFolder-id}/messages",
16
+ "method": "get",
17
+ "toolName": "list-mail-folder-messages",
18
+ "scopes": ["Mail.Read"]
19
+ },
20
+ {
21
+ "pathPattern": "/me/messages/{message-id}",
22
+ "method": "get",
23
+ "toolName": "get-mail-message",
24
+ "scopes": ["Mail.Read"]
25
+ },
26
+ {
27
+ "pathPattern": "/me/sendMail",
28
+ "method": "post",
29
+ "toolName": "send-mail",
30
+ "scopes": ["Mail.Send"]
31
+ },
32
+ {
33
+ "pathPattern": "/me/messages",
34
+ "method": "post",
35
+ "toolName": "create-draft-email",
36
+ "scopes": ["Mail.ReadWrite"]
37
+ },
38
+ {
39
+ "pathPattern": "/me/messages/{message-id}",
40
+ "method": "delete",
41
+ "toolName": "delete-mail-message",
42
+ "scopes": ["Mail.ReadWrite"]
43
+ },
44
+ {
45
+ "pathPattern": "/me/messages/{message-id}/move",
46
+ "method": "post",
47
+ "toolName": "move-mail-message",
48
+ "scopes": ["Mail.ReadWrite"]
49
+ },
50
+ {
51
+ "pathPattern": "/me/events",
52
+ "method": "get",
53
+ "toolName": "list-calendar-events",
54
+ "scopes": ["Calendars.Read"]
55
+ },
56
+ {
57
+ "pathPattern": "/me/events/{event-id}",
58
+ "method": "get",
59
+ "toolName": "get-calendar-event",
60
+ "scopes": ["Calendars.Read"]
61
+ },
62
+ {
63
+ "pathPattern": "/me/events",
64
+ "method": "post",
65
+ "toolName": "create-calendar-event",
66
+ "scopes": ["Calendars.ReadWrite"]
67
+ },
68
+ {
69
+ "pathPattern": "/me/events/{event-id}",
70
+ "method": "patch",
71
+ "toolName": "update-calendar-event",
72
+ "scopes": ["Calendars.ReadWrite"]
73
+ },
74
+ {
75
+ "pathPattern": "/me/events/{event-id}",
76
+ "method": "delete",
77
+ "toolName": "delete-calendar-event",
78
+ "scopes": ["Calendars.ReadWrite"]
79
+ },
80
+ {
81
+ "pathPattern": "/me/calendarView",
82
+ "method": "get",
83
+ "toolName": "get-calendar-view",
84
+ "scopes": ["Calendars.Read"]
85
+ },
86
+ {
87
+ "pathPattern": "/me/calendars",
88
+ "method": "get",
89
+ "toolName": "list-calendars",
90
+ "scopes": ["Calendars.Read"]
91
+ },
92
+ {
93
+ "pathPattern": "/me/drives",
94
+ "method": "get",
95
+ "toolName": "list-drives",
96
+ "scopes": ["Files.Read"]
97
+ },
98
+ {
99
+ "pathPattern": "/drives/{drive-id}/root",
100
+ "method": "get",
101
+ "toolName": "get-drive-root-item",
102
+ "scopes": ["Files.Read"]
103
+ },
104
+ {
105
+ "pathPattern": "/drives/{drive-id}/root",
106
+ "method": "get",
107
+ "toolName": "get-root-folder",
108
+ "scopes": ["Files.Read"]
109
+ },
110
+ {
111
+ "pathPattern": "/drives/{drive-id}/items/{driveItem-id}/children",
112
+ "method": "get",
113
+ "toolName": "list-folder-files",
114
+ "scopes": ["Files.Read"]
115
+ },
116
+ {
117
+ "pathPattern": "/drives/{drive-id}/items/{driveItem-id}/children/{driveItem-id1}/content",
118
+ "method": "get",
119
+ "toolName": "download-onedrive-file-content",
120
+ "scopes": ["Files.Read"]
121
+ },
122
+ {
123
+ "pathPattern": "/drives/{drive-id}/items/{driveItem-id}",
124
+ "method": "delete",
125
+ "toolName": "delete-onedrive-file",
126
+ "scopes": ["Files.ReadWrite"]
127
+ },
128
+ {
129
+ "pathPattern": "/drives/{drive-id}/items/{driveItem-id}/content",
130
+ "method": "put",
131
+ "toolName": "upload-file-content",
132
+ "scopes": ["Files.ReadWrite"]
133
+ },
134
+ {
135
+ "pathPattern": "/drives/{drive-id}/items/{driveItem-id}/workbook/worksheets/{workbookWorksheet-id}/charts/add",
136
+ "method": "post",
137
+ "toolName": "create-excel-chart",
138
+ "isExcelOp": true,
139
+ "scopes": ["Files.ReadWrite"]
140
+ },
141
+ {
142
+ "pathPattern": "/drives/{drive-id}/items/{driveItem-id}/workbook/worksheets/{workbookWorksheet-id}/range()/format",
143
+ "method": "patch",
144
+ "toolName": "format-excel-range",
145
+ "isExcelOp": true,
146
+ "scopes": ["Files.ReadWrite"]
147
+ },
148
+ {
149
+ "pathPattern": "/drives/{drive-id}/items/{driveItem-id}/workbook/worksheets/{workbookWorksheet-id}/range()/sort",
150
+ "method": "patch",
151
+ "toolName": "sort-excel-range",
152
+ "isExcelOp": true,
153
+ "scopes": ["Files.ReadWrite"]
154
+ },
155
+ {
156
+ "pathPattern": "/drives/{drive-id}/items/{driveItem-id}/workbook/worksheets/{workbookWorksheet-id}/range(address='{address}')",
157
+ "method": "get",
158
+ "toolName": "get-excel-range",
159
+ "isExcelOp": true,
160
+ "scopes": ["Files.Read"]
161
+ },
162
+ {
163
+ "pathPattern": "/drives/{drive-id}/items/{driveItem-id}/workbook/worksheets",
164
+ "method": "get",
165
+ "toolName": "list-excel-worksheets",
166
+ "isExcelOp": true,
167
+ "scopes": ["Files.Read"]
168
+ },
169
+ {
170
+ "pathPattern": "/me/onenote/notebooks",
171
+ "method": "get",
172
+ "toolName": "list-onenote-notebooks",
173
+ "scopes": ["Notes.Read"]
174
+ },
175
+ {
176
+ "pathPattern": "/me/onenote/notebooks/{notebook-id}/sections",
177
+ "method": "get",
178
+ "toolName": "list-onenote-notebook-sections",
179
+ "scopes": ["Notes.Read"]
180
+ },
181
+ {
182
+ "pathPattern": "/me/onenote/sections/{onenoteSection-id}/pages",
183
+ "method": "get",
184
+ "toolName": "list-onenote-section-pages",
185
+ "scopes": ["Notes.Read"]
186
+ },
187
+ {
188
+ "pathPattern": "/me/onenote/pages/{onenotePage-id}/content",
189
+ "method": "get",
190
+ "toolName": "get-onenote-page-content",
191
+ "scopes": ["Notes.Read"]
192
+ },
193
+ {
194
+ "pathPattern": "/me/onenote/pages",
195
+ "method": "post",
196
+ "toolName": "create-onenote-page",
197
+ "scopes": ["Notes.Create"]
198
+ },
199
+ {
200
+ "pathPattern": "/me/todo/lists",
201
+ "method": "get",
202
+ "toolName": "list-todo-task-lists",
203
+ "scopes": ["Tasks.Read"]
204
+ },
205
+ {
206
+ "pathPattern": "/me/todo/lists/{todoTaskList-id}/tasks",
207
+ "method": "get",
208
+ "toolName": "list-todo-tasks",
209
+ "scopes": ["Tasks.Read"]
210
+ },
211
+ {
212
+ "pathPattern": "/me/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}",
213
+ "method": "get",
214
+ "toolName": "get-todo-task",
215
+ "scopes": ["Tasks.Read"]
216
+ },
217
+ {
218
+ "pathPattern": "/me/todo/lists/{todoTaskList-id}/tasks",
219
+ "method": "post",
220
+ "toolName": "create-todo-task",
221
+ "scopes": ["Tasks.ReadWrite"]
222
+ },
223
+ {
224
+ "pathPattern": "/me/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}",
225
+ "method": "patch",
226
+ "toolName": "update-todo-task",
227
+ "scopes": ["Tasks.ReadWrite"]
228
+ },
229
+ {
230
+ "pathPattern": "/me/todo/lists/{todoTaskList-id}/tasks/{todoTask-id}",
231
+ "method": "delete",
232
+ "toolName": "delete-todo-task",
233
+ "scopes": ["Tasks.ReadWrite"]
234
+ },
235
+ {
236
+ "pathPattern": "/me/planner/tasks",
237
+ "method": "get",
238
+ "toolName": "list-planner-tasks",
239
+ "scopes": ["Tasks.Read"]
240
+ },
241
+ {
242
+ "pathPattern": "/planner/plans/{plannerPlan-id}",
243
+ "method": "get",
244
+ "toolName": "get-planner-plan",
245
+ "scopes": ["Tasks.Read"]
246
+ },
247
+ {
248
+ "pathPattern": "/planner/plans/{plannerPlan-id}/tasks",
249
+ "method": "get",
250
+ "toolName": "list-plan-tasks",
251
+ "scopes": ["Tasks.Read"]
252
+ },
253
+ {
254
+ "pathPattern": "/planner/tasks/{plannerTask-id}",
255
+ "method": "get",
256
+ "toolName": "get-planner-task",
257
+ "scopes": ["Tasks.Read"]
258
+ },
259
+ {
260
+ "pathPattern": "/planner/tasks",
261
+ "method": "post",
262
+ "toolName": "create-planner-task",
263
+ "scopes": ["Tasks.ReadWrite"]
264
+ },
265
+ {
266
+ "pathPattern": "/me/contacts",
267
+ "method": "get",
268
+ "toolName": "list-outlook-contacts",
269
+ "scopes": ["Contacts.Read"]
270
+ },
271
+ {
272
+ "pathPattern": "/me/contacts/{contact-id}",
273
+ "method": "get",
274
+ "toolName": "get-outlook-contact",
275
+ "scopes": ["Contacts.Read"]
276
+ },
277
+ {
278
+ "pathPattern": "/me/contacts",
279
+ "method": "post",
280
+ "toolName": "create-outlook-contact",
281
+ "scopes": ["Contacts.ReadWrite"]
282
+ },
283
+ {
284
+ "pathPattern": "/me/contacts/{contact-id}",
285
+ "method": "patch",
286
+ "toolName": "update-outlook-contact",
287
+ "scopes": ["Contacts.ReadWrite"]
288
+ },
289
+ {
290
+ "pathPattern": "/me/contacts/{contact-id}",
291
+ "method": "delete",
292
+ "toolName": "delete-outlook-contact",
293
+ "scopes": ["Contacts.ReadWrite"]
294
+ },
295
+ {
296
+ "pathPattern": "/me",
297
+ "method": "get",
298
+ "toolName": "get-current-user",
299
+ "scopes": ["User.Read"]
300
+ },
301
+ {
302
+ "pathPattern": "/me/chats",
303
+ "method": "get",
304
+ "toolName": "list-chats",
305
+ "scopes": ["Chat.Read"],
306
+ "requiresWorkAccount": true
307
+ },
308
+ {
309
+ "pathPattern": "/chats/{chat-id}",
310
+ "method": "get",
311
+ "toolName": "get-chat",
312
+ "scopes": ["Chat.Read"],
313
+ "requiresWorkAccount": true
314
+ },
315
+ {
316
+ "pathPattern": "/chats/{chat-id}/messages",
317
+ "method": "get",
318
+ "toolName": "list-chat-messages",
319
+ "scopes": ["ChatMessage.Read"],
320
+ "requiresWorkAccount": true
321
+ },
322
+ {
323
+ "pathPattern": "/chats/{chat-id}/messages/{chatMessage-id}",
324
+ "method": "get",
325
+ "toolName": "get-chat-message",
326
+ "scopes": ["ChatMessage.Read"],
327
+ "requiresWorkAccount": true
328
+ },
329
+ {
330
+ "pathPattern": "/chats/{chat-id}/messages",
331
+ "method": "post",
332
+ "toolName": "send-chat-message",
333
+ "scopes": ["ChatMessage.Send"],
334
+ "requiresWorkAccount": true
335
+ },
336
+ {
337
+ "pathPattern": "/me/joinedTeams",
338
+ "method": "get",
339
+ "toolName": "list-joined-teams",
340
+ "scopes": ["Team.ReadBasic.All"],
341
+ "requiresWorkAccount": true
342
+ },
343
+ {
344
+ "pathPattern": "/teams/{team-id}",
345
+ "method": "get",
346
+ "toolName": "get-team",
347
+ "scopes": ["Team.ReadBasic.All"],
348
+ "requiresWorkAccount": true
349
+ },
350
+ {
351
+ "pathPattern": "/teams/{team-id}/channels",
352
+ "method": "get",
353
+ "toolName": "list-team-channels",
354
+ "scopes": ["Channel.ReadBasic.All"],
355
+ "requiresWorkAccount": true
356
+ },
357
+ {
358
+ "pathPattern": "/teams/{team-id}/channels/{channel-id}",
359
+ "method": "get",
360
+ "toolName": "get-team-channel",
361
+ "scopes": ["Channel.ReadBasic.All"],
362
+ "requiresWorkAccount": true
363
+ },
364
+ {
365
+ "pathPattern": "/teams/{team-id}/channels/{channel-id}/messages",
366
+ "method": "get",
367
+ "toolName": "list-channel-messages",
368
+ "scopes": ["ChannelMessage.Read.All"],
369
+ "requiresWorkAccount": true
370
+ },
371
+ {
372
+ "pathPattern": "/teams/{team-id}/channels/{channel-id}/messages/{chatMessage-id}",
373
+ "method": "get",
374
+ "toolName": "get-channel-message",
375
+ "scopes": ["ChannelMessage.Read.All"],
376
+ "requiresWorkAccount": true
377
+ },
378
+ {
379
+ "pathPattern": "/teams/{team-id}/channels/{channel-id}/messages",
380
+ "method": "post",
381
+ "toolName": "send-channel-message",
382
+ "scopes": ["ChannelMessage.Send"],
383
+ "requiresWorkAccount": true
384
+ },
385
+ {
386
+ "pathPattern": "/teams/{team-id}/members",
387
+ "method": "get",
388
+ "toolName": "list-team-members",
389
+ "scopes": ["TeamMember.Read.All"],
390
+ "requiresWorkAccount": true
391
+ },
392
+ {
393
+ "pathPattern": "/chats/{chat-id}/messages/{chatMessage-id}/replies",
394
+ "method": "get",
395
+ "toolName": "list-chat-message-replies",
396
+ "scopes": ["ChatMessage.Read"],
397
+ "requiresWorkAccount": true
398
+ },
399
+ {
400
+ "pathPattern": "/chats/{chat-id}/messages/{chatMessage-id}/replies",
401
+ "method": "post",
402
+ "toolName": "reply-to-chat-message",
403
+ "scopes": ["ChatMessage.Send"],
404
+ "requiresWorkAccount": true
405
+ },
406
+ {
407
+ "pathPattern": "/sites",
408
+ "method": "get",
409
+ "toolName": "search-sharepoint-sites",
410
+ "scopes": ["Sites.Read.All"],
411
+ "requiresWorkAccount": true
412
+ },
413
+ {
414
+ "pathPattern": "/sites/{site-id}",
415
+ "method": "get",
416
+ "toolName": "get-sharepoint-site",
417
+ "scopes": ["Sites.Read.All"],
418
+ "requiresWorkAccount": true
419
+ },
420
+ {
421
+ "pathPattern": "/sites/{site-id}/drives",
422
+ "method": "get",
423
+ "toolName": "list-sharepoint-site-drives",
424
+ "scopes": ["Sites.Read.All"],
425
+ "requiresWorkAccount": true
426
+ },
427
+ {
428
+ "pathPattern": "/sites/{site-id}/drives/{drive-id}",
429
+ "method": "get",
430
+ "toolName": "get-sharepoint-site-drive-by-id",
431
+ "scopes": ["Sites.Read.All"],
432
+ "requiresWorkAccount": true
433
+ },
434
+ {
435
+ "pathPattern": "/sites/{site-id}/items",
436
+ "method": "get",
437
+ "toolName": "list-sharepoint-site-items",
438
+ "scopes": ["Sites.Read.All"],
439
+ "requiresWorkAccount": true
440
+ },
441
+ {
442
+ "pathPattern": "/sites/{site-id}/items/{baseItem-id}",
443
+ "method": "get",
444
+ "toolName": "get-sharepoint-site-item",
445
+ "scopes": ["Sites.Read.All"],
446
+ "requiresWorkAccount": true
447
+ },
448
+ {
449
+ "pathPattern": "/sites/{site-id}/lists",
450
+ "method": "get",
451
+ "toolName": "list-sharepoint-site-lists",
452
+ "scopes": ["Sites.Read.All"],
453
+ "requiresWorkAccount": true
454
+ },
455
+ {
456
+ "pathPattern": "/sites/{site-id}/lists/{list-id}",
457
+ "method": "get",
458
+ "toolName": "get-sharepoint-site-list",
459
+ "scopes": ["Sites.Read.All"],
460
+ "requiresWorkAccount": true
461
+ },
462
+ {
463
+ "pathPattern": "/sites/{site-id}/lists/{list-id}/items",
464
+ "method": "get",
465
+ "toolName": "list-sharepoint-site-list-items",
466
+ "scopes": ["Sites.Read.All"],
467
+ "requiresWorkAccount": true
468
+ },
469
+ {
470
+ "pathPattern": "/sites/{site-id}/lists/{list-id}/items/{listItem-id}",
471
+ "method": "get",
472
+ "toolName": "get-sharepoint-site-list-item",
473
+ "scopes": ["Sites.Read.All"],
474
+ "requiresWorkAccount": true
475
+ },
476
+ {
477
+ "pathPattern": "/sites/{site-id}/getByPath(path='{path}')",
478
+ "method": "get",
479
+ "toolName": "get-sharepoint-site-by-path",
480
+ "scopes": ["Sites.Read.All"],
481
+ "requiresWorkAccount": true
482
+ },
483
+ {
484
+ "pathPattern": "/sites/delta()",
485
+ "method": "get",
486
+ "toolName": "get-sharepoint-sites-delta",
487
+ "scopes": ["Sites.Read.All"],
488
+ "requiresWorkAccount": true
489
+ }
490
+ ]