Microsoft 365 MCP Server
Scanned@makhatib
npx machina-cli add skill @makhatib/mcp-microsoft365 --openclawMicrosoft 365 MCP Server
Full Microsoft 365 integration via Model Context Protocol (MCP).
Features
📧 Mail (Outlook)
- List, read, send, and search emails
- Filter by folder (inbox, sent, drafts)
- HTML email support
📅 Calendar
- List and create events
- Teams meeting integration
- Check availability/free-busy
📁 OneDrive
- Browse files and folders
- Search files
- Read file content
✅ Tasks (Microsoft To-Do)
- List task lists
- Create and manage tasks
- Set importance and due dates
💬 Teams
- List chats
- Read and send messages
👥 Users
- List organization users
- Get user profiles
Requirements
- Node.js 18+
- Azure Entra ID App with Microsoft Graph permissions
Setup
1. Create Azure Entra ID App
- Go to Azure Portal
- Navigate to Microsoft Entra ID → App registrations → New registration
- Configure:
- Name:
MCP-Microsoft365 - Supported account types: Single tenant (recommended)
- Redirect URI:
http://localhost:3000/callback
- Name:
2. Add API Permissions
Add these Application permissions for Microsoft Graph:
Mail.Read, Mail.Send, Mail.ReadWrite
Calendars.Read, Calendars.ReadWrite
Files.Read.All, Files.ReadWrite.All
Tasks.Read.All, Tasks.ReadWrite.All
Chat.Read.All, Chat.ReadWrite.All
User.Read.All
Important: Click "Grant admin consent"
3. Get Credentials
Save these values:
- Application (client) ID
- Directory (tenant) ID
- Client Secret (create under Certificates & secrets)
4. Install
# Clone/download the skill
cd mcp-microsoft365
# Install dependencies
npm install
# Build
npm run build
5. Configure mcporter
mcporter config add m365 --stdio "node /path/to/mcp-microsoft365/dist/index.js"
Edit config/mcporter.json to add environment variables:
{
"mcpServers": {
"m365": {
"command": "node /path/to/dist/index.js",
"env": {
"TENANT_ID": "your-tenant-id",
"CLIENT_ID": "your-client-id",
"CLIENT_SECRET": "your-client-secret",
"DEFAULT_USER": "user@yourdomain.com"
}
}
}
}
Usage
# List recent emails
mcporter call m365.m365_mail_list top:5
# Send email
mcporter call m365.m365_mail_send to:"recipient@email.com" subject:"Hello" body:"<p>Hi!</p>"
# Search
mcporter call m365.m365_mail_search query:"important"
Calendar
# List events
mcporter call m365.m365_calendar_list top:10
# Create event with Teams meeting
mcporter call m365.m365_calendar_create subject:"Team Sync" start:"2026-01-27T10:00:00" end:"2026-01-27T11:00:00" isOnline:true
Files
# List OneDrive root
mcporter call m365.m365_files_list
# Search files
mcporter call m365.m365_files_search query:"report"
Tasks
# List task lists
mcporter call m365.m365_tasks_lists
Teams
# List chats
mcporter call m365.m365_teams_chats top:10
19 Available Tools
| Tool | Description |
|---|---|
m365_mail_list | List emails |
m365_mail_read | Read email by ID |
m365_mail_send | Send email |
m365_mail_search | Search emails |
m365_calendar_list | List events |
m365_calendar_create | Create event |
m365_calendar_availability | Check free/busy |
m365_files_list | List files |
m365_files_search | Search files |
m365_files_read | Read file content |
m365_files_info | Get file metadata |
m365_tasks_lists | List task lists |
m365_tasks_list | List tasks |
m365_tasks_create | Create task |
m365_teams_chats | List chats |
m365_teams_messages | Read messages |
m365_teams_send | Send message |
m365_users_list | List users |
m365_user_info | Get user profile |
Author
Mahmoud Alkhatib
- Website: malkhatib.com
- YouTube: @malkhatib
- Twitter: @malkhateeb
License
MIT
Overview
Connect and manage Microsoft 365 services through MCP. This skill exposes Mail, Calendar, OneDrive, Tasks, Teams, and User data via Microsoft Graph using MCP protocol, enabling automated workflows and centralized control.
How This Skill Works
The MCP server runs a Node.js app that authenticates with Azure AD using application permissions, then makes Graph API calls for mail, calendar, files, tasks, chats, and users. It is exposed as 19 MCP tools (e.g., m365_mail_list, m365_calendar_create, m365_files_list, m365_tasks_lists, m365_teams_chats, m365_users_list) and can be driven by mcporter commands to perform actions.
When to Use It
- Automate email workflows by listing, reading, sending, and searching Outlook messages (Mail).
- Plan team schedules by listing/creating calendar events and checking availability, including Teams meetings.
- Browse and read OneDrive content, such as files and folders, for content sharing and retrieval.
- Create and manage Tasks (To-Do) with due dates, priorities, and lists.
- Query Teams chats and user profiles to surface collaboration data for reporting or onboarding.
Quick Start
- Step 1: Create an Azure Entra ID App in the Azure Portal, configure Graph permissions, and note the Tenant ID and Client ID.
- Step 2: Install dependencies and build the MCP Microsoft 365 server: npm install, npm run build.
- Step 3: Configure mcporter with environment variables (TENANT_ID, CLIENT_ID, CLIENT_SECRET, DEFAULT_USER) and run the server via mcporter config.
Best Practices
- Limit Graph permissions to the minimum required and grant admin consent for the app.
- Store credentials securely in environment variables and rotate CLIENT_SECRET regularly.
- Test against a non-production tenant or sandbox before enabling production workflows.
- Design idempotent operations (e.g., avoid duplicating calendar events or tasks).
- Monitor MCP calls and implement logging/alerting to manage throttling and failures.
Example Use Cases
- List the 5 most recent emails from Inbox and read a message by ID using m365_mail_list and m365_mail_read.
- Create a Teams meeting with a given subject and time window via m365_calendar_create with isOnline set to true.
- List OneDrive root contents and read a specific file's content using m365_files_list and m365_files_read.
- List all To-Do task lists and create a high-priority task with a due date using m365_tasks_lists and m365_tasks_create.
- List the first 10 Teams chats and read the latest messages using m365_teams_chats and m365_teams_messages.