MCP ExplorerExplorer

Email Mcp

@mhazarabadon 10 months ago
1 MIT
FreeCommunity
AI Systems
an MCP which supports both SMTP and IMAP

Overview

What is Email Mcp

email-mcp is a Model Context Protocol server designed to manage email operations using both SMTP and IMAP protocols. It provides tools for sending emails and programmatically searching mailboxes.

Use cases

Use cases include sending automated emails for reminders, notifications, and alerts, as well as integrating email functionalities into applications for user communication.

How to use

To use email-mcp, install the package via pip or uvx, then run the server by providing your SMTP and IMAP server credentials. For Gmail users, an App Password is required instead of a regular password.

Key features

Key features include the ability to send emails using SMTP, search mailboxes using IMAP, and support for multiple email providers like Gmail, Outlook, and Yahoo.

Where to use

email-mcp can be used in various fields such as application development, automated email notifications, and email management systems.

Content

Email MCP server

Overview

A Model Context Protocol server for managing email operations using SMTP and IMAP. This server provides tools to send emails and search mailboxes programmatically.

Prerequisites

  • SMTP server credentials (server address, username, password)
  • IMAP server credentials (server address, username, password)
  • For Gmail users:
    • Enable 2-Factor Authentication
    • Generate an App Password from Google Account settings
    • Use the App Password instead of your regular password

Installation

  1. Install the package using pip:
pip install email-mcp
  1. Install the package
uvx install email-mcp

Running the Server

Using Gmail (Recommended)

For Gmail accounts:

  • Create an App Password from Google Account settings
  • Use the App Password instead of your regular password
python -m email_mcp \
  --smtp-server "smtp.gmail.com" \
  --smtp-username "[email protected]" \
  --smtp-password "your-app-password" \
  --imap-server "imap.gmail.com" \
  --imap-username "[email protected]" \
  --imap-password "your-app-password"

Using Other Email Providers

Replace the server addresses and credentials according to your email provider:

python -m email_mcp \
  --smtp-server "your-smtp-server" \
  --smtp-username "your-email" \
  --smtp-password "your-password" \
  --imap-server "your-imap-server" \
  --imap-username "your-email" \
  --imap-password "your-password"

Common Email Provider Settings:

Tools

  1. send_email

    • Send an email using SMTP
    • Input:
      • to_email (string, required): Recipient email addresses (comma-separated). Example: “[email protected], [email protected]
      • subject (string, required): Email subject line. Example: “Meeting Reminder”
      • body (string, required): Email content in HTML format
      • cc (string, optional): CC recipient email addresses (comma-separated). Example: “[email protected], [email protected]
    • Returns: Confirmation of email being sent
  2. search_mailbox

    • Search emails in a mailbox using IMAP
    • Input:
      • search_criteria (list of strings, required): IMAP search criteria
      • folder (string, optional): Mailbox folder to search (default: “INBOX”)
      • limit (integer, optional): Maximum number of results (default: 10)
    • Returns: List of matching emails with their details

Search Criteria Examples

The search_criteria parameter supports various IMAP search options:

Basic Search:

  • ["ALL"] - Return all messages
  • ["NEW"] - Match new messages
  • ["UNSEEN"] - Match unread messages

Message Status:

  • ["ANSWERED"] - Match answered messages
  • ["FLAGGED"] - Match flagged messages
  • ["SEEN"] - Match read messages

Header Fields:

Content Search:

  • ["BODY", "keyword"] - Search in message body
  • ["TEXT", "keyword"] - Search in all message text

Date Search:

  • ["SINCE", "01-Jan-2024"] - Match messages after date
  • ["BEFORE", "01-Jan-2024"] - Match messages before date
  • ["ON", "01-Jan-2024"] - Match messages on date

Claude Desktop

Add this to your claude_desktop_config.json:

License

This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers