Microsoft Exchange 2019 On-Premises Claude MCP
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., "@Microsoft Exchange 2019 On-Premises Claude MCPBook room A1 tomorrow at 2pm with my team to review the Q3 roadmap"
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.
Microsoft Exchange 2019 On-Premises Claude MCP
An MCP server that connects Claude (claude.ai, Claude Desktop, Claude Code) to on-premises Microsoft Exchange (via EWS) and Active Directory. Users can book meeting rooms, check colleagues' free/busy, manage calendar events and handle email in natural language.
Users sign in with your OpenID Connect provider (tested with Keycloak). The server validates their JWT and acts as them in Exchange through one service account with ApplicationImpersonation, so no user password ever reaches the server.
Language: replies are in English by default; set
UI_LANGUAGE=fafor Persian (Farsi). Times are handled in Iran Standard Time (UTC+03:30), which is easy to change: see Customizing.
Features
Safe booking. Every booking is two steps: a preview, then
confirmed=true. The schema requires it. Free/busy is checked for the organizer, attendees and room, and checked again on confirm. Dates are resolved server-side, so a stale date from the model is visible to the user before anything is sent. Past dates are rejected.Room verification with rollback. After booking, the server polls the room's own calendar until it holds a meeting with the same
calendar:UID. If the room declined (a race or a booking policy), the meeting is deleted byItemId.Recurring meetings: daily, weekly and monthly series. Availability is checked for every occurrence, and one conflict refuses the whole series.
Room access control: restrict a room to members of an AD group. Nested groups are checked with
LDAP_MATCHING_RULE_IN_CHAIN, and the check fails closed.Org-chart aware: book a meeting with your team or your direct reports, and look up managers through LDAP.
Email: list, read, send and reply, plus attachment download links.
Persian-aware user search: normalizes Arabic/Persian letter variants.
Tools
Area | Tools |
Calendar |
|
Team / group |
|
Directory |
|
| |
Session |
|
Related MCP server: Outlook MCP Server
Architecture
Claude (connector / Claude Code) ── Authorization: Bearer <OIDC JWT> ──► reverse proxy (TLS)
├─ / → 127.0.0.1:3000 index.js (MCP, Streamable HTTP)
└─ /auth/ → 127.0.0.1:3001 login-server.js
index.js ── EWS SOAP / NTLM / ExchangeImpersonation ──► Exchange (EWS)
index.js ── LDAPS ─────────────────────────────────────► Active Directory
index.js ── JWKS verify ───────────────────────────────► OIDC providerThe server publishes /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server, so MCP clients discover the OAuth login automatically.
Requirements
Node.js 20+
Exchange 2016/2019 with EWS enabled
A service account with the ApplicationImpersonation role, which is also used to bind to LDAP
An OIDC provider. Users' tokens must carry an
emailclaim that matches their Exchange primary SMTP address.A reverse proxy with TLS, such as nginx (see
deploy/nginx.conf.example)
Setup
git clone https://github.com/shahmirdelfanazari/Microsoft-Exchange-2019-ON-Premises-Claude-MCP.git
cd Microsoft-Exchange-2019-ON-Premises-Claude-MCP
npm install
cp .env.example .env # fill in your values
cp rooms.example.json rooms.json # list your room mailboxes
# optional: copy your AD CA certificate to ./ldaps-ca.pem
npm startExchange
New-ManagementRoleAssignment -Name "mail-mcp-impersonation" `
-Role ApplicationImpersonation -User svc-mail-mcpRoom mailboxes should be auto-accept resource mailboxes.
OIDC client (Keycloak)
Client ID
mail-mcp(or whatever you set inOIDC_CLIENT_ID), standard flow, PKCE S256.Redirect URIs:
http://localhost*(Claude Code) andhttps://<PUBLIC_URL>/auth/oauth-callback.Turn Advanced → OpenID Connect Compatibility Modes → "Exclude Issuer From Authentication Response" ON. MCP clients enforce RFC 9207, and this server advertises itself as the issuer. Without this setting, login fails with
Issuer mismatch in authorization response.
Rooms (rooms.json)
{
"rooms": [{ "email": "room-a1@example.com", "name": "A1 (6-8 people)" }],
"restricted": { "room-exec@example.com": "exec-room@example.com" },
"excluded": ["room-other-building@example.com"],
"sizeGuide": "2 people→A2, 3-4→B1, 6-8→A1"
}roomsis the fallback list, used when Exchange has no room lists. It also supplies display names.restrictedmaps a room to an AD group (bymailorsAMAccountName); only members can book it. If the group is missing, nobody can book the room.excludedlists rooms that are never bookable.sizeGuideis shown to the model.
Running in production
Use pm2 with deploy/ecosystem.config.cjs.example, and run a single process (MCP sessions live in memory). Bind the server to localhost only and expose it through the reverse proxy.
Connecting Claude
Claude Code:
claude mcp add exchange --transport http https://mail-mcp.example.com/mcpclaude.ai / Claude Desktop: add a custom connector pointing at
https://mail-mcp.example.com/mcp.
Customizing
Timezone: Iran time (fixed +210 minutes, no DST) is used in
nowIran(),isPastDateTime(),iranLocalToMs(),get_current_timeand the availability request (Bias=-210). Change these for another zone.Work week and hours:
isWorkDay()(Friday off),WORK_START_HOURandWORK_END_HOURinindex.js.Language: every user-facing string lives in
locales/en.jsandlocales/fa.js.UI_LANGUAGEchooses which one is used. To add a language, copylocales/en.js(keep every key), translate it, and register it ini18n.js.
Security
Read SECURITY.md before deploying. In short: the service account can read every mailbox, so keep the server on your internal network and keep .env readable by root only.
License
This server cannot be deployed
Maintenance
Related MCP Connectors
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
Connect Apple iCloud and Microsoft 365 mail, calendars, contacts and tasks to AI.
Mac & Windows: let ChatGPT, Claude & Cursor use your email, calendar, iMessage, Teams, files.
- platform7nOAuthtech.p7n
Connect Claude to your Platform7n workspaces: chat, links, work and decks. One-click OAuth.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceConnects Claude with Microsoft Outlook through the Graph API, providing comprehensive email, calendar, folder management, and rules creation capabilities.19MIT
- AlicenseNot gradedqualityCmaintenanceConnects Claude to Microsoft Outlook through the Microsoft Graph API, enabling email management (list, search, read, send) and calendar operations (list, create, accept, decline, delete events) via OAuth 2.0 authentication.1MIT
- 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.-
- AlicenseNot gradedqualityBmaintenanceConnects Claude with Microsoft 365 services such as Email, Calendar, Teams, OneDrive, and more through the Microsoft Graph API.39 npm17MIT