ms365-mcp-server 1.0.2 → 1.0.3

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
@@ -55,7 +55,7 @@ function parseArgs() {
55
55
  }
56
56
  const server = new Server({
57
57
  name: "ms365-mcp-server",
58
- version: "1.0.2"
58
+ version: "1.0.3"
59
59
  }, {
60
60
  capabilities: {
61
61
  resources: {
@@ -78,12 +78,16 @@ export class MS365Operations {
78
78
  searchTerms.push(emailSearchTerms.join(' OR '));
79
79
  }
80
80
  if (criteria.subject) {
81
- // For subject searches, we can use quotes if the subject contains spaces
82
- if (criteria.subject.includes(' ')) {
83
- searchTerms.push(`subject:"${criteria.subject}"`);
81
+ // For subject searches, use proper syntax based on content
82
+ const subjectTerm = criteria.subject.trim();
83
+ if (subjectTerm.includes(' ') || subjectTerm.includes('"')) {
84
+ // If contains spaces or quotes, wrap in quotes and escape any internal quotes
85
+ const escapedSubject = subjectTerm.replace(/"/g, '\\"');
86
+ searchTerms.push(`subject:"${escapedSubject}"`);
84
87
  }
85
88
  else {
86
- searchTerms.push(`subject:${criteria.subject}`);
89
+ // Simple single word, no quotes needed
90
+ searchTerms.push(`subject:${subjectTerm}`);
87
91
  }
88
92
  }
89
93
  return searchTerms.join(' AND ');
@@ -223,6 +227,13 @@ export class MS365Operations {
223
227
  // Build search and filter queries
224
228
  const searchQuery = this.buildSearchQuery(criteria);
225
229
  const filterQuery = this.buildFilterQuery(criteria);
230
+ // Debug logging
231
+ if (searchQuery) {
232
+ logger.log(`Search query: ${searchQuery}`);
233
+ }
234
+ if (filterQuery) {
235
+ logger.log(`Filter query: ${filterQuery}`);
236
+ }
226
237
  let apiCall;
227
238
  let useSearchAPI = !!searchQuery;
228
239
  try {
@@ -233,7 +244,7 @@ export class MS365Operations {
233
244
  apiCall = graphClient.api('/me/messages')
234
245
  .select('id,subject,from,toRecipients,ccRecipients,receivedDateTime,sentDateTime,bodyPreview,isRead,hasAttachments,importance,conversationId,parentFolderId,webLink')
235
246
  .header('ConsistencyLevel', 'eventual')
236
- .search(`"${searchQuery}"`)
247
+ .search(searchQuery)
237
248
  .top(criteria.maxResults || 50);
238
249
  // Can't use filter with search, so we'll need to filter results manually if needed
239
250
  }
@@ -353,6 +364,7 @@ export class MS365Operations {
353
364
  webLink: email.webLink || ''
354
365
  })) || [];
355
366
  // Apply manual filtering for any criteria that couldn't be handled by the filter
367
+ // This includes subject, to, cc, and query filters that need manual processing
356
368
  messages = this.applyManualFiltering(messages, criteria);
357
369
  return {
358
370
  messages,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms365-mcp-server",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
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",