MCP server providing Microsoft Outlook integration via Graph API: - Email: list, search, read, send, thread reconstruction - Calendar: list, create, decline, cancel, delete events - Folders: list, create, move emails - Inbox rules: list, create, reorder - MSAL device code flow auth with persistent token cache - Test mode with mock data - Comprehensive README with setup, config, and tool reference 20 MCP tools across 5 modules. Node.js >= 14. MIT license.
131 lines
3.6 KiB
JavaScript
131 lines
3.6 KiB
JavaScript
/**
|
|
* Calendar module for Outlook MCP server
|
|
*/
|
|
const handleListEvents = require('./list');
|
|
const handleDeclineEvent = require('./decline');
|
|
const handleCreateEvent = require('./create');
|
|
const handleCancelEvent = require('./cancel');
|
|
const handleDeleteEvent = require('./delete');
|
|
|
|
// Calendar tool definitions
|
|
const calendarTools = [
|
|
{
|
|
name: "list-events",
|
|
description: "List calendar events. Defaults to upcoming events from now. Use startDate/endDate to query a specific date range including past events (e.g. to reconstruct what was scheduled on a given day).",
|
|
inputSchema: {
|
|
type: "object",
|
|
properties: {
|
|
count: {
|
|
anyOf: [{ type: "number" }, { type: "string" }],
|
|
description: "Number of events to retrieve (default: 10, max: 500). WARNING: Large counts may consume significant context tokens."
|
|
},
|
|
startDate: {
|
|
type: "string",
|
|
description: "Start of date range (ISO 'YYYY-MM-DD' or full ISO 8601 datetime). Defaults to now if omitted."
|
|
},
|
|
endDate: {
|
|
type: "string",
|
|
description: "End of date range (ISO 'YYYY-MM-DD' or full ISO 8601 datetime). To query a single day set startDate and endDate to the same date."
|
|
}
|
|
},
|
|
required: []
|
|
},
|
|
handler: handleListEvents
|
|
},
|
|
{
|
|
name: "decline-event",
|
|
description: "Declines a calendar event",
|
|
inputSchema: {
|
|
type: "object",
|
|
properties: {
|
|
eventId: {
|
|
type: "string",
|
|
description: "The ID of the event to decline"
|
|
},
|
|
comment: {
|
|
type: "string",
|
|
description: "Optional comment for declining the event"
|
|
}
|
|
},
|
|
required: ["eventId"]
|
|
},
|
|
handler: handleDeclineEvent
|
|
},
|
|
{
|
|
name: "create-event",
|
|
description: "Creates a new calendar event",
|
|
inputSchema: {
|
|
type: "object",
|
|
properties: {
|
|
subject: {
|
|
type: "string",
|
|
description: "The subject of the event"
|
|
},
|
|
start: {
|
|
type: "string",
|
|
description: "The start time of the event in ISO 8601 format"
|
|
},
|
|
end: {
|
|
type: "string",
|
|
description: "The end time of the event in ISO 8601 format"
|
|
},
|
|
attendees: {
|
|
type: "array",
|
|
items: {
|
|
type: "string"
|
|
},
|
|
description: "List of attendee email addresses"
|
|
},
|
|
body: {
|
|
type: "string",
|
|
description: "Optional body content for the event"
|
|
}
|
|
},
|
|
required: ["subject", "start", "end"]
|
|
},
|
|
handler: handleCreateEvent
|
|
},
|
|
{
|
|
name: "cancel-event",
|
|
description: "Cancels a calendar event",
|
|
inputSchema: {
|
|
type: "object",
|
|
properties: {
|
|
eventId: {
|
|
type: "string",
|
|
description: "The ID of the event to cancel"
|
|
},
|
|
comment: {
|
|
type: "string",
|
|
description: "Optional comment for cancelling the event"
|
|
}
|
|
},
|
|
required: ["eventId"]
|
|
},
|
|
handler: handleCancelEvent
|
|
},
|
|
{
|
|
name: "delete-event",
|
|
description: "Deletes a calendar event",
|
|
inputSchema: {
|
|
type: "object",
|
|
properties: {
|
|
eventId: {
|
|
type: "string",
|
|
description: "The ID of the event to delete"
|
|
}
|
|
},
|
|
required: ["eventId"]
|
|
},
|
|
handler: handleDeleteEvent
|
|
}
|
|
];
|
|
|
|
module.exports = {
|
|
calendarTools,
|
|
handleListEvents,
|
|
handleDeclineEvent,
|
|
handleCreateEvent,
|
|
handleCancelEvent,
|
|
handleDeleteEvent
|
|
};
|