Email Smtp Imap Mcp

io.github.samihalawaPublished by GitHub account samihalawav2.2.2Updated Nov 1, 2026

Multi-account SMTP/IMAP email tools: search, read, send, reply, forward, flags and folders.

Overview

AI-generated overview

Local MCP server that gives an assistant SMTP/IMAP email tools to search, read, send, reply, forward and organize mail across multiple accounts.

What you can do
  • List configured accounts and their default, and list folders with optional total and unread counts
  • Search inbox mail by text, sender, recipient, subject, date, read or flag state, and attachments, optionally returning bodies and attachments
  • Send plain-text or HTML email with CC, BCC, sender aliases and base64 attachments
  • Reply, reply-all or forward by email UID with threading and optional original attachments
  • Mark messages read or unread, flag or unflag them, and move them between folders
When to use it
Useful when you want an assistant to work directly with real mailboxes over standard SMTP/IMAP: triaging an inbox, finding specific messages, drafting and sending replies, or handling several work and personal accounts from one server.
Requirements
Runs locally over stdio via npx (Node.js). Needs SMTP and IMAP host, port, TLS and credential settings for each account, supplied through the EMAIL_ACCOUNTS_JSON secret or single-account SMTP_/IMAP_ variables, optionally in a .env file pointed to by EMAIL_ENV_FILE. DEFAULT_EMAIL_ACCOUNT is optional. Outbound network access to the mail servers and TLS 1.2 or newer are required.
Before you install
EMAIL_ACCOUNTS_JSON holds plaintext mail passwords or app passwords for every account, so store it privately and avoid committing it. The server can send, reply, forward, move, flag and mark mail, which changes real mailboxes and can reach other people; review before letting an assistant act. Mail content and attachments are read into the assistant's context, and mail servers must support TLS with valid certificates.

Installation

In SourceWeft

  1. Open Email Smtp Imap Mcp in the dashboard and add it to a workspace.
  2. Enable the server for the chats that should use its tools.

Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.

Other MCP clients

Follow the launch instructions in the repository.

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] [OpenSSF Best Practices] [OpenSSF Baseline] [Node.js] [stars] [license]

Why this server

For third-party notices, licence enquiries and the version 2.2.2 supplement, see the open source licence compliance programme.

  • 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:

dotenv
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
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.

json
{  "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

See the tool reference for every input, default, response field and error format.

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.

All tools except accounts_list accept 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. Both SMTP and IMAP require TLS 1.2 or newer and a valid server certificate. With secure: false, STARTTLS is mandatory before authentication; servers without STARTTLS are rejected. Plaintext-only relays are not supported.

Development

bash
git clone https://github.com/samihalawa/email-smtp-imap-mcp.gitcd email-smtp-imap-mcpnpm cinpm 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

Security and release assurance

Report vulnerabilities through the private route in SECURITY.md. The security assurance programme and source-bound review describe the controls, evidence and publication boundaries for this project. They do not claim an external ISO certificate or completed OpenChain conformance.

Maintainers can run npm run assurance to build the package, run security checks, archive pinned component inputs and verify an offline recovery. The generated release assets include platform-specific build inputs and are intended for durable release retention.

Source: README.md at commit dc32584

Tools

6

accounts_list

List every configured email account and show which account is the default. Use this before other tools when multiple SMTP/IMAP accounts are configured.

Takes no parameters.

emails_find

Search for emails in your inbox with flexible filters. Optionally get full email content and attachments. Use this to find specific emails, check for unread messages, or browse your inbox.

Parameterslimitqueryfiltersaccount_nameinclude_contentinclude_attachments

emails_modify

Change email states like read/unread, flagged, or move between folders. Use this to organize your inbox, mark emails as read, archive messages, or flag important emails.

Parametersflagunflagemail_idsrequiredmark_readmark_unreadaccount_namemove_to_folder

email_send

Send a new email with HTML support and file attachments. Use this to send messages, project updates, or any new email conversation.

Parameterscctorequiredbccbodyrequiredsubjectrequiredbody_typefrom_emailattachmentsaccount_name

email_respond

Reply to or forward an existing email. Use this to continue email conversations, respond to messages, or forward information to others.

Parameterstobodyrequiredemail_idrequiredbody_typeaccount_nameresponse_typeinclude_originalinclude_attachmentsadditional_attachments

folders_list

List all available email folders/labels in your account. Use this to see your folder structure and organize emails.

Parametersaccount_nameinclude_counts

Version history

1
  1. v2.2.2LatestNov 1, 2026

Score

90% of the applicable checks met

How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.

  • Reached in the last 30 days25 pts
  • Auth declared10 pts

    Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.

  • Tools listedRequired15 pts
  • DescriptionRequired15 pts
  • Logo10 pts
  • Documentation15 pts
  • License10 pts