outlook-mcp
by: ryaker
MCP server for Claude to access Outlook data via Microsoft Graph API
πOverview
Purpose: The Modular Outlook MCP Server is designed to connect Claude with Microsoft Outlook via the Microsoft Graph API, facilitating email management through a structured approach.
Overview: This server implements the Model Context Protocol (MCP) with a modular architecture, promoting easy integration and maintainability. It offers various functionalities, ensuring seamless interaction with Outlook using standardized methods and authentication mechanisms.
Key Features:
-
Authentication: Utilizes OAuth 2.0 for secure access to the Microsoft Graph API, enabling safe authentication processes.
-
Email Management: Provides comprehensive capabilities to list, search, read, and send emails, enhancing user interaction with Outlook.
-
Modular Structure: Features a clear separation of functionalities, making it easy to maintain and extend the server.
-
OData Filter Handling: Implements robust handling of OData queries, ensuring proper formatting and escaping for reliable API interactions.
-
Test Mode: Incorporates simulated responses that allow for testing without needing actual API calls, streamlining development and debugging processes.
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.
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
βββ 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 with Microsoft Graph API
- Email Management: List, search, read, and send emails
- Modular Structure: Enhanced maintainability
- OData Filter Handling: Proper escaping and formatting of OData queries
- Test Mode: Simulated responses for testing
Configuration
Edit the config.js
file to configure the server:
- Server name and version
- Test mode settings
- Authentication parameters
- Email field selections
- API endpoints
Usage with Claude Desktop
- Copy the sample configuration from
claude-config-sample.json
to your Claude Desktop configuration - Restart Claude Desktop
- Authenticate with Microsoft using the
authenticate
tool - Use the email tools to manage your Outlook account
Running Standalone
Test the server with:
./test-modular-server.sh
This connects to the server for testing.
Authentication Flow
- Start a local authentication server on port 3333 (using
outlook-auth-server.js
) - Use the
authenticate
tool for the authentication URL - Complete the authentication in your browser
- Tokens are stored in
~/.outlook-mcp-tokens.json
Troubleshooting
- Authentication Issues: Check the token file and logs
- OData Filter Errors: Look for escape sequences in the logs
- API Call Failures: Check for error messages in the response
Extending the Server
To add 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 the
TOOLS
array inindex.js