An MCP server providing access to Microsoft Outlook email, calendar, and Teams messages via Microsoft Graph API.
First, create an app registration in your Azure AD tenant:
- Go to portal.azure.com
- Navigate to Azure Active Directory > App registrations > New registration
- Configure:
- Name:
o365-mcp - Supported account types: "Accounts in this organizational directory only"
- Name:
- Under "Authentication":
- Redirect URI: Public client/native, value:
https://login.microsoftonline.com/{tenant}/oauth2/nativeclient(replace {tenant} with your Directory ID) - Enable "Allow public client flows"
- Redirect URI: Public client/native, value:
- Under "API permissions", add delegated permissions:
Mail.ReadMail.ReadWriteCalendars.ReadCalendars.ReadWriteChat.ReadChat.ReadWriteChannelMessage.Read.All(requires admin consent)Contacts.ReadUser.Read
- Request admin consent for
ChannelMessage.Read.Allfrom your IT team - Note your Application (client) ID and Directory (tenant) ID
npm install
npm run buildBefore using with Claude Code, authenticate once to store your token in Keychain:
AZURE_TENANT_ID=<your-tenant-id> \
AZURE_CLIENT_ID=<your-client-id> \
npm run authFollow the device code flow in your terminal.
Add this to ~/.claude.json:
{
"mcpServers": {
"o365": {
"command": "node",
"args": ["/Users/nickda/Code/nick-dev/o365-mcp/dist/index.js"],
"env": {
"AZURE_TENANT_ID": "<your-tenant-id>",
"AZURE_CLIENT_ID": "<your-client-id>"
}
}
}
}Restart Claude Code.
AZURE_TENANT_ID=<your-tenant-id> \
AZURE_CLIENT_ID=<your-client-id> \
npm run testInteractively test tools before using in Claude Code:
AZURE_TENANT_ID=<your-tenant-id> \
AZURE_CLIENT_ID=<your-client-id> \
npx @modelcontextprotocol/inspector node dist/index.jsThen visit the Inspector URL in your browser to invoke tools manually.
get_emails- List emails from inbox with filteringget_email- Get full content of a single emailsearch_emails- Full-text search across emailsget_calendar_events- List calendar events for a date rangeget_event- Get full details of a calendar eventget_teams_messages- Get messages from Teams chats or channelssearch_teams_messages- Search across Teams messagesget_contacts- Look up a contact by name or email
draft_email- Create an email draftsend_teams_message- Send a Teams messagecreate_calendar_event- Create a calendar eventaccept_decline_event- RSVP to a calendar invite
Run: npm run auth
Admin consent is required for ChannelMessage.Read.All. Contact your IT team, or use 1:1 chats instead.
The Keychain implementation uses the keytar npm package. On macOS, this uses the native Keychain. Verify keytar is installed: npm ls keytar
npm run build- Compile TypeScriptnpm run dev- Run with tsx (for development)npm run start- Run compiled servernpm run auth- Run authentication flownpm run test- Run integration tests