This MCP server enables AI assistants to query Microsoft 365 enterprise data through natural language with full permission enforcement, integrating with GitHub Copilot and Claude Desktop.
Core Capabilities:
Retrieve raw text chunks (
m365_retrieve): Get relevance-scored excerpts from SharePoint, OneDrive, and external connectors for custom RAG, deep analysis, and cross-document reasoningQuick Q&A (
m365_chat): Get synthesized answers from email, calendar, Teams, SharePoint, and OneDrive for people lookup, meeting schedules, email summaries, and enterprise facts with optional web groundingMeeting insights (
m365_meetings): Access AI-generated summaries, action items, decisions, and mentions from Teams meetings with transcription enabledDocument discovery (
m365_search): Semantically search OneDrive using hybrid keyword + semantic search, returning file metadata, previews, and URLs with KQL filtering by file type, date, and folder pathFile analysis (
m365_chat_with_files): Ask questions about specific documents by URI to summarize, compare, or extract information from known files
Key Features:
Multi-turn conversations with conversation ID tracking for follow-up questions
Configurable result limits (up to 25 chunks for retrieval, 100 for search)
Delegated permissions with user-specific data access enforcement
Interactive browser and device code authentication with token caching
Supports both stdio mode (for MCP clients) and HTTP mode (for debugging)
Brings Microsoft 365 enterprise data into GitHub Copilot, allowing users to query SharePoint, OneDrive, Teams, and Outlook through natural language for document retrieval and analysis.
Click on "Install 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-copilot-mcpSummarize the main action items from yesterday's project sync meeting"
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-copilot-mcp
MCP server for Microsoft 365 Copilot APIs — bring enterprise data into GitHub Copilot & Claude Desktop.
What This Does
Query SharePoint, OneDrive, email, calendar, and Teams meetings through natural language—all with full Microsoft 365 permission enforcement.
Tool | API | What It Does | Best For |
| Retrieval | Returns text chunks for YOUR AI to reason over | Custom RAG, deep analysis |
| Chat | M365 Copilot synthesizes an answer | Quick Q&A, people/calendar |
| Meeting Insights | AI summaries, action items, mentions | Post-meeting follow-up |
| Search | Semantic document discovery | Finding files |
| Chat + Files | Ask questions about specific documents | Summarizing known files |
Requirements
Microsoft 365 Copilot license (required for API access)
Python 3.11+
Azure AD app registration with delegated permissions
Quick Start
1. Create Azure AD App Registration
Go to Azure Portal → Azure Active Directory → App registrations
Click "New registration"
Name:
m365-copilot-mcpSupported account types: Single tenant (or Multitenant)
Redirect URI:
http://localhost:8400(Mobile and desktop applications)Add API permissions (Delegated):
Sites.Read.AllMail.ReadPeople.Read.AllOnlineMeetingTranscript.Read.AllChat.ReadChannelMessage.Read.AllExternalItem.Read.AllFiles.Read.AllOnlineMeetings.Read
Grant admin consent
2. Install
2a. WSL-Specific Setup (Windows Subsystem for Linux)
If running in WSL, additional setup is required for browser-based authentication:
Enable WSL Interoperability
WSL interoperability allows Linux to launch Windows executables (like browsers). Check if it's enabled:
If the file doesn't exist, check your /etc/wsl.conf:
Ensure interop is enabled (or not explicitly disabled):
After editing, restart WSL from Windows PowerShell:
Then reopen your WSL terminal.
Install wslu (WSL Utilities)
wslu provides wslview which opens Windows browsers from WSL:
Verify installation:
This should open Google in your Windows default browser.
Alternative: Run from Windows
If WSL interop doesn't work in your environment, you can configure VS Code to use Windows Python instead of WSL Python in your .vscode/mcp.json:
3. Configure
Create a .env file:
4. Authenticate (One-Time)
Run the authentication command once to cache your credentials:
A browser window will open. Sign in with your M365 account. Your credentials are saved to ~/.m365-copilot-mcp/ for future use.
5. Test Locally
MCP Client Configuration
VS Code / GitHub Copilot
Add to your .vscode/mcp.json:
Claude Desktop
Add to claude_desktop_config.json:
Example Queries
Authentication Flow
This MCP server uses delegated permissions, meaning it accesses Microsoft 365 data on behalf of you, the signed-in user.
How It Works
Key Security Points
Aspect | Explanation |
App Registration (SPN) | Defines what permissions can be requested—not whose data is accessed |
User Sign-in | Required on first use; you authenticate with your M365 account |
Access Token | Contains YOUR identity; grants access only to YOUR mailbox, files, etc. |
Token Cache | Stored locally in |
Authentication Methods
Interactive Browser (default): Opens your browser for Microsoft sign-in
Device Code (fallback): For headless/SSH environments—displays a code to enter at microsoft.com/devicelogin
First-Time Setup
Recommended: Run m365-copilot --auth once before using with VS Code or Claude Desktop. This caches your credentials so the MCP server can authenticate silently.
If you skip this step, you'll see on first tool use:
Browser flow: A browser window opens → Sign in with your M365 account → Consent to permissions
Device code flow: A message in VS Code Output panel with a code → Visit the URL → Enter the code → Sign in
After authentication, tokens are cached and subsequent requests don't require re-authentication (until token expires, typically 1-24 hours depending on tenant policy).
Why Delegated Permissions?
This approach is more secure for personal developer tools:
Delegated (This Server) | Application Permissions |
✅ Requires user sign-in | ❌ No user sign-in needed |
✅ Access only YOUR data | ⚠️ Access ANY user's data |
✅ User or admin consent | ⚠️ Admin consent required |
✅ Ideal for personal tools | Better for background services |
The SPN cannot access any Microsoft 365 data without you explicitly signing in first.
Environment Variables
Variable | Required | Description |
| Yes | App registration client ID |
| Yes | Azure AD tenant ID |
| No | Only for confidential clients |
| No | Request timeout in seconds (default: 60) |
| No | Token cache location |
Troubleshooting
WSL: "WSL Interoperability is disabled"
Check
/etc/wsl.conffor[interop] enabled = falseand remove/change itRestart WSL:
wsl --shutdownfrom Windows PowerShellVerify with:
ls /proc/sys/fs/binfmt_misc/WSLInterop
WSL: Browser doesn't open
Install wslu:
sudo apt install wsluTest:
wslview https://google.comAlternative: Run
python login.pyfrom Windows PowerShell
"Insufficient permissions"
Ensure admin consent is granted for all API permissions
Verify user has Microsoft 365 Copilot license
"Token expired"
Run
m365-copilot --authto re-authenticateOr delete
~/.m365-copilot-mcp/and re-authenticate
"Gateway timeout" on long queries
Break complex queries into smaller parts
Use
m365_retrievefor better control over scope
API Rate Limits
API | Rate Limit | Notes |
Chat API | Not documented | Subject to Graph throttling |
Retrieval API | 200 req/user/hour | Max 25 results per request |
Search API | 200 req/user/hour | Max 100 results per request |
Meeting Insights | Standard Graph limits | Available ~4 hours post-meeting |
Development
License
MIT