Skip to main content
Glama
moellerm1968

MailMCP

by moellerm1968
README.md
# 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

A3.7/5.0

Scored across 8 tools

Disambiguation5/5

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.

Naming Consistency5/5

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.

Tool Count5/5

Eight tools is well-scoped for an email MCP server. The set covers core email operations without unnecessary redundancy or bloat.

Completeness4/5

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.

Maintenance

ActivityInactive
ResponsivenessNo issues