Stores email vector embeddings for semantic search capabilities, manages connections properly, and provides metadata filtering and efficient retrieval
Planned future integration for expanded database options and more advanced relationship modeling for emails
Generates vector embeddings for emails using models like nomic-embed-text for enhanced semantic search capabilities
Provides primary email storage, full-text search capabilities, processing status tracking, and efficient filtering with proper connection management
Email Processing MCP Server
This MCP server provides email processing capabilities with MongoDB integration for semantic search and SQLite for efficient storage and retrieval.
Features
Process emails from Outlook with date range filtering
Store emails in SQLite database with proper connection management
Generate vector embeddings using Ollama
Multi-mailbox support
Support for Inbox, Sent Items, and optionally Deleted Items folders
Upcoming Features
Email search with semantic capabilities
Email summarization using LLMs
Automatic email categorization
Customizable email reports
Advanced filtering options
Outlook drafting email responses
Outlook rule suggestions
Expanded database options with Neo4j and ChromaDB integration
Prerequisites
Python 3.10 or higher
Ollama running locally (for embeddings)
Microsoft Outlook installed
Windows OS (for Outlook integration)
MongoDB server (for storing embeddings)
Installation
Install uv (if not already installed):
Create a virtual environment:
Activate the virtual environment:
Windows:
.venv\Scripts\activatemacOS/Linux:
source .venv/bin/activateInstall dependencies:
Install the fastmcp package:
Make sure Ollama is running locally with required models:
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
Tracing and Monitoring
The server has been designed to support external tracing and monitoring solutions. The MCP logging implementation has been intentionally removed in favor of a more robust tracing approach that will be implemented separately.
Note: Do not attempt to re-implement the previous logging system. A new tracing solution will be provided in the future.
Configuration fields explained:
command
: Full path to the Python executable in your virtual environmentargs
: Array containing the full path to the MCP server scriptenv
: Environment variables for configurationMONGODB_URI
: MongoDB connection stringSQLITE_DB_PATH
: Absolute path to SQLite database fileEMBEDDING_BASE_URL
: Ollama server URLEMBEDDING_MODEL
: Model to use for embeddingsLLM_MODEL
: Model to use for LLM operationsCOLLECTION_NAME
: Name of the MongoDB collection to use (required)PROCESS_DELETED_ITEMS
: Whether to process emails from the Deleted Items folder (optional, default: "false")
disabled
: Whether the server is disabled (should be false)alwaysAllow
: Array of tools that don't require user confirmationautoApprove
: Array of tools that can be auto-approved
Replace the paths with the actual paths on your system. Note that Windows paths in the env
section should use double backslashes.
Available Tools
1. process_emails
Process emails from a specified date range:
The tool will:
Connect to specified Outlook mailboxes
Retrieve emails from Inbox and Sent Items folders (and Deleted Items if enabled)
Store emails in SQLite database
Generate embeddings using Ollama
Store embeddings in MongoDB for semantic search
Example Usage in Claude
Architecture
The server uses a hybrid search approach:
SQLite database for:
Primary email storage
Full-text search capabilities
Processing status tracking
Efficient filtering
Directory is created automatically if it doesn't exist
Connections are properly closed to prevent database locking
MongoDB for:
Vector embeddings storage
Semantic similarity search
Metadata filtering
Efficient retrieval
Connections are properly closed after use
Error Handling
The server provides detailed error messages for common issues:
Invalid date formats
Connection issues with Outlook
MongoDB errors
Embedding generation failures with retry logic
SQLite storage errors
Ollama server connection issues with automatic retries
Resource Management
The server implements proper resource management to prevent issues:
Database connections (SQLite and MongoDB) are kept open during the server's lifetime to prevent "Cannot operate on a closed database" errors
Connections are only closed when the server shuts down, using an atexit handler
Destructors and context managers are used as a fallback to ensure connections are closed when objects are garbage collected
Connection management is designed to balance resource usage with operational reliability
Robust retry logic for external services like Ollama to handle temporary connection issues
Security Notes
The server only processes emails from specified mailboxes
All data is stored locally (SQLite) and in MongoDB
No external API calls except to local Ollama server
Requires explicit user approval for email processing
No sensitive email data is exposed through the MCP interface
Debugging
If you encounter issues:
Verify emails were successfully processed (check process_emails response)
Ensure Ollama server is running for embedding generation
Check that the SQLite database is accessible
Verify MongoDB connection is working properly
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Processes emails from Outlook with date filtering, storing them in SQLite databases while generating vector embeddings for semantic search capabilities in MongoDB.
- Features
- Upcoming Features
- Prerequisites
- Installation
- Configuration
- Available Tools
- Example Usage in Claude
- Architecture
- Error Handling
- Resource Management
- Security Notes
- Debugging
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityProvides IMAP and SMTP capabilities, enabling developers to manage email services with seamless integration and automated workflows.Last updated -483BSD 3-Clause
- -securityAlicense-qualityProvides comprehensive Gmail integration with LLM processing capabilities, allowing users to read, search, filter emails and handle attachments through the Model Context Protocol.Last updated -21MIT License
- -securityFlicense-qualityEnables comprehensive email management through IMAP/SMTP protocols with tools for searching, organizing, moving, flagging, and sending emails across various email providers. Features safe preview mode for destructive operations and supports multiple email providers including Gmail, Outlook, and Chinese email services.Last updated -2
- -securityFlicense-qualityEnables automated customer reminder management by integrating with Google Sheets to read customer data and sending scheduled email reminders based on due dates. Supports personalized email templates, intelligent scheduling, and duplicate prevention with Gmail SMTP integration.Last updated -