Get the FREE Ultimate OpenClaw Setup Guide →

mcp -outlook-email

MCP server from Cam10001110101/mcp-server-outlook-email

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio cam10001110101-mcp-server-outlook-email python src/mcp_server.py \
  --env MONGODB_URI="mongodb://localhost:27017/MCP" \
  --env SQLITE_DB_PATH="/data/emails.db" \
  --env COLLECTION_NAME="outlook-emails" \
  --env EMBEDDING_MODEL="nomic-embed-text" \
  --env GRAPH_CLIENT_ID="YOUR_AZURE_AD_CLIENT_ID" \
  --env GRAPH_TENANT_ID="YOUR_TENANT_ID" \
  --env OUTLOOK_PROVIDER="graph" \
  --env GRAPH_USER_EMAILS="All" \
  --env EMBEDDING_BASE_URL="http://localhost:11434" \
  --env GRAPH_CLIENT_SECRET="YOUR_AZURE_AD_CLIENT_SECRET"

How to use

This MCP server processes Microsoft Outlook emails and provides semantic search and analytics capabilities. It can gather emails from Outlook via Graph API (or other providers if configured), generate vector embeddings for email content using an Ollama embedding model, store metadata and content in SQLite, and index embeddings in MongoDB for fast semantic search. The server exposes MCP-compliant tools such as process_emails, search_emails, analyze_email_sentiment, and export_email_data, enabling workflows for ingestion, retrieval, sentiment analysis, and data export across CSV, JSON, HTML, or Excel formats. To use it, start the server with the configured command, connect through the MCP transport, and invoke the available tools via the protocol to process mailboxes, search by semantic queries, or export results for reporting.

How to install

Prerequisites:

  • Python 3.10 or higher
  • Ollama running locally with the nomic-embed-text model
  • MongoDB server for embeddings storage
  • Access to a Graph API (Azure AD) app if using Graph-based mailbox access

Steps:

  1. Install Python package management and the MCP server dependencies

    • Ensure Python 3.10+
    • Install uv if using the uv workflow (optional here if using standard Python script):
      pip install uv
      
  2. Set up a Python virtual environment and install the MCP server

    • Create and activate venv:
      python -m venv .venv
      # Windows
      .venv\Scripts\activate
      # macOS/Linux
      source .venv/bin/activate
      
    • Install the package in editable mode (or install dependencies from setup):
      uv pip install -e .
      
  3. Install Ollama embedding model

    • Pull the embedding model:
      ollama pull nomic-embed-text
      
  4. Install Graph API credentials (if using Graph) and set environment variables according to the README example

    • Create an Azure AD App and obtain client id, client secret, and tenant id
    • Ensure permissions Mail.Read and User.Read.All are granted and admin consent is provided
  5. Run the MCP server

    • Use the mcp_config example values or adapt to your environment
    • Start the Python server script (src/mcp_server.py) with the configured environment variables

Note: If you prefer a container-based or Node-based setup, adapt the mcp_config accordingly or refer to the provider-specific sections in the README.

Additional notes

Tips:

  • Ensure MONGODB_URI and SQLITE_DB_PATH point to accessible databases with proper permissions.
  • The EMBEDDING_BASE_URL should point to your Ollama server (default is http://localhost:11434). If you modify it, update EMBEDDING_BASE_URL accordingly.
  • OUTLOOK_PROVIDER graph requires Graph API credentials and mailbox access permissions; for multi-mailbox auto-discovery, set GRAPH_USER_EMAILS to All.
  • When processing emails, consider enabling PROCESS_DELETED_ITEMS if you need Deleted Items processing; adjust LOCAL_TIMEZONE to match the source mailbox timezone for correct date filtering.
  • If you run into transport issues, verify MCP handshake compatibility and ensure the MCP SDK version aligns with MCP 2025-06-18 specification.
  • For debugging, consult the embedded tool docs (process_emails, search_emails, etc.) to verify input/output schemas and error types.

Related MCP Servers

Sponsor this space

Reach thousands of developers