mcpField
S
SMTP Email MCP Server

SMTP Email MCP Server

Local
github.com/samihalawaCommunication25Updated 3w ago

About SMTP Email MCP Server

SMTP Email MCP Server is a local MCP server for searching, reading, sending, replying to, forwarding and organizing email across multiple accounts. It works with Gmail, iCloud Mail, Fastmail, Outlook and other standard SMTP/IMAP providers, with no account-count limit.

Key features

  1. 01SMTP sending and IMAP receiving in one server
  2. 02Switching between multiple accounts by name
  3. 03Email search, reply, forward and attachments
  4. 04Flagging, read state changes and folder moves
  5. 05Local stdio transport without a hosted relay

Use cases

  1. 01Managing work and personal inboxes from Claude Desktop
  2. 02Finding unread emails and replying or forwarding them
  3. 03Archiving or moving messages into chosen folders

MCP support

This project is an MCP server that exposes email sending and management through tools such as accounts_list, emails_find and email_send to MCP clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"smtp": {
"command": "npx",
"args": [
"-y",
"@smithery/cli"
]
}
}
}
Run commandnpx -y @smithery/cli

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@smithery/cli

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project README

One MCP server connecting multiple email accounts

Email SMTP/IMAP MCP

One local MCP server for every inbox: search, read, send, reply, forward, and organize email across multiple accounts.

release npm downloads CI Node.js stars license

Why this server

  • No account-count cap — add work, personal, support, or client inboxes and switch with account_name.
  • SMTP + IMAP together — send and receive through one small MCP server.
  • Complete everyday workflow — search, read, reply, forward, attach files, flag, archive, move, and list folders.
  • Provider-agnostic — works with Gmail, iCloud Mail, Fastmail, Outlook, self-hosted mail, and other standard SMTP/IMAP providers.
  • Local stdio transport — no hosted relay and no separate control panel.

Search, send, respond, organize, and browse folders across accounts

Quick start

1. Create your .env

Copy .env.example to a private location and add as many named accounts as you need:

EMAIL_ACCOUNTS_JSON='{
  "work": {
    "smtp": {
      "host": "smtp.gmail.com",
      "port": 587,
      "secure": false,
      "user": "[email protected]",
      "password": "app-password"
    },
    "imap": {
      "host": "imap.gmail.com",
      "port": 993,
      "secure": true,
      "user": "[email protected]",
      "password": "app-password"
    },
    "default_from_name": "Your Name",
    "sender_emails": ["[email protected]", "[email protected]"]
  },
  "personal": {
    "smtp": {
      "host": "smtp.mail.me.com",
      "port": 587,
      "secure": false,
      "user": "[email protected]",
      "password": "app-password"
    },
    "imap": {
      "host": "imap.mail.me.com",
      "port": 993,
      "secure": true,
      "user": "[email protected]",
      "password": "app-password"
    }
  }
}'

DEFAULT_EMAIL_ACCOUNT="work"

The server loads .env from its working directory automatically. EMAIL_ENV_FILE lets an MCP client use an .env stored anywhere.

2. Add the MCP server

For Claude Desktop, edit:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "email": {
      "command": "npx",
      "args": ["-y", "email-smtp-imap-mcp"],
      "env": {
        "EMAIL_ENV_FILE": "/absolute/path/to/your/.env"
      }
    }
  }
}

Use an absolute path, restart your MCP client, then ask: “List my configured email accounts.”

Pass account JSON directly from the MCP client

You can skip the .env file and set EMAIL_ACCOUNTS_JSON plus DEFAULT_EMAIL_ACCOUNT directly in the MCP client’s env object. The JSON must be escaped into a single string.

{
  "env": {
    "EMAIL_ACCOUNTS_JSON": "{\"work\":{\"smtp\":{\"host\":\"smtp.gmail.com\",\"port\":587,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.gmail.com\",\"port\":993,\"user\":\"[email protected]\",\"password\":\"app-password\"}}}",
    "DEFAULT_EMAIL_ACCOUNT": "work"
  }
}
Single-account `.env` variables

Use SMTP_HOST, SMTP_PORT, SMTP_SECURE, SMTP_USER, SMTP_PASS, IMAP_HOST, IMAP_PORT, IMAP_SECURE, IMAP_USER, and IMAP_PASS instead of EMAIL_ACCOUNTS_JSON.

SMTP_USERNAME/SMTP_PASSWORD and IMAP_USERNAME/IMAP_PASSWORD are accepted aliases. IMAP credentials default to the SMTP credentials when omitted. Use SENDER_EMAILS as a comma-separated allowlist for optional from_email selection.

Tools

ToolWhat it does
accounts_listList every configured account and identify the default without exposing credentials.
emails_findSearch by text, sender, recipient, subject, date, read state, flag state, or attachments. Optionally return bodies and attachments.
email_sendSend plain-text or HTML email with CC, BCC, sender aliases, and base64 attachments.
email_respondReply, reply-all, or forward by email UID with threading and optional original attachments.
emails_modifyMark read/unread, flag/unflag, or move messages to another folder.
folders_listList folders with optional total and unread counts.

Every email tool accepts an optional account_name. Without it, the server uses DEFAULT_EMAIL_ACCOUNT or the first configured account. There is no application-level account-count limit.

Verify your setup

After restarting the MCP client, try these in order:

  1. “List my configured email accounts.”
  2. “List folders for my work account.”
  3. “Find the five newest unread emails in my personal account.”
  4. “Send a plain-text email from my work account.”

Provider settings

ProviderSMTPIMAPCredential
Gmailsmtp.gmail.com:587imap.gmail.com:993App password
iCloud Mailsmtp.mail.me.com:587imap.mail.me.com:993App-specific password
Other providersUse the provider's SMTP hostUse the provider's IMAP hostProvider password or app password

Use secure: true for implicit TLS ports such as 465/993. Port 587 normally uses secure: false and upgrades with STARTTLS.

Development

git clone https://github.com/samihalawa/email-smtp-imap-mcp.git
cd email-smtp-imap-mcp
npm ci
npm test

Run the compiled stdio server with npm start. Build a production container with docker build -t email-smtp-imap-mcp ..

Contributing

Issues and focused pull requests are welcome. See CONTRIBUTING.md for the development workflow and SECURITY.md for vulnerability reports.

License

MIT © Sami Halawa

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.