@teamnetwork-nz/m365-mcp-server 1.6.1 → 1.7.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/README.md +5 -1
- package/dist/graph/calendar.js +30 -12
- package/dist/graph/email.js +18 -2
- package/dist/index.js +1 -1
- package/dist/tools/calendar/createEvent.js +3 -1
- package/dist/tools/calendar/deleteEvent.js +22 -0
- package/dist/tools/calendar/findMeetingTimes.js +1 -1
- package/dist/tools/calendar/listEvents.js +11 -3
- package/dist/tools/calendar/updateEvent.js +3 -1
- package/dist/tools/email/getMessage.js +2 -2
- package/dist/tools/registry.js +2 -0
- package/dist/tools/schemas.js +13 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -199,21 +199,25 @@ Operations always target exactly one mailbox per request, either the default or
|
|
|
199
199
|
| Tool | Description |
|
|
200
200
|
|---|---|
|
|
201
201
|
| `list_calendars` | List calendars for a mailbox |
|
|
202
|
-
| `list_events` | Search
|
|
202
|
+
| `list_events` | Search by subject, category, attendee, organizer, show-as, location, or response status. With a date window, recurring events expand into occurrences; without one, recurrence masters are returned |
|
|
203
203
|
| `get_schedule` | Retrieve free/busy grids for one or more attendees before proposing a meeting time |
|
|
204
204
|
| `find_meeting_times` | Ask Graph to rank available meeting slots for required attendees within a time window |
|
|
205
205
|
| `get_event` | Get full event details |
|
|
206
206
|
| `create_event` | Create a new event (non-readonly mailboxes only) |
|
|
207
207
|
| `update_event` | Update an existing event (non-readonly mailboxes only) |
|
|
208
|
+
| `delete_event` | Permanently delete an event or recurring series master (non-readonly mailboxes only) |
|
|
208
209
|
|
|
209
210
|
### Agent search guidance
|
|
210
211
|
|
|
211
212
|
- Start with `relativeDate` (for example `last7days` or `thisMonth`) and `searchAllFolders: true` when the folder is unknown. Use the per-call `timeZone` override when the request's locale differs from server configuration.
|
|
212
213
|
- `sender` accepts a display-name or address substring. Combine it freely with `subject`, `bodySearch`, recipient, flag, and attachment filters. When Microsoft Graph cannot safely combine criteria, `searchMetadata` identifies the local filtering and candidate count.
|
|
214
|
+
- Sender matching is local because Graph cannot reliably combine sender substring matching with the other filters. An empty or partial page does not prove that older matches do not exist: follow `nextPageToken`, especially for searches spanning several months.
|
|
213
215
|
- Use `bodyFormat: "none"` for triage, `"preview"` for screening, and `"text"` or `"html"` only when full content is required. Use `select` to further minimize payloads.
|
|
214
216
|
- Continue a search by passing the returned `nextPageToken` as `pageToken`. Treat the token as opaque and do not edit it.
|
|
215
217
|
- Request `conversationId` (included automatically by the search tool) and call `list_conversation_messages` to inspect a thread. Use `attachmentName` to locate messages before calling the attachment tools.
|
|
216
218
|
- Call `get_schedule` to inspect availability or `find_meeting_times` to get ranked candidate slots before creating a meeting. `list_events` already uses Graph `calendarView`, so recurring occurrences in the requested window are returned individually.
|
|
219
|
+
- Microsoft Graph's ordinary mail API cannot access Exchange Online Archive/In-Place Archive mailboxes. `searchAllFolders` covers folders in the primary mailbox only; Outlook's ordinary Archive folder is included, but the separate Online Archive is not.
|
|
220
|
+
- For `get_message`, use `bodyFormat: "preserveRaw"` when fidelity matters. `text` intentionally asks Graph to convert HTML to plain text for easier agent consumption.
|
|
217
221
|
|
|
218
222
|
### To Do
|
|
219
223
|
|
package/dist/graph/calendar.js
CHANGED
|
@@ -18,11 +18,11 @@ export async function getSchedule(client, email, schedules, startDate, endDate,
|
|
|
18
18
|
throw mapGraphError(err, 'get_schedule');
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
export async function findMeetingTimes(client, email, attendees, startDate, endDate, durationMinutes, maxCandidates, minimumAttendeePercentage) {
|
|
21
|
+
export async function findMeetingTimes(client, email, attendees, startDate, endDate, durationMinutes, maxCandidates, minimumAttendeePercentage, activityDomain) {
|
|
22
22
|
try {
|
|
23
23
|
return await client.api(`/users/${email}/findMeetingTimes`).post({
|
|
24
24
|
attendees: attendees.map((address) => ({ emailAddress: { address }, type: 'required' })),
|
|
25
|
-
timeConstraint: { timeslots: [{ start: { dateTime: startDate, timeZone: 'UTC' }, end: { dateTime: endDate, timeZone: 'UTC' } }] },
|
|
25
|
+
timeConstraint: { activityDomain, timeslots: [{ start: { dateTime: startDate, timeZone: 'UTC' }, end: { dateTime: endDate, timeZone: 'UTC' } }] },
|
|
26
26
|
meetingDuration: `PT${durationMinutes}M`,
|
|
27
27
|
maxCandidates,
|
|
28
28
|
minimumAttendeePercentage,
|
|
@@ -36,16 +36,14 @@ export async function findMeetingTimes(client, email, attendees, startDate, endD
|
|
|
36
36
|
}
|
|
37
37
|
export async function listEvents(client, email, params) {
|
|
38
38
|
try {
|
|
39
|
-
|
|
39
|
+
const hasRange = params.startDate !== undefined && params.endDate !== undefined;
|
|
40
40
|
const basePath = params.calendarId
|
|
41
|
-
? `/users/${email}/calendars/${params.calendarId}
|
|
42
|
-
: `/users/${email}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
.query({
|
|
46
|
-
|
|
47
|
-
endDateTime: params.endDate,
|
|
48
|
-
})
|
|
41
|
+
? `/users/${email}/calendars/${params.calendarId}/${hasRange ? 'calendarView' : 'events'}`
|
|
42
|
+
: `/users/${email}/${hasRange ? 'calendarView' : 'events'}`;
|
|
43
|
+
let request = client.api(basePath);
|
|
44
|
+
if (hasRange)
|
|
45
|
+
request = request.query({ startDateTime: params.startDate, endDateTime: params.endDate });
|
|
46
|
+
const response = await request
|
|
49
47
|
.select(params.select)
|
|
50
48
|
.top(params.maxResults)
|
|
51
49
|
.orderby('start/dateTime')
|
|
@@ -63,6 +61,10 @@ export async function listEvents(client, email, params) {
|
|
|
63
61
|
return false;
|
|
64
62
|
if (params.categories?.length && !contains(event['categories'], params.categories))
|
|
65
63
|
return false;
|
|
64
|
+
if (params.category && !contains(event['categories'], [params.category]))
|
|
65
|
+
return false;
|
|
66
|
+
if (params.subject && !contains(event['subject'], [params.subject]))
|
|
67
|
+
return false;
|
|
66
68
|
if (params.myResponseStatus && event['responseStatus']?.['response'] !== params.myResponseStatus)
|
|
67
69
|
return false;
|
|
68
70
|
return true;
|
|
@@ -77,7 +79,7 @@ export async function getEvent(client, email, eventId) {
|
|
|
77
79
|
try {
|
|
78
80
|
return await client
|
|
79
81
|
.api(`/users/${email}/events/${eventId}`)
|
|
80
|
-
.select('id,subject,body,start,end,location,organizer,attendees,isOnlineMeeting,onlineMeeting,recurrence')
|
|
82
|
+
.select('id,subject,body,start,end,location,organizer,attendees,isOnlineMeeting,onlineMeeting,recurrence,isReminderOn,reminderMinutesBeforeStart,categories,showAs')
|
|
81
83
|
.get();
|
|
82
84
|
}
|
|
83
85
|
catch (err) {
|
|
@@ -111,6 +113,10 @@ export async function createEvent(client, email, params) {
|
|
|
111
113
|
if (attendees.length > 0) {
|
|
112
114
|
body['attendees'] = attendees;
|
|
113
115
|
}
|
|
116
|
+
if (params.isReminderOn !== undefined)
|
|
117
|
+
body['isReminderOn'] = params.isReminderOn;
|
|
118
|
+
if (params.reminderMinutesBeforeStart !== undefined)
|
|
119
|
+
body['reminderMinutesBeforeStart'] = params.reminderMinutesBeforeStart;
|
|
114
120
|
return await client.api(basePath).post(body);
|
|
115
121
|
}
|
|
116
122
|
catch (err) {
|
|
@@ -143,9 +149,21 @@ export async function updateEvent(client, email, eventId, params) {
|
|
|
143
149
|
type: 'required',
|
|
144
150
|
}));
|
|
145
151
|
}
|
|
152
|
+
if (params.isReminderOn !== undefined)
|
|
153
|
+
patch['isReminderOn'] = params.isReminderOn;
|
|
154
|
+
if (params.reminderMinutesBeforeStart !== undefined)
|
|
155
|
+
patch['reminderMinutesBeforeStart'] = params.reminderMinutesBeforeStart;
|
|
146
156
|
return await client.api(`/users/${email}/events/${eventId}`).patch(patch);
|
|
147
157
|
}
|
|
148
158
|
catch (err) {
|
|
149
159
|
throw mapGraphError(err, 'update_event');
|
|
150
160
|
}
|
|
151
161
|
}
|
|
162
|
+
export async function deleteEvent(client, email, eventId) {
|
|
163
|
+
try {
|
|
164
|
+
await client.api(`/users/${email}/events/${eventId}`).delete();
|
|
165
|
+
}
|
|
166
|
+
catch (err) {
|
|
167
|
+
throw mapGraphError(err, 'delete_event');
|
|
168
|
+
}
|
|
169
|
+
}
|
package/dist/graph/email.js
CHANGED
|
@@ -104,13 +104,26 @@ function normalizePage(response) {
|
|
|
104
104
|
export async function listConversationMessages(client, email, conversationId, maxResults) {
|
|
105
105
|
try {
|
|
106
106
|
const escaped = conversationId.replace(/'/g, "''");
|
|
107
|
-
|
|
107
|
+
const base = () => client.api(`/users/${email}/messages`).select('id,conversationId,subject,from,toRecipients,ccRecipients,receivedDateTime,isRead,hasAttachments,bodyPreview').filter(`conversationId eq '${escaped}'`).top(maxResults);
|
|
108
|
+
try {
|
|
109
|
+
return normalizePage(await base().orderby('receivedDateTime asc').get());
|
|
110
|
+
}
|
|
111
|
+
catch (err) {
|
|
112
|
+
const status = err['statusCode'];
|
|
113
|
+
const message = err.message ?? '';
|
|
114
|
+
if (status !== 400 && !/too complex|ErrorInvalidRestriction|InefficientFilter/i.test(message))
|
|
115
|
+
throw err;
|
|
116
|
+
const response = normalizePage(await base().get());
|
|
117
|
+
const values = response['value'] ?? [];
|
|
118
|
+
values.sort((a, b) => String(a['receivedDateTime']).localeCompare(String(b['receivedDateTime'])));
|
|
119
|
+
return { ...response, value: values, searchMetadata: { degradation: 'Graph rejected filter plus orderby; retried without orderby and sorted this page locally.' } };
|
|
120
|
+
}
|
|
108
121
|
}
|
|
109
122
|
catch (err) {
|
|
110
123
|
throw mapGraphError(err, 'list_conversation_messages');
|
|
111
124
|
}
|
|
112
125
|
}
|
|
113
|
-
export async function getMessage(client, email, messageId, includeBody, includeAttachments, includeInternetMessageHeaders) {
|
|
126
|
+
export async function getMessage(client, email, messageId, includeBody, includeAttachments, includeInternetMessageHeaders, bodyFormat) {
|
|
114
127
|
try {
|
|
115
128
|
const selectFields = [
|
|
116
129
|
'id', 'subject', 'from', 'toRecipients', 'ccRecipients',
|
|
@@ -123,6 +136,9 @@ export async function getMessage(client, email, messageId, includeBody, includeA
|
|
|
123
136
|
let req = client
|
|
124
137
|
.api(`/users/${email}/messages/${messageId}`)
|
|
125
138
|
.select(selectFields.join(','));
|
|
139
|
+
if (includeBody && bodyFormat !== 'preserveRaw') {
|
|
140
|
+
req = req.header('Prefer', `outlook.body-content-type="${bodyFormat}"`);
|
|
141
|
+
}
|
|
126
142
|
if (includeAttachments) {
|
|
127
143
|
// Expand attachments inline — avoids a second round-trip for the caller
|
|
128
144
|
req = req.expand('attachments($select=id,name,contentType,size,isInline)');
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ async function main() {
|
|
|
18
18
|
const createConfiguredServer = () => {
|
|
19
19
|
const server = new McpServer({
|
|
20
20
|
name: '@teamnetwork/m365-mcp-server',
|
|
21
|
-
version: '1.
|
|
21
|
+
version: '1.7.0',
|
|
22
22
|
}, {
|
|
23
23
|
instructions: `
|
|
24
24
|
Microsoft 365 MCP server — email, calendar, and To Do via the Microsoft Graph API.
|
|
@@ -7,7 +7,7 @@ import { logger } from '../../utils/logger.js';
|
|
|
7
7
|
import { resolveMailbox } from '../../utils/resolveMailbox.js';
|
|
8
8
|
import { toCalendarDatetime, localizeResponseDates } from '../../utils/datetime.js';
|
|
9
9
|
export function registerCreateEvent(server, config, auth) {
|
|
10
|
-
server.tool('create_event', 'Create a
|
|
10
|
+
server.tool('create_event', 'Create a calendar event, optionally with attendees, an online meeting, and an Outlook reminder. Set isReminderOn and reminderMinutesBeforeStart together when a reminder is required. Requires a writable mailbox.', CreateEventSchema.shape, async (params) => {
|
|
11
11
|
try {
|
|
12
12
|
const resolved = resolveMailbox(config, params.accountId, params.mailbox);
|
|
13
13
|
logger.info('create_event', { accountId: resolved.accountId, mailbox: resolved.mailbox });
|
|
@@ -27,6 +27,8 @@ export function registerCreateEvent(server, config, auth) {
|
|
|
27
27
|
...(params.body !== undefined && { body: params.body }),
|
|
28
28
|
...(params.location !== undefined && { location: params.location }),
|
|
29
29
|
...(params.attendees !== undefined && { attendees: params.attendees }),
|
|
30
|
+
...(params.isReminderOn !== undefined && { isReminderOn: params.isReminderOn }),
|
|
31
|
+
...(params.reminderMinutesBeforeStart !== undefined && { reminderMinutesBeforeStart: params.reminderMinutesBeforeStart }),
|
|
30
32
|
});
|
|
31
33
|
return { content: [{ type: 'text', text: JSON.stringify(localizeResponseDates(result), null, 2) }] };
|
|
32
34
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DeleteEventSchema } from '../schemas.js';
|
|
2
|
+
import { createGraphClient } from '../../graph/clientFactory.js';
|
|
3
|
+
import { deleteEvent } from '../../graph/calendar.js';
|
|
4
|
+
import { assertWritable } from '../../middleware/readonlyGuard.js';
|
|
5
|
+
import { resolveMailbox } from '../../utils/resolveMailbox.js';
|
|
6
|
+
import { errorResponse } from '../../utils/errors.js';
|
|
7
|
+
import { logger } from '../../utils/logger.js';
|
|
8
|
+
export function registerDeleteEvent(server, config, auth) {
|
|
9
|
+
server.tool('delete_event', 'Permanently delete a calendar event by ID. Deleting a recurring-series master removes the series. This is destructive and requires a writable mailbox; confirm user intent before calling.', DeleteEventSchema.shape, async (params) => {
|
|
10
|
+
try {
|
|
11
|
+
const resolved = resolveMailbox(config, params.accountId, params.mailbox);
|
|
12
|
+
assertWritable(config, resolved.accountId, resolved.mailbox);
|
|
13
|
+
const client = createGraphClient(await auth.getAccessToken(resolved.accountId));
|
|
14
|
+
await deleteEvent(client, resolved.mailbox, params.eventId);
|
|
15
|
+
return { content: [{ type: 'text', text: JSON.stringify({ success: true, deletedEventId: params.eventId }) }] };
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
logger.error('delete_event failed', { accountId: params.accountId, mailbox: params.mailbox });
|
|
19
|
+
return errorResponse(err);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -11,7 +11,7 @@ export function registerFindMeetingTimes(server, config, auth) {
|
|
|
11
11
|
const resolved = resolveMailbox(config, params.accountId, params.mailbox);
|
|
12
12
|
assertMailboxConfigured(config, resolved.accountId, resolved.mailbox);
|
|
13
13
|
const client = createGraphClient(await auth.getAccessToken(resolved.accountId));
|
|
14
|
-
const result = await findMeetingTimes(client, resolved.mailbox, params.attendees, toUtcIso(params.startDate, params.timeZone), toUtcIso(params.endDate, params.timeZone), params.durationMinutes, params.maxCandidates, params.minimumAttendeePercentage);
|
|
14
|
+
const result = await findMeetingTimes(client, resolved.mailbox, params.attendees, toUtcIso(params.startDate, params.timeZone), toUtcIso(params.endDate, params.timeZone), params.durationMinutes, params.maxCandidates, params.minimumAttendeePercentage, params.activityDomain);
|
|
15
15
|
return { content: [{ type: 'text', text: JSON.stringify(localizeResponseDates(result), null, 2) }] };
|
|
16
16
|
}
|
|
17
17
|
catch (err) {
|
|
@@ -8,7 +8,7 @@ import { resolveSelect, SelectValidationError, EVENT_SELECT_FIELDS, EVENT_SELECT
|
|
|
8
8
|
import { resolveMailbox } from '../../utils/resolveMailbox.js';
|
|
9
9
|
import { toUtcIso, localizeResponseDates } from '../../utils/datetime.js';
|
|
10
10
|
export function registerListEvents(server, config, auth) {
|
|
11
|
-
server.tool('list_events', 'Search calendar
|
|
11
|
+
server.tool('list_events', 'Search calendar events by subject, category, attendee, organizer, show-as, location, or response status. Supply both startDate and endDate to expand recurring occurrences in that window; omit both to browse event objects including recurrence masters.', ListEventsSchema.shape, async (params) => {
|
|
12
12
|
try {
|
|
13
13
|
const resolved = resolveMailbox(config, params.accountId, params.mailbox);
|
|
14
14
|
logger.info('list_events', { accountId: resolved.accountId, mailbox: resolved.mailbox });
|
|
@@ -24,6 +24,10 @@ export function registerListEvents(server, config, auth) {
|
|
|
24
24
|
requested.push('showAs');
|
|
25
25
|
if (params.categories && !requested.includes('categories'))
|
|
26
26
|
requested.push('categories');
|
|
27
|
+
if (params.category && !requested.includes('categories'))
|
|
28
|
+
requested.push('categories');
|
|
29
|
+
if (params.subject && !requested.includes('subject'))
|
|
30
|
+
requested.push('subject');
|
|
27
31
|
if (params.myResponseStatus && !requested.includes('responseStatus'))
|
|
28
32
|
requested.push('responseStatus');
|
|
29
33
|
select = resolveSelect(requested, EVENT_SELECT_FIELDS, EVENT_SELECT_DEFAULT);
|
|
@@ -36,17 +40,21 @@ export function registerListEvents(server, config, auth) {
|
|
|
36
40
|
}
|
|
37
41
|
const token = await auth.getAccessToken(resolved.accountId);
|
|
38
42
|
const client = createGraphClient(token);
|
|
43
|
+
if ((params.startDate === undefined) !== (params.endDate === undefined))
|
|
44
|
+
throw new ToolError('startDate and endDate must be supplied together, or both omitted', 'INVALID_DATE_RANGE');
|
|
39
45
|
const result = await listEvents(client, resolved.mailbox, {
|
|
40
|
-
startDate: toUtcIso(params.startDate, params.timeZone),
|
|
41
|
-
endDate: toUtcIso(params.endDate, params.timeZone),
|
|
42
46
|
maxResults: params.maxResults,
|
|
43
47
|
select,
|
|
48
|
+
...(params.startDate !== undefined && { startDate: toUtcIso(params.startDate, params.timeZone) }),
|
|
49
|
+
...(params.endDate !== undefined && { endDate: toUtcIso(params.endDate, params.timeZone) }),
|
|
44
50
|
...(params.calendarId !== undefined && { calendarId: params.calendarId }),
|
|
45
51
|
...(params.attendees !== undefined && { attendees: params.attendees }),
|
|
46
52
|
...(params.organizer !== undefined && { organizer: params.organizer }),
|
|
47
53
|
...(params.showAs !== undefined && { showAs: params.showAs }),
|
|
48
54
|
...(params.location !== undefined && { location: params.location }),
|
|
49
55
|
...(params.categories !== undefined && { categories: params.categories }),
|
|
56
|
+
...(params.category !== undefined && { category: params.category }),
|
|
57
|
+
...(params.subject !== undefined && { subject: params.subject }),
|
|
50
58
|
...(params.myResponseStatus !== undefined && { myResponseStatus: params.myResponseStatus }),
|
|
51
59
|
});
|
|
52
60
|
return { content: [{ type: 'text', text: JSON.stringify(localizeResponseDates(result), null, 2) }] };
|
|
@@ -7,7 +7,7 @@ import { logger } from '../../utils/logger.js';
|
|
|
7
7
|
import { resolveMailbox } from '../../utils/resolveMailbox.js';
|
|
8
8
|
import { toCalendarDatetime, localizeResponseDates } from '../../utils/datetime.js';
|
|
9
9
|
export function registerUpdateEvent(server, config, auth) {
|
|
10
|
-
server.tool('update_event', 'Update
|
|
10
|
+
server.tool('update_event', 'Update only the supplied calendar-event fields, including enabling/disabling reminders and changing reminder lead time. Requires a writable mailbox.', UpdateEventSchema.shape, async (params) => {
|
|
11
11
|
try {
|
|
12
12
|
const resolved = resolveMailbox(config, params.accountId, params.mailbox);
|
|
13
13
|
logger.info('update_event', { accountId: resolved.accountId, mailbox: resolved.mailbox });
|
|
@@ -29,6 +29,8 @@ export function registerUpdateEvent(server, config, auth) {
|
|
|
29
29
|
: {}),
|
|
30
30
|
...(params.location !== undefined && { location: params.location }),
|
|
31
31
|
...(params.attendees !== undefined && { attendees: params.attendees }),
|
|
32
|
+
...(params.isReminderOn !== undefined && { isReminderOn: params.isReminderOn }),
|
|
33
|
+
...(params.reminderMinutesBeforeStart !== undefined && { reminderMinutesBeforeStart: params.reminderMinutesBeforeStart }),
|
|
32
34
|
});
|
|
33
35
|
return { content: [{ type: 'text', text: JSON.stringify(localizeResponseDates(result), null, 2) }] };
|
|
34
36
|
}
|
|
@@ -7,14 +7,14 @@ import { logger } from '../../utils/logger.js';
|
|
|
7
7
|
import { resolveMailbox } from '../../utils/resolveMailbox.js';
|
|
8
8
|
import { localizeResponseDates } from '../../utils/datetime.js';
|
|
9
9
|
export function registerGetMessage(server, config, auth) {
|
|
10
|
-
server.tool('get_message', 'Get
|
|
10
|
+
server.tool('get_message', 'Get one email by ID. Set includeBody, includeAttachments, or includeInternetMessageHeaders as needed. bodyFormat preserveRaw leaves Graph content unchanged; text requests plain text; html requests HTML.', GetMessageSchema.shape, async (params) => {
|
|
11
11
|
try {
|
|
12
12
|
const resolved = resolveMailbox(config, params.accountId, params.mailbox);
|
|
13
13
|
logger.info('get_message', { accountId: resolved.accountId, mailbox: resolved.mailbox });
|
|
14
14
|
assertMailboxConfigured(config, resolved.accountId, resolved.mailbox);
|
|
15
15
|
const token = await auth.getAccessToken(resolved.accountId);
|
|
16
16
|
const client = createGraphClient(token);
|
|
17
|
-
const result = await getMessage(client, resolved.mailbox, params.messageId, params.includeBody, params.includeAttachments, params.includeInternetMessageHeaders);
|
|
17
|
+
const result = await getMessage(client, resolved.mailbox, params.messageId, params.includeBody, params.includeAttachments, params.includeInternetMessageHeaders, params.bodyFormat);
|
|
18
18
|
return { content: [{ type: 'text', text: JSON.stringify(localizeResponseDates(result), null, 2) }] };
|
|
19
19
|
}
|
|
20
20
|
catch (err) {
|
package/dist/tools/registry.js
CHANGED
|
@@ -17,6 +17,7 @@ import { registerCreateEvent } from './calendar/createEvent.js';
|
|
|
17
17
|
import { registerUpdateEvent } from './calendar/updateEvent.js';
|
|
18
18
|
import { registerGetSchedule } from './calendar/getSchedule.js';
|
|
19
19
|
import { registerFindMeetingTimes } from './calendar/findMeetingTimes.js';
|
|
20
|
+
import { registerDeleteEvent } from './calendar/deleteEvent.js';
|
|
20
21
|
// Todo tools
|
|
21
22
|
import { registerListTodoLists } from './todo/listTodoLists.js';
|
|
22
23
|
import { registerListTodoTasks } from './todo/listTodoTasks.js';
|
|
@@ -71,6 +72,7 @@ function registerCalendarTools(server, config, auth) {
|
|
|
71
72
|
registerUpdateEvent(server, config, auth);
|
|
72
73
|
registerGetSchedule(server, config, auth);
|
|
73
74
|
registerFindMeetingTimes(server, config, auth);
|
|
75
|
+
registerDeleteEvent(server, config, auth);
|
|
74
76
|
}
|
|
75
77
|
function registerTodoTools(server, config, auth) {
|
|
76
78
|
registerListTodoLists(server, config, auth);
|
package/dist/tools/schemas.js
CHANGED
|
@@ -38,6 +38,7 @@ export const GetMessageSchema = AccountMailbox.extend({
|
|
|
38
38
|
includeBody: z.boolean().default(true).describe('Whether to include the full message body in the response'),
|
|
39
39
|
includeAttachments: z.boolean().default(false).describe('Whether to expand and include attachment metadata in the response'),
|
|
40
40
|
includeInternetMessageHeaders: z.boolean().default(false).describe('Whether to include raw internet message headers (e.g. Message-ID, X-Mailer, received chain). Useful for spam analysis and routing diagnostics.'),
|
|
41
|
+
bodyFormat: z.enum(['preserveRaw', 'text', 'html']).default('preserveRaw').describe('Body representation when includeBody is true. preserveRaw sends no conversion preference; text asks Graph for plain text; html asks for HTML.'),
|
|
41
42
|
});
|
|
42
43
|
export const ListMessageAttachmentsSchema = AccountMailbox.extend({
|
|
43
44
|
messageId: z.string().describe('The message ID to list attachments for'),
|
|
@@ -69,14 +70,16 @@ export const MoveMessageSchema = AccountMailbox.extend({
|
|
|
69
70
|
export const ListCalendarsSchema = AccountMailbox;
|
|
70
71
|
export const ListEventsSchema = AccountMailbox.extend({
|
|
71
72
|
calendarId: z.string().optional().describe('Calendar ID. Omit to use the default calendar.'),
|
|
72
|
-
startDate: z.string().describe('Start of the date range.
|
|
73
|
-
endDate: z.string().describe('End of the date range.
|
|
73
|
+
startDate: z.string().optional().describe('Start of the date range. Supply with endDate to expand recurring occurrences. Omit both to browse calendar event objects, including recurrence masters.'),
|
|
74
|
+
endDate: z.string().optional().describe('End of the date range. Supply with startDate; omit both for an unbounded event-object listing.'),
|
|
74
75
|
timeZone: z.string().optional().describe('IANA timezone override for interpreting this request, e.g. Pacific/Auckland.'),
|
|
75
76
|
attendees: z.array(z.string()).optional().describe('Keep events where an attendee name/address contains any supplied value.'),
|
|
76
77
|
organizer: z.string().optional().describe('Keep events whose organizer name/address contains this substring.'),
|
|
77
78
|
showAs: z.enum(['free', 'tentative', 'busy', 'oof', 'workingElsewhere', 'unknown']).optional(),
|
|
78
79
|
location: z.string().optional().describe('Case-insensitive location substring.'),
|
|
79
80
|
categories: z.array(z.string()).optional().describe('Keep events carrying any supplied Outlook category.'),
|
|
81
|
+
category: z.string().optional().describe('Convenience alias: keep events carrying a category containing this value. Can be combined with categories.'),
|
|
82
|
+
subject: z.string().optional().describe('Case-insensitive event subject substring.'),
|
|
80
83
|
myResponseStatus: z.enum(['none', 'organizer', 'tentativelyAccepted', 'accepted', 'declined', 'notResponded']).optional(),
|
|
81
84
|
maxResults: z.number().int().min(1).max(100).default(25),
|
|
82
85
|
select: z.array(z.string()).optional().describe('Fields to return. Omit for defaults (subject, start, end, location, isOnlineMeeting). Valid fields: id, subject, start, end, location, isOnlineMeeting, onlineMeetingUrl, organizer, attendees, body, bodyPreview, categories, isRecurring, recurrence, sensitivity, showAs, responseStatus, uid'),
|
|
@@ -100,6 +103,7 @@ export const FindMeetingTimesSchema = AccountMailbox.extend({
|
|
|
100
103
|
timeZone: z.string().optional().describe('IANA timezone for naive inputs, e.g. Pacific/Auckland.'),
|
|
101
104
|
maxCandidates: z.number().int().min(1).max(20).default(5),
|
|
102
105
|
minimumAttendeePercentage: z.number().min(0).max(100).default(100).describe('100 requires every attendee to be available.'),
|
|
106
|
+
activityDomain: z.enum(['work', 'personal', 'unrestricted']).default('work').describe('work restricts suggestions to work hours; personal includes weekends; unrestricted permits any hour/day.'),
|
|
103
107
|
});
|
|
104
108
|
export const GetEventSchema = AccountMailbox.extend({
|
|
105
109
|
eventId: z.string().describe('The event ID'),
|
|
@@ -116,6 +120,8 @@ export const CreateEventSchema = AccountMailbox.extend({
|
|
|
116
120
|
location: z.string().optional().describe('Location display name'),
|
|
117
121
|
attendees: z.array(z.string().email()).optional().describe('List of attendee email addresses'),
|
|
118
122
|
isOnlineMeeting: z.boolean().default(false).describe('Whether to create an online meeting link'),
|
|
123
|
+
isReminderOn: z.boolean().optional().describe('Enable or disable the Outlook reminder.'),
|
|
124
|
+
reminderMinutesBeforeStart: z.number().int().min(0).optional().describe('Minutes before the event start when the reminder fires.'),
|
|
119
125
|
});
|
|
120
126
|
export const UpdateEventSchema = AccountMailbox.extend({
|
|
121
127
|
eventId: z.string().describe('The ID of the event to update'),
|
|
@@ -127,6 +133,11 @@ export const UpdateEventSchema = AccountMailbox.extend({
|
|
|
127
133
|
timeZone: z.string().optional().describe('IANA timezone name override. Defaults to the server\'s configured timezone (DATETIME_FORMAT env var).'),
|
|
128
134
|
location: z.string().optional(),
|
|
129
135
|
attendees: z.array(z.string().email()).optional(),
|
|
136
|
+
isReminderOn: z.boolean().optional().describe('Enable or disable the Outlook reminder.'),
|
|
137
|
+
reminderMinutesBeforeStart: z.number().int().min(0).optional().describe('Minutes before the event start when the reminder fires.'),
|
|
138
|
+
});
|
|
139
|
+
export const DeleteEventSchema = AccountMailbox.extend({
|
|
140
|
+
eventId: z.string().min(1).describe('The event ID to delete. Deleting a recurring series master deletes its occurrences.'),
|
|
130
141
|
});
|
|
131
142
|
// ── Todo tools ─────────────────────────────────────────────────────────────
|
|
132
143
|
const TodoBase = AccountMailbox.extend({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamnetwork-nz/m365-mcp-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "MCP server for Microsoft 365 — Email, Calendar, To Do, SharePoint document libraries, and Teams — using client credentials (app-only auth). Supports multiple accounts, shared mailboxes, per-mailbox read-only access, and grant-based SharePoint access control.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|