Outlook MCP Server
Connects Claude to Microsoft Outlook through the Microsoft Graph API, enabling email management (list, search, read, send) and calendar operations (list, create, accept, decline, delete events) via OAuth 2.0 authentication.
README
Modular Outlook MCP Server
This is a modular implementation of the Outlook MCP (Model Context Protocol) server that connects Claude with Microsoft Outlook through the Microsoft Graph API. Certified by MCPHub https://mcphub.com/mcp-servers/ryaker/outlook-mcp
Directory Structure
/modular/
├── index.js # Main entry point
├── config.js # Configuration settings
├── auth/ # Authentication modules
│ ├── index.js # Authentication exports
│ ├── token-manager.js # Token storage and refresh
│ └── tools.js # Auth-related tools
├── calendar/ # Calendar functionality
│ ├── index.js # Calendar exports
│ ├── list.js # List events
│ ├── create.js # Create event
│ ├── delete.js # Delete event
│ ├── cancel.js # Cancel
│ ├── accept.js # Accept event
│ ├── tentative.js # Tentatively accept event
│ ├── decline.js # Decline event
├── email/ # Email functionality
│ ├── index.js # Email exports
│ ├── list.js # List emails
│ ├── search.js # Search emails
│ ├── read.js # Read email
│ └── send.js # Send email
└── utils/ # Utility functions
├── graph-api.js # Microsoft Graph API helper
├── odata-helpers.js # OData query building
└── mock-data.js # Test mode data
Features
- Authentication: OAuth 2.0 authentication with Microsoft Graph API
- Email Management: List, search, read, and send emails
- Calendar Management: List, create, accept, decline, and delete calendar events
- Modular Structure: Clean separation of concerns for better maintainability
- OData Filter Handling: Proper escaping and formatting of OData queries
- Test Mode: Simulated responses for testing without real API calls
Quick Start
- Install dependencies:
npm install - Azure setup: Register app in Azure Portal (see detailed steps below)
- Configure environment: Copy
.env.exampleto.envand add your Azure credentials - Configure Claude: Update your Claude Desktop config with the server path
- Start auth server:
npm run auth-server - Authenticate: Use the authenticate tool in Claude to get the OAuth URL
- Start using: Access your Outlook data through Claude!
Installation
Prerequisites
- Node.js 14.0.0 or higher
- npm or yarn package manager
- Azure account for app registration
Install Dependencies
npm install
This will install the required dependencies including:
@modelcontextprotocol/sdk- MCP protocol implementationdotenv- Environment variable management
Azure App Registration & Configuration
To use this MCP server you need to first register and configure an app in Azure Portal. The following steps will take you through the process of registering a new app, configuring its permissions, and generating a client secret.
App Registration
- Open Azure Portal in your browser
- Sign in with a Microsoft Work or Personal account
- Search for or cilck on "App registrations"
- Click on "New registration"
- Enter a name for the app, for example "Outlook MCP Server"
- Select the "Accounts in any organizational directory and personal Microsoft accounts" option
- In the "Redirect URI" section, select "Web" from the dropdown and enter "http://localhost:3333/auth/callback" in the textbox
- Click on "Register"
- From the Overview section of the app settings page, copy the "Application (client) ID" and enter it as the MS_CLIENT_ID in the .env file as well as the OUTLOOK_CLIENT_ID in the claude-config-sample.json file
App Permissions
- From the app settings page in Azure Portal select the "API permissions" option under the Manage section
- Click on "Add a permission"
- Click on "Microsoft Graph"
- Select "Delegated permissions"
- Search for the following permissions and slect the checkbox next to each one
- offline_access
- User.Read
- Mail.Read
- Mail.Send
- Calendars.Read
- Calendars.ReadWrite
- Contacts.Read
- Click on "Add permissions"
Client Secret
- From the app settings page in Azure Portal select the "Certificates & secrets" option under the Manage section
- Switch to the "Client secrets" tab
- Click on "New client secret"
- Enter a description, for example "Client Secret"
- Select the longest possible expiration time
- Click on "Add"
- ⚠️ IMPORTANT: Copy the secret VALUE (not the Secret ID) and save it for the next step
Configuration
1. Environment Variables
Create a .env file in the project root by copying the example:
cp .env.example .env
Edit .env and add your Azure credentials:
# Get these values from Azure Portal > App Registrations > Your App
MS_CLIENT_ID=your-application-client-id-here
MS_CLIENT_SECRET=your-client-secret-VALUE-here
USE_TEST_MODE=false
Important Notes:
- Use
MS_CLIENT_IDandMS_CLIENT_SECRETin the.envfile - For Claude Desktop config, you'll use
OUTLOOK_CLIENT_IDandOUTLOOK_CLIENT_SECRET - Always use the client secret VALUE, never the Secret ID
2. Claude Desktop Configuration
Copy the configuration from claude-config-sample.json to your Claude Desktop config file and update the paths and credentials:
{
"mcpServers": {
"outlook-assistant": {
"command": "node",
"args": [
"/absolute/path/to/outlook-mcp/index.js"
],
"env": {
"USE_TEST_MODE": "false",
"OUTLOOK_CLIENT_ID": "your-client-id-here",
"OUTLOOK_CLIENT_SECRET": "your-client-secret-here"
}
}
}
}
3. Advanced Configuration (Optional)
To configure server behavior, you can edit config.js to change:
- Server name and version
- Test mode settings
- Authentication parameters
- Email field selections
- API endpoints
Usage with Claude Desktop
- Configure Claude Desktop: Add the server configuration (see Configuration section above)
- Restart Claude Desktop: Close and reopen Claude Desktop to load the new MCP server
- Start Authentication Server: Open a terminal and run
npm run auth-server - Authenticate: In Claude Desktop, use the
authenticatetool to get an OAuth URL - Complete OAuth Flow: Visit the URL in your browser and sign in with Microsoft
- Start Using: Once authenticated, you can use all the Outlook tools in Claude!
Running Standalone
You can test the server using:
./test-modular-server.sh
This will use the MCP Inspector to directly connect to the server and let you test the available tools.
Authentication Flow
The authentication process requires two steps:
Step 1: Start the Authentication Server
npm run auth-server
This starts a local server on port 3333 that handles the OAuth callback from Microsoft.
⚠️ Important: The auth server MUST be running before you try to authenticate. The authentication URL will not work if the server isn't running.
Step 2: Authenticate with Microsoft
- In Claude Desktop, use the
authenticatetool - Claude will provide a URL like:
http://localhost:3333/auth?client_id=your-client-id - Visit this URL in your browser
- Sign in with your Microsoft account
- Grant the requested permissions
- You'll be redirected back to a success page
- Tokens are automatically stored in
~/.outlook-mcp-tokens.json
The authentication server can be stopped after successful authentication (tokens are saved). However, you'll need to restart it if you need to re-authenticate.
Troubleshooting
Common Installation Issues
"Cannot find module '@modelcontextprotocol/sdk/server/index.js'"
Solution: Install dependencies first:
npm install
"Error: listen EADDRINUSE: address already in use :::3333"
Solution: Port 3333 is already in use. Kill the existing process:
npx kill-port 3333
Then restart the auth server: npm run auth-server
Authentication Issues
"Invalid client secret provided" (Error AADSTS7000215)
Root Cause: You're using the Secret ID instead of the Secret Value.
Solution:
- Go to Azure Portal > App Registrations > Your App > Certificates & secrets
- Copy the Value column (not the Secret ID column)
- Update both:
.envfile:MS_CLIENT_SECRET=actual-secret-value- Claude Desktop config:
OUTLOOK_CLIENT_SECRET=actual-secret-value
- Restart the auth server:
npm run auth-server
Authentication URL doesn't work / "This site can't be reached"
Root Cause: Authentication server isn't running.
Solution:
- Start the auth server first:
npm run auth-server - Wait for "Authentication server running at http://localhost:3333"
- Then try the authentication URL in Claude
"Authentication required" after successful setup
Root Cause: Token may have expired or been corrupted.
Solutions:
- Check if token file exists:
~/.outlook-mcp-tokens.json - If corrupted, delete the file and re-authenticate
- Restart the auth server and authenticate again
Configuration Issues
Server doesn't start in Claude Desktop
Solutions:
- Check the absolute path in your Claude Desktop config
- Ensure
OUTLOOK_CLIENT_IDandOUTLOOK_CLIENT_SECRETare set in Claude config - Restart Claude Desktop after config changes
Environment variables not loading
Solutions:
- Ensure
.envfile exists in the project root - Use
MS_CLIENT_IDandMS_CLIENT_SECRETin.env - Don't add quotes around values in
.envfile
API and Runtime Issues
- OData Filter Errors: Check server logs for escape sequence issues
- API Call Failures: Look for detailed error messages in the response
- Token Refresh Issues: Delete
~/.outlook-mcp-tokens.jsonand re-authenticate
Getting Help
If you're still having issues:
- Check the console output from
npm run auth-serverfor detailed error messages - Verify your Azure app registration settings match the documentation
- Ensure you have the required Microsoft Graph API permissions
Extending the Server
To add more functionality:
- Create new module directories (e.g.,
calendar/) - Implement tool handlers in separate files
- Export tool definitions from module index files
- Import and add tools to
TOOLSarray inindex.js
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。
