UNPKG

@softeria/ms-365-mcp-server

Version:

A Model Context Protocol (MCP) server for interacting with Microsoft 365 and Office services through the Graph API

94 lines (93 loc) 2.69 kB
const TOOL_CATEGORIES = { mail: { name: "mail", pattern: /mail|attachment|draft|download-bytes/i, description: "Email operations (read, send, manage folders, attachments)" }, calendar: { name: "calendar", pattern: /calendar|event|schedule|meeting/i, description: "Calendar and event management" }, files: { name: "files", pattern: /drive|file|upload|download|folder|item/i, description: "OneDrive file and folder operations" }, personal: { name: "personal", pattern: /mail|calendar|drive|contact|todo|onenote|attachment|draft|event|file|folder|search|query|download-bytes|parse-teams-url/i, description: "Personal productivity tools (mail, calendar, files, contacts, tasks, notes, search)" }, work: { name: "work", pattern: /team|channel|chat|sharepoint|planner|site|list|shared|search|query|download-bytes|schedule|meeting/i, description: "Organization/work tools (Teams, SharePoint, shared mailboxes, search)", requiresOrgMode: true }, excel: { name: "excel", pattern: /excel|worksheet|workbook|range|chart/i, description: "Excel spreadsheet operations" }, contacts: { name: "contacts", pattern: /contact/i, description: "Outlook contacts management" }, tasks: { name: "tasks", pattern: /todo|planner|task/i, description: "Task and planning tools (To Do, Planner)" }, onenote: { name: "onenote", pattern: /onenote|notebook|section|page/i, description: "OneNote notebook operations" }, search: { name: "search", pattern: /search|query/i, description: "Microsoft Search capabilities" }, users: { name: "users", pattern: /user|list-users|download-bytes/i, description: "User directory access", requiresOrgMode: true }, all: { name: "all", pattern: /.*/, description: "All available tools" } }; function getCombinedPresetPattern(presets) { const patterns = presets.map((preset) => { const category = TOOL_CATEGORIES[preset]; if (!category) { throw new Error( `Unknown preset: ${preset}. Available presets: ${Object.keys(TOOL_CATEGORIES).join(", ")}` ); } return category.pattern.source; }); return patterns.join("|"); } function listPresets() { return Object.values(TOOL_CATEGORIES).map((category) => ({ name: category.name, description: category.description, requiresOrgMode: category.requiresOrgMode })); } function presetRequiresOrgMode(preset) { const category = TOOL_CATEGORIES[preset]; return category?.requiresOrgMode || false; } export { TOOL_CATEGORIES, getCombinedPresetPattern, listPresets, presetRequiresOrgMode };