@softeria/ms-365-mcp-server 0.136.0 → 0.137.0

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/.env.example CHANGED
@@ -1,5 +1,10 @@
1
1
  # Microsoft 365 OAuth Configuration
2
2
  # Create an Azure AD app registration and get these values:
3
+ #
4
+ # NOTE: .env is read from the directory the server is started in, which the MCP
5
+ # client picks. Only the four variables below are read from it. Everything else
6
+ # (token cache paths, the auth-cache command, Key Vault, logging, HTTP settings)
7
+ # must be set in your shell or MCP client config.
3
8
 
4
9
  # Your Azure AD App Registration Client ID
5
10
  MS365_MCP_CLIENT_ID=your-azure-ad-app-client-id-here
@@ -38,7 +43,8 @@ MS365_MCP_TENANT_ID=common
38
43
  # When set, secrets are fetched from Azure Key Vault instead of environment variables.
39
44
  # This is useful for production deployments, especially with Azure Container Apps.
40
45
  #
41
- # MS365_MCP_KEYVAULT_URL=https://your-keyvault-name.vault.azure.net
46
+ # Not read from .env - export MS365_MCP_KEYVAULT_URL in the environment instead:
47
+ # export MS365_MCP_KEYVAULT_URL=https://your-keyvault-name.vault.azure.net
42
48
  #
43
49
  # Key Vault secret names (store these in your Key Vault):
44
50
  # - ms365-mcp-client-id (required)
@@ -58,8 +64,10 @@ MS365_MCP_TENANT_ID=common
58
64
  # -------------------------------------------------------------------
59
65
  # Headless local-MSAL deployments can store token-cache and selected-account
60
66
  # metadata with a provider-neutral executable wrapper. The value is a real
61
- # executable path, not a shell command string; put any provider-specific args
62
- # inside the wrapper script.
67
+ # executable path (absolute), not a shell command string; put any
68
+ # provider-specific args inside the wrapper script.
63
69
  #
64
- # MS365_MCP_AUTH_CACHE_COMMAND=/path/to/ms365-auth-cache-store
65
- # MS365_MCP_AUTH_CACHE_COMMAND_TIMEOUT_MS=10000
70
+ # This one starts a process, so it is deliberately NOT read from .env. Export it
71
+ # in the environment that launches the server:
72
+ # export MS365_MCP_AUTH_CACHE_COMMAND=/path/to/ms365-auth-cache-store
73
+ # export MS365_MCP_AUTH_CACHE_COMMAND_TIMEOUT_MS=10000
package/README.md CHANGED
@@ -440,6 +440,11 @@ registration:
440
440
 
441
441
  With these configured, the server will use your custom Azure app instead of the built-in one.
442
442
 
443
+ > **Note**: `.env` is read from the directory the server is started in, and the MCP client decides what
444
+ > that is. Only `MS365_MCP_CLIENT_ID`, `MS365_MCP_CLIENT_SECRET`, `MS365_MCP_TENANT_ID` and
445
+ > `MS365_MCP_CLOUD_TYPE` are read from it. Every other variable listed above must be set in your shell
446
+ > or MCP client config; anything else found in a `.env` is ignored with a warning on stderr.
447
+
443
448
  #### 3. Bring Your Own Token (BYOT)
444
449
 
445
450
  If you are running ms-365-mcp-server as part of a larger system that manages Microsoft OAuth tokens externally, you can
@@ -844,8 +844,8 @@ const microsoft_graph_driveItem = z.object({
844
844
  webUrl: z.string().describe(
845
845
  "URL that either displays the resource in the browser (for Office file formats), or is a direct link to the file (for other formats). Read-only."
846
846
  ).nullish(),
847
- createdByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
848
- lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
847
+ createdByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
848
+ lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
849
849
  audio: microsoft_graph_audio.optional(),
850
850
  bundle: microsoft_graph_bundle.optional(),
851
851
  cTag: z.string().describe(
@@ -2584,8 +2584,8 @@ const microsoft_graph_listItem = z.object({
2584
2584
  webUrl: z.string().describe(
2585
2585
  "URL that either displays the resource in the browser (for Office file formats), or is a direct link to the file (for other formats). Read-only."
2586
2586
  ).nullish(),
2587
- createdByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
2588
- lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
2587
+ createdByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
2588
+ lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
2589
2589
  contentType: microsoft_graph_contentTypeInfo.optional(),
2590
2590
  deleted: microsoft_graph_deleted.optional(),
2591
2591
  sharepointIds: microsoft_graph_sharepointIds.optional(),
@@ -2593,7 +2593,7 @@ const microsoft_graph_listItem = z.object({
2593
2593
  documentSetVersions: z.array(microsoft_graph_documentSetVersion).describe("Version information for a document set version created by a user.").optional(),
2594
2594
  driveItem: microsoft_graph_driveItem.describe("[Note: Simplified from 45 properties to 25 most common ones]").optional(),
2595
2595
  fields: microsoft_graph_fieldValueSet.optional(),
2596
- permissions: z.array(microsoft_graph_permission).optional(),
2596
+ permissions: z.array(microsoft_graph_permission).describe("The set of permissions for the item. Read-only. Nullable.").optional(),
2597
2597
  versions: z.array(microsoft_graph_listItemVersion).describe("The list of previous versions of the list item.").optional()
2598
2598
  }).passthrough();
2599
2599
  const microsoft_graph_longRunningOperationStatus = z.enum([
@@ -2706,8 +2706,8 @@ const microsoft_graph_list = z.lazy(
2706
2706
  webUrl: z.string().describe(
2707
2707
  "URL that either displays the resource in the browser (for Office file formats), or is a direct link to the file (for other formats). Read-only."
2708
2708
  ).nullish(),
2709
- createdByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
2710
- lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
2709
+ createdByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
2710
+ lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
2711
2711
  displayName: z.string().describe("The displayable title of the list.").nullish(),
2712
2712
  list: microsoft_graph_listInfo.optional(),
2713
2713
  sharepointIds: microsoft_graph_sharepointIds.optional(),
@@ -2717,7 +2717,7 @@ const microsoft_graph_list = z.lazy(
2717
2717
  drive: microsoft_graph_drive.optional(),
2718
2718
  items: z.array(microsoft_graph_listItem).describe("All items contained in the list.").optional(),
2719
2719
  operations: z.array(microsoft_graph_richLongRunningOperation).describe("The collection of long-running operations on the list.").optional(),
2720
- permissions: z.array(microsoft_graph_permission).optional(),
2720
+ permissions: z.array(microsoft_graph_permission).describe("The set of permissions for the item. Read-only. Nullable.").optional(),
2721
2721
  subscriptions: z.array(microsoft_graph_subscription).describe("The set of subscriptions on the list.").optional()
2722
2722
  }).passthrough()
2723
2723
  );
@@ -2739,8 +2739,8 @@ const microsoft_graph_drive = z.lazy(
2739
2739
  webUrl: z.string().describe(
2740
2740
  "URL that either displays the resource in the browser (for Office file formats), or is a direct link to the file (for other formats). Read-only."
2741
2741
  ).nullish(),
2742
- createdByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
2743
- lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
2742
+ createdByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
2743
+ lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
2744
2744
  driveType: z.string().describe(
2745
2745
  "Describes the type of drive represented by this resource. OneDrive personal drives return personal. OneDrive for Business returns business. SharePoint document libraries return documentLibrary. Read-only."
2746
2746
  ).nullish(),
@@ -3014,7 +3014,7 @@ const microsoft_graph_team = z.lazy(
3014
3014
  ).nullish(),
3015
3015
  allChannels: z.array(microsoft_graph_channel).describe("List of channels either hosted in or shared with the team (incoming channels).").optional(),
3016
3016
  channels: z.array(microsoft_graph_channel).describe("The collection of channels and messages associated with the team.").optional(),
3017
- group: microsoft_graph_group.describe("[Note: Simplified from 80 properties to 25 most common ones]").optional(),
3017
+ group: microsoft_graph_group.describe("[Note: Simplified from 81 properties to 25 most common ones]").optional(),
3018
3018
  incomingChannels: z.array(microsoft_graph_channel).describe("List of channels shared with the team.").optional(),
3019
3019
  installedApps: z.array(microsoft_graph_teamsAppInstallation).describe("The apps installed in this team.").optional(),
3020
3020
  members: z.array(microsoft_graph_conversationMember).describe("Members and owners of the team.").optional(),
@@ -3586,6 +3586,13 @@ const microsoft_graph_chatInfo = z.object({
3586
3586
  const microsoft_graph_chatRestrictions = z.object({
3587
3587
  allowTextOnly: z.boolean().describe("Indicates whether only text is allowed in the meeting chat. Optional.").nullish()
3588
3588
  }).passthrough();
3589
+ const microsoft_graph_cloudVideoInteropInfo = z.object({
3590
+ moreInfoWebUrl: z.string().describe("Provides other video teleconferencing (VTC) dial-in options. Read-only.").nullish(),
3591
+ tenantKey: z.string().describe(
3592
+ "The tenant key that is used to dial into the interactive voice response (IVR) of the partner CVI service."
3593
+ ).nullish(),
3594
+ videoTeleconferenceId: z.string().describe("The video teleconferencing ID. Read-only.").nullish()
3595
+ }).passthrough();
3589
3596
  const microsoft_graph_joinMeetingIdSettings = z.object({
3590
3597
  isPasscodeRequired: z.boolean().describe(
3591
3598
  "Indicates whether a passcode is required to join a meeting when using joinMeetingId. Optional."
@@ -3617,6 +3624,7 @@ const microsoft_graph_onlineMeeting = z.object({
3617
3624
  audioConferencing: microsoft_graph_audioConferencing.optional(),
3618
3625
  chatInfo: microsoft_graph_chatInfo.optional(),
3619
3626
  chatRestrictions: microsoft_graph_chatRestrictions.optional(),
3627
+ cloudVideoInteropInfo: microsoft_graph_cloudVideoInteropInfo.optional(),
3620
3628
  expiryDateTime: z.string().regex(
3621
3629
  /^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$/
3622
3630
  ).datetime({ offset: true }).describe(
@@ -3625,8 +3633,7 @@ const microsoft_graph_onlineMeeting = z.object({
3625
3633
  isEndToEndEncryptionEnabled: z.boolean().describe("Indicates whether end-to-end encryption (E2EE) is enabled for the online meeting.").nullish(),
3626
3634
  isEntryExitAnnounced: z.boolean().describe("Indicates whether to announce when callers join or leave.").nullish(),
3627
3635
  joinInformation: microsoft_graph_itemBody.optional(),
3628
- joinMeetingIdSettings: microsoft_graph_joinMeetingIdSettings.optional(),
3629
- joinWebUrl: z.string().describe("The join URL of the online meeting. Read-only.").nullish()
3636
+ joinMeetingIdSettings: microsoft_graph_joinMeetingIdSettings.optional()
3630
3637
  }).passthrough().passthrough();
3631
3638
  const microsoft_graph_onlineMeetingCollectionResponse = z.object({
3632
3639
  "@odata.count": z.number().int().nullable(),
@@ -4549,8 +4556,8 @@ const microsoft_graph_baseItem = z.object({
4549
4556
  webUrl: z.string().describe(
4550
4557
  "URL that either displays the resource in the browser (for Office file formats), or is a direct link to the file (for other formats). Read-only."
4551
4558
  ).nullish(),
4552
- createdByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
4553
- lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional()
4559
+ createdByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
4560
+ lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional()
4554
4561
  }).passthrough();
4555
4562
  const microsoft_graph_site = z.object({
4556
4563
  id: z.string().describe("The unique identifier for an entity. Read-only.").optional(),
@@ -4571,8 +4578,8 @@ const microsoft_graph_site = z.object({
4571
4578
  webUrl: z.string().describe(
4572
4579
  "URL that either displays the resource in the browser (for Office file formats), or is a direct link to the file (for other formats). Read-only."
4573
4580
  ).nullish(),
4574
- createdByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
4575
- lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
4581
+ createdByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
4582
+ lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
4576
4583
  isPersonalSite: z.boolean().describe("Identifies whether the site is personal or not. Read-only.").nullish(),
4577
4584
  root: microsoft_graph_root.optional(),
4578
4585
  sharepointIds: microsoft_graph_sharepointIds.optional(),
@@ -4692,6 +4699,7 @@ const microsoft_graph_virtualEventSession = z.object({
4692
4699
  audioConferencing: microsoft_graph_audioConferencing.optional(),
4693
4700
  chatInfo: microsoft_graph_chatInfo.optional(),
4694
4701
  chatRestrictions: microsoft_graph_chatRestrictions.optional(),
4702
+ cloudVideoInteropInfo: microsoft_graph_cloudVideoInteropInfo.optional(),
4695
4703
  expiryDateTime: z.string().regex(
4696
4704
  /^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$/
4697
4705
  ).datetime({ offset: true }).describe(
@@ -4700,8 +4708,7 @@ const microsoft_graph_virtualEventSession = z.object({
4700
4708
  isEndToEndEncryptionEnabled: z.boolean().describe("Indicates whether end-to-end encryption (E2EE) is enabled for the online meeting.").nullish(),
4701
4709
  isEntryExitAnnounced: z.boolean().describe("Indicates whether to announce when callers join or leave.").nullish(),
4702
4710
  joinInformation: microsoft_graph_itemBody.optional(),
4703
- joinMeetingIdSettings: microsoft_graph_joinMeetingIdSettings.optional(),
4704
- joinWebUrl: z.string().describe("The join URL of the online meeting. Read-only.").nullish()
4711
+ joinMeetingIdSettings: microsoft_graph_joinMeetingIdSettings.optional()
4705
4712
  }).passthrough().passthrough();
4706
4713
  const microsoft_graph_meetingAudience = z.enum(["everyone", "organization", "unknownFutureValue"]);
4707
4714
  const microsoft_graph_communicationsUserIdentity = z.object({
@@ -4723,10 +4730,14 @@ const microsoft_graph_virtualEventRegistrationQuestionBase = z.object({
4723
4730
  const microsoft_graph_virtualEventWebinarRegistrationConfiguration = z.object({
4724
4731
  id: z.string().describe("The unique identifier for an entity. Read-only.").optional(),
4725
4732
  capacity: z.number().gte(-2147483648).lte(2147483647).describe("Total capacity of the virtual event.").nullish(),
4733
+ isManualApprovalEnabled: z.boolean().describe(
4734
+ "Indicates whether registrations require organizer approval before a participant is confirmed."
4735
+ ).nullish(),
4736
+ isWaitlistEnabled: z.boolean().describe(
4737
+ "Indicates whether more registrants are automatically placed on a waitlist when capacity is reached."
4738
+ ).nullish(),
4726
4739
  registrationWebUrl: z.string().describe("Registration URL of the virtual event.").nullish(),
4727
- questions: z.array(microsoft_graph_virtualEventRegistrationQuestionBase).describe("Registration questions.").optional(),
4728
- isManualApprovalEnabled: z.boolean().nullish(),
4729
- isWaitlistEnabled: z.boolean().nullish()
4740
+ questions: z.array(microsoft_graph_virtualEventRegistrationQuestionBase).describe("Registration questions.").optional()
4730
4741
  }).passthrough();
4731
4742
  const microsoft_graph_virtualEventRegistrationQuestionAnswer = z.object({
4732
4743
  booleanValue: z.boolean().describe(
@@ -4783,6 +4794,7 @@ const microsoft_graph_virtualEventWebinar = z.object({
4783
4794
  externalEventInformation: z.array(microsoft_graph_virtualEventExternalInformation).describe(
4784
4795
  "The external information of a virtual event. Returned only for event organizers or coorganizers; otherwise, null."
4785
4796
  ).optional(),
4797
+ isRegistrationRequired: z.boolean().describe("Indicates whether attendee registration is enabled for the virtual event.").nullish(),
4786
4798
  settings: microsoft_graph_virtualEventSettings.optional(),
4787
4799
  startDateTime: microsoft_graph_dateTimeTimeZone.optional(),
4788
4800
  status: microsoft_graph_virtualEventStatus.optional(),
@@ -5212,6 +5224,7 @@ const schemas = {
5212
5224
  microsoft_graph_audioConferencing,
5213
5225
  microsoft_graph_chatInfo,
5214
5226
  microsoft_graph_chatRestrictions,
5227
+ microsoft_graph_cloudVideoInteropInfo,
5215
5228
  microsoft_graph_joinMeetingIdSettings,
5216
5229
  microsoft_graph_onlineMeeting,
5217
5230
  microsoft_graph_onlineMeetingCollectionResponse,
@@ -5865,8 +5878,8 @@ const endpoints = makeApi([
5865
5878
  webUrl: z.string().describe(
5866
5879
  "URL that either displays the resource in the browser (for Office file formats), or is a direct link to the file (for other formats). Read-only."
5867
5880
  ).nullish(),
5868
- createdByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
5869
- lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
5881
+ createdByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
5882
+ lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
5870
5883
  audio: microsoft_graph_audio.optional(),
5871
5884
  bundle: microsoft_graph_bundle.optional(),
5872
5885
  cTag: z.string().describe(
@@ -5980,8 +5993,8 @@ const endpoints = makeApi([
5980
5993
  webUrl: z.string().describe(
5981
5994
  "URL that either displays the resource in the browser (for Office file formats), or is a direct link to the file (for other formats). Read-only."
5982
5995
  ).nullish(),
5983
- createdByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
5984
- lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 136 properties to 25 most common ones]").optional(),
5996
+ createdByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
5997
+ lastModifiedByUser: microsoft_graph_user.describe("[Note: Simplified from 137 properties to 25 most common ones]").optional(),
5985
5998
  audio: microsoft_graph_audio.optional(),
5986
5999
  bundle: microsoft_graph_bundle.optional(),
5987
6000
  cTag: z.string().describe(
@@ -11185,6 +11198,7 @@ resource.`,
11185
11198
  audioConferencing: microsoft_graph_audioConferencing.optional(),
11186
11199
  chatInfo: microsoft_graph_chatInfo.optional(),
11187
11200
  chatRestrictions: microsoft_graph_chatRestrictions.optional(),
11201
+ cloudVideoInteropInfo: microsoft_graph_cloudVideoInteropInfo.optional(),
11188
11202
  expiryDateTime: z.string().regex(
11189
11203
  /^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$/
11190
11204
  ).datetime({ offset: true }).describe(
@@ -11195,8 +11209,7 @@ resource.`,
11195
11209
  ).nullish(),
11196
11210
  isEntryExitAnnounced: z.boolean().describe("Indicates whether to announce when callers join or leave.").nullish(),
11197
11211
  joinInformation: microsoft_graph_itemBody.optional(),
11198
- joinMeetingIdSettings: microsoft_graph_joinMeetingIdSettings.optional(),
11199
- joinWebUrl: z.string().describe("The join URL of the online meeting. Read-only.").nullish()
11212
+ joinMeetingIdSettings: microsoft_graph_joinMeetingIdSettings.optional()
11200
11213
  }).passthrough().passthrough()
11201
11214
  }
11202
11215
  ],
@@ -11257,6 +11270,7 @@ resource.`,
11257
11270
  audioConferencing: microsoft_graph_audioConferencing.optional(),
11258
11271
  chatInfo: microsoft_graph_chatInfo.optional(),
11259
11272
  chatRestrictions: microsoft_graph_chatRestrictions.optional(),
11273
+ cloudVideoInteropInfo: microsoft_graph_cloudVideoInteropInfo.optional(),
11260
11274
  expiryDateTime: z.string().regex(
11261
11275
  /^[0-9]{4,}-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])T([01][0-9]|2[0-3]):[0-5][0-9]:[0-5][0-9]([.][0-9]{1,12})?(Z|[+-][0-9][0-9]:[0-9][0-9])$/
11262
11276
  ).datetime({ offset: true }).describe(
@@ -11267,8 +11281,7 @@ resource.`,
11267
11281
  ).nullish(),
11268
11282
  isEntryExitAnnounced: z.boolean().describe("Indicates whether to announce when callers join or leave.").nullish(),
11269
11283
  joinInformation: microsoft_graph_itemBody.optional(),
11270
- joinMeetingIdSettings: microsoft_graph_joinMeetingIdSettings.optional(),
11271
- joinWebUrl: z.string().describe("The join URL of the online meeting. Read-only.").nullish()
11284
+ joinMeetingIdSettings: microsoft_graph_joinMeetingIdSettings.optional()
11272
11285
  }).passthrough().passthrough()
11273
11286
  }
11274
11287
  ],
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "dotenv/config";
2
+ import { loadEnvFile } from "./load-env.js";
3
3
  import { parseArgs } from "./cli.js";
4
4
  import logger from "./logger.js";
5
5
  import AuthManager, { buildAllowedScopeDiagnostics, resolveAuthScopes } from "./auth.js";
@@ -33,6 +33,7 @@ process.on("uncaughtException", (err, origin) => {
33
33
  });
34
34
  async function main() {
35
35
  try {
36
+ loadEnvFile();
36
37
  const args = parseArgs();
37
38
  const includeWorkScopes = args.orgMode || false;
38
39
  if (includeWorkScopes) {
@@ -0,0 +1,41 @@
1
+ import { parse } from "dotenv";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ const ENV_FILE_ALLOWLIST = [
5
+ "MS365_MCP_CLIENT_ID",
6
+ "MS365_MCP_CLIENT_SECRET",
7
+ "MS365_MCP_TENANT_ID",
8
+ "MS365_MCP_CLOUD_TYPE"
9
+ ];
10
+ function loadEnvFile(options = {}) {
11
+ const file = options.path ?? path.resolve(process.cwd(), ".env");
12
+ let fromFile = {};
13
+ try {
14
+ fromFile = parse(fs.readFileSync(file, "utf8"));
15
+ } catch {
16
+ }
17
+ const applied = [];
18
+ const ignored = [];
19
+ for (const [key, value] of Object.entries(fromFile)) {
20
+ if (!ENV_FILE_ALLOWLIST.includes(key)) {
21
+ ignored.push(key);
22
+ continue;
23
+ }
24
+ if (process.env[key] !== void 0) {
25
+ continue;
26
+ }
27
+ process.env[key] = value;
28
+ applied.push(key);
29
+ }
30
+ const ignoredOwn = ignored.filter((key) => key.startsWith("MS365_MCP_"));
31
+ if (ignoredOwn.length > 0) {
32
+ 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.`
34
+ );
35
+ }
36
+ return { applied, ignored };
37
+ }
38
+ export {
39
+ ENV_FILE_ALLOWLIST,
40
+ loadEnvFile
41
+ };
@@ -289,6 +289,9 @@ function parseTimeoutMs(value) {
289
289
  return parsed;
290
290
  }
291
291
  async function assertCommandUsable(commandPath) {
292
+ if (!path.isAbsolute(commandPath)) {
293
+ throw new Error(`${AUTH_CACHE_COMMAND_ENV} must be an absolute path.`);
294
+ }
292
295
  let stats;
293
296
  try {
294
297
  stats = await fs.promises.stat(commandPath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softeria/ms-365-mcp-server",
3
- "version": "0.136.0",
3
+ "version": "0.137.0",
4
4
  "description": " A Model Context Protocol (MCP) server for interacting with Microsoft 365 and Office services through the Graph API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",