Exchange MCP Server
The Exchange MCP Server exposes Exchange on-premise administration and monitoring as MCP tools (stdio or HTTP) for AI assistants like Claude Code, OpenCode, and Cursor.
Mailbox & recipient administration — list, create, set, remove mailboxes; distribution groups, mail contacts, mail users, permissions, and statistics.
Mail flow & transport troubleshooting — queues, queue digest, retry/suspend queues, transport rules, send/receive connectors, accepted/remote domains, and message tracking logs.
Server, database & DAG management — list/get Exchange servers, mailbox databases, database copy status, DAG health, certificates, and virtual directories.
Monitoring & health checks — server health, health reports, service health, replication health, component states, mailflow tests, and admin audit log searches.
Connectivity diagnostics — test PowerShell, EWS, REST, and overall Exchange connectivity when tools fail with 404.
AI operations intelligence — 24 AI tools for executive summaries, root-cause analysis, anomaly detection, capacity forecasting, security risk reports, and migration advice.
Reporting — 80+ report tools covering mailbox inventory, database growth, DAG health, mail flow volume, NDRs, and infrastructure overview.
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., "@Exchange MCP Server List all mailboxes over 50 GB and their total item counts"
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.
Exchange Agentic Admin — AI Powered Exchange Operations Intelligence Platform
Model Context Protocol server and desktop platform for Exchange Server on-premise administration, monitoring and troubleshooting — PowerShell Remoting, EWS and REST, with AI-powered operations intelligence.
Exchange administrators can use AI assistants such as OpenCode, Claude Code, Cursor and others to run real Exchange Management Shell tasks — mailbox provisioning, transport troubleshooting, database and DAG health — directly against on-premise Exchange.
Table of Contents
Related MCP server: OWA Exchange MCP Server
Features
200 tools covering Exchange Management Shell and the Exchange Admin Center: Recipients, Mail Flow, Servers, Databases, DAG, Monitoring, Compliance, Client Access, Certificates, Security, Logs and Reports, plus Organization, Diagnostics and AI.
AI Suite (24 tools) — executive summary, root cause analysis, anomaly detection, capacity forecast, cleanup advisor and more. Generates narrative insights from live data without requiring an external API key.
Reports (80+ tools) — mailbox, database, DAG, mail flow, infrastructure and compliance reports.
High Availability — configure multiple Exchange servers for automatic failover (
serverslist withfailoverorround_robinstrategy, health tracking and retry).Multiple Exchange versions: 2013, 2016, 2019 and Subscription Edition with automatic detection.
Multiple authentication methods: Basic, OAuth 2.0 via ADFS or Azure AD, and Certificate.
Multiple transports: stdio for local clients and HTTP/SSE for remote or Docker deployments.
Support for self-signed certificates in lab environments with strict validation in production.
Prerequisites
Node.js 20 or later
Exchange Server 2013 or later, reachable over the network:
EWS:
https://<host>/EWS/Exchange.asmxREST (2016 or later):
https://<host>/api/v2.0PowerShell Remoting:
https://<host>/PowerShell— must use the fully qualified domain name. Verify withGet-PowerShellVirtualDirectoryandTest-WSMan <host>.
Windows is recommended for PowerShell-based tools, which use PowerShell Remoting with support for self-signed certificates. On Linux or macOS, PowerShell tools require a custom wrapper.
An account with appropriate RBAC roles, such as Organization Management or Recipient Management. To check required roles for a cmdlet, run
Get-ManagementRole -Cmdlet Get-Queue.For the desktop app: the same items above, plus Node.js 20 or later with project dependencies installed (
npm install). No separate Electron install is needed — Electron ships as a project dependency. A model-provider API key is optional (only needed to fetch live model lists; the built-in AI reports work without one).For Docker: Docker Engine 24+ (or Docker Desktop) with Compose v2. Note the container runs on Linux, so the PowerShell-tool limitation above applies — EWS/REST tools work fully inside the container.
Quick Start (Windows-first; macOS/Linux notes inline)
Option A — ZIP download (simplest)
Download the repo ZIP from GitHub (Code → Download ZIP) and extract it.
Open a terminal in the extracted folder and check Node:
node --version # needs v20 or later — https://nodejs.org/en/downloadInstall, then run the one-command setup:
npm install npm run setupThis builds the project, runs the init wizard (asks for your Exchange host and account, writes
config.yaml), then runsdoctorto test PowerShell and EWS connectivity. Re-run it any time — it stops at the first failing step.Start the desktop app:
npm run desktop
Option B — git clone (enables in-app updates)
git clone https://github.com/Qaiser-ms-consultant/MicrosoftExchangeServerMCP.git
cd MicrosoftExchangeServerMCPThen steps 2–4 above. Running from a clone additionally enables the in-app
update pill (header shows N behind — Update when GitHub has new commits).
What success looks like
npm run setupends withSetup complete.anddoctorreports reachable PowerShell + EWS endpoints.npm run desktopopens Exchange Agentic Admin; the header shows your Exchange host.npm testpasses the suite.To use the MCP server directly:
npm start(stdio) ornode dist/server.js --config=./config.yaml --transport=http(port 3000), then point a client at it and try"list mailboxes with exchange_list_mailboxes".
Wizard and Auto-Patch (MCP clients)
npx exchange-mcp init
# Creates config.yaml with file-based password reference and tests connectivity.
npx exchange-mcp add --client opencode,claude-code
# Patches client configuration files and creates backups.
npx exchange-mcp doctor # Tests both PowerShell and EWS endpoints
opencode mcp list # Should show connected
claude mcp list # Should show connectedTroubleshooting a fresh install
npm installlooks stuck: the first install downloads Electron (~100 MB) — give it several minutes on a slow link before retrying.Node version error:
npm run setupexits immediately with a download link — install Node 20+, then re-run.PowerShell scripts blocked (Windows):
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned, then re-run setup.Skipped/failed the wizard: run
npm run initmanually, or copyconfig.example.yamltoconfig.yamland edit it.doctorfails: verify the host is the FQDN (Get-PowerShellVirtualDirectory,Test-WSMan <host>), and the account has an RBAC role like Organization Management (Get-ManagementRole -Cmdlet Get-Queueshows what's needed).No update pill: expected for ZIP installs (no
.gitpresent) — clone the repo to get in-app updates.macOS/Linux: the app and EWS/REST tools work, but PowerShell-based tools need a custom remoting wrapper (see Prerequisites).
Run with Docker
The repo ships a multi-stage Dockerfile (Node 20 Alpine) and a docker-compose.yml. The container runs the server with HTTP transport on port 3000, so multiple clients can share one server (stdio mode is per-client and does not apply in Docker).
Important: HTTP transport now requires authentication (see Security Notes). Configure MCP_API_KEYS or other auth methods before starting.
# 1. Configure (same file as local runs)
cp config.example.yaml config.yaml # then edit endpoint + auth
# or run the wizard on the host (needs Node): npx exchange-mcp init
# 2. (Optional) environment overrides — compose reads these from .env or the shell
cat > .env <<'EOF'
EXCHANGE_ENDPOINT=https://mail.contoso.com
AUTH_METHOD=basic
EXCHANGE_PASSWORD=yourPassword
EXCHANGE_INSECURE=false
# HTTP Transport Authentication (required)
MCP_HTTP_AUTH_ENABLED=true
MCP_HTTP_AUTH_METHOD=apikey
MCP_API_KEYS="your-secure-key-1,your-secure-key-2"
EOF
# 3. Build and start
docker compose up --build -d
curl -H "X-API-Key: your-secure-key-1" http://localhost:3000/health
# 4. Point any MCP client at the shared endpoint (see Connect to Clients):
# { "mcpServers": { "exchange": { "type": "http", "url": "http://localhost:3000/sse" } } }
# Client must include authentication header
# Logs / stop
docker compose logs -f exchange-mcp
docker compose downPlain docker run equivalent (no compose):
docker build -t exchange-mcp .
docker run -d --name exchange-mcp -p 127.0.0.1:3000:3000 \
-v ./config.yaml:/app/config.yaml:ro \
-e EXCHANGE_ENDPOINT=https://mail.contoso.com \
-e EXCHANGE_PASSWORD=yourPassword \
-e MCP_HTTP_AUTH_ENABLED=true \
-e MCP_HTTP_AUTH_METHOD=apikey \
-e MCP_API_KEYS="your-secure-key-1,your-secure-key-2" \
exchange-mcpNotes:
The image bakes
config.example.yamlin as a fallbackconfig.yaml; compose mounts your./config.yamlover it read-only, so always edit (or mount) the repo file with real credentials.Environment variables override
config.yamlvalues — prefer passing secrets via env rather than baking them into an image.The container is Linux-based: EWS/REST tools work fully, but PowerShell-Remoting tools need a Windows host or a custom wrapper (same limitation as running natively on Linux/macOS).
restart: unless-stoppedis set in compose, so the server comes back up after host reboots.Default port binding is
127.0.0.1:3000(localhost only). Change to3000:3000to expose externally (ensure strong auth is configured).
Desktop App — Exchange Agentic Admin
A standalone Electron desktop app — Exchange Agentic Admin, AI Powered Exchange Operations Intelligence Platform — for administrators who prefer a graphical interface over CLI.
Run in development:
npm install
npm run build # compile MCP + desktop
npm run desktop # start Electron (loads src/desktop/renderer/index.html)
# Alternative with tsx: npx electron src/desktop/main.tsBuild installer:
npm run desktop:build # uses electron-builder, outputs dist/installer
# Artifacts: dist/Exchange MCP Desktop Setup.exe (Windows) and .dmg (macOS)
# No publish by default (--publish=never)Prerequisites: Node.js 20+, npm install, and the same Exchange reachability/credentials as the server (the app spawns its MCP backend from the repo's ./config.yaml plus environment variables). Windows is recommended for full PowerShell-tool functionality.
Updating: the header shows an update pill. From a git clone it reads Up to date or N behind — Update; clicking pulls fast-forward only (clean tree required — commit or stash first, otherwise it refuses and changes nothing), runs npm install when dependencies changed, then offers Restart now. From a ZIP download (no git) it reads Up to date or Sync to latest/Update available; clicking downloads the latest GitHub ZIP and overlays it, preserving your local config.yaml/.env, then runs npm install only if the lockfile changed. Either way a restart rebuilds and runs the new code (npm run desktop builds on launch), and details land in the Logs view. Non-checkout installs that are neither (e.g. a packaged build) show no pill.
Features:
Home (Agent) — prompt console with a human-friendly result card plus Raw MCP JSON and PowerShell Trace views; write actions ask for confirmation before executing
Health tab — four status cards (Desktop App → MCP Server, MCP Server, PowerShell/WinRM, EWS) with start/restart/stop controls and connectivity checks
Helping Prompts tab — pre-built prompt recipes that insert into the console
Model Providers (14) — OpenAI, Anthropic, Google, Azure OpenAI, AWS Bedrock, Ollama, Ollama Cloud, Mistral, Cohere, Groq, Together, OpenRouter, Custom and OpenCode. Select a provider to fetch live models, enter a file-based API key, test the connection
Light/dark theme — toggle in the header; model settings persist to
~/.config/exchange-desktop/config.yaml(Windows:%USERPROFILE%\.config\exchange-desktop\config.yaml), separate from the MCPconfig.yamlAI answers (Electron) — with a model provider, API key, and model saved, prompts are interpreted and results narrated by the model (✦ AI Answer card with actual token usage); MCP tools stay the execution layer. Works with OpenAI-compatible providers (OpenAI, Groq, Together, OpenRouter, Mistral, Ollama, Custom, OpenCode); Ollama endpoints that reject the compatible path automatically retry the native
/api/chatprotocol. Without a model it falls back to keyword routing. The model panel confirms "AI answers ON" after save/test; if a model call fails you get an amber notice with the reason instead of silent keyword results
Configuration
Config File
Copy an example and edit config.yaml. This file is ignored by git, so secrets are never committed:
config.example.yaml— generic example usinghttps://mail.contoso.comconfig.production.yaml.example— production template with lab variant in comments
# config.yaml
exchange:
endpoint: https://mail.contoso.com # or https://exchange.lab.local for lab
version: auto # 2013, 2016, 2019 or auto
provider: auto # ews, rest, powershell or auto
ewsPath: /EWS/Exchange.asmx
restPath: /api/v2.0
powershellUri: https://mail.contoso.com/PowerShell # Must be https://<fqdn>/PowerShell
insecure: false # true for lab with self-signed certificate
tls:
rejectUnauthorized: true # false for lab
allowSelfSigned: false
auth:
method: basic # basic, oauth or certificate
basic:
username: admin@contoso.com
password: "${EXCHANGE_PASSWORD}" # Use an environment variable
domain: CONTOSO
oauth:
authority: https://adfs.contoso.local/adfs
clientId: "${OAUTH_CLIENT_ID}"
clientSecret: "${OAUTH_CLIENT_SECRET}"
certificate:
pfxPath: ./cert.pfx
passphrase: "${CERT_PASSPHRASE}"
server:
transport: stdio # stdio or http
port: 3000
host: 0.0.0.0Lab with Self-Signed Certificate vs Production
Environment | insecure | rejectUnauthorized | Notes |
Lab with self-signed certificate, for example |
|
| Allows self-signed certificates for EWS, REST and PowerShell |
Production with valid certificate, for example |
|
| Strict validation (default) |
You can also set EXCHANGE_INSECURE=true or EXCHANGE_POWERSHELL_URL=https://<fqdn>/PowerShell as environment variables. On startup the server logs whether insecure mode is enabled and which endpoints are in use.
Lab example:
exchange:
endpoint: https://exchange.lab.local
powershellUri: https://exchange.lab.local/PowerShell
insecure: true
tls: { rejectUnauthorized: false, allowSelfSigned: true }High availability example (if one server is unavailable, the server will try the next):
exchange:
endpoint: https://exch01.contoso.com
powershellUri: https://exch01.contoso.com/PowerShell
servers:
- https://exch01.contoso.com/PowerShell
- https://exch02.contoso.com/PowerShell
ha:
strategy: failover # or round_robin
retryCount: 2
# Or via environment: EXCHANGE_SERVERS=https://exch01/PowerShell,https://exch02/PowerShellAuthentication
Basic (simple, suitable for lab):
auth: { method: basic, basic: { username: admin@lab.local, password: '...', domain: LAB } }OAuth 2.0 (ADFS or Azure AD, client credentials flow):
auth:
method: oauth
oauth:
authority: https://adfs.contoso.local/adfs
clientId: your-client-id
clientSecret: your-secret
scope: https://mail.contoso.local/.defaultCertificate (mutual TLS):
auth: { method: certificate, certificate: { pfxPath: ./cert.pfx, passphrase: '...' } }All Options
Setting | Environment Variable | Default | Description |
|
|
| Base URL including scheme and host |
|
|
| Full PowerShell remoting URL. Setting |
|
| — | Comma-separated list of PowerShell URIs for high availability, for example |
| — |
|
|
|
|
| Set to |
| — |
| Set to |
|
|
|
|
|
| — | — |
|
| — | — |
|
|
|
|
|
|
| HTTP port when using http transport |
|
|
| Enable authentication for HTTP transport (secure by default) |
|
|
|
|
|
| — | Comma-separated API keys for API key authentication |
|
| — | Comma-separated bearer tokens for Bearer token authentication |
|
| — | Username and password for Basic authentication |
|
| — | Comma-separated CIDR ranges for IP allowlist |
|
| — | Comma-separated CIDR ranges for IP denylist |
|
|
| Rate limit window in milliseconds |
|
|
| Maximum requests per window per IP |
|
|
| Require authentication for |
Configuration is loaded in the following order: defaults, then config.yaml (or the file specified with --config), then environment variables. Values in YAML may reference environment variables using ${VAR} syntax.
Connect to Clients
All clients support either stdio for local use (one client per server process) or HTTP for shared or remote use. Always build first with npm run build and use an absolute path to the config file.
OpenCode
File: ~/.config/opencode/opencode.jsonc (on Windows: C:\Users\<you>\.config\opencode\opencode.jsonc)
With config file:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"exchange": {
"type": "local",
"command": ["node", "/absolute/path/to/dist/server.js", "--config=/absolute/path/to/config.yaml"],
"enabled": true
}
}
}With environment variables:
{
"mcp": {
"exchange": {
"type": "local",
"command": ["node", "/absolute/path/to/dist/server.js"],
"enabled": true,
"environment": {
"EXCHANGE_ENDPOINT": "https://mail.contoso.com",
"EXCHANGE_POWERSHELL_URL": "https://mail.contoso.com/PowerShell",
"AUTH_METHOD": "basic",
"EXCHANGE_PASSWORD": "yourPassword",
"EXCHANGE_INSECURE": "false"
}
}
}
}Verify with opencode mcp list, which should show connected. Restart the OpenCode interface after changes.
Claude Code (CLI)
# Add server
claude mcp add exchange -- node /absolute/path/to/dist/server.js --config=/absolute/path/to/config.yaml
# With environment variables
claude mcp add exchange --env EXCHANGE_ENDPOINT=https://mail.contoso.com --env EXCHANGE_PASSWORD=yourPassword -- node /absolute/path/to/dist/server.js
# List or remove
claude mcp list
claude mcp remove exchangeRestart the Claude Code session and run /mcp to see available tools.
Claude Desktop
File: claude_desktop_config.json
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"exchange": {
"command": "node",
"args": ["/absolute/path/to/dist/server.js", "--config=/absolute/path/to/config.yaml"],
"env": {
"EXCHANGE_INSECURE": "false"
}
}
}
}Restart Claude Desktop. For lab environments with self-signed certificates, set EXCHANGE_INSECURE to true.
Cursor
File: ~/.cursor/mcp.json (global) or .cursor/mcp.json (project)
{
"mcpServers": {
"exchange": {
"command": "node",
"args": ["/absolute/path/to/dist/server.js", "--config=/absolute/path/to/config.yaml"]
}
}
}You can also add the server through the Cursor user interface. Restart Cursor after changes.
Codex (OpenAI)
File: ~/.codex/config.toml or ~/.config/codex/config.json
[mcp_servers.exchange]
command = "node"
args = ["/absolute/path/to/dist/server.js", "--config=/absolute/path/to/config.yaml"]Windsurf
File: ~/.codeium/windsurf/mcp_config.json (check Windsurf documentation for the exact path)
{
"mcpServers": {
"exchange": {
"command": "node",
"args": ["/absolute/path/to/dist/server.js", "--config=/absolute/path/to/config.yaml"]
}
}
}VS Code
Requires an MCP extension. Create .vscode/mcp.json:
{
"servers": {
"exchange": {
"command": "node",
"args": ["/absolute/path/to/dist/server.js", "--config=/absolute/path/to/config.yaml"]
}
}
}Reload the window after changes.
Generic Client
Stdio (local, one client at a time):
node /absolute/path/to/dist/server.js --config=/absolute/path/to/config.yamlHTTP / SSE (shared, remote or Docker):
# Set server.transport to http in config.yaml
node dist/server.js --transport=http --config=./config.yaml
# or
docker compose up --build
# Health check with authentication (required)
curl -H "X-API-Key: your-key" http://localhost:3000/health
# or with Bearer token
curl -H "Authorization: Bearer your-token" http://localhost:3000/healthRemote client configuration (include authentication):
{
"mcpServers": {
"exchange": {
"type": "http",
"url": "http://localhost:3000/sse",
"headers": {
"X-API-Key": "your-key"
}
}
}
}Note that stdio servers are per-client. Use HTTP mode when multiple clients need to share the same server.
Inspector (for testing):
npx @modelcontextprotocol/inspector node dist/server.js --config=./config.yamlTools Reference — 200 tools
Group | Description | Tools |
Recipients | Mailboxes, distribution groups and contacts |
|
Mail Flow and Transport | Send and receive connectors, queues, transport rules and tracking logs |
|
Servers, Databases, DAG and Certificates | Exchange servers, mailbox databases, availability groups and certificates |
|
Monitoring and Health | Managed availability and server health |
|
Compliance, Hold and Mailbox Features | Litigation hold, retention, journaling and mailbox settings |
|
Search, Mailbox and Recovery | Mailbox search and recovery |
|
Client Access, Certificates, Security, Logs and Reports | Virtual directories, certificates, security and logs |
|
Mailbox (EWS, REST and PowerShell) | Full mailbox lifecycle and content management |
|
AI Suite — 24 tools
Tool | Purpose |
| Overall health score and critical warnings with recommendations |
| Investigates queue growth and identifies likely root cause |
| Detects unusual sending volume and other anomalies |
| Forecasts database and mailbox capacity |
| Identifies inactive mailboxes and recoverable storage |
| Per-mailbox cleanup analysis with quota and growth details |
| Comprehensive mailbox analysis with health score and findings |
| Correlates forwarding, volume and protocol risks |
| Finds excessive permissions |
| Detects potentially compromised accounts |
| Analyzes mail flow volume and trends |
| Groups non-delivery reports by cause |
| Scans for risky configuration |
| Assesses migration readiness |
| Recommends migration batches |
| Estimates migration completion time |
| Natural language interface to reports |
| Compares servers, databases or time periods |
| Analyzes impact of configuration changes |
| Forecasts impact of moving mailboxes |
| Generates incident summaries |
| Daily health brief |
| Proactive alerts |
| Executive dashboard |
Reports — 80+ tools
Reports cover mailbox inventory and size, database growth and whitespace, DAG health, mail flow volume and non-delivery reports, infrastructure inventory, server hardware and other areas. All reports are available through the report.* namespace, for example report.mailbox_inventory, report.database_growth_forecast, report.exchange_environment_overview, and via npx exchange-mcp doctor for connectivity.
Examples
Administration:
"Show mailbox stats for admin@contoso.com" → exchange_get_mailbox_statistics
"List queues on MAIL01 with more than 100 messages" → exchange_get_queue { server: "MAIL01", filter: "MessageCount -gt 100" }
"Track email from sender@contoso.com today" → exchange_get_message_tracking_log { sender: "sender@contoso.com", start: "2026-09-02T00:00:00Z" }
"Is the DAG healthy?" → exchange_get_database_copy_status { identity: "*" }
"Check certificate expiry" → exchange_get_exchange_certificate
"Test connectivity" → exchange_test_connection { target: "powershell" }AI Reports:
"Executive summary" → ai.exchange_executive_summary
"Root cause of queue 3452" → ai.root_cause_analysis { "domain": "example.com" }
"Anomaly — who is spamming?" → ai.anomaly_detection
"Capacity forecast" → ai.capacity_forecast
"Cleanup — recover space" → ai.cleanup_recommendation
"Who is compromised?" → ai.compromised_account_detection
"Can I migrate 2013 to 2019?" → ai.migration_advisor { "targetVersion": "Exchange 2019" }
"Ask Exchange" → ai.ask_exchange { "query": "Show me all mailboxes over 50 GB" }
"What if I move 500 mailboxes?" → ai.what_if_analysis { "sourceDB": "DB01", "targetDB": "DB05", "count": 500 }
"Tell me everything about this mailbox" → ai.tell_me_everything { "identity": "user@company.com" }
"Mailbox cleanup for user" → ai.mailbox_cleanup_advisor { "identity": "user@company.com" }Mailbox:
"List inbox top 5" → exchange_list_messages { folder: "inbox", top: 5 }
"Send meeting invite" → exchange_create_calendar_event { subject: "...", start: "...", attendees: [...] }Troubleshooting
Issue | Solution |
| The config path points to a directory. Remove it and run |
| Add |
| Duplicate registration. Ensure you are running the latest build with |
| Verify username, domain and password and that the account has the required RBAC role. For Basic authentication, run |
| The PowerShell URL is incorrect. It must be |
| The server expects WS-Management. This build uses PowerShell Remoting with |
| Add the cmdlet to the allow list. |
| For lab environments, set |
| Run |
Queues always empty |
|
For further diagnostics, run:
npx @modelcontextprotocol/inspector node dist/server.js --config=./config.yaml
npx exchange-mcp doctor --endpoint https://mail.contoso.comDevelopment
npm install
npm run dev # watch mode with tsx
npm test # run tests
npm run build # compile TypeScript to dist/
npx @modelcontextprotocol/inspector node dist/server.js --config=./config.yamlProject structure: server and configuration, authentication, Exchange clients (EWS, REST, PowerShell), tools, resources and utilities.
Security Notes
Never commit
config.yamlor files containing passwords or certificates. Useconfig.example.yamlas a template.Administrative tools are powerful. Exchange RBAC still applies, and an allow list prevents arbitrary cmdlet execution.
Prefer OAuth or Certificate authentication in production and use valid certificates.
OAuth tokens are cached in memory and certificate authentication uses HTTPS agents with
pfxorcertoptions.PowerShell Remoting uses
SkipCACheckonly wheninsecureis enabled for lab environments.
HTTP Transport Security Enhancement (v0.1.0+)
Security Enhancement: HTTP transport mode (--transport=http or MCP_TRANSPORT=http) now includes built-in authentication and access controls. The Express server validates credentials on every request before allowing access to any MCP tool, with secure-by-default settings.
Prior versions ran the HTTP transport without application-level authentication. This release adds multiple authentication methods, IP filtering, and rate limiting as standard features.
HTTP Transport Authentication Configuration
Add server.httpAuth to your config.yaml or use environment variables:
config.yaml:
server:
transport: http
port: 3000
host: 0.0.0.0
httpAuth:
enabled: true # default: true (secure by default)
method: apikey # apikey | bearer | basic | none | [apikey, bearer]
apiKeys:
- "your-secure-api-key-1"
- "your-secure-api-key-2" # multiple keys for rotation
bearerTokens:
- "your-bearer-token" # when method includes "bearer"
basicAuth:
username: "admin"
password: "your-password" # when method is "basic"
allowlist:
- "10.0.0.0/8" # CIDR allowlist (optional)
- "192.168.1.0/24"
denylist: [] # CIDR denylist (optional)
rateLimit:
windowMs: 60000 # 1 minute window
maxRequests: 100 # max requests per IP per window
protectHealth: false # true = require auth for /health (LB probes)Environment variables (recommended for secrets):
MCP_HTTP_AUTH_ENABLED=true
MCP_HTTP_AUTH_METHOD=apikey
MCP_API_KEYS="key1,key2"
MCP_BEARER_TOKENS="token1,token2"
MCP_BASIC_USER=admin
MCP_BASIC_PASS=password
MCP_ALLOWLIST="10.0.0.0/8,192.168.1.0/24"
MCP_DENYLIST=""
MCP_RATE_LIMIT_WINDOW_MS=60000
MCP_RATE_LIMIT_MAX_REQUESTS=100
MCP_PROTECT_HEALTH=falseQuick Setup
# Non-interactive (CI/CD friendly)
npm run setup:http-auth -- --yes --method apikey --key-count 2
# With custom options
npm run setup:http-auth -- --yes --method bearer --allowlist "10.0.0.0/8" --rate-limit-max 50
# JSON output for automation
npm run setup:http-auth -- --yes --jsonClient Configuration
API Key (recommended):
# Header: X-API-Key or Authorization: ApiKey <key>
curl -H "X-API-Key: your-key" http://localhost:3000/health
# Agent config
export MCP_API_KEY="your-key"Bearer Token:
curl -H "Authorization: Bearer your-token" http://localhost:3000/healthBasic Auth:
curl -u user:pass http://localhost:3000/healthImpact by Transport Mode
Transport | Impact | Notes |
stdio (default) | No impact | Uses OS-level process pipes; no network exposure |
HTTP ( | Requires auth | All endpoints secured; 401 without credentials |
Docker | Requires auth | Compose binds to |
Docker Compose (Updated)
The default docker-compose.yml now binds to localhost only and includes auth env vars:
services:
exchange-mcp:
build: .
ports:
- "127.0.0.1:3000:3000" # localhost only
environment:
- EXCHANGE_ENDPOINT=${EXCHANGE_ENDPOINT}
- AUTH_METHOD=${AUTH_METHOD:-basic}
- EXCHANGE_PASSWORD=${EXCHANGE_PASSWORD}
- MCP_HTTP_AUTH_ENABLED=true
- MCP_HTTP_AUTH_METHOD=apikey
- MCP_API_KEYS=${MCP_API_KEYS}
volumes:
- ./config.yaml:/app/config.yaml:ro
restart: unless-stoppedTo expose externally: Change port mapping to "3000:3000" and ensure strong auth is configured.
Upgrading from Previous Versions
If you were using HTTP transport without authentication configured:
Run
npm run setup:http-auth -- --yesto generate keys and update configRestart the server
Update clients to include authentication headers
For Docker: add
MCP_API_KEYSto your.envfile and rebuild
Contributing
Contributions are welcome, especially for additional Exchange cmdlets, tests and deployment recipes. Please run npm run build and npm test before submitting and do not commit config.yaml or *.pfx files.
License
MIT — see LICENSE.
Acknowledgements
Built on the Model Context Protocol TypeScript SDK and the Exchange Server and Exchange PowerShell documentation.
Available Tools
42 toolsexchange_create_mailboxC
Create mailbox (New-Mailbox) — user/shared/room
Inputs: name (required), room, alias, shared, +2 more.
exchange_get_cas_mailboxC
Get Client Access mailbox settings (ActiveSync, OWA, MAPI)
Inputs: identity (required).
exchange_get_dagC
Get Database Availability Groups (DAGs)
Inputs: identity.
exchange_get_database_copy_statusC
Get database copy status (DAG health)
Inputs: server, identity.
exchange_get_distribution_group_memberC
Get distribution group members
Inputs: identity (required).
exchange_get_exchange_certificateC
Get Exchange certificates (expiry monitoring)
Inputs: server.
exchange_get_health_reportB
Get health report (Get-HealthReport) — rollup per server/DAG
Inputs: server, healthSet.
exchange_get_mailboxC
Get mailbox details by identity
Inputs: identity (required).
exchange_get_mailbox_databaseC
Get mailbox database details
Inputs: identity (required).
exchange_get_mailbox_permissionsC
Get mailbox permissions (FullAccess, SendAs, etc.)
Inputs: identity (required).
exchange_get_mailbox_statisticsA
Get mailbox statistics (size, item count, last logon, DB) — troubleshooting storage/quota
Inputs: identity (required).
exchange_get_message_tracking_logC
Search message tracking logs (troubleshooting delivery)
Inputs: end, start, sender, server, +3 more.
exchange_get_monitoring_itemB
Get monitoring items (probes/monitors/responders) for a health set
Inputs: server (required), healthSet.
exchange_get_queueB
Get transport queues (Get-Queue) — key for troubleshooting mail flow
Inputs: filter, server.
exchange_get_queue_digestB
Get queue digest across DAG (Get-QueueDigest)
Inputs: dag.
exchange_get_role_groupsA
List role groups (RBAC — Permissions)
Inputs: no named parameters.
exchange_get_serverC
Get Exchange server details
Inputs: identity (required).
exchange_get_server_component_stateB
Get server component states (ServerWideOffline, etc.)
Inputs: server (required).
exchange_get_server_healthC
Get server health (Get-ServerHealth) — Managed Availability health sets
Inputs: server (required), healthSet.
exchange_get_transport_rulesA
Get transport (mail flow) rules
Inputs: no named parameters.
exchange_get_transport_serviceC
Get Transport service config
Inputs: server.
exchange_get_virtual_directoryB
Get virtual directories (OWA/ECP/EWS/ActiveSync/MAPI)
Inputs: type, server.
exchange_list_accepted_domainsB
List accepted domains
Inputs: no named parameters.
exchange_list_distribution_groupsC
List distribution groups
Inputs: filter.
exchange_list_dynamic_distribution_groupsB
List dynamic distribution groups
Inputs: no named parameters.
exchange_list_mailbox_databasesC
List mailbox databases
Inputs: includePreExchange2013.
exchange_list_mailboxesC
List mailboxes (admin) — supports filter and RecipientTypeDetails
Inputs: filter, resultSize, recipientType.
exchange_list_mail_contactsC
List mail contacts
Inputs: resultSize.
exchange_list_mail_usersD
List mail users
Inputs: resultSize.
exchange_list_receive_connectorsA
List Receive connectors (optionally per server)
Inputs: server.
exchange_list_remote_domainsB
List remote domains
Inputs: no named parameters.
exchange_list_send_connectorsB
List Send connectors
Inputs: no named parameters.
exchange_list_serversA
List Exchange servers (Get-ExchangeServer)
Inputs: no named parameters.
exchange_remove_mailboxC
Remove mailbox (disable/delete)
Inputs: identity (required), permanent.
exchange_retry_queueC
Retry a queue (troubleshooting)
Inputs: identity (required), server.
exchange_search_admin_audit_logC
Search admin audit log (compliance)
Inputs: endDate, userIds, startDate, resultSize.
exchange_set_mailboxC
Set mailbox properties (prohibitSendQuota, retention, etc.)
Inputs: identity (required), customAttribute1, issueWarningQuota, prohibitSendQuota.
exchange_suspend_queueC
Suspend a queue
Inputs: identity (required).
exchange_test_connectionA
Diagnose Exchange connectivity — tests endpoint reachability, PowerShell virtual directory, and auth. Use when all tools return 404.
Inputs: target.
exchange_test_mailflowD
Test mailflow (Test-Mailflow)
Inputs: sourceMailbox, targetMailbox.
exchange_test_replication_healthC
Test replication health (DAG — Test-ReplicationHealth)
Inputs: server.
exchange_test_service_healthC
Test service health (Test-ServiceHealth) — checks required services
Inputs: server.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 42 tools
Most tools map to a distinct Exchange resource and action, such as mailboxes, connectors, queues, or health sets. A few clusters (mailbox statistics vs. permissions vs. CAS settings, and health report vs. server health vs. monitoring items) could be confused, but the descriptions provide enough clarity.
All tools share the exchange_ prefix and mostly follow a verb_noun pattern with list/get/create/set/remove/test/search. Minor inconsistencies exist, such as get_distribution_group_member using a singular noun and get_queue/get_queue_digest using get for collections rather than list.
42 tools is a very large surface for one MCP server and exceeds the 25+ threshold. While the breadth reflects Exchange's many admin areas, the count creates significant selection overhead and increases the chance of agent misrouting.
Mailbox lifecycle is well covered, and health/transport diagnostics are strong. However, distribution groups, mail contacts/users, connectors, transport rules, and accepted/remote domains are mostly read-only, leaving notable management gaps for a general Exchange administration tool.
Maintenance
Related MCP Connectors
Postgate AI: Exchange mail, calendar, contacts and tasks - on-prem, hybrid, Online, per-user rights
- DNS-DATA RemoteDeprecatedcom.dns-data
Connect AI assistants to authorized Windows and macOS devices for files, commands, and management.
Connect AI assistants to explicitly paired computers, servers, and VMs for permitted remote actions.
Remote Desktop Commander: use files, terminal and processes on your own computers from any AI app.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceEnables AI assistants to interact with Microsoft 365 services (users, mail, calendar, files) via Microsoft Graph API.34 npm1MIT
- AlicenseAqualityCmaintenanceMCP server for any Microsoft Exchange / OWA deployment. Gives LLM agents access to email, calendar, directory search, folders, availability, and meeting analytics via 30 tools.3032 PyPI12MIT
- AlicenseNot gradedqualityDmaintenanceEnables an SAP Joule agent to read and send email from a scoped Microsoft Exchange mailbox via MCP tools, translating tool calls into Microsoft Graph requests.ISC
- 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