M365 Assistant MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@M365 Assistant MCP Server send an email to Sarah about the meeting agenda"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
M365 Assistant MCP Server
A comprehensive MCP (Model Context Protocol) server that connects Claude with Microsoft 365 services through the Microsoft Graph API and Power Automate API.
Supported Services
Outlook - Email, calendar, folders, and rules
OneDrive - Files, folders, search, and sharing
Power Automate - Flows, environments, and run history
Related MCP server: Outlook MCP Server
Directory Structure
├── index.js # Main entry point
├── config.js # Configuration settings
├── auth/ # Authentication modules
│ ├── index.js # Authentication exports
│ ├── token-manager.js # Token storage and refresh (Graph + Flow)
│ └── tools.js # Auth-related tools
├── calendar/ # Calendar functionality
│ ├── index.js # Calendar exports
│ ├── list.js # List events
│ ├── create.js # Create event
│ ├── delete.js # Delete event
│ ├── cancel.js # Cancel event
│ ├── accept.js # Accept event
│ └── decline.js # Decline event
├── email/ # Email functionality
│ ├── index.js # Email exports
│ ├── list.js # List emails
│ ├── search.js # Search emails
│ ├── read.js # Read email
│ ├── send.js # Send email
│ └── mark-as-read.js # Mark email read/unread
├── folder/ # Folder functionality
│ ├── index.js # Folder exports
│ ├── list.js # List folders
│ ├── create.js # Create folder
│ └── move.js # Move emails
├── rules/ # Email rules functionality
│ ├── index.js # Rules exports
│ ├── list.js # List rules
│ └── create.js # Create rule
├── onedrive/ # OneDrive functionality
│ ├── index.js # OneDrive exports
│ ├── list.js # List files/folders
│ ├── search.js # Search files
│ ├── download.js # Get download URL
│ ├── upload.js # Simple upload (<4MB)
│ ├── upload-large.js # Chunked upload (>4MB)
│ ├── share.js # Create sharing link
│ └── folder.js # Create/delete folders
├── power-automate/ # Power Automate functionality
│ ├── index.js # Power Automate exports
│ ├── flow-api.js # Flow API client
│ ├── list-environments.js # List environments
│ ├── list-flows.js # List flows
│ ├── run-flow.js # Trigger flow
│ ├── list-runs.js # Run history
│ └── toggle-flow.js # Enable/disable flow
└── utils/ # Utility functions
├── graph-api.js # Microsoft Graph API helper
├── odata-helpers.js # OData query building
└── mock-data.js # Test mode dataFeatures
Authentication: OAuth 2.0 authentication with Microsoft Graph API (+ Flow API for Power Automate)
Email Management: List, search, read, send, and organize emails
Calendar Management: List, create, accept, decline, and delete calendar events
OneDrive Integration: List, search, upload, download, and share files
Power Automate: List environments/flows, trigger flows, view run history
Modular Structure: Clean separation of concerns for maintainability
Test Mode: Simulated responses for testing without real API calls
Available Tools
Outlook (Email & Calendar)
Tool | Description |
| List recent emails from inbox |
| Search emails with filters |
| Read email content |
| Send a new email |
| Mark email as read/unread |
| List calendar events |
| Create calendar event |
| Accept event invitation |
| Decline event invitation |
| Delete calendar event |
| List mail folders |
| Create mail folder |
| Move emails between folders |
| List inbox rules |
| Create inbox rule |
OneDrive
Tool | Description |
| List files in a path |
| Search files by query |
| Get download URL |
| Upload small file (<4MB) |
| Chunked upload (>4MB) |
| Create sharing link |
| Create folder |
| Delete file or folder |
Power Automate
Tool | Description |
| List Power Platform environments |
| List flows in environment |
| Trigger a manual flow |
| Get flow run history |
| Enable/disable a flow |
Quick Start
Install dependencies:
npm installAzure setup: Register app in Azure Portal (see detailed steps below)
Configure environment: Copy
.env.exampleto.envand add your Azure credentialsConfigure Claude: Update your Claude Desktop config with the server path
Start auth server:
npm run auth-serverAuthenticate: Use the authenticate tool in Claude to get the OAuth URL
Start using: Access your M365 data through Claude!
Installation
Prerequisites
Node.js 14.0.0 or higher
npm or yarn package manager
Azure account for app registration
Install Dependencies
npm installAzure App Registration & Configuration
App Registration
Open Azure Portal
Search for "App registrations"
Click "New registration"
Name: "M365 MCP Server"
Account type: "Accounts in any organizational directory and personal Microsoft accounts"
Redirect URI: Web →
http://localhost:3333/auth/callbackClick "Register"
Copy the "Application (client) ID" for your
.envfile
App Permissions
Go to "API permissions" under Manage
Click "Add a permission" → "Microsoft Graph" → "Delegated permissions"
Add these permissions:
offline_accessUser.ReadMail.Read,Mail.ReadWrite,Mail.SendCalendars.Read,Calendars.ReadWriteFiles.Read,Files.ReadWrite
Click "Add permissions"
For Power Automate (optional):
Requires additional Azure AD configuration with Flow API scope
See Power Automate section below for details
Client Secret
Go to "Certificates & secrets" → "Client secrets"
Click "New client secret"
Add description and select expiration
Copy the VALUE (not the Secret ID)
Configuration
1. Environment Variables
cp .env.example .envEdit .env:
# Get these values from Azure Portal > App Registrations > Your App
MS_CLIENT_ID=your-application-client-id-here
MS_CLIENT_SECRET=your-client-secret-VALUE-here
MS_TENANT_ID=your-tenant-id-here
USE_TEST_MODE=falseImportant Notes:
Use
MS_CLIENT_IDandMS_CLIENT_SECRETin the.envfileSet
MS_TENANT_IDfor single-tenant apps to avoid/commonendpoint errorsFor Claude Desktop config, you'll use
OUTLOOK_CLIENT_IDandOUTLOOK_CLIENT_SECRETAlways use the client secret VALUE, never the Secret ID
2. Claude Desktop Configuration
Add to your Claude Desktop config:
{
"mcpServers": {
"m365-assistant": {
"command": "node",
"args": ["/path/to/outlook-mcp/index.js"],
"env": {
"USE_TEST_MODE": "false",
"OUTLOOK_CLIENT_ID": "your-client-id",
"OUTLOOK_CLIENT_SECRET": "your-client-secret"
}
}
}
}Authentication
Graph API (Outlook + OneDrive)
Start auth server:
npm run auth-serverUse the
authenticatetool in ClaudeVisit the provided URL and sign in
Tokens saved to
~/.outlook-mcp-tokens.json
Power Automate (Optional)
Power Automate requires a separate token with the Flow API scope. Configure additional Azure AD permissions for https://service.flow.microsoft.com//.default scope.
Limitations:
Only solution-aware flows are accessible
Only manual trigger flows can be run via API
Requires environment ID for most operations
Troubleshooting
Common Issues
"Cannot find module"
npm install"Port 3333 in use"
npx kill-port 3333
npm run auth-server"Invalid client secret" (AADSTS7000215)
Use the secret VALUE, not the Secret ID
"Authentication required"
Delete
~/.outlook-mcp-tokens.jsonand re-authenticate
Testing
# Run with MCP Inspector
npm run inspect
# Run in test mode (mock data)
npm run test-mode
# Run Jest tests
npm testExtending the Server
Create new module directory
Implement tool handlers in separate files
Export tool definitions from module index
Import and add to
TOOLSarray inindex.js
Available Tools
34 toolsaboutB
Returns information about this M365 Assistant server
Inputs: no named parameters.
authenticateC
Authenticate with Microsoft Graph API to access Outlook data
Inputs: force.
cancel-eventC
Cancels a calendar event
Inputs: eventId (required), comment.
check-auth-statusB
Check the current authentication status with Microsoft Graph API
Inputs: no named parameters.
create-eventC
Creates a new calendar event
Inputs: end (required), start (required), subject (required), body, +1 more.
create-folderC
Creates a new mail folder
Inputs: name (required), parentFolder.
create-ruleC
Creates a new inbox rule
Inputs: name (required), sequence, isEnabled, markAsRead, +4 more.
decline-eventC
Declines a calendar event
Inputs: eventId (required), comment.
delete-emailA
Deletes an email by moving it to Deleted Items (trash). Use permanent=true to hard delete.
Inputs: id (required), permanent.
delete-eventC
Deletes a calendar event
Inputs: eventId (required).
draft-emailA
Creates and saves an email draft in Outlook
Inputs: cc, to, bcc, body, +2 more.
edit-rule-sequenceC
Changes the execution order of an existing inbox rule
Inputs: ruleName (required), sequence (required).
flow-listC
List flows in a Power Platform environment
Inputs: environmentId (required).
flow-list-environmentsB
List available Power Platform environments
Inputs: no named parameters.
flow-list-runsC
Get run history for a flow
Inputs: flowId (required), environmentId (required), count.
flow-runC
Trigger a manual flow run
Inputs: flowId (required), environmentId (required), inputs.
flow-toggleB
Enable or disable a flow
Inputs: flowId (required), environmentId (required), enable.
list-emailsC
Lists recent emails from your inbox
Inputs: count, folder.
list-eventsB
Lists upcoming events from your calendar
Inputs: count, endDateTime, startDateTime.
list-foldersC
Lists mail folders in your Outlook account
Inputs: includeChildren, includeItemCounts.
list-rulesC
Lists inbox rules in your Outlook account
Inputs: includeDetails.
mark-as-readC
Marks an email as read or unread
Inputs: id (required), isRead.
move-emailsC
Moves emails from one folder to another
Inputs: emailIds (required), targetFolder (required), sourceFolder.
onedrive-create-folderC
Create a new folder in OneDrive
Inputs: name (required), path.
onedrive-deleteB
Delete a file or folder from OneDrive
Inputs: path, itemId.
onedrive-downloadA
Get a download URL for a file in OneDrive. Either 'itemId' or 'path' must be provided.
Inputs: path, itemId.
onedrive-listB
List files and folders in OneDrive at a specific path
Inputs: path, count.
onedrive-searchC
Search for files in OneDrive by name or content
Inputs: query (required), count.
onedrive-uploadB
Upload a small file (< 4MB) to OneDrive
Inputs: path (required), content (required), conflictBehavior.
onedrive-upload-largeA
Upload a large file (> 4MB) to OneDrive using chunked upload
Inputs: path (required), content (required), conflictBehavior.
read-emailA
Reads the content of a specific email. HTML emails are securely sanitized to extract only visible text, preventing prompt injection attacks via hidden content.
Inputs: id (required), includeRawHtml.
search-emailsC
Search for emails using various criteria
Inputs: to, from, count, query, +4 more.
send-emailB
Composes and sends a new email. Supports both plain text and HTML content.
Inputs: to (required), body (required), subject (required), cc, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 34 tools
Most tools target a distinct resource+action, but there are real boundaries to trip on: list-folders/create-folder are unprefixed and sit alongside onedrive-create-folder/onedrive-list, so folder operations are ambiguous between mail and OneDrive. The calendar trio decline-event / cancel-event / delete-event is also easy to misselect, since the descriptions only restate the verb without clarifying the difference in effect.
Readable but the convention flips: email/calendar tools use bare verb_noun (list-emails, create-event), OneDrive uses a service prefix (onedrive-upload), and flow tools invert to noun_verb (flow-list, flow-list-runs) instead of list-flows. The result is that 'list' means the leading verb in some groups and a trailing word in others, plus orphan names like about and authenticate.
34 tools is heavy for a single server and near the over-scoped threshold, but it is justified by aggregating four distinct domains (mail, calendar, OneDrive, Power Automate). Each domain gets roughly 5-9 tools, which is scoped reasonably, though a few specialized tools (onedrive-upload-large vs onedrive-upload) could be folded into parameters.
Core lifecycles are mostly covered: mail has list/search/read/send/draft/move/folders/rules, OneDrive has list/search/upload/download/share/delete, and flows have list/run/history/toggle. However there is no update/edit-event (calendar can only create/cancel/delete), no OneDrive move/copy/rename, and no rule delete or general rule update beyond sequencing.
Maintenance
Related MCP Connectors
Attach OneDrive files to Outlook drafts from Claude; send after you approve. Paid, 7-day trial.
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
One workspace of tools for Claude and ChatGPT: connect 600+ apps, generate media, build tools.
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceConnects Claude with Microsoft Outlook through the Graph API, providing comprehensive email, calendar, folder management, and rules creation capabilities.19MIT
- AlicenseNot gradedqualityDmaintenanceConnects Claude to Microsoft Outlook through the Microsoft Graph API, enabling email management (list, search, read, send) and calendar operations (list, create, accept, decline, delete events) via OAuth 2.0 authentication.1MIT
- FlicenseNot gradedqualityDmaintenanceProvides Claude Desktop and Claude Code with access to Microsoft 365 email and calendar services via the Microsoft Graph API. It enables users to manage emails, search folders, schedule calendar events, and check availability through natural language commands.-
- AlicenseBqualityBmaintenanceConnects Claude with Microsoft 365 services such as Email, Calendar, Teams, OneDrive, and more through the Microsoft Graph API.1617MIT