@wootz/outlook-ews-mcp
v0.2.0
Published
MCP server for Outlook email and calendar via EWS
Downloads
382
Readme
outlook-ews-mcp
MCP server,透過 EWS 存取 Outlook 郵件與行事曆。
前提
- Node.js 18+
- Office 365 企業帳號
- 組織必須開放 EWS 存取
安裝
npm install -g @wootz/outlook-ews-mcp
# 或
pnpm add -g @wootz/outlook-ews-mcpMCP 設定
{
"mcpServers": {
"outlook": {
"command": "npx",
"args": ["-y", "@wootz/outlook-ews-mcp"]
}
}
}或從原始碼(先執行 pnpm install && pnpm build):
{
"mcpServers": {
"outlook": {
"command": "node",
"args": ["/path/to/outlook-ews-mcp/dist/index.js"]
}
}
}透過 ALLOWED_TOOLS 限制可用的 tool,多個以逗號分隔。未設定則全部啟用。login 與 logout 不受此設定影響,永遠啟用:
{
"mcpServers": {
"outlook": {
"command": "npx",
"args": ["-y", "@wootz/outlook-ews-mcp"],
"env": {
"ALLOWED_TOOLS": "list_emails,get_email,list_events"
}
}
}
}驗證流程
使用 login tool 登入,或第一次呼叫任何 tool 時 server 會自動要求驗證:
Authentication required.
1. Open: https://microsoft.com/devicelogin
2. Enter code: ABC-1234完成後 token 存在 ~/.outlook-mcp/token.json,之後自動 silent refresh。Token 有效期約 90 天,有使用就自動續期。使用 logout tool 可登出並清除所有快取。
可用 Tools
驗證
| Tool | 說明 |
|------|------|
| login | 發起 device code 登入流程 |
| logout | 登出並清除所有快取憑證 |
郵件
| Tool | 說明 |
|------|------|
| list_emails | 列出信件(支援篩選未讀、寄件人、日期) |
| get_email | 取得完整郵件內容與附件清單 |
| search_emails | 依關鍵字搜尋 |
| send_email | 發送新郵件 |
| reply_email | 回覆郵件 |
| forward_email | 轉寄郵件 |
| mark_email | 標記已讀/未讀 |
| move_email | 移動到資料夾 |
| delete_email | 刪除(移到垃圾桶或永久刪除) |
| list_folders | 列出所有資料夾 |
行事曆
| Tool | 說明 |
|------|------|
| list_events | 列出指定時間範圍的行程 |
| get_event | 取得行程詳情(與會者、會議連結) |
| create_event | 建立新行程 |
| update_event | 更新行程 |
| delete_event | 刪除行程 |
| create_meeting | 建立會議並發送邀請 |
| get_free_busy | 查詢他人空閒時間 |
注意事項
- Microsoft 預計 2026/10 停止 EWS 對 Outlook add-in 的支援,但獨立 app 的時程未定
- 若組織封鎖 EWS,需考慮改用 Graph API(需要管理員 Grant admin consent)
