aviman1109

imap-mcp

Community aviman1109
Updated

IMAP MCP server with polling watchers that push matched mail to n8n/webhooks — FastMCP HTTP transport

imap-mcp

IMAP client MCP. Read mail from a Dovecot / Synology MailPlus mailbox, andoptionally fire webhooks when new matching messages arrive — replaces fragileGmail OAuth for automation triggers.

Tools

Tool Description
list_unread(mailbox, limit) Unread message summaries
search(criteria, mailbox, limit) Raw IMAP SEARCH
fetch(uid, mailbox) Full message (headers + text + html)
mark_read(uid, mailbox) Set \Seen flag
move(uid, source, dest) Move to another folder
list_folders() All folders
get_status() IMAP ping + watcher rules + fire count

Environment

Variable Required Description
IMAP_HOST Server (e.g. 192.168.68.61)
IMAP_PORT Default 993
IMAP_SSL true (default) or false
IMAP_USERNAME Synology account name, not email
IMAP_PASSWORD
IMAP_DEFAULT_MAILBOX Default INBOX
WATCHES_JSON Inline JSON array of watch rules
WATCHES_FILE Path to JSON file (default /data/watches.json)
POLL_INTERVAL_SECS Default 30
PORT MCP server port (default 38105)

Watch rules

[
  {
    "name": "garmin-livetrack",
    "mailbox": "INBOX",
    "criteria": "FROM \"[email protected]\" SUBJECT \"LiveTrack\" UNSEEN",
    "webhook_url": "http://host.docker.internal:5678/webhook/livetrack-mail",
    "mark_read": true,
    "move_to": null
  }
]

On startup the watcher "primes" each rule with existing matching UIDs, soonly new mail after boot fires. Every POLL_INTERVAL_SECS it re-runseach rule's criteria and POSTs matching messages (full body) to webhook_urlas { "rule": "...", "mailbox": "...", "message": {...} }. After asuccessful POST it either moves the message to move_to, or marks it readif mark_read.

MCP Server · Populars

MCP Server · New