MCP Outlook with OAuth2
Uses Keycloak as the OAuth2 identity provider, accepting access tokens via Authorization Code + PKCE and enforcing JWT scopes plus subject-to-mailbox mapping.
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., "@MCP Outlook with OAuth2search my inbox for emails from finance and summarize the latest one"
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.
MCP Outlook with OAuth2
Русский · Deployment · Architecture and origins · Testing
A self-hosted MCP server for on-premises Microsoft Exchange: user OAuth2 authentication, EWS mailbox access, and integration with LiteLLM. Outlook desktop and Microsoft Graph are not required.
Status: all 12 tools passed 59 synthetic-backend calls through an existing LiteLLM 1.96.0 and real Keycloak OAuth2. The local suite has 32 tests. Live Exchange 2019 CU15 interoperability and Kubernetes deployment have not yet been verified.
LiteLLM → MCP OAuth proxy → Exchange EWS
↕
AAS / Keycloak (lab)MCP is the confidential OAuth2 client of AAS. It receives the callback, exchanges codes with PKCE, refreshes AAS tokens and stores them encrypted. LiteLLM receives separate MCP tokens; the AAS client secret stays in MCP. Keycloak substitutes for AAS in the lab. Exchange access still uses separate HTTPS + NTLM service-account impersonation. AAS password retrieval is not implemented; the actual platform contract is still required.
Capabilities
Mail search/read, attachment download, saved drafts and confirmed sending, read flags, message moves, directory lookup, and personal calendar events. See the tool/scope table.
This is an independent implementation using FastMCP and exchangelib. It is not a fork of ItayElizur/mcp-outlook and copies none of its code. The inspected reference commit, differences, and reasons are documented here.
Related MCP server: Outlook MCP Server
Get the code and build
git clone https://github.com/iasemin/mcp-outlook-with-oauth.git
cd mcp-outlook-with-oauth
uv sync --frozen
uv run pytest -q
docker buildx build --platform linux/amd64 \
-t YOUR_REGISTRY/mcp-outlook-with-oauth:0.2.0 --push .No container image is published by this repository yet; build and push to your own registry. Python package/module names remain outlook-ews-mcp / outlook_mcp.
Deployment
Internal Exchange / Kubernetes: short deployment guide; manifests in
deploy/k8s/mcp.yaml.Local OAuth stand: reproduction steps; Compose starts Keycloak, PostgreSQL, MCP and an ingress to an existing LiteLLM. It does not install LiteLLM or Exchange.
Evidence: 59-call synthetic test report. No real mailbox data or credentials are included.
MIT license for this project's code. Dependencies retain their own licenses. This project is not affiliated with Microsoft.
This server cannot be deployed
Maintenance
Related MCP Connectors
- WorkwaeOAuthcom.workwae
Email, calendar and contacts for AI agents: Gmail, Microsoft 365 and IMAP accounts behind one API.
Gmail, Outlook, Drive, OneDrive and calendars for AI agents. Many accounts, one endpoint, audit log.
Gmail, Outlook, iCloud, Fastmail and any IMAP mailbox for your agent. Scoped OAuth, approved sends.
Manage Microsoft 365 email, calendar, contacts and inbox rules via the Graph API with OAuth 2.0.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server for any Microsoft Exchange / OWA deployment. Gives LLM agents access to email, calendar, directory search, folders, availability, and meeting analytics via 30 tools.3034 PyPI10MIT
- FlicenseNot gradedqualityDmaintenanceEnables LLMs and MCP clients to read, search, and manage Microsoft Outlook emails through a standardized interface.-
- AlicenseNot gradedqualityCmaintenanceEnables Claude to safely interact with an on-premises Microsoft Exchange mailbox via EWS for email operations like list, read, reply, forward, move, delete (soft), and mark read/unread, with enforced two-step confirmation on destructive actions.MIT
- FlicenseAqualityCmaintenanceEnables AI agents to interact with an OVH Exchange mailbox via EWS and NTLM authentication, including searching, reading, sending, replying to, and forwarding emails, as well as managing folders and attachments.8-