Skip to main content
Glama
Mail Notification MCP

Mail Notification MCP

by Guascoign

Mail Notification MCP

Ein MCP-Server zum Senden von Fortschritts- und manuellen Genehmigungs-E-Mails über SMTP. Er verwendet den standardmäßigen stdio-Transport und eignet sich für den Aufruf durch MCP-Clients wie Codex, Claude Desktop, Cursor, VS Code usw.

Bereitgestellte Tools

  • send_progress_update: Sendet Projektfortschritts-, Abschluss- oder Blockiert-Meldungen.

  • request_human_approval: Sendet Angelegenheiten, die manuell genehmigt/abgelehnt werden müssen, und generiert eine Genehmigungsnummer.

  • send_simple_email: Sendet normale Klartext- oder HTML-E-Mails.

  • send_custom_email: Sendet benutzerdefinierte E-Mails mit CC/BCC und Anhängen.

  • test_smtp_connection: Testet SMTP-Verbindung und -Authentifizierung.

  • test_imap_connection: Testet IMAP-Verbindung und -Authentifizierung.

  • read_replies: Liest die neuesten Antworten im Posteingang, standardmäßig ohne als gelesen zu markieren.

  • check_approval_status: Erkennt „Genehmigt“, „Abgelehnt“ oder „Ausstehend“ anhand der Genehmigungsnummer.

  • wait_for_approval: Pollt und wartet auf eine manuelle Antwort, bis Genehmigung, Ablehnung oder Timeout eintritt.

Die Standardempfänger für Fortschrittstools stammen aus config.json; Genehmigungs-E-Mails fordern ausdrücklich eine Antwort mit „Genehmigt“ oder „Abgelehnt“. Andere Projektingenieure müssen lediglich die MCP-Tools aufrufen und müssen SMTP nicht selbst implementieren.

Related MCP server: mcp-email-server

1. Konfiguration von SMTP und Ziel-E-Mail-Adresse

Bearbeiten Sie die config.json im Projektstammverzeichnis (Vorlage siehe config.example.json):

{
  "smtp": {
    "host": "smtp.gmail.com",
    "port": 587,
    "secure": false,
    "username": "你的发件邮箱@gmail.com",
    "password": "",
    "password_env": "MAIL_SMTP_PASSWORD",
    "from_email": "你的发件邮箱@gmail.com"
  },
  "imap": {
    "host": "imap.gmail.com",
    "port": 993,
    "secure": true,
    "username": "你的发件邮箱@gmail.com",
    "password": "",
    "password_env": "MAIL_SMTP_PASSWORD"
  },
  "notification": {
    "to": "目标收件邮箱@example.com",
    "subject_prefix": "[工程通知]",
    "project_name": "我的工程"
  }
}

Es wird empfohlen, das Passwort in einer Umgebungsvariable zu platzieren, anstatt es direkt in die Datei zu schreiben:

$env:MAIL_SMTP_PASSWORD = "你的邮箱应用专用密码"

Sie können auch direkt smtp.password ausfüllen. Die config.json wird von .gitignore ignoriert und sollte nicht in das Versionsverwaltungs-Repository eingecheckt werden.

Häufige SMTP-Einstellungen:

E-Mail

host

port

secure

Gmail

smtp.gmail.com

587

false

Outlook

smtp-mail.outlook.com

587

false

QQ Mail

smtp.qq.com

587

false

163 Mail

smtp.163.com

465

true

Gmail, QQ usw. erfordern normalerweise, dass SMTP aktiviert ist und ein anwendungsspezifisches Passwort verwendet wird. Wenn das normale Web-Login-Passwort nicht direkt verwendet werden kann, erstellen Sie gemäß den Anforderungen des E-Mail-Anbieters einen Autorisierungscode/App-Passcode.

IMAP wird zum Lesen von Antworten verwendet. QQ Mail verwendet normalerweise imap.qq.com:993 + SSL; wenn imap.password weggelassen wird, verwendet das Programm das SMTP-Passwort/zugriffs-Code. Umgebungsvariablen überschreiben config.json; es können auch IMAP_HOST, IMAP_PORT, IMAP_SECURE, IMAP_USER, IMAP_PASS und NOTIFY_TO verwendet werden.

2. Installation und Test

Erfordert Python 3.11+ und uv. Führen Sie in PowerShell aus:

cd C:\AI_Tools\Mail
uv sync --extra dev
uv run pytest
uv run python -m email_mcp_server.server

Im stdio-Modus von MCP sollte kein normaler Text manuell eingegeben werden; der MCP-Client startet den Prozess. Es wird empfohlen, zuerst test_smtp_connection und test_imap_connection aufzurufen.

3. Einbindung in andere Projekte

Am Beispiel eines Clients, der das mcpServers-Format unterstützt, fügen Sie die folgenden Servereinträge in die Client-Konfiguration ein. Windows-Pfade müssen doppelte Backslashes verwenden:

{
  "mcpServers": {
    "mail-notification": {
      "command": "uv",
      "args": [
        "--directory",
        "C:\\AI_Tools\\Mail",
        "run",
        "python",
        "-m",
        "email_mcp_server.server"
      ]
    }
  }
}

Wenn uv nicht im PATH des Clients liegt, ersetzen Sie den command durch den absoluten Pfad der uv.exe. Starten Sie den Client nach der Änderung der MCP-Konfiguration neu.

Aufrufbeispiele

Statusbericht senden verwenden Zeitabläufe:

调用 send_progress_update:
project="订单系统"
status="进行中"
summary="已完成数据库迁移脚本,并通过本地测试"
details="迁移了 12 张表,新增回滚检查"
next_steps="部署到测试环境并等待接口联调"

Manuelle Aktion:

调用 request_human_approval:
project="订单系统"
title="是否允许部署到生产环境"
request="请批准今晚 22:00 执行生产部署"
reason="测试环境已通过,预计需要 15 分钟,期间会短暂重启服务"
options="批准部署 / 延后到明天"
deadline="今天 21:30 前"

Das Tool unterstützt einen optionalen to-Parameter, um den Empfänger für einen einzelnen Vorgang zu überschreiben; wenn er weggelassen wird, verwendet es notification.to aus config.json.

Antworten lesen:

调用 read_replies:
from_address="target@example.com"
subject_contains="Mail Notification MCP 测试邮件"
since_hours=72

Genehmigung bestätigen:

调用 check_approval_status:
approval_id="APR-ABC1234567"

Der von den Genehmigungstools zurückgegebene Status ist approved, rejected, pending oder timeout. Standardmäßig wird nur der INBOX gelesen und der Gelesen-Status von E-Mails wird nicht automatisch geändert.

Sicherheitshinweise

  • Verwenden Sie bevorzugt anwendungsspezifische Passwörter oder Autorisierungscodes, nicht das Haupt-E-Mail-Passwort.

  • Committen Sie keine echten Passwörter oder echte Ziel-E-Mail-Adressen in Git.

  • Standardmäßig wird lokales stdio verwendet; der HTTP-Modus bindet nur 127.0.0.1.

Available Tools

9 tools
check_approval_statusB

Find an approval reply and classify it as approved, rejected, or pending.

Inputs: approval_id (required), limit, since_hours, from_address. Returns: result

read_repliesA

Read recent reply emails from IMAP.

    Messages are read with BODY.PEEK and remain unread by default. Use
    ``from_address`` or ``subject_contains`` to narrow the result.
    

Inputs: limit, mailbox, mark_read, since_hours, +4 more. Returns: result

request_human_approvalB

Email a human approval request with a traceable approval ID.

    The recipient defaults to ``notification.to`` in config.json. The
    email asks the recipient to reply with “批准” or “拒绝”.
    

Inputs: title (required), project (required), request (required), to, +3 more. Returns: result

send_custom_emailA

Send a custom email with full configuration options.

    Args:
        email: Email message details including:
            - to: Recipient email address(es) (string or list)
            - cc: CC email address(es) (optional, string or list)
            - bcc: BCC email address(es) (optional, string or list)
            - subject: Email subject
            - text: Plain text email body (optional)
            - html: HTML email body (optional)
            - attachments: List of attachments (optional), each with:
                - path: Local file path to attach (preferred)
                - content: Base64-encoded file content (alternative to path)
                - filename: Override filename (auto-derived from path if omitted)
                - mime_type: MIME type override (optional)
        smtp_config: Optional SMTP configuration override with:
            - host: SMTP server hostname
            - port: SMTP server port
            - secure: Use SSL/TLS
            - username: Auth username
            - password: Auth password
            - from_email: Sender email address

    Returns:
        Success message or error message
    

Inputs: email (required), smtp_config. Returns: result

send_progress_updateB

Send a standardized work-progress notification.

    The recipient defaults to ``notification.to`` in config.json. Use
    ``to`` only when a one-off recipient override is needed.
    

Inputs: status (required), project (required), summary (required), to, +2 more. Returns: result

send_simple_emailB

Send a simple email.

    Args:
        to: Recipient email address
        subject: Email subject
        body: Email body content
        is_html: Whether body is HTML (default: False)
        smtp_config: Optional SMTP configuration override with:
            - host: SMTP server hostname
            - port: SMTP server port
            - secure: Use SSL/TLS
            - username: Auth username
            - password: Auth password
            - from_email: Sender email address
            Falls back to environment variables if not provided.

    Returns:
        Success message or error message
    

Inputs: to (required), body (required), subject (required), is_html, +1 more. Returns: result

test_imap_connectionA

Test IMAP connection and authentication without reading messages.

Inputs: no named parameters. Returns: result

test_smtp_connectionB

Test SMTP connection.

    Args:
        smtp_config: Optional SMTP configuration override with:
            - host: SMTP server hostname
            - port: SMTP server port
            - secure: Use SSL/TLS
            - username: Auth username
            - password: Auth password
            - from_email: Sender email address
            Falls back to environment variables if not provided.

    Returns:
        Connection test result or error message
    

Inputs: smtp_config. Returns: result

wait_for_approvalB

Poll IMAP until an approval is approved, rejected, or times out.

Inputs: approval_id (required), from_address, timeout_seconds, poll_interval_seconds. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 9 tools

    Disambiguation3/5

    There is meaningful overlap between send_simple_email and send_custom_email, both centered on sending mail, and between read_replies, check_approval_status, and wait_for_approval, all of which interact with incoming IMAP replies. The descriptions help separate them, but an agent could still mis-select when trying to perform a generic send or read action.

    Naming Consistency4/5

    Most tool names follow a clear verb_noun snake_case pattern, such as test_imap_connection, send_custom_email, and check_approval_status. Minor deviations like wait_for_approval and the generic read_replies keep it from being perfectly uniform, but the naming is still predictable and readable.

    Tool Count5/5

    With 9 tools, the set is well-scoped for a Mail Notification MCP covering connection testing, email sending, reply reading, and approval handling. Each tool contributes to the server's core purpose without obvious bloat.

    Completeness4/5

    The approval workflow is well covered: send a request, read/classify the reply, and wait for a result. Generic mailbox operations like listing folders or fetching arbitrary messages are absent, but those are not central to the stated notification and approval purpose.

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      B
      maintenance
      A multi-service email platform for MCP-compatible clients that supports standard email providers, transactional APIs, and local testing environments. It enables users to send and receive emails, monitor service health, and integrate with messaging webhooks like Slack and Discord through natural language commands.
      10
      4
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables reading and sending emails via IMAP and SMTP through the MCP protocol. Supports multiple email accounts and configuration via UI or environment variables.
      BSD 3-Clause
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP server that enables Claude Code agents to send and read emails via SMTP/IMAP with per-agent credential isolation and audit logging.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Exposes any IMAP mailbox and SMTP relay as MCP tools, enabling email management (read, search, send, delete) through MCP-compatible agents.
      1
      MIT