# imap-mcp

imap-mcp is a Claude Code MCP server that connects to mailboxes to save draft messages over IMAP. It places prepared emails into the drafts folder without sending them immediately.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 15 repo stars
- Author: langmail
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/langmail/imap-mcp
- Updated: 2026-11-19
- Security check: automated, 2026-11-24 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/imap-mcp

## What it does

The server connects an assistant to standard IMAP mailboxes, such as Gmail or Outlook. Through its single `create-draft` tool, the model populates the recipient, subject line, and body, then writes the message directly into `Drafts` or `INBOX.Drafts`. The sender field defaults to the configured mailbox username when omitted.

Running the tool requires Node.js and explicit IMAP credentials. Connection details pass through environment variables for host, port, username, password, and SSL flag. The server solely handles draft generation and does not read incoming mail or send messages out.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `IMAP_HOST`, `IMAP_PORT`, `IMAP_USERNAME`, `IMAP_PASSWORD`, `IMAP_USE_SSL` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env IMAP_HOST=<IMAP_HOST> --env IMAP_PORT=<IMAP_PORT> --env IMAP_USERNAME=<IMAP_USERNAME> --env IMAP_PASSWORD=<IMAP_PASSWORD> --env IMAP_USE_SSL=<IMAP_USE_SSL> --transport stdio imap-mcp -- npx -y imap-mcp
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add imap-mcp --env IMAP_HOST=<IMAP_HOST> --env IMAP_PORT=<IMAP_PORT> --env IMAP_USERNAME=<IMAP_USERNAME> --env IMAP_PASSWORD=<IMAP_PASSWORD> --env IMAP_USE_SSL=<IMAP_USE_SSL> -- npx -y imap-mcp
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "imap-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "imap-mcp"
            ],
            "env": {
                "IMAP_HOST": "<IMAP_HOST>",
                "IMAP_PORT": "<IMAP_PORT>",
                "IMAP_USERNAME": "<IMAP_USERNAME>",
                "IMAP_PASSWORD": "<IMAP_PASSWORD>",
                "IMAP_USE_SSL": "<IMAP_USE_SSL>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "imap-mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "imap-mcp"
            ],
            "env": {
                "IMAP_HOST": "<IMAP_HOST>",
                "IMAP_PORT": "<IMAP_PORT>",
                "IMAP_USERNAME": "<IMAP_USERNAME>",
                "IMAP_PASSWORD": "<IMAP_PASSWORD>",
                "IMAP_USE_SSL": "<IMAP_USE_SSL>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e IMAP_HOST=<IMAP_HOST> -e IMAP_PORT=<IMAP_PORT> -e IMAP_USERNAME=<IMAP_USERNAME> -e IMAP_PASSWORD=<IMAP_PASSWORD> -e IMAP_USE_SSL=<IMAP_USE_SSL> imap-mcp npx -y imap-mcp
```
Replace <…> with your own values

## When to use it
- saving IMAP email drafts
- save draft messages without sending them immediately
- prepare email body and subject line for manual review
- connect Gmail or Outlook mailboxes to an AI assistant

## Example prompts
- Draft an email to team@example.com with the subject Release Report and a short summary of changes
- Save a draft response to client@domain.com confirming tomorrow's meeting
- Prepare a draft reminder for colleague@work.com regarding the budget review

## Similar
- [email-imap-fetch](https://affpapa.org/en/nevibecode/skills/email-imap-fetch.md) — skill · 378 installs
- [email-smtp-imap-mcp](https://affpapa.org/en/nevibecode/mcp/email-smtp-imap-mcp.md) — MCP server · ★ 26 repo stars
- [Email (IMAP/SMTP)](https://affpapa.org/en/nevibecode/mcp/email-imapsmtp.md) — MCP server · ★ 15 repo stars
- [Mailbox](https://affpapa.org/en/nevibecode/mcp/mailbox.md) — MCP server · ★ 9 repo stars
- [Fluxmail](https://affpapa.org/en/nevibecode/mcp/fluxmail.md) — MCP server · ★ 9 repo stars
- [Envelope](https://affpapa.org/en/nevibecode/mcp/envelope.md) — MCP server · ★ 8 repo stars

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
