outlook-mcp
Enables AI assistants to manage Microsoft Outlook email and calendar through the Microsoft Graph API, including reading, sending, searching emails, and handling calendar events.
README
Microsoft Outlook MCP Server
A Model Context Protocol (MCP) server that enables AI assistants to interact with Microsoft Outlook email and calendar through the Microsoft Graph API.
Features
- Email Operations: Read, search, send, reply to emails and download attachments
- SharePoint Integration: Access SharePoint files via sharing links or direct file IDs. Download files shared to you via emails.
- Calendar Management: View and manage calendar events and appointments
- Office Document Processing: Parse PDF, Word, PowerPoint, and Excel files with extracted text content
- Large File Support: Automatic handling of files that exceed MCP response size limits
Quick Start
Choose your installation method:
| Method | Best For |
|---|---|
| DXT Extension | Claude Desktop users |
| CLI Configuration | Claude Code, mcp CLI, other MCP clients |
Prerequisites: Before installing, you'll need to set up an Azure application to get your Client ID and Tenant ID.
Installation
Installing as DXT Extension
For Claude Desktop users, DXT extensions provide the simplest installation experience.
Option 1: Download Pre-built Extension
- Download
outlook-mcp.dxtfrom the Releases page - In Claude Desktop, go to Settings → Extensions
- Click Install from file and select the
.dxtfile - Enter your Azure Client ID, Tenant ID, and optional download directory when prompted
Option 2: Build from Source
- Clone and install dependencies:
git clone https://github.com/XenoXilus/outlook-mcp.git cd outlook-mcp npm install - Install the DXT CLI:
npm install -g @anthropic-ai/dxt - Pack the extension:
dxt pack . outlook-mcp.dxt - Install the generated
.dxtfile in Claude Desktop as above
Using with CLI Tools
For CLI-based MCP clients (Claude Code, mcp CLI, etc.), configure the server directly.
1. Clone and Install:
git clone https://github.com/XenoXilus/outlook-mcp.git
cd outlook-mcp
npm install
2. Configure your MCP client:
Add the following to your MCP servers configuration (location varies by client):
{
"outlook-mcp": {
"command": "node",
"args": ["/absolute/path/to/outlook-mcp/server/index.js"],
"env": {
"AZURE_CLIENT_ID": "your-azure-client-id",
"AZURE_TENANT_ID": "your-azure-tenant-id",
"MCP_OUTLOOK_WORK_DIR": "/optional/download/directory"
}
}
}
Common config file locations:
- Claude Code:
~/.claude.jsonor project-level.mcp.json - mcp CLI:
~/.config/mcp/servers.json
3. Alternative: Use environment variables
Instead of specifying env in the config, you can export the variables in your shell:
export AZURE_CLIENT_ID="your-azure-client-id"
export AZURE_TENANT_ID="your-azure-tenant-id"
export MCP_OUTLOOK_WORK_DIR="/optional/download/directory"
Azure Setup Guide
To use this MCP server, you need to register an application in Microsoft Azure.
For Business/Work Accounts (Recommended)
- Go to the Azure Portal and search for "App registrations".
- Click New registration.
- Name:
Outlook MCP(or similar) - Supported account types: Accounts in this organizational directory only (Single tenant)
- Redirect URI: Select Web and enter
http://localhost/callback
- Name:
- Click Register.
- Go to Authentication in the sidebar.
- Under "Advanced settings", set Allow public client flows to Yes.
- Click Save.
- On the Overview page, copy:
- Application (client) ID → This is your
AZURE_CLIENT_ID - Directory (tenant) ID → This is your
AZURE_TENANT_ID
- Application (client) ID → This is your
- Go to API permissions in the sidebar.
- Click Add a permission -> Microsoft Graph -> Delegated permissions.
- Add these permissions:
Mail.Read,Mail.ReadWrite,Mail.SendCalendars.Read,Calendars.ReadWriteUser.Read,MailboxSettings.ReadFiles.Read.All,Files.ReadWrite.AllSites.Read.All,Sites.ReadWrite.Alloffline_access
- Click Add permissions.
- (Optional) If you are an admin, click Grant admin consent to suppress consent prompts for users.
Note: No client secret is required (PKCE auth flow).
For Personal Accounts (outlook.com, hotmail.com)
Personal Microsoft accounts can also register apps in Azure:
- Sign in to the Azure Portal with your personal Microsoft account (outlook.com, hotmail.com, etc.).
- If prompted to create a directory, follow the steps to create a free Azure directory.
- Follow the same steps as above for Business accounts.
- When configuring, use Accounts in any organizational directory and personal Microsoft accounts for supported account types.
Configuration Reference
Environment Variables
| Variable | Required | Description |
|---|---|---|
AZURE_CLIENT_ID |
Yes | Your Azure AD application client ID |
AZURE_TENANT_ID |
Yes | Your Azure AD directory (tenant) ID |
MCP_OUTLOOK_WORK_DIR |
No | Directory for saving large files (defaults to system temp) |
Large File Handling
When downloading large attachments or SharePoint files, the server automatically detects when the response would exceed the MCP 1MB limit and saves the content to local files instead.
- If
MCP_OUTLOOK_WORK_DIRis set, large files are saved to this directory - If not set, files are saved to the system temp directory
- Files are automatically named with timestamps to avoid conflicts
- Old files are periodically cleaned up to manage disk space
Example Prompts
Once installed, you can ask the AI assistant things like:
Email Management
- "Show me my unread emails from this week"
- "Find all emails from John about the project proposal"
- "Send a reply to the last email from Sarah thanking her for the update"
- "Draft an email to the team summarizing today's meeting"
Calendar
- "What meetings do I have tomorrow?"
- "Schedule a 30-minute call with Alex next Tuesday afternoon"
- "Show me my availability for the rest of the week"
Attachments & SharePoint
- "Download and summarize the PDF attachment from the latest email from Finance"
- "Get the contents of this SharePoint link: [paste link]"
- "What files were attached to emails from Legal this month?"
Office Document Processing
The server automatically parses:
- PDF files: Extracts text content
- Word documents (.docx): Extracts text content
- PowerPoint (.pptx): Extracts slide text
- Excel (.xlsx): Parses data into structured format
Authentication
The server uses OAuth 2.0 with PKCE for secure authentication:
- First run will open a browser for Microsoft authentication
- Tokens are encrypted and stored locally (uses OS keychain if available, otherwise encrypted file storage)
- Automatic token refresh for long-term usage
- No sensitive data stored in plain text
Required Permissions
The app requests these Microsoft Graph permissions:
Mail.Read,Mail.ReadWrite,Mail.Send- Email accessCalendars.Read,Calendars.ReadWrite- Calendar accessUser.Read,MailboxSettings.Read- User profileFiles.Read.All,Files.ReadWrite.All- OneDrive/SharePoint filesSites.Read.All,Sites.ReadWrite.All- SharePoint sitesoffline_access- Refresh tokens
Troubleshooting
Large File Issues
- Problem: "Result exceeds maximum length" error
- Solution: Ensure
MCP_OUTLOOK_WORK_DIRis set and writable - Alternative: Files automatically save to system temp if work dir not configured
Authentication Issues
- Problem: Authentication failures
- Solution: Verify Azure AD app permissions and client ID
- Reset: Clear stored tokens and re-authenticate
SharePoint Access Issues
- Problem: Cannot access SharePoint files
- Solution: Ensure sharing links are valid and user has access permissions
- Alternative: Use direct file ID access if available
Development
Project Structure
outlook-mcp/
├── server/
│ ├── index.js # Main MCP server
│ ├── auth/ # Authentication management
│ ├── graph/ # Microsoft Graph API client
│ ├── schemas/ # MCP tool schemas
│ ├── tools/ # MCP tool implementations
│ │ ├── attachments/ # Attachment tools
│ │ ├── calendar/ # Calendar tools
│ │ ├── email/ # Email tools
│ │ ├── folders/ # Folder management
│ │ └── sharepoint/ # SharePoint tools
│ └── utils/ # Utility modules
└── package.json
Running Tests
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:benchmark # Performance benchmarks
Debugging
npm run test:graph # Test Graph API connection
Support
If this tool saved you time, consider supporting the development!
License
MIT License
Contributing
- Fork the repository
- Create a feature branch
- Make changes with tests
- Submit a pull request
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。