outlook-mcp

outlook-mcp

MCP server that enables Claude to manage Outlook emails, including reading, sending, organizing, drafting, and bulk operations via Microsoft Graph API.

Category
访问服务器

README

outlook-mcp

MCP server for Claude that provides full Outlook email management via Microsoft Graph API. Read, send, organize, draft, and bulk-manage emails — all from Claude Code or Claude Desktop.

Quick Install

claude mcp add outlook -e OUTLOOK_CLIENT_ID=your_client_id -- npx -y @hamzashahbaz/outlook-mcp

Features

19 tools for complete email management:

Reading

Tool Description
outlook_list_messages List emails in a folder with pagination and OData filters
outlook_get_message Get full email details by message ID
outlook_search_messages Search emails using KQL queries
outlook_list_folders List all mail folders with unread counts

Sending

Tool Description
outlook_send_email Send a new email to one or more recipients
outlook_reply Reply to an email (reply or reply-all)
outlook_forward Forward an email to new recipients

Drafts

Tool Description
outlook_create_draft Create a draft email (saved, not sent)
outlook_update_draft Update an existing draft
outlook_send_draft Send a previously created draft
outlook_delete_draft Delete a draft

Organization

Tool Description
outlook_move_message Move a message to a different folder
outlook_delete_message Delete a message (moves to Deleted Items)
outlook_update_message Mark as read/unread, flag/unflag
outlook_mark_all_read Mark all messages in a folder as read
outlook_create_folder Create a new mail folder
outlook_empty_folder Permanently delete all messages in a folder

Bulk Operations

Tool Description
outlook_bulk_move_by_sender Move all emails from a sender domain to a folder
outlook_bulk_move_by_search Move emails matching a KQL search query to a folder

Prerequisites

  • Node.js 18+
  • Azure App Registration with device code flow enabled

Setup

Azure App Registration

  1. Go to Azure Portal > App Registrations > New Registration
  2. Name: Outlook MCP (or anything you like)
  3. Supported account types: Personal Microsoft accounts only (or include organizational if needed)
  4. Redirect URI: Leave blank (device code flow doesn't need one)
  5. Under Authentication > Advanced settings:
    • Enable Allow public client flows (required for device code)
  6. Under API Permissions, add Microsoft Graph delegated permissions:
    • Mail.ReadWrite
    • Mail.Send
    • User.Read
  7. Copy the Application (client) ID — this is your OUTLOOK_CLIENT_ID

Authentication

On first run, the server initiates an OAuth 2.0 device code flow:

  1. A URL and code are displayed in stderr output
  2. Open the URL in your browser and enter the code
  3. Sign in with your Microsoft account and grant permissions
  4. Tokens are saved automatically for future use

Tokens auto-refresh using the refresh token. If a refresh fails (e.g., token revoked), delete the token file and restart — the device code flow will trigger again.

Configuration

Claude Code

Add via CLI (recommended):

claude mcp add outlook -e OUTLOOK_CLIENT_ID=your_client_id -- npx -y @hamzashahbaz/outlook-mcp

Or add manually to .mcp.json:

{
  "mcpServers": {
    "outlook": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@hamzashahbaz/outlook-mcp"],
      "env": {
        "OUTLOOK_CLIENT_ID": "your_client_id"
      }
    }
  }
}

Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "outlook": {
      "command": "npx",
      "args": ["-y", "@hamzashahbaz/outlook-mcp"],
      "env": {
        "OUTLOOK_CLIENT_ID": "your_client_id"
      }
    }
  }
}

Token Storage

Tokens are stored at ~/.outlook-mcp/.tokens.json with 600 permissions (owner read/write only). This location persists across npx invocations.

The file contains:

  • Access token — short-lived, auto-refreshed
  • Refresh token — long-lived, used to obtain new access tokens

To re-authenticate, delete the token file:

rm ~/.outlook-mcp/.tokens.json

Folder Names

Standard Outlook folder names: Inbox, SentItems, Drafts, DeletedItems, Archive, JunkEmail

Custom folders use the display name as created.

Troubleshooting

"OUTLOOK_CLIENT_ID environment variable is required"

Set OUTLOOK_CLIENT_ID in your MCP configuration's env block.

Authentication expired

Delete the token file and restart:

rm ~/.outlook-mcp/.tokens.json

The device code flow will trigger again on next use.

"Insufficient privileges"

Check your Azure App Registration > API Permissions. Ensure Mail.ReadWrite and Mail.Send are granted. For organizational accounts, admin consent may be required.

Rate limited

Microsoft Graph enforces rate limits. The server reports the Retry-After header value. Wait and retry.

Known Limitations

  • Cannot delete mail folders — Microsoft Graph API does not support folder deletion for personal accounts
  • Search pagination — KQL search results are limited to 25 per request (the server handles pagination internally)
  • Bulk operations — Process up to 200-500 messages per call to avoid timeouts

How It Works

  • API: Microsoft Graph API v1.0
  • Auth: OAuth 2.0 device code flow
  • Protocol: Model Context Protocol (MCP) over stdio
  • Validation: Zod schemas for all tool inputs
  • Built for: Claude Code and Claude Desktop

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选