MC

MCP Server: Outlook Mail, Calendar & OneDrive

Manage Outlook Mail, Calendar, and early OneDrive on an MCP server—access virtual assistant features (Azure admin required).

Quick Install
npx -y @Norcim133/OutlookMCPServer

Overview

This MCP (Model Context Protocol) server integrates Microsoft Outlook Mail, Calendar, and an early OneDrive implementation into an MCP-based assistant workflow. It provides a local HTTP service that translates MCP tool calls to Microsoft Graph operations, enabling virtual assistant capabilities such as reading and composing mail, managing calendar events, and interacting with files in OneDrive. Because these operations require elevated Graph permissions, the server must be registered in Azure AD and granted admin consent before production use.

For developers, the server is useful when you need a self-hosted bridge between a conversational AI (or any MCP-aware client) and Microsoft 365 data. It centralizes authentication, token management, and Graph API calls so client agents can invoke high-level MCP tools without handling OAuth flows or Graph SDK logic directly.

Features

  • Exposes MCP-style tools for:
    • Outlook Mail (read, compose, reply, delete)
    • Calendar (create, update, list events)
    • Early OneDrive (upload, download, list files)
  • Centralized Azure AD OAuth2 integration with admin consent support
  • Token caching and refresh handling to reduce repeated sign-ins
  • HTTP API endpoints that map MCP tool calls to Microsoft Graph operations
  • Docker-ready and local development workflows
  • Logging and basic telemetry for troubleshooting

Installation / Configuration

Prerequisites:

  • Node.js (14+ recommended) or Docker
  • Azure AD tenant and an app registration with required Microsoft Graph permissions (admin consent required for application-level access)
  • An Azure admin to grant consent for Graph scopes like Mail.ReadWrite, Calendars.ReadWrite, Files.ReadWrite.All

Clone and run locally:

git clone https://github.com/Norcim133/OutlookMCPServer.git
cd OutlookMCPServer
npm install
npm run build    # if the repo requires a build step
npm start

Run with Docker:

# build image
docker build -t outlook-mcp-server .

# run container (example)
docker run -d --name outlook-mcp \
  -e CLIENT_ID=your-client-id \
  -e CLIENT_SECRET=your-client-secret \
  -e TENANT_ID=your-tenant-id \
  -e REDIRECT_URI=http://localhost:3000/auth/callback \
  -p 3000:3000 \
  outlook-mcp-server

Environment variables (example .env):

PORT=3000
CLIENT_ID=<Azure_AD_App_Client_ID>
CLIENT_SECRET=<Azure_AD_App_Client_Secret>
TENANT_ID=<Azure_AD_Tenant_ID>
REDIRECT_URI=http://localhost:3000/auth/callback
SCOPE=openid profile offline_access User.Read Mail.ReadWrite Calendars.ReadWrite Files.ReadWrite.All
LOG_LEVEL=info

Helpful configuration table:

VariablePurpose
CLIENT_IDAzure AD application (client) ID
CLIENT_SECRETApp client secret (or certificate config)
TENANT_IDAzure tenant ID or “common” for multi-tenant
REDIRECT_URIOAuth2 redirect URL registered in app
SCOPEGraph scopes requested (see recommended list above)
PORTLocal server port

Azure AD setup notes:

  • Register an app in the Azure portal and add Microsoft Graph permissions:
    • Delegated or application perms depending on your scenario (Mail.ReadWrite, Calendars.ReadWrite, Files.ReadWrite.All).
  • For application-level Graph operations (daemon style), admin consent is required.
  • Configure the Redirect URI and update the same value in your .env.

Available Resources

  • GitHub repository: https://github.com/Norcim133/OutlookMCPServer
  • Microsoft Graph docs: https://docs.microsoft.com/graph/
  • Azure App Registration guide: https://docs.microsoft.com/azure/active-directory/develop/quickstart-register-app

API/Endpoint overview (typical paths; check repo for exact routes):

  • GET /mcp/mail/messages — list messages for an authenticated context
  • POST /mcp/mail/send — send a new message
  • GET /mcp/calendar/events — list calendar events
  • POST /mcp/calendar/events — create an event
  • GET /mcp/onedrive/items — list files in root or folder
  • POST /mcp/onedrive/upload — upload a file
  • /auth/* — OAuth2 authorization and callback endpoints

The server exposes MCP-style JSON payloads and responds with Graph-equivalent structured objects, allowing MCP-aware agents to compose prompts that reference tool outputs.

Use Cases

  • Virtual assistant that reads a user’s unread inbox and summarizes high-priority messages:
    • The assistant calls the Mail tool via the MCP endpoint to fetch unread messages, then uses a language model to generate a short summary and suggested replies.
  • Scheduling assistant that creates calendar events from natural-language requests:
    • User: “Schedule a 30-minute check-in with Sarah next Tuesday at 10am.”
    • The assistant translates the request into a Calendar.create call through the server, which creates the event in the user’s calendar.
  • Document helper that uploads and shares a file to OneDrive and returns a shareable link:
    • The assistant receives a file object from the client, calls the OneDrive upload endpoint, then requests a share link and returns it to the user.
  • Enterprise automation where an admin account runs background tasks:
    • A backend job uses application-level credentials to scan mailboxes (with consent) and generate alerts or reports, without individual interactive sign-ins.

Notes & Best Practices

  • Always secure CLIENT_SECRET or use certificate-based auth for production.
  • Use least-privilege Graph permissions and request additional scopes only when needed.
  • For delegated scenarios, implement a secure user consent flow; for background processing use application permissions with admin consent.
  • Inspect logs and enable proper telemetry when integrating into larger systems.

For implementation details, inspect the repository code for exact endpoints, request/response shapes, and any middleware used for MCP compatibility.