@softeria/ms-365-mcp-server 0.114.5 → 0.115.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/dist/auth.js +13 -4
- package/dist/endpoints.json +2 -2
- package/package.json +1 -1
- package/src/endpoints.json +2 -2
package/dist/auth.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicClientApplication } from "@azure/msal-node";
|
|
1
|
+
import { AuthError, PublicClientApplication } from "@azure/msal-node";
|
|
2
2
|
import logger from "./logger.js";
|
|
3
3
|
import { readFileSync } from "fs";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
@@ -236,6 +236,13 @@ function buildScopeDiagnostics(toolScopes, allowedScopesInput) {
|
|
|
236
236
|
extraAllowedScopesNotUsedByTools: [...allowedScopesInput].sort((a, b) => a.localeCompare(b)).filter((scope) => !isScopeUsedByTools(scope, toolPermissions))
|
|
237
237
|
};
|
|
238
238
|
}
|
|
239
|
+
function describeAuthError(error) {
|
|
240
|
+
if (error instanceof AuthError) {
|
|
241
|
+
const suberror = error.subError ? ` / ${error.subError}` : "";
|
|
242
|
+
return `${error.errorCode}${suberror} (correlationId: ${error.correlationId || "none"}): ${error.errorMessage}`;
|
|
243
|
+
}
|
|
244
|
+
return error.message;
|
|
245
|
+
}
|
|
239
246
|
class AuthManager {
|
|
240
247
|
constructor(config, scopes = [], expectedAccount, storage) {
|
|
241
248
|
logger.info(`And scopes are ${scopes.join(", ")}`, scopes);
|
|
@@ -451,8 +458,8 @@ class AuthManager {
|
|
|
451
458
|
this.tokenExpiry = response.expiresOn ? new Date(response.expiresOn).getTime() : null;
|
|
452
459
|
await this.saveTokenCache();
|
|
453
460
|
return this.accessToken;
|
|
454
|
-
} catch {
|
|
455
|
-
logger.error(
|
|
461
|
+
} catch (error) {
|
|
462
|
+
logger.error(`Silent token acquisition failed: ${describeAuthError(error)}`);
|
|
456
463
|
throw new Error("Silent token acquisition failed");
|
|
457
464
|
}
|
|
458
465
|
}
|
|
@@ -766,7 +773,8 @@ class AuthManager {
|
|
|
766
773
|
const response = await this.msalApp.acquireTokenSilent(silentRequest);
|
|
767
774
|
await this.saveTokenCache();
|
|
768
775
|
return response.accessToken;
|
|
769
|
-
} catch {
|
|
776
|
+
} catch (error) {
|
|
777
|
+
logger.error(`Silent token acquisition failed: ${describeAuthError(error)}`);
|
|
770
778
|
throw new Error(
|
|
771
779
|
`Failed to acquire token for account '${targetAccount.username || targetAccount.name || "unknown"}'. The token may have expired. Please re-login with: --login`
|
|
772
780
|
);
|
|
@@ -780,6 +788,7 @@ export {
|
|
|
780
788
|
buildScopesFromEndpoints,
|
|
781
789
|
collapseScopeHierarchy,
|
|
782
790
|
auth_default as default,
|
|
791
|
+
describeAuthError,
|
|
783
792
|
getEndpointRequiredScopes,
|
|
784
793
|
getMissingAllowedScopes,
|
|
785
794
|
getSelectedAccountPath,
|
package/dist/endpoints.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"toolName": "list-mail-messages",
|
|
13
13
|
"presets": ["mail", "outlook", "personal"],
|
|
14
14
|
"scopes": ["Mail.Read"],
|
|
15
|
-
"llmTip": "CRITICAL: When searching emails, the $search parameter value MUST be wrapped in double quotes. Format: $search=\"your search query here\". Use KQL (Keyword Query Language) syntax to search specific properties: 'from:', 'subject:', 'body:', 'to:', 'cc:', 'bcc:', 'attachment:', 'hasAttachments:', 'importance:', 'received:', 'sent:'. Examples: $search=\"from:john@example.com\" | $search=\"subject:meeting AND hasAttachments:true\" | $search=\"body:urgent AND received>=2024-01-01\" | $search=\"from:john AND importance:high\". Remember: ALWAYS wrap the entire search expression in double quotes! Reference: https://learn.microsoft.com/en-us/graph/search-query-parameter IMPORTANT: Always use $select to limit returned fields and reduce response size. Recommended default: $select=id,subject,from,toRecipients,receivedDateTime,bodyPreview,isRead,hasAttachments. Use bodyPreview instead of body for listings. To read the full email body, use get-mail-message with the specific message id."
|
|
15
|
+
"llmTip": "List read search my Outlook emails across folders. CRITICAL: When searching emails, the $search parameter value MUST be wrapped in double quotes. Format: $search=\"your search query here\". Use KQL (Keyword Query Language) syntax to search specific properties: 'from:', 'subject:', 'body:', 'to:', 'cc:', 'bcc:', 'attachment:', 'hasAttachments:', 'importance:', 'received:', 'sent:'. Examples: $search=\"from:john@example.com\" | $search=\"subject:meeting AND hasAttachments:true\" | $search=\"body:urgent AND received>=2024-01-01\" | $search=\"from:john AND importance:high\". Remember: ALWAYS wrap the entire search expression in double quotes! Reference: https://learn.microsoft.com/en-us/graph/search-query-parameter IMPORTANT: Always use $select to limit returned fields and reduce response size. Recommended default: $select=id,subject,from,toRecipients,receivedDateTime,bodyPreview,isRead,hasAttachments. Use bodyPreview instead of body for listings. To read the full email body, use get-mail-message with the specific message id."
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"pathPattern": "/me/mailFolders",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"toolName": "list-mail-folder-messages",
|
|
67
67
|
"presets": ["mail", "outlook", "personal"],
|
|
68
68
|
"scopes": ["Mail.Read"],
|
|
69
|
-
"llmTip": "CRITICAL: When searching emails, the $search parameter value MUST be wrapped in double quotes. Format: $search=\"your search query here\". Use KQL (Keyword Query Language) syntax to search specific properties: 'from:', 'subject:', 'body:', 'to:', 'cc:', 'bcc:', 'attachment:', 'hasAttachments:', 'importance:', 'received:', 'sent:'. Examples: $search=\"from:john@example.com\" | $search=\"subject:meeting AND hasAttachments:true\" | $search=\"body:urgent AND received>=2024-01-01\" | $search=\"from:alice AND importance:high\". Remember: ALWAYS wrap the entire search expression in double quotes! Reference: https://learn.microsoft.com/en-us/graph/search-query-parameter IMPORTANT: Always use $select to limit returned fields and reduce response size. Recommended default: $select=id,subject,from,toRecipients,receivedDateTime,bodyPreview,isRead,hasAttachments. Use bodyPreview instead of body for listings. To read the full email body, use get-mail-message with the specific message id."
|
|
69
|
+
"llmTip": "List read search Outlook emails within a specific mail folder. CRITICAL: When searching emails, the $search parameter value MUST be wrapped in double quotes. Format: $search=\"your search query here\". Use KQL (Keyword Query Language) syntax to search specific properties: 'from:', 'subject:', 'body:', 'to:', 'cc:', 'bcc:', 'attachment:', 'hasAttachments:', 'importance:', 'received:', 'sent:'. Examples: $search=\"from:john@example.com\" | $search=\"subject:meeting AND hasAttachments:true\" | $search=\"body:urgent AND received>=2024-01-01\" | $search=\"from:alice AND importance:high\". Remember: ALWAYS wrap the entire search expression in double quotes! Reference: https://learn.microsoft.com/en-us/graph/search-query-parameter IMPORTANT: Always use $select to limit returned fields and reduce response size. Recommended default: $select=id,subject,from,toRecipients,receivedDateTime,bodyPreview,isRead,hasAttachments. Use bodyPreview instead of body for listings. To read the full email body, use get-mail-message with the specific message id."
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
"pathPattern": "/me/messages/{message-id}",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softeria/ms-365-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.115.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",
|
package/src/endpoints.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"toolName": "list-mail-messages",
|
|
13
13
|
"presets": ["mail", "outlook", "personal"],
|
|
14
14
|
"scopes": ["Mail.Read"],
|
|
15
|
-
"llmTip": "CRITICAL: When searching emails, the $search parameter value MUST be wrapped in double quotes. Format: $search=\"your search query here\". Use KQL (Keyword Query Language) syntax to search specific properties: 'from:', 'subject:', 'body:', 'to:', 'cc:', 'bcc:', 'attachment:', 'hasAttachments:', 'importance:', 'received:', 'sent:'. Examples: $search=\"from:john@example.com\" | $search=\"subject:meeting AND hasAttachments:true\" | $search=\"body:urgent AND received>=2024-01-01\" | $search=\"from:john AND importance:high\". Remember: ALWAYS wrap the entire search expression in double quotes! Reference: https://learn.microsoft.com/en-us/graph/search-query-parameter IMPORTANT: Always use $select to limit returned fields and reduce response size. Recommended default: $select=id,subject,from,toRecipients,receivedDateTime,bodyPreview,isRead,hasAttachments. Use bodyPreview instead of body for listings. To read the full email body, use get-mail-message with the specific message id."
|
|
15
|
+
"llmTip": "List read search my Outlook emails across folders. CRITICAL: When searching emails, the $search parameter value MUST be wrapped in double quotes. Format: $search=\"your search query here\". Use KQL (Keyword Query Language) syntax to search specific properties: 'from:', 'subject:', 'body:', 'to:', 'cc:', 'bcc:', 'attachment:', 'hasAttachments:', 'importance:', 'received:', 'sent:'. Examples: $search=\"from:john@example.com\" | $search=\"subject:meeting AND hasAttachments:true\" | $search=\"body:urgent AND received>=2024-01-01\" | $search=\"from:john AND importance:high\". Remember: ALWAYS wrap the entire search expression in double quotes! Reference: https://learn.microsoft.com/en-us/graph/search-query-parameter IMPORTANT: Always use $select to limit returned fields and reduce response size. Recommended default: $select=id,subject,from,toRecipients,receivedDateTime,bodyPreview,isRead,hasAttachments. Use bodyPreview instead of body for listings. To read the full email body, use get-mail-message with the specific message id."
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"pathPattern": "/me/mailFolders",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"toolName": "list-mail-folder-messages",
|
|
67
67
|
"presets": ["mail", "outlook", "personal"],
|
|
68
68
|
"scopes": ["Mail.Read"],
|
|
69
|
-
"llmTip": "CRITICAL: When searching emails, the $search parameter value MUST be wrapped in double quotes. Format: $search=\"your search query here\". Use KQL (Keyword Query Language) syntax to search specific properties: 'from:', 'subject:', 'body:', 'to:', 'cc:', 'bcc:', 'attachment:', 'hasAttachments:', 'importance:', 'received:', 'sent:'. Examples: $search=\"from:john@example.com\" | $search=\"subject:meeting AND hasAttachments:true\" | $search=\"body:urgent AND received>=2024-01-01\" | $search=\"from:alice AND importance:high\". Remember: ALWAYS wrap the entire search expression in double quotes! Reference: https://learn.microsoft.com/en-us/graph/search-query-parameter IMPORTANT: Always use $select to limit returned fields and reduce response size. Recommended default: $select=id,subject,from,toRecipients,receivedDateTime,bodyPreview,isRead,hasAttachments. Use bodyPreview instead of body for listings. To read the full email body, use get-mail-message with the specific message id."
|
|
69
|
+
"llmTip": "List read search Outlook emails within a specific mail folder. CRITICAL: When searching emails, the $search parameter value MUST be wrapped in double quotes. Format: $search=\"your search query here\". Use KQL (Keyword Query Language) syntax to search specific properties: 'from:', 'subject:', 'body:', 'to:', 'cc:', 'bcc:', 'attachment:', 'hasAttachments:', 'importance:', 'received:', 'sent:'. Examples: $search=\"from:john@example.com\" | $search=\"subject:meeting AND hasAttachments:true\" | $search=\"body:urgent AND received>=2024-01-01\" | $search=\"from:alice AND importance:high\". Remember: ALWAYS wrap the entire search expression in double quotes! Reference: https://learn.microsoft.com/en-us/graph/search-query-parameter IMPORTANT: Always use $select to limit returned fields and reduce response size. Recommended default: $select=id,subject,from,toRecipients,receivedDateTime,bodyPreview,isRead,hasAttachments. Use bodyPreview instead of body for listings. To read the full email body, use get-mail-message with the specific message id."
|
|
70
70
|
},
|
|
71
71
|
{
|
|
72
72
|
"pathPattern": "/me/messages/{message-id}",
|