outlook-mcp
An MCP server that gives AI agents structured access to a Microsoft Outlook mailbox through the Microsoft Graph API, with a deliberate constraint: agents can read and draft emails, but only humans can send.
README
outlook-mcp
An MCP server that gives AI agents structured access to a Microsoft Outlook mailbox through the Microsoft Graph API — with one deliberate constraint at its core:
Agents read and draft. Only humans send.
There is no send tool in this server, and the OAuth token it holds does not include the Mail.Send scope. Even a fully compromised or badly prompted agent cannot send email through it — the capability doesn't exist at the token level. Everything outbound lands in your Drafts folder for human review.
I built this to power an autonomous operations pipeline: scheduled headless agent sessions sweep the mailbox twice a day, reconcile every open commitment and follow-up into a dashboard, and queue reply drafts for review. It runs identically under Claude Code and OpenAI Codex — one integration layer, two vendors' agents.
Permission model
| Capability | Agent | Notes |
|---|---|---|
| List/search/read mail | ✅ | Full mailbox visibility |
| Organize (folders, move, batch triage) | ✅ | Reversible operations only |
| Create drafts / reply drafts | ✅ | Lands in Drafts, never sent |
| Send email | ❌ | No tool, and no Mail.Send scope on the token |
| Delete email | ❌ | Not implemented |
Auth is MSAL Authorization Code Flow with PKCE through a localhost-only callback. Tokens cache to ~/.outlook-mcp/ with 0600 permissions.
Tools (10)
| Tool | Purpose |
|---|---|
list_folders |
Folder tree with counts |
create_folder |
Create a mail folder |
list_emails |
Page through a folder (subject, sender, preview, unread) |
search_emails |
KQL search across all folders (from:, subject:, free text) |
read_email |
Full message body (HTML converted to clean text), recipients, attachments list |
move_emails |
Move messages between folders |
batch_move_emails |
Bulk triage in one call |
create_draft |
New outbound draft |
create_reply_draft |
Reply/reply-all draft on an existing thread |
summarize_folder |
Folder statistics (volume, unread, top senders) |
Setup
1. Register a (free) app in Entra ID
Microsoft Entra admin center → App registrations → New registration:
- Supported account types: your tenant only, or multi-tenant + personal accounts (then use
OUTLOOK_MCP_TENANT_ID=common) - Redirect URI: platform Mobile and desktop applications → add
http://localhost:3847/auth/callback - Authentication → enable Allow public client flows
- API permissions → Microsoft Graph → Delegated →
Mail.ReadWrite,MailboxSettings.Read
No client secret is needed (public client + PKCE).
2. Build and authenticate
npm install
npm run build
export OUTLOOK_MCP_CLIENT_ID=<your app client id>
export OUTLOOK_MCP_TENANT_ID=<your tenant id or "common">
npm run auth # opens browser once; token cache persists at ~/.outlook-mcp/
3. Connect an agent
Claude Code — .mcp.json in your project (or claude mcp add):
{
"mcpServers": {
"outlook": {
"command": "node",
"args": ["/path/to/outlook-mcp/dist/index.js"],
"env": {
"OUTLOOK_MCP_CLIENT_ID": "<client id>",
"OUTLOOK_MCP_TENANT_ID": "<tenant id>"
}
}
}
}
OpenAI Codex — ~/.codex/config.toml:
[mcp_servers.outlook]
command = "node"
args = ["/path/to/outlook-mcp/dist/index.js"]
env = { OUTLOOK_MCP_CLIENT_ID = "<client id>", OUTLOOK_MCP_TENANT_ID = "<tenant id>" }
Same server, same tools, either agent. That portability is the point of MCP.
Architecture
┌─────────────┐ stdio ┌──────────────┐ HTTPS ┌─────────────────┐
│ Claude Code │◄──────────────►│ │◄─────────────►│ Microsoft Graph │
├─────────────┤ JSON-RPC │ outlook-mcp │ REST v1.0 │ /me/messages │
│ OpenAI Codex│◄──────────────►│ (Node/TS) │ │ /me/mailFolders│
└─────────────┘ └──────┬───────┘ └─────────────────┘
│
┌──────┴───────┐
│ MSAL + PKCE │ Mail.ReadWrite only —
│ token cache │ no Mail.Send on the token
└──────────────┘
- Transport: stdio (JSON-RPC), one process per agent session
- Auth: MSAL Auth Code Flow + PKCE, localhost callback, silent refresh from disk cache
- Bodies: HTML mail converted to clean plain text before it reaches the model (token efficiency)
- Validation: every tool input validated with zod before any Graph call
Development
npm run dev # tsc --watch
npm run inspect # MCP Inspector against the built server
License
MIT © Don Fournier
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。