MailMCP
# MailMCP
MCP-Server für den Zugriff auf ein E-Mail-Postfach via IMAP/SMTP. Geschrieben in Node.js / TypeScript. Läuft als stdio-Prozess direkt auf dem Host.
## Features
- Alle Ordner des Postfachs auflisten
- E-Mails in einem beliebigen Ordner auflisten (neuste zuerst)
- Vollständigen Inhalt einer E-Mail lesen (Text, HTML, Anhänge)
- E-Mails nach Betreff, Absender oder Body durchsuchen
- E-Mail in anderen Ordner verschieben
- E-Mails senden (inkl. CC, BCC, HTML, Anhänge als Base64)
- Lokale Datei direkt als E-Mail-Anhang versenden
- Konfigurierbarer INBOX-Ordner
## Verfügbare Tools
| Tool | Beschreibung |
|---|---|
| `list_folders` | Alle IMAP-Ordner auflisten |
| `list_emails` | E-Mails in einem Ordner auflisten (mit Filter: ungelesen) |
| `get_email` | Vollständige E-Mail per UID lesen |
| `search_emails` | E-Mails nach Stichwort durchsuchen |
| `move_email` | E-Mail in anderen Ordner verschieben |
| `send_email` | E-Mail senden (To, Subject, Text, optional CC/BCC/HTML/Anhänge als Base64) |
| `send_local_file` | Lokale Datei vom Host-Dateisystem als Anhang versenden |
| `get_inbox_config` | Aktuelle Serverkonfiguration anzeigen |
## Setup
### 1. Abhängigkeiten installieren & bauen
```bash
npm install
npm run build
```
### 2. Konfiguration
```bash
cp .env.example .env
```
Werte in `.env` anpassen:
| Variable | Beschreibung | Standard |
|---|---|---|
| `MAIL_HOST` | IMAP-Server | – |
| `MAIL_PORT` | IMAP-Port | `993` |
| `MAIL_SSL` | IMAP SSL | `true` |
| `MAIL_USER` | E-Mail-Adresse | – |
| `MAIL_PASSWORD` | Passwort | – |
| `MAIL_INBOX` | Standard-Posteingang | `INBOX` |
| `MAIL_MAX_EMAILS` | Max. E-Mails pro Abfrage | `50` |
| `SMTP_HOST` | SMTP-Server | – |
| `SMTP_PORT` | SMTP-Port | `587` |
| `SMTP_SSL` | SMTP SSL (true = Port 465) | `false` |
| `SMTP_FROM_NAME` | Absendername | – |
Die `.env`-Datei wird automatisch geladen — es sind keine Umgebungsvariablen im MCP-Client nötig.
## MCP-Integration (mcporter / Claude / VS Code)
```json
{
"mcpServers": {
"mailmcp": {
"command": "node /pfad/zu/mailmcp/dist/server.js"
}
}
}
```
## Dateistruktur
```
mailmcp/
├── src/
│ ├── server.ts # MCP Server & Tool-Definitionen
│ ├── imap-client.ts # IMAP-Verbindung & E-Mail-Parsing
│ ├── smtp-client.ts # SMTP-Versand via nodemailer
│ └── config.ts # Konfiguration via .env
├── package.json
├── tsconfig.json
├── .env # Credentials (nicht einchecken!)
├── .env.example
└── .gitignore
```
TDQS
Scored across 8 tools
Each tool addresses a distinct email operation: listing folders, listing messages, reading a single message, searching, sending, moving, sending a local file, and viewing config. The only mild overlap is send_email and send_local_file, but they are clearly differentiated by attachment source and defaults.
All tools follow a consistent lowercase verb_noun pattern: list_folders, list_emails, get_email, search_emails, send_email, move_email, send_local_file, and get_inbox_config. The naming style is uniform and predictable.
Eight tools is well-scoped for an email MCP server. The set covers core email operations without unnecessary redundancy or bloat.
The core email workflow is covered: listing folders and emails, reading, searching, sending, moving, and handling local file attachments. Obvious gaps like deleting emails, marking read/unread, or creating folders are missing, but agents can still accomplish most common tasks.