MCP HubMCP Hub
ryaker

outlook-mcp

by: ryaker

MCP server for Claude to access Outlook data via Microsoft Graph API

22created 13/03/2025
Visit
Outlook
GraphAPI

πŸ“Œ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

  1. Copy the sample configuration from claude-config-sample.json to your Claude Desktop configuration
  2. Restart Claude Desktop
  3. Authenticate with Microsoft using the authenticate tool
  4. 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

  1. Start a local authentication server on port 3333 (using outlook-auth-server.js)
  2. Use the authenticate tool for the authentication URL
  3. Complete the authentication in your browser
  4. 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:

  1. Create new module directories (e.g., calendar/)
  2. Implement tool handlers in separate files
  3. Export tool definitions from module index files
  4. Import and add tools to the TOOLS array in index.js