ms365-mcp-server 1.1.7 → 1.1.8

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/index.js CHANGED
@@ -5,6 +5,7 @@
5
5
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
6
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
7
7
  import express from 'express';
8
+ import cors from 'cors';
8
9
  import path from 'path';
9
10
  import { fileURLToPath } from 'url';
10
11
  import fs from 'fs/promises';
@@ -66,7 +67,7 @@ function parseArgs() {
66
67
  }
67
68
  const server = new Server({
68
69
  name: "ms365-mcp-server",
69
- version: "1.1.7"
70
+ version: "1.1.8"
70
71
  }, {
71
72
  capabilities: {
72
73
  resources: {
@@ -1059,9 +1060,16 @@ function getListOfArtifacts(functionName, attachments) {
1059
1060
  const app = express();
1060
1061
  const PORT = process.env.PORT || 55000;
1061
1062
  const SERVER_URL = ms365Config.serverUrl || `http://localhost:${PORT}`;
1063
+ // Enable CORS for all routes
1064
+ app.use(cors());
1062
1065
  // Get the directory name in ESM
1063
1066
  const __filename = fileURLToPath(import.meta.url);
1064
1067
  const __dirname = path.dirname(__filename);
1068
+ // Create public/attachments directory if it doesn't exist
1069
+ const attachmentsDir = path.join(__dirname, '../public/attachments');
1070
+ fs.mkdir(attachmentsDir, { recursive: true })
1071
+ .then(() => logger.log('Attachments directory ready'))
1072
+ .catch(err => logger.error('Error creating attachments directory:', err));
1065
1073
  // Serve static files from public directory
1066
1074
  app.use('/attachments', express.static(path.join(__dirname, '../public/attachments')));
1067
1075
  // Start Express server
@@ -860,9 +860,6 @@ export class MS365Operations {
860
860
  if (additionalCriteria.before) {
861
861
  apiCall.filter(`receivedDateTime le ${new Date(additionalCriteria.before).toISOString()}`);
862
862
  }
863
- if (additionalCriteria.hasAttachment !== undefined) {
864
- apiCall.filter(`hasAttachments eq ${additionalCriteria.hasAttachment}`);
865
- }
866
863
  if (additionalCriteria.isUnread !== undefined) {
867
864
  apiCall.filter(`isRead eq ${!additionalCriteria.isUnread}`);
868
865
  }
@@ -900,11 +897,15 @@ export class MS365Operations {
900
897
  attachments: []
901
898
  })) || [];
902
899
  // Filter messages to only include those where the user is in TO or CC
903
- const filteredMessages = messages.filter(message => {
900
+ let filteredMessages = messages.filter(message => {
904
901
  const isInTo = message.toRecipients.some(recipient => recipient.address.toLowerCase() === userEmail.toLowerCase());
905
902
  const isInCc = message.ccRecipients.some(recipient => recipient.address.toLowerCase() === userEmail.toLowerCase());
906
903
  return isInTo || isInCc;
907
904
  });
905
+ // Apply hasAttachment filter manually if specified
906
+ if (additionalCriteria.hasAttachment !== undefined) {
907
+ filteredMessages = filteredMessages.filter(message => message.hasAttachments === additionalCriteria.hasAttachment);
908
+ }
908
909
  // Sort messages by receivedDateTime in descending order
909
910
  filteredMessages.sort((a, b) => new Date(b.receivedDateTime).getTime() - new Date(a.receivedDateTime).getTime());
910
911
  // For emails with attachments, get attachment counts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms365-mcp-server",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "Microsoft 365 MCP Server for managing Microsoft 365 email through natural language interactions with full OAuth2 authentication support",
5
5
  "main": "dist/index.js",
6
6
  "type": "module",
@@ -33,6 +33,8 @@
33
33
  "@azure/msal-node": "^2.6.6",
34
34
  "@microsoft/microsoft-graph-client": "^3.0.7",
35
35
  "@modelcontextprotocol/sdk": "^1.10.1",
36
+ "@types/cors": "^2.8.19",
37
+ "cors": "^2.8.5",
36
38
  "express": "^5.1.0",
37
39
  "isomorphic-fetch": "^3.0.0",
38
40
  "keytar": "^7.9.0",