Microsoft 365 Mail — Claude Code MCP server: how to install
MCP server connecting Microsoft 365 Outlook Mail via Graph API. It lets agents search inboxes, send replies, triage messages, and manage out-of-office status.
claude mcp add --env MS_CLIENT_ID=<MS_CLIENT_ID> --env MS_CONFIG_DIR=<MS_CONFIG_DIR> --env MS_ACCOUNT_EMAIL=<MS_ACCOUNT_EMAIL> --env MS_MCP_PACKAGE_ID=<MS_MCP_PACKAGE_ID> --env MICROSOFT_REQUEST_TIMEOUT_MS=<MICROSOFT_REQUEST_TIMEOUT_MS> --transport stdio microsoft-mail -- npx -y @mindstone/mcp-server-microsoft-mailWhat Microsoft 365 Mail does
This server equips AI agents with 22 tools to interact with Outlook via Microsoft Graph. Capabilities cover searching messages, drafting replies, moving emails between folders, and saving file attachments. It also houses the authenticate_microsoft_account tool for its connector group.
Unlike standalone tools, this server does not launch an interactive browser login. The host environment manages OAuth directly and writes credentials to ${MS_CONFIG_DIR}/credentials/. Without those on-disk token files, every tool invocation fails immediately with an auth_required error payload.
Running this package requires Node.js 20 or newer. You must supply MS_CLIENT_ID and MS_CONFIG_DIR. Upstream Graph requests default to a 60000 ms timeout. Downloads land in the system temporary folder unless MCP_WORKSPACE_PATH is set.
What it helps with
- find unread messages by sender or topic
- reply directly to existing email threads
- save email attachments to local storage
- set out-of-office auto-replies
Example prompts for the agent
- Find my five latest unread emails from [email protected] and reply to the newest one
- Download attachments from the latest email with subject Q3 planning
- Turn on out-of-office replies until next Monday
How to install Microsoft 365 Mail
Platform CLI
claude mcp add --env MS_CLIENT_ID=<MS_CLIENT_ID> --env MS_CONFIG_DIR=<MS_CONFIG_DIR> --env MS_ACCOUNT_EMAIL=<MS_ACCOUNT_EMAIL> --env MS_MCP_PACKAGE_ID=<MS_MCP_PACKAGE_ID> --env MICROSOFT_REQUEST_TIMEOUT_MS=<MICROSOFT_REQUEST_TIMEOUT_MS> --transport stdio microsoft-mail -- npx -y @mindstone/mcp-server-microsoft-mailReplace <…> with your own values. 1 more environment variable is in the server README
Platform CLI
codex mcp add microsoft-mail --env MS_CLIENT_ID=<MS_CLIENT_ID> --env MS_CONFIG_DIR=<MS_CONFIG_DIR> --env MS_ACCOUNT_EMAIL=<MS_ACCOUNT_EMAIL> --env MS_MCP_PACKAGE_ID=<MS_MCP_PACKAGE_ID> --env MICROSOFT_REQUEST_TIMEOUT_MS=<MICROSOFT_REQUEST_TIMEOUT_MS> -- npx -y @mindstone/mcp-server-microsoft-mailReplace <…> with your own values. 1 more environment variable is in the server README
Config file
{
"mcpServers": {
"microsoft-mail": {
"command": "npx",
"args": [
"-y",
"@mindstone/mcp-server-microsoft-mail"
],
"env": {
"MS_CLIENT_ID": "<MS_CLIENT_ID>",
"MS_CONFIG_DIR": "<MS_CONFIG_DIR>",
"MS_ACCOUNT_EMAIL": "<MS_ACCOUNT_EMAIL>",
"MS_MCP_PACKAGE_ID": "<MS_MCP_PACKAGE_ID>",
"MICROSOFT_REQUEST_TIMEOUT_MS": "<MICROSOFT_REQUEST_TIMEOUT_MS>"
}
}
}
}Replace <…> with your own values. 1 more environment variable is in the server README
Config file
{
"servers": {
"microsoft-mail": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@mindstone/mcp-server-microsoft-mail"
],
"env": {
"MS_CLIENT_ID": "<MS_CLIENT_ID>",
"MS_CONFIG_DIR": "<MS_CONFIG_DIR>",
"MS_ACCOUNT_EMAIL": "<MS_ACCOUNT_EMAIL>",
"MS_MCP_PACKAGE_ID": "<MS_MCP_PACKAGE_ID>",
"MICROSOFT_REQUEST_TIMEOUT_MS": "<MICROSOFT_REQUEST_TIMEOUT_MS>"
}
}
}
}Replace <…> with your own values. 1 more environment variable is in the server README
Platform CLI
gemini mcp add -e MS_CLIENT_ID=<MS_CLIENT_ID> -e MS_CONFIG_DIR=<MS_CONFIG_DIR> -e MS_ACCOUNT_EMAIL=<MS_ACCOUNT_EMAIL> -e MS_MCP_PACKAGE_ID=<MS_MCP_PACKAGE_ID> -e MICROSOFT_REQUEST_TIMEOUT_MS=<MICROSOFT_REQUEST_TIMEOUT_MS> microsoft-mail npx -y @mindstone/mcp-server-microsoft-mailReplace <…> with your own values. 1 more environment variable is in the server README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Microsoft 365 Mail
How do I install Microsoft 365 Mail in Claude Code?
Run `claude mcp add mcp-server-microsoft-mail -e MS_CLIENT_ID=<MS_CLIENT_ID> -e MS_CONFIG_DIR=<MS_CONFIG_DIR> -- npx -y @mindstone/mcp-server-microsoft-mail`. Replace the placeholders with your Entra app client ID and config directory path.
What does the Microsoft 365 Mail MCP server do?
It exposes 22 Microsoft Graph tools for managing Outlook. Your agent can read inboxes, organize folders, send replies, and update mailbox settings.
Why does this server require MS_CONFIG_DIR?
The server does not handle OAuth login flows on its own. It relies on the host application to write session tokens into ${MS_CONFIG_DIR}/credentials/ and index them in accounts.json.