@softeria/ms-365-mcp-server 0.9.11 → 0.9.13

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
@@ -21,19 +21,23 @@ API.
21
21
  ## Supported Services & Tools
22
22
 
23
23
  **Email (Outlook)**
24
- <sub>list-mail-messages, list-mail-folders, list-mail-folder-messages, get-mail-message, send-mail, delete-mail-message</sub>
24
+ <sub>list-mail-messages, list-mail-folders, list-mail-folder-messages, get-mail-message, send-mail,
25
+ delete-mail-message</sub>
25
26
 
26
27
  **Calendar**
27
- <sub>list-calendars, list-calendar-events, get-calendar-event, get-calendar-view, create-calendar-event, update-calendar-event, delete-calendar-event</sub>
28
+ <sub>list-calendars, list-calendar-events, get-calendar-event, get-calendar-view, create-calendar-event,
29
+ update-calendar-event, delete-calendar-event</sub>
28
30
 
29
31
  **OneDrive & SharePoint Files**
30
- <sub>list-drives, get-drive-root-item, list-folder-files, download-onedrive-file-content, upload-file-content, upload-new-file, delete-onedrive-file</sub>
32
+ <sub>list-drives, get-drive-root-item, list-folder-files, download-onedrive-file-content, upload-file-content,
33
+ upload-new-file, delete-onedrive-file</sub>
31
34
 
32
35
  **Excel Operations**
33
36
  <sub>list-excel-worksheets, get-excel-range, create-excel-chart, format-excel-range, sort-excel-range</sub>
34
37
 
35
38
  **OneNote**
36
- <sub>list-onenote-notebooks, list-onenote-notebook-sections, list-onenote-section-pages, get-onenote-page-content, create-onenote-page</sub>
39
+ <sub>list-onenote-notebooks, list-onenote-notebook-sections, list-onenote-section-pages, get-onenote-page-content,
40
+ create-onenote-page</sub>
37
41
 
38
42
  **To Do Tasks**
39
43
  <sub>list-todo-task-lists, list-todo-tasks, get-todo-task, create-todo-task, update-todo-task, delete-todo-task</sub>
@@ -42,13 +46,19 @@ API.
42
46
  <sub>list-planner-tasks, get-planner-plan, list-plan-tasks, get-planner-task, create-planner-task</sub>
43
47
 
44
48
  **Contacts**
45
- <sub>list-outlook-contacts, get-outlook-contact, create-outlook-contact, update-outlook-contact, delete-outlook-contact</sub>
49
+ <sub>list-outlook-contacts, get-outlook-contact, create-outlook-contact, update-outlook-contact,
50
+ delete-outlook-contact</sub>
46
51
 
47
52
  **Teams & Chats** (Work/School accounts only)
48
- <sub>list-chats, get-chat, list-chat-messages, get-chat-message, send-chat-message, list-chat-message-replies, reply-to-chat-message, list-joined-teams, get-team, list-team-channels, get-team-channel, list-channel-messages, get-channel-message, send-channel-message, list-team-members</sub>
53
+ <sub>list-chats, get-chat, list-chat-messages, get-chat-message, send-chat-message, list-chat-message-replies,
54
+ reply-to-chat-message, list-joined-teams, get-team, list-team-channels, get-team-channel, list-channel-messages,
55
+ get-channel-message, send-channel-message, list-team-members</sub>
49
56
 
50
57
  **SharePoint Sites** (Work/School accounts only)
51
- <sub>search-sharepoint-sites, get-sharepoint-site, get-sharepoint-site-by-path, list-sharepoint-site-drives, get-sharepoint-site-drive-by-id, list-sharepoint-site-items, get-sharepoint-site-item, list-sharepoint-site-lists, get-sharepoint-site-list, list-sharepoint-site-list-items, get-sharepoint-site-list-item, get-sharepoint-sites-delta</sub>
58
+ <sub>search-sharepoint-sites, get-sharepoint-site, get-sharepoint-site-by-path, list-sharepoint-site-drives,
59
+ get-sharepoint-site-drive-by-id, list-sharepoint-site-items, get-sharepoint-site-item, list-sharepoint-site-lists,
60
+ get-sharepoint-site-list, list-sharepoint-site-list-items, get-sharepoint-site-list-item,
61
+ get-sharepoint-sites-delta</sub>
52
62
 
53
63
  **User Profile**
54
64
  <sub>get-current-user</sub>
@@ -98,7 +108,7 @@ integration method.
98
108
 
99
109
  > ⚠️ You must authenticate before using tools.
100
110
 
101
- The server supports two authentication methods:
111
+ The server supports three authentication methods:
102
112
 
103
113
  #### 1. Device Code Flow (Default)
104
114
 
@@ -134,6 +144,19 @@ This mode:
134
144
 
135
145
  MCP clients will automatically handle the OAuth flow when they see the advertised capabilities.
136
146
 
147
+ #### 3. Bring Your Own Token (BYOT)
148
+
149
+ If you are running ms-365-mcp-server as part of a larger system that manages Microsoft OAuth tokens externally, you can provide an access token directly to this MCP server:
150
+
151
+ ```bash
152
+ MS365_MCP_OAUTH_TOKEN=your_oauth_token npx @softeria/ms-365-mcp-server
153
+ ```
154
+
155
+ This method:
156
+ - Bypasses the interactive authentication flows
157
+ - Uses your pre-existing OAuth token for Microsoft Graph API requests
158
+ - Does not handle token refresh (token lifecycle management is your responsibility)
159
+
137
160
  > **Note**: HTTP mode requires authentication. For unauthenticated testing, use stdio mode with device code flow.
138
161
  >
139
162
  > **Authentication Tools**: In HTTP mode, login/logout tools are disabled by default since OAuth handles authentication.
@@ -147,6 +170,7 @@ The following options can be used when running ms-365-mcp-server directly from t
147
170
  --login Login using device code flow
148
171
  --logout Log out and clear saved credentials
149
172
  --verify-login Verify login without starting the server
173
+ --force-work-scopes Force inclusion of work account scopes during login (includes Teams, SharePoint, etc.)
150
174
  ```
151
175
 
152
176
  ### Server Options
@@ -166,10 +190,12 @@ Environment variables:
166
190
 
167
191
  - `READ_ONLY=true|1`: Alternative to --read-only flag
168
192
  - `ENABLED_TOOLS`: Filter tools using regex pattern (alternative to --enabled-tools flag)
193
+ - `MS365_MCP_FORCE_WORK_SCOPES=true|1`: Force inclusion of work account scopes (alternative to --force-work-scopes flag)
169
194
  - `LOG_LEVEL`: Set logging level (default: 'info')
170
- - `SILENT=true`: Disable console output
195
+ - `SILENT=true|1`: Disable console output
171
196
  - `MS365_MCP_CLIENT_ID`: Custom Azure app client ID (defaults to built-in app)
172
197
  - `MS365_MCP_TENANT_ID`: Custom tenant ID (defaults to 'common' for multi-tenant)
198
+ - `MS365_MCP_OAUTH_TOKEN`: Pre-existing OAuth token for Microsoft Graph API (BYOT method)
173
199
 
174
200
  ## Support
175
201
 
package/dist/auth.js CHANGED
@@ -53,8 +53,9 @@ class AuthManager {
53
53
  this.msalApp = new PublicClientApplication(this.config);
54
54
  this.accessToken = null;
55
55
  this.tokenExpiry = null;
56
- this.oauthToken = null;
57
- this.isOAuthMode = false;
56
+ const oauthTokenFromEnv = process.env.MS365_MCP_OAUTH_TOKEN;
57
+ this.oauthToken = oauthTokenFromEnv ?? null;
58
+ this.isOAuthMode = oauthTokenFromEnv != null;
58
59
  }
59
60
  async loadTokenCache() {
60
61
  try {
package/dist/cli.js CHANGED
@@ -18,7 +18,8 @@ program
18
18
  .option('--read-only', 'Start server in read-only mode, disabling write operations')
19
19
  .option('--http [port]', 'Use Streamable HTTP transport instead of stdio (optionally specify port, default: 3000)')
20
20
  .option('--enable-auth-tools', 'Enable login/logout tools when using HTTP mode (disabled by default in HTTP mode)')
21
- .option('--enabled-tools <pattern>', 'Filter tools using regex pattern (e.g., "excel|contact" to enable Excel and Contact tools)');
21
+ .option('--enabled-tools <pattern>', 'Filter tools using regex pattern (e.g., "excel|contact" to enable Excel and Contact tools)')
22
+ .option('--force-work-scopes', 'Force inclusion of work account scopes during login (includes Teams, SharePoint, etc.)');
22
23
  export function parseArgs() {
23
24
  program.parse();
24
25
  const options = program.opts();
@@ -28,5 +29,9 @@ export function parseArgs() {
28
29
  if (process.env.ENABLED_TOOLS) {
29
30
  options.enabledTools = process.env.ENABLED_TOOLS;
30
31
  }
32
+ if (process.env.MS365_MCP_FORCE_WORK_SCOPES === 'true' ||
33
+ process.env.MS365_MCP_FORCE_WORK_SCOPES === '1') {
34
+ options.forceWorkScopes = true;
35
+ }
31
36
  return options;
32
37
  }
package/dist/index.js CHANGED
@@ -4,10 +4,12 @@ import logger from './logger.js';
4
4
  import AuthManager from './auth.js';
5
5
  import MicrosoftGraphServer from './server.js';
6
6
  import { version } from './version.js';
7
+ import { buildScopesFromEndpoints } from './auth.js';
7
8
  async function main() {
8
9
  try {
9
10
  const args = parseArgs();
10
- const authManager = new AuthManager();
11
+ const scopes = buildScopesFromEndpoints(args.forceWorkScopes);
12
+ const authManager = new AuthManager(undefined, scopes);
11
13
  await authManager.loadTokenCache();
12
14
  if (args.login) {
13
15
  await authManager.acquireTokenByDeviceCode();
package/dist/logger.js CHANGED
@@ -27,7 +27,7 @@ const logger = winston.createLogger({
27
27
  export const enableConsoleLogging = () => {
28
28
  logger.add(new winston.transports.Console({
29
29
  format: winston.format.combine(winston.format.colorize(), winston.format.simple()),
30
- silent: process.env.SILENT === 'true',
30
+ silent: process.env.SILENT === 'true' || process.env.SILENT === '1',
31
31
  }));
32
32
  };
33
33
  export default logger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softeria/ms-365-mcp-server",
3
- "version": "0.9.11",
3
+ "version": "0.9.13",
4
4
  "description": "Microsoft 365 MCP Server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",