Outlook Email Processor

by cam10001110101

14 370 downloads Not rated yet
GitHub

About

Integrates with Outlook to provide email processing, semantic search, and metadata storage capabilities using MongoDB and SQLite, enabling advanced analysis and retrieval of email data in Windows environments.

Details

Repository
Cam10001110101/mcp-server-outlook-email

Explore

- Process emails from Outlook with date range filtering
- Store emails in SQLite database with proper connection management
- Generate vector embeddings using Ollama (nomic-embed-text)
- Semantic search across email content via MongoDB vector store
- Multi-mailbox and multi-account support
- Support for Inbox, Sent Items, and optionally Deleted Items folders

- Protocol Version: Declares protocolVersion: "2025-06-18" during handshake
- Structured Output: All tools return typed, validated Pydantic models
- HTTP Transport: Supports Streamable HTTP with proper header validation
- Tool Metadata: Enhanced tool descriptions with titles and schemas
- Error Handling: Structured error responses with detailed information

- Email summarization using LLMs
- Automatic email categorization
- Customizable email reports
- Outlook drafting email responses
- Outlook rule suggestions
- Expanded database options with Neo4j and ChromaDB integration

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Outlook Email Processor
    Command (node, npx, python, etc.) /path/to/.venv/bin/python
    Arguments
    • Argument 1 /path/to/src/mcp_server.py
    Environment
    • MONGODB_URI mongodb://localhost:27017/MCP?authSource=admin
    • LOCAL_TIMEZONE America/Los_Angeles
    • SQLITE_DB_PATH /path/to/data/emails.db
    • COLLECTION_NAME outlook-emails
    • EMBEDDING_MODEL nomic-embed-text
    • OUTLOOK_PROVIDER mac
    • EMBEDDING_BASE_URL http://localhost:11434

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Add the server to your Claude for Desktop configuration file:
- Windows: %APPDATA%\Claude\claude_desktop_config.json
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

pip install uv
uv venv .venv

Core installation (required):

bash
uv pip install -e .

Platform-specific extras:
bash

ollama pull nomic-embed-text

| Variable | Description | Required |
|----------|-------------|----------|
| MONGODB_URI | MongoDB connection string | Yes |
| SQLITE_DB_PATH | Path to SQLite database file | Yes |
| EMBEDDING_BASE_URL | Ollama server URL (default: http://localhost:11434) | No |
| EMBEDDING_MODEL | Embedding model name (default: nomic-embed-text) | No |
| COLLECTION_NAME | MongoDB collection name | Yes |
| PROCESS_DELETED_ITEMS | Process Deleted Items folder (default: "false") | No |
| OUTLOOK_PROVIDER | Provider: auto, windows, mac, graph (default: "auto") | No |
| LOCAL_TIMEZONE | Timezone for dates (default: "UTC", e.g., "America/Chicago") | No |

Graph API Variables (required when OUTLOOK_PROVIDER=graph):

| Variable | Description |
|----------|-------------|
| GRAPH_CLIENT_ID | Azure AD application (client) ID |
| GRAPH_CLIENT_SECRET | Azure AD client secret |
| GRAPH_TENANT_ID | Azure AD tenant ID |
| GRAPH_USER_EMAILS | Mailboxes: comma-separated list or "All" for auto-discovery |

---

Uses native Outlook COM automation via pywin32.

{
  "mcpServers": {
    "outlook-email": {
      "command": "C:/path/to/.venv/Scripts/python",
      "args": ["C:/path/to/src/mcp_server.py"],
      "env": {
        "MONGODB_URI": "mongodb://localhost:27017/MCP?authSource=admin",
        "SQLITE_DB_PATH": "C:\\path\\to\\data\\emails.db",
        "EMBEDDING_BASE_URL": "http://localhost:11434",
        "EMBEDDING_MODEL": "nomic-embed-text",
        "COLLECTION_NAME": "outlook-emails",
        "OUTLOOK_PROVIDER": "windows",
        "LOCAL_TIMEZONE": "America/Chicago"
      }
    }
  }
}

Uses AppleScript to communicate with Outlook for Mac.

{
  "mcpServers": {
    "outlook-email": {
      "command": "/path/to/.venv/bin/python",
      "args": ["/path/to/src/mcp_server.py"],
      "env": {
        "MONGODB_URI": "mongodb://localhost:27017/MCP?authSource=admin",
        "SQLITE_DB_PATH": "/path/to/data/emails.db",
        "EMBEDDING_BASE_URL": "http://localhost:11434",
        "EMBEDDING_MODEL": "nomic-embed-text",
        "COLLECTION_NAME": "outlook-emails",
        "OUTLOOK_PROVIDER": "mac",
        "LOCAL_TIMEZONE": "America/Los_Angeles"
      }
    }
  }
}

Works on any platform with Azure AD credentials. Supports single or multiple mailboxes.

Single mailbox or specific mailboxes:

{
"mcpServers": {
"outlook-email": {
"command": "python",
"args": ["src/mcp_server.py"],
"env": {
"MONGODB_URI": "mongodb://localhost:27017/MCP",
"SQLITE_DB_PATH": "/data/emails.db",
"EMBEDDING_BASE_URL": "http://localhost:11434",
"EMBEDDING_MODEL": "nomic-embed-text",
"COLLECTION_NAME": "outlook-emails",
"OUTLOOK_PROVIDER": "graph",
"GRAPH_CLIENT_ID": "your-azure-ad-client-id",
"GRAPH_CLIENT_SECRET": "your-client-secret",
"GRAPH_TENANT_ID": "your-tenant-id",
"GRAPH_USER_EMAILS": "[email protected],[email protected]"
}
}
}
}

All mailboxes in tenant (auto-discovery):

{
"mcpServers": {
"outlook-email": {
"command": "python",
"args": ["src/mcp_server.py"],
"env": {
"MONGODB_URI": "mongodb://localhost:27017/MCP",
"SQLITE_DB_PATH": "/data/emails.db",
"EMBEDDING_BASE_URL": "http://localhost:11434",
"EMBEDDING_MODEL": "nomic-embed-text",
"COLLECTION_NAME": "outlook-emails",
"OUTLOOK_PROVIDER": "graph",
"GRAPH_CLIENT_ID": "your-azure-ad-client-id",
"GRAPH_CLIENT_SECRET": "your-client-secret",
"GRAPH_TENANT_ID": "your-tenant-id",
"GRAPH_USER_EMAILS": "All"
}
}
}
}

"Process emails from February 1st to February 17th from all mailboxes"

process_emails

Process emails from a specified date range and return structured results. Input: start_date (string, ISO format), end_date (string, ISO format), mailboxes (list of strings or ['All']). Output: success (boolean), processed_count (integer), retrieved_count (integer), stored_count (integer), failed_count (integer), message (string), error (string).

search_emails

Search for emails based on specified criteria. Input: query (string), filters (optional). Output: list of matching emails.

analyze_email_sentiment

Analyze the sentiment of specified emails. Input: email_ids (list of strings). Output: sentiment scores (dictionary with email IDs and their respective sentiment scores).

find_actionable_items

Identify actionable items from a list of emails. Input: email_ids (list of strings). Output: list of actionable items.

export_email_data

Export email data to specified formats (CSV, JSON, HTML, Excel). Input: format (string), email_ids (list of strings). Output: success (boolean), message (string).

list_outlook_folders

List all available Outlook folders. Output: list of folder names.

get_folder_statistics

Get statistics for specified Outlook folders. Input: folder_names (list of strings). Output: statistics (dictionary with folder names and their respective statistics).

organize_emails_by_rules

Organize emails based on specified rules. Input: rules (dictionary), email_ids (list of strings). Output: success (boolean), message (string).

extract_contacts

Extract contacts from processed emails. Output: list of contacts.

get_email_statistics

Retrieve statistics regarding processed emails. Output: statistics (dictionary with various email processing metrics).

check_data_consistency

Check the consistency of data between SQLite and MongoDB. Output: consistency status (boolean), discrepancies (list of discrepancies if any).

| Category | Tools |
|----------|-------|
| Email Processing | process_emails |
| Search & Analysis | search_emails, analyze_email_sentiment, find_actionable_items |
| Data Export | export_email_data (CSV, JSON, HTML, Excel) |
| Folder Management | list_outlook_folders, get_folder_statistics, organize_emails_by_rules |
| Contact Management | extract_contacts |
| Statistics | get_email_statistics, check_data_consistency |

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "outlook email processor": {
            "env": {
                "MONGODB_URI": "mongodb://localhost:27017/MCP?authSource=admin",
                "LOCAL_TIMEZONE": "America/Los_Angeles",
                "SQLITE_DB_PATH": "/path/to/data/emails.db",
                "COLLECTION_NAME": "outlook-emails",
                "EMBEDDING_MODEL": "nomic-embed-text",
                "OUTLOOK_PROVIDER": "mac",
                "EMBEDDING_BASE_URL": "http://localhost:11434"
            },
            "args": [
                "/path/to/src/mcp_server.py"
            ],
            "command": "/path/to/.venv/bin/python"
        }
    }
}

Linux

{
    "env": {
        "MONGODB_URI": "mongodb://localhost:27017/MCP",
        "SQLITE_DB_PATH": "/data/emails.db",
        "COLLECTION_NAME": "outlook-emails",
        "EMBEDDING_MODEL": "nomic-embed-text",
        "GRAPH_CLIENT_ID": "your-azure-ad-client-id",
        "GRAPH_TENANT_ID": "your-tenant-id",
        "OUTLOOK_PROVIDER": "graph",
        "GRAPH_USER_EMAILS": "[email protected],[email protected]",
        "EMBEDDING_BASE_URL": "http://localhost:11434",
        "GRAPH_CLIENT_SECRET": "your-client-secret"
    },
    "args": [
        "src/mcp_server.py"
    ],
    "command": "python"
}

Macos

{
    "env": {
        "MONGODB_URI": "mongodb://localhost:27017/MCP?authSource=admin",
        "LOCAL_TIMEZONE": "America/Los_Angeles",
        "SQLITE_DB_PATH": "/path/to/data/emails.db",
        "COLLECTION_NAME": "outlook-emails",
        "EMBEDDING_MODEL": "nomic-embed-text",
        "OUTLOOK_PROVIDER": "mac",
        "EMBEDDING_BASE_URL": "http://localhost:11434"
    },
    "args": [
        "/path/to/src/mcp_server.py"
    ],
    "command": "/path/to/.venv/bin/python"
}

Windows

{
    "env": {
        "MONGODB_URI": "mongodb://localhost:27017/MCP?authSource=admin",
        "LOCAL_TIMEZONE": "America/Chicago",
        "SQLITE_DB_PATH": "C:\\path\\to\\data\\emails.db",
        "COLLECTION_NAME": "outlook-emails",
        "EMBEDDING_MODEL": "nomic-embed-text",
        "OUTLOOK_PROVIDER": "windows",
        "EMBEDDING_BASE_URL": "http://localhost:11434"
    },
    "args": [
        "C:/path/to/src/mcp_server.py"
    ],
    "command": "C:/path/to/.venv/Scripts/python"
}

MseeP.ai Security Assessment Badge

Email Processing MCP Server

A cross-platform MCP server that processes Microsoft Outlook emails, generates vector embeddings using Ollama, and provides semantic search capabilities. Works on Windows, macOS, and any platform via Microsoft Graph API.

The server complies with the Model Context Protocol (MCP) 2025-06-18 specification and uses the official MCP SDK.

Features

Core Capabilities

- Process emails from Outlook with date range filtering - Store emails in SQLite database with proper connection management - Generate vector embeddings using Ollama (nomic-embed-text) - Semantic search across email content via MongoDB vector store - Multi-mailbox and multi-account support - Support for Inbox, Sent Items, and optionally Deleted Items folders

Cross-Platform Support

- Windows: Native Outlook COM automation via pywin32 - macOS: AppleScript integration with Outlook for Mac - Any Platform: Microsoft Graph API for cloud-based access (Windows, macOS, Linux, containers)

MCP 2025-06-18 Compliance

- Structured Tool Results: Tools return properly typed, validated Pydantic models - HTTP Transport: Supports both STDIO and HTTP (Streamable HTTP) transports - Protocol Negotiation: Declares protocol version during handshake - Enhanced Metadata: Tool titles and descriptions for better UI integration

Available Tools (12+)

| Category | Tools | |----------|-------| | Email Processing | process_emails | | Search & Analysis | search_emails, analyze_email_sentiment, find_actionable_items | | Data Export | export_email_data (CSV, JSON, HTML, Excel) | | Folder Management | list_outlook_folders, get_folder_statistics, organize_emails_by_rules | | Contact Management | extract_contacts | | Statistics | get_email_statistics, check_data_consistency |

Prerequisites

Required (All Platforms)

- Python 3.10 or higher - Ollama running locally with nomic-embed-text model - MongoDB server (for storing embeddings)

Platform-Specific Requirements

| Platform | Requirement |
|----------|-------------|
| Windows | Microsoft Outlook installed + pywin32 |
| macOS | Microsoft Outlook for Mac installed |
| Graph API | Azure AD app registration with Mail.Read permission |

Installation

1. Install uv (if not already installed)

pip install uv

2. Create and activate virtual environment

uv venv .venv

Windows

.venv\Scripts\activate

macOS/Linux

source .venv/bin/activate

3. Install dependencies

Core installation (required):

uv pip install -e .

Platform-specific extras:

# Windows (adds pywin32 for COM automation)
uv pip install -e ".[windows]"

Graph API support (cross-platform cloud access)

uv pip install -e ".[graph]"

All optional dependencies

uv pip install -e ".[all]"

4. Install Ollama embedding model

ollama pull nomic-embed-text

5. (Graph API only) Register Azure AD Application

If using Microsoft Graph API, you need to register an application in Azure AD:

1. Go to Azure Portal → Azure Active Directory → App registrations
2. Click "New registration"
3. Name your app and select "Accounts in this organizational directory only"
4. After creation, note the Application (client) ID and Directory (tenant) ID
5. Go to "Certificates & secrets" → "New client secret" → note the secret value
6. Go to "API permissions" → "Add a permission" → "Microsoft Graph" → "Application permissions"
7. Add: Mail.Read, User.Read.All (for multi-account discovery)
8. Click "Grant admin consent"

Configuration

Add the server to your Claude for Desktop configuration file:
- Windows: %APPDATA%\Claude\claude_desktop_config.json
- macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Environment Variables

| Variable | Description | Required |
|----------|-------------|----------|
| MONGODB_URI | MongoDB connection string | Yes |
| SQLITE_DB_PATH | Path to SQLite database file | Yes |
| EMBEDDING_BASE_URL | Ollama server URL (default: http://localhost:11434) | No |
| EMBEDDING_MODEL | Embedding model name (default: nomic-embed-text) | No |
| COLLECTION_NAME | MongoDB collection name | Yes |
| PROCESS_DELETED_ITEMS | Process Deleted Items folder (default: "false") | No |
| OUTLOOK_PROVIDER | Provider: auto, windows, mac, graph (default: "auto") | No |
| LOCAL_TIMEZONE | Timezone for dates (default: "UTC", e.g., "America/Chicago") | No |

Graph API Variables (required when OUTLOOK_PROVIDER=graph):

| Variable | Description |
|----------|-------------|
| GRAPH_CLIENT_ID | Azure AD application (client) ID |
| GRAPH_CLIENT_SECRET | Azure AD client secret |
| GRAPH_TENANT_ID | Azure AD tenant ID |
| GRAPH_USER_EMAILS | Mailboxes: comma-separated list or "All" for auto-discovery |

---

Windows Configuration (COM Automation)

Uses native Outlook COM automation via pywin32.

{
  "mcpServers": {
    "outlook-email": {
      "command": "C:/path/to/.venv/Scripts/python",
      "args": ["C:/path/to/src/mcp_server.py"],
      "env": {
        "MONGODB_URI": "mongodb://localhost:27017/MCP?authSource=admin",
        "SQLITE_DB_PATH": "C:\\path\\to\\data\\emails.db",
        "EMBEDDING_BASE_URL": "http://localhost:11434",
        "EMBEDDING_MODEL": "nomic-embed-text",
        "COLLECTION_NAME": "outlook-emails",
        "OUTLOOK_PROVIDER": "windows",
        "LOCAL_TIMEZONE": "America/Chicago"
      }
    }
  }
}

macOS Configuration (AppleScript)

Uses AppleScript to communicate with Outlook for Mac.

{
  "mcpServers": {
    "outlook-email": {
      "command": "/path/to/.venv/bin/python",
      "args": ["/path/to/src/mcp_server.py"],
      "env": {
        "MONGODB_URI": "mongodb://localhost:27017/MCP?authSource=admin",
        "SQLITE_DB_PATH": "/path/to/data/emails.db",
        "EMBEDDING_BASE_URL": "http://localhost:11434",
        "EMBEDDING_MODEL": "nomic-embed-text",
        "COLLECTION_NAME": "outlook-emails",
        "OUTLOOK_PROVIDER": "mac",
        "LOCAL_TIMEZONE": "America/Los_Angeles"
      }
    }
  }
}

Graph API Configuration (Cross-Platform)

Works on any platform with Azure AD credentials. Supports single or multiple mailboxes.

Single mailbox or specific mailboxes:

{
"mcpServers": {
"outlook-email": {
"command": "python",
"args": ["src/mcp_server.py"],
"env": {
"MONGODB_URI": "mongodb://localhost:27017/MCP",
"SQLITE_DB_PATH": "/data/emails.db",
"EMBEDDING_BASE_URL": "http://localhost:11434",
"EMBEDDING_MODEL": "nomic-embed-text",
"COLLECTION_NAME": "outlook-emails",
"OUTLOOK_PROVIDER": "graph",
"GRAPH_CLIENT_ID": "your-azure-ad-client-id",
"GRAPH_CLIENT_SECRET": "your-client-secret",
"GRAPH_TENANT_ID": "your-tenant-id",
"GRAPH_USER_EMAILS": "[email protected],[email protected]"
}
}
}
}

All mailboxes in tenant (auto-discovery):

{
"mcpServers": {
"outlook-email": {
"command": "python",
"args": ["src/mcp_server.py"],
"env": {
"MONGODB_URI": "mongodb://localhost:27017/MCP",
"SQLITE_DB_PATH": "/data/emails.db",
"EMBEDDING_BASE_URL": "http://localhost:11434",
"EMBEDDING_MODEL": "nomic-embed-text",
"COLLECTION_NAME": "outlook-emails",
"OUTLOOK_PROVIDER": "graph",
"GRAPH_CLIENT_ID": "your-azure-ad-client-id",
"GRAPH_CLIENT_SECRET": "your-client-secret",
"GRAPH_TENANT_ID": "your-tenant-id",
"GRAPH_USER_EMAILS": "All"
}
}
}
}

Provider Auto-Detection

…

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.