IMAP MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
pip install -e .
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "host=${host}" -e "port=${port}" -e "username=${username}" -e "password=${password}" imap-mcp -- node "<FULL_PATH_TO_IMAP_MCP>/dist/index.js"

Replace <FULL_PATH_TO_IMAP_MCP>/dist/index.js with the actual folder you prepared in step 1.

Required:hostportusernamepassword
README.md

MCP Server for IMAP email operations.

IMAP MCP Server

Status: Getestet

MCP (Model Context Protocol) Server für IMAP Email-Operationen.

Installation

cd IMAP-MCP
pip install -e .

Konfiguration

  1. Kopiere config.json.example zu config.json
  2. Trage deine IMAP-Zugangsdaten ein:
{
  "imap": {
    "host": "imap.example.com",
    "port": 993,
    "secure": true
  },
  "credentials": {
    "username": "deine-email@example.com",
    "password": "dein-app-passwort"
  }
}

Verwendung

Als MCP Server starten

imap-mcp

In Claude Code einbinden

In ~/.claude/settings.json:

{
  "mcpServers": {
    "imap": {
      "command": "python",
      "args": ["-m", "imap_mcp.server"],
      "cwd": "/pfad/zu/IMAP-MCP/src"
    }
  }
}

Funktionen (38 Tools)

Verbindung

Funktion Beschreibung
connect IMAP-Verbindung aufbauen
authenticate Login mit Username/Passwort
disconnect Verbindung schliessen
auto_connect Mit config.json Credentials verbinden

Mailboxen

Funktion Beschreibung
list_mailboxes Alle Ordner auflisten
select_mailbox Ordner oeffnen
create_mailbox Neuen Ordner erstellen
get_mailbox_status Status (Anzahl, Ungelesen, etc.)

Emails lesen

Funktion Beschreibung
fetch_emails Emails abrufen mit Filtern
get_email Komplette Email per UID
get_email_headers Nur Header (schneller)
get_email_body Body (text/html)
get_attachments Anhaenge auflisten
download_attachment Anhang herunterladen (base64)
get_thread Email-Thread/Konversation

Suche

Funktion Beschreibung
search_emails Freie Suche (IMAP SEARCH)
search_by_sender Nach Absender
search_by_subject Nach Betreff
search_by_date Nach Datum
search_unread Alle ungelesenen
search_flagged Alle markierten

Aktionen

Funktion Beschreibung
mark_read Als gelesen markieren
mark_unread Als ungelesen markieren
flag_email Flag hinzufuegen
unflag_email Flag entfernen
move_email In anderen Ordner verschieben
copy_email In anderen Ordner kopieren
archive_email Archivieren
save_draft Entwurf speichern

Statistiken

Funktion Beschreibung
get_unread_count Anzahl ungelesener Emails
get_total_count Gesamtanzahl

Cache & Watch

Funktion Beschreibung
get_cached_overview Gecachte Uebersicht
refresh_cache Cache aktualisieren
start_watch IDLE Watch starten
stop_watch IDLE Watch stoppen
idle_watch Einzelne Mailbox beobachten

Auto-Archive

Funktion Beschreibung
get_auto_archive_list Auto-Archive Sender auflisten
add_auto_archive_sender Sender hinzufuegen
remove_auto_archive_sender Sender entfernen
reload_auto_archive Config neu laden

Lizenz

MIT

Tools (5)

fetch_emailsRetrieve emails based on specific filters.
search_emailsPerform a free-text search using IMAP SEARCH.
mark_readMark a specific email as read.
archive_emailMove an email to the archive folder.
start_watchInitiate real-time IDLE monitoring for the mailbox.

Environment Variables

hostrequiredThe IMAP server hostname
portrequiredThe IMAP server port
usernamerequiredEmail account username
passwordrequiredEmail account password or app password

Configuration

claude_desktop_config.json
{"mcpServers": {"imap": {"command": "python", "args": ["-m", "imap_mcp.server"], "cwd": "/path/to/IMAP-MCP/src"}}}

Try it

Search for all unread emails from my manager in the last 24 hours.
List all folders in my mailbox and tell me how many unread messages are in the Inbox.
Archive all emails from the newsletter sender 'updates@example.com'.
Get the body of the most recent email with the subject 'Project Update'.
Start watching my inbox for new incoming messages.

Frequently Asked Questions

What are the key features of IMAP MCP Server?

Comprehensive IMAP interaction with 38 distinct tools. Real-time mailbox monitoring using IDLE watch. Advanced email filtering and search capabilities. Automated email archiving and folder management. Support for attachments and email thread retrieval.

What can I use IMAP MCP Server for?

Automating the sorting and archiving of incoming newsletters and notifications.. Quickly searching through large email archives using natural language queries via Claude.. Monitoring specific mailboxes for urgent incoming requests in real-time.. Extracting and organizing information from email threads into structured reports..

How do I install IMAP MCP Server?

Install IMAP MCP Server by running: pip install -e .

What MCP clients work with IMAP MCP Server?

IMAP MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep IMAP MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare