@softeria/ms-365-mcp-server 0.9.12 → 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
@@ -108,7 +108,7 @@ integration method.
108
108
 
109
109
  > ⚠️ You must authenticate before using tools.
110
110
 
111
- The server supports two authentication methods:
111
+ The server supports three authentication methods:
112
112
 
113
113
  #### 1. Device Code Flow (Default)
114
114
 
@@ -144,6 +144,19 @@ This mode:
144
144
 
145
145
  MCP clients will automatically handle the OAuth flow when they see the advertised capabilities.
146
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
+
147
160
  > **Note**: HTTP mode requires authentication. For unauthenticated testing, use stdio mode with device code flow.
148
161
  >
149
162
  > **Authentication Tools**: In HTTP mode, login/logout tools are disabled by default since OAuth handles authentication.
@@ -182,6 +195,7 @@ Environment variables:
182
195
  - `SILENT=true|1`: Disable console output
183
196
  - `MS365_MCP_CLIENT_ID`: Custom Azure app client ID (defaults to built-in app)
184
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)
185
199
 
186
200
  ## Support
187
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softeria/ms-365-mcp-server",
3
- "version": "0.9.12",
3
+ "version": "0.9.13",
4
4
  "description": "Microsoft 365 MCP Server",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",