office365-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., "@office365-mcp-server show my upcoming calendar events for today"
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.
Office 365 MCP Server
Complete Microsoft Graph API integration for Claude Code CLI with 45 powerful Office 365 tools
Seamlessly integrate your Office 365 account with Claude Code CLI for intelligent email management, calendar operations, file handling, and more. Built using the official Model Context Protocol (MCP) SDK.
โจ Features
๐ง Email Management - 16 tools for reading, searching, organizing, and sending emails
๐ Calendar Operations - 9 tools for managing events and schedules
๐ OneDrive Files - 8 tools for file and folder management
๐ฅ Contacts - 4 tools for contact management
๐ฌ Microsoft Teams - 5 tools for team collaboration
โ Tasks & To-Do - 4 tools for task management
๐ Secure - Environment variable configuration, no hardcoded credentials
โก Fast - Built on official MCP SDK for optimal performance
Total: 45 Production-Ready Tools
Related MCP server: outpost
๐ Table of Contents
๐ง Requirements
Node.js 18.0.0 or higher
Claude Code CLI installed and configured
Microsoft 365 Account (Office 365)
Azure AD Application with appropriate permissions
Admin Consent for your Azure AD tenant
๐ฆ Installation
1. Clone the Repository
git clone https://github.com/eesb99/office365-mcp-server.git
cd office365-mcp-server2. Install Dependencies
npm installRequired packages:
@modelcontextprotocol/sdk- Official MCP SDK@azure/msal-node- Microsoft Authentication Library@microsoft/microsoft-graph-client- Microsoft Graph API clientzod- Schema validation
3. Configure Environment Variables
Copy the example configuration:
cp .env.example .envEdit .env with your Azure credentials (see Azure Configuration below):
AZURE_CLIENT_ID=your-client-id-here
AZURE_AUTHORITY=https://login.microsoftonline.com/your-tenant-id-here
AZURE_CLIENT_SECRET=your-client-secret-here
OFFICE365_USER_EMAIL=your-email@yourdomain.comโ ๏ธ NEVER commit the .env file to Git!
โ๏ธ Azure Configuration
Step 1: Create Azure AD App Registration
Go to Azure Portal
Navigate to Azure Active Directory โ App registrations
Click + New registration
Configure:
Name:
Office 365 MCP Server(or your preferred name)Supported account types:
Accounts in this organizational directory onlyRedirect URI: Leave blank
Click Register
Step 2: Note Your Credentials
After registration, note these values:
Application (client) ID - Use for
AZURE_CLIENT_IDDirectory (tenant) ID - Use in
AZURE_AUTHORITYURL
Step 3: Create Client Secret
In your app registration, go to Certificates & secrets
Click + New client secret
Add description:
MCP Server SecretSet expiry:
90 days(recommended, or choose your preference)Click Add
โ ๏ธ IMPORTANT: Copy the Value immediately (shown only once!)
Use this for
AZURE_CLIENT_SECRET
Step 4: Configure API Permissions
In your app registration, go to API permissions
Click + Add a permission โ Microsoft Graph โ Application permissions
Add these permissions:
Required Permissions (Minimum - 4 tools):
User.Read.AllMail.ReadCalendars.ReadFiles.Read.All
Full Feature Set (All 45 tools):
Mail.ReadWrite- Email managementMail.Send- Send emailsMailboxSettings.ReadWrite- Mailbox configurationCalendars.ReadWrite- Calendar operationsFiles.ReadWrite.All- File managementContacts.ReadWrite- Contact managementTeam.ReadBasic.All- Teams accessChannel.ReadBasic.All- Channel informationChannelMessage.Send- Send channel messagesChannelMessage.Read.All- Read channel messagesChat.ReadWrite- Chat managementTasks.ReadWrite- Task management
Click Add permissions
Step 5: Grant Admin Consent
โ ๏ธ CRITICAL: After adding permissions:
Click โ Grant admin consent for [Your Organization]
Click Yes to confirm
Wait for all permissions to show โ Granted status
Note: Admin consent is required for Application permissions. Contact your Microsoft 365 administrator if you don't have sufficient privileges.
For detailed instructions, see AZURE_PERMISSIONS_SETUP.md.
๐ค Claude Code CLI Setup
Configuration
Add this MCP server to your Claude Code configuration:
Location: ~/.claude.json
{
"mcpServers": {
"office365": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/office365-mcp-server/office365-sdk.js"],
"env": {
"AZURE_CLIENT_ID": "your-client-id-here",
"AZURE_CLIENT_SECRET": "your-client-secret-here",
"AZURE_AUTHORITY": "https://login.microsoftonline.com/your-tenant-id-here",
"OFFICE365_USER_EMAIL": "your-email@yourdomain.com"
}
}
}
}Important:
Replace
/absolute/path/to/office365-mcp-server/with the actual pathUse absolute paths, not relative paths
Add your actual Azure credentials to the
envsection
Verify Installation
Restart Claude Code CLI
In a new conversation, type:
list office 365 toolsYou should see 45 available tools
Troubleshooting: If tools don't appear, check:
Path to
office365-sdk.jsis absolute and correctAll environment variables are set in
~/.claude.jsonNode.js 18+ is installed:
node --versionDependencies are installed:
npm install
๐ Usage
Once configured in Claude Code CLI, you can use natural language to interact with Office 365:
Example Commands
Email:
"Show me my last 10 emails"
"Search for emails from jeff@example.com about Q4 budget"
"Send an email to team@company.com with subject 'Meeting Notes'"
"What emails are in my Sent Items folder?"Calendar:
"What's on my calendar this week?"
"Create a meeting tomorrow at 2pm for 1 hour"
"Show all events in the next 30 days"Files:
"List files in my OneDrive root folder"
"Search for files containing 'proposal'"
"Show me PDF files modified this month"Contacts:
"List all my contacts"
"Find contact information for John Smith"Teams:
"List all my Teams"
"Show channels in the Marketing team"
"Get recent messages from the General channel"Tasks:
"Show my task lists"
"What tasks are incomplete?"
"Create a task in my To-Do list"๐ Available Tools
๐ง Email Management (16 tools)
Tool | Description |
| Get recent emails from inbox |
| Search emails with query |
| Get specific email details |
| Send an email |
| Reply to an email |
| Forward an email |
| List all mail folders |
| Get emails from specific folder |
| Search within specific folder |
| Move email to folder |
| Delete an email |
| Mark email as read |
| Mark email as unread |
| List email attachments |
| Download attachment |
| Create new folder |
๐ Calendar Operations (9 tools)
Tool | Description |
| Get upcoming calendar events |
| Get specific event details |
| Create new calendar event |
| Update existing event |
| Delete an event |
| List all calendars |
| Get events in date range |
| Find available meeting times |
| Accept meeting invitation |
๐ OneDrive Files (8 tools)
Tool | Description |
| List files in folder |
| Get file details |
| Search for files |
| Download file content |
| Upload new file |
| Create new folder |
| Delete file or folder |
| Move file to folder |
๐ฅ Contacts (4 tools)
Tool | Description |
| List all contacts |
| Get specific contact |
| Create new contact |
| Search contacts |
๐ฌ Microsoft Teams (5 tools)
Tool | Description |
| List all teams |
| List channels in team |
| Get channel messages |
| Send message to channel |
| List recent chats |
โ Tasks & To-Do (4 tools)
Tool | Description |
| List all task lists |
| Get tasks from list |
| Create new task |
| Update existing task |
For complete tool documentation, see OFFICE365_TOOLS.md
๐งช Testing
Option 1: Test with Claude Code CLI
Simply use the natural language commands in Claude Code after setup.
Option 2: Standalone Testing
Test the server independently:
# Test basic authentication
node tests/simple-test.js
# Test MCP server protocol
node tests/simple-mcp-server.jsNote: Standalone testing requires credentials in .env file.
๐ Security
Best Practices
โ
Environment Variables: All credentials stored in environment variables
โ
No Hardcoded Secrets: No credentials in source code
โ
Git Protection: .gitignore prevents credential commits
โ
Validation: Startup validation ensures all required variables are set
โ
Admin Consent: Application permissions require admin approval
Security Features
Application Permissions: Server-to-service authentication (no user prompts)
Scoped Access: Limited to configured user account
Audit Logging: Use Azure AD audit logs to monitor access
Secret Rotation: Rotate client secrets every 90 days (recommended)
Security Documentation
SECURITY.md - Security policy and responsible disclosure
SECURITY_SCAN_REPORT.md - Vulnerability analysis
FINAL_SECURITY_AUDIT.md - Pre-publication audit
โ ๏ธ Never commit .env files or expose credentials in code!
๐ Troubleshooting
Tools Not Appearing in Claude Code
Check:
Path in
~/.claude.jsonis absolute (not relative)All environment variables are set in
~/.claude.jsonenvsectionClaude Code CLI has been restarted after configuration
Run
node office365-sdk.js- should start without errors
Authentication Errors
401 Unauthorized:
Verify
AZURE_CLIENT_SECRETis correct (use Value, not Secret ID)Check secret hasn't expired in Azure Portal
Ensure
AZURE_CLIENT_IDandAZURE_AUTHORITYare correct
403 Forbidden:
Admin consent not granted - check Azure Portal API permissions
Wait 5-10 minutes after granting consent for propagation
Verify permissions show "โ Granted" status
Missing Permissions
Error: "Insufficient privileges to complete the operation"
Solution:
Go to Azure Portal โ App registrations โ Your app
API permissions โ Check all required permissions are added
Click "Grant admin consent" again
Verify all show "โ Granted" status
Connection Issues
Server fails to start:
Check Node.js version:
node --version(need 18+)Reinstall dependencies:
rm -rf node_modules && npm installVerify all environment variables are set
Check for typos in
~/.claude.json(validate JSON syntax)
For more troubleshooting, see AZURE_PERMISSIONS_SETUP.md
๐ค Contributing
Contributions are welcome! This is an open-source project.
How to Contribute
Fork the repository
Create a feature branch:
git checkout -b feature/amazing-featureMake your changes
Test thoroughly with Claude Code CLI
Commit your changes:
git commit -m 'Add amazing feature'Push to your fork:
git push origin feature/amazing-featureOpen a Pull Request
Development Guidelines
Follow existing code style (2-space indentation for JavaScript)
Add tests for new features
Update documentation for new tools
No hardcoded credentials in code
Use environment variables for configuration
Reporting Issues
Found a bug or have a suggestion? Open an issue
Include:
Claude Code CLI version
Node.js version
Operating system
Error messages (remove any credentials!)
Steps to reproduce
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2025 eesb99
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.๐ Acknowledgments
Built with Model Context Protocol (MCP) SDK
Powered by Microsoft Graph API
Designed for Claude Code CLI
Created with assistance from Claude Code
๐ Support & Contact
GitHub: @eesb99
Email: eesb99@gmail.com
Issues: GitHub Issues
๐ Project Stats
Version: 2.0.0 (Security Hardened)
Total Tools: 45
Code Quality: Production Ready
Testing: Tested with Claude Code CLI
Security Audit: Passed (see FINAL_SECURITY_AUDIT.md)
Last Updated: 2025-10-29
๐ Star History
If you find this project useful, please consider giving it a star on GitHub! โญ
Made with โค๏ธ for the Claude Code community
Available Tools
45 toolscreate_calendar_eventC
Create a new calendar event
Inputs: subject (required), start (required), end (required), attendees, +2 more.
create_contactC
Create a new contact
Inputs: displayName (required), emailAddress (required), mobilePhone, companyName, +1 more.
create_draftC
Create an email draft
Inputs: to (required), subject (required), body (required), attachments.
create_folderA
Create a new folder in OneDrive
Inputs: folderName (required), path.
create_inbox_ruleC
Create an automated inbox rule for email organization
Inputs: ruleName (required), conditions (required), actions (required).
create_taskC
Create a new task in a To-Do list
Inputs: listId (required), title (required), dueDateTime, importance.
delete_calendar_eventC
Delete a calendar event
Inputs: eventId (required).
delete_emailB
Delete an email
Inputs: emailId (required).
download_attachmentC
Download a specific email attachment (max 10MB)
Inputs: emailId (required), attachmentId (required).
find_meeting_timesC
Find optimal meeting times based on attendee availability
Inputs: attendees (required), startTime (required), endTime (required), duration.
get_calendar_eventsC
Get upcoming calendar events
Inputs: days.
get_calendar_viewC
Get calendar events in a specific date range
Inputs: startDateTime (required), endDateTime (required).
get_channel_messagesB
Get recent messages from a Teams channel
Inputs: teamId (required), channelId (required), maxResults.
get_email_attachmentsB
List all attachments for a specific email
Inputs: emailId (required).
get_email_detailsA
Get complete email details including full body, recipients, and metadata
Inputs: emailId (required).
get_event_detailsC
Get complete details for a specific calendar event
Inputs: eventId (required).
get_file_contentB
Download file content from OneDrive (max 10MB)
Inputs: fileId (required).
get_file_metadataA
Get file metadata without downloading content
Inputs: fileId (required).
get_folder_emailsC
Get emails from a specific folder (e.g., Sent Items, Archive)
Inputs: folderId (required), maxResults.
get_free_busy_scheduleB
Get free/busy schedule for attendees
Inputs: attendees (required), startTime (required), endTime (required).
get_recent_emailsC
Get recent emails from Office 365
Inputs: count.
list_calendarsB
Get all calendars for the user
Inputs: no named parameters.
list_contactsC
Get all contacts
Inputs: maxResults.
list_drive_itemsC
List files and folders in OneDrive
Inputs: path, orderBy, maxResults.
list_mail_foldersA
Get all mail folders (Inbox, Sent Items, Archive, etc.)
Inputs: no named parameters.
list_tasksC
Get tasks from a specific To-Do list
Inputs: listId (required), maxResults.
list_team_channelsB
Get all channels in a specific team
Inputs: teamId (required).
list_teamsA
Get all teams the user is a member of
Inputs: no named parameters.
list_todo_listsB
Get all To-Do task lists
Inputs: no named parameters.
mark_as_readB
Mark email as read or unread
Inputs: emailId (required), isRead.
move_emailB
Move an email to a different folder
Inputs: emailId (required), destinationFolderId (required).
move_fileB
Move a file or folder to a different location
Inputs: itemId (required), destinationPath (required).
search_contactsA
Search contacts by name, email, or company
Inputs: query (required).
search_emailsC
Search emails with optional text query
Inputs: query, maxResults.
search_filesB
Search for files and folders in OneDrive
Inputs: query (required).
search_in_folderB
Search emails within a specific folder
Inputs: folderId (required), query, maxResults.
send_channel_messageC
Send a message to a Teams channel
Inputs: teamId (required), channelId (required), message (required).
send_chat_messageC
Send a direct chat message
Inputs: chatId (required), message (required).
send_emailB
Send an email via Office 365
Inputs: to (required), subject (required), body (required).
send_email_with_attachmentsC
Send email with file attachments
Inputs: to (required), subject (required), body (required), attachments.
update_calendar_eventC
Update an existing calendar event
Inputs: eventId (required), updates (required).
update_contactC
Update an existing contact
Inputs: contactId (required), updates (required).
update_taskC
Update an existing task
Inputs: listId (required), taskId (required), updates (required).
upload_fileB
Upload a file to OneDrive (max 4MB)
Inputs: path (required), fileName (required), contentBytes (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 45 tools
Each tool targets a distinct resource or action with clear descriptions, e.g., send_email vs send_email_with_attachments, search_emails vs search_in_folder. No two tools are ambiguous.
All tools follow a consistent verb_noun pattern using underscores (e.g., create_calendar_event, get_recent_emails). No mixing of styles.
45 tools is high but justified by covering multiple Office 365 domains (email, calendar, contacts, tasks, OneDrive, Teams). The set is well-scoped, though slightly larger than ideal for coherence.
Covers most core operations across domains. Minor gaps: missing delete for contacts, tasks, and files; no update for files. Overall, agents can accomplish common tasks.
Maintenance
Related MCP Connectors
Manage Microsoft 365 email, calendar, contacts and inbox rules via the Graph API with OAuth 2.0.
Carbon Voice MCP serves as a bridge that connects AI assistants like ChatGPT, Claude, and Cursor to a user's Carbon Voice account, turning voice messages and conversations into a private, on-demand knowledge base. It provides 28 specialized tools for comprehensive voice messaging management, including creating and sending messages, accessing conversation history with instant transcription, running AI actions (summarization, TLDR generation, meeting notes), and managing workspace collaboration through folders, contacts, and team communications.
Permissioned access to Outlook, OneDrive and Teams via the user's own Microsoft account
One workspace of tools for Claude and ChatGPT: connect 600+ apps, generate media, build tools.
Related MCP Servers
- 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.-
- AlicenseBqualityFmaintenanceEnables interaction with Microsoft Outlook services (Tasks, Calendar, Email, Contacts, and Teams) via the Microsoft Graph API, providing 39 tools for Claude Desktop with natural language and JSON output.39MIT
- AlicenseNot gradedqualityCmaintenanceConnects Claude with Microsoft 365 services such as Email, Calendar, Teams, OneDrive, and more through the Microsoft Graph API.81 npm17MIT
- AlicenseNot gradedqualityDmaintenanceConnects Claude with Microsoft 365 services including Outlook, OneDrive, and Power Automate, enabling email, calendar, files, and flow management through natural language.63 npm454MIT