
Email (IMAP/SMTP)
io.github.boutquinPublished by GitHub account boutquinv1.0.1Updated Oct 25, 2026
Multi-account IMAP/SMTP email server with 22 tools for reading, sending, searching, and organizing.
Overview
A local MCP server that gives an assistant full IMAP/SMTP email access across multiple accounts: reading, searching, sending, and organizing mail.
- What you can do
- List accounts, folders and messages, and read unread mail or full message bodies with pagination and thread views. Search subject and body with sender, recipient and date filters. Send, reply, forward, create and send drafts, with file attachments from the host. Move, copy, delete, mark read or unread, flag, and batch these operations. List and download attachments.
- When to use it
- Use it when you want an assistant to work with real mailboxes over standard IMAP/SMTP, including well-known providers like Gmail, Outlook, Yahoo, iCloud, Fastmail and Zoho, or custom mail servers, across several accounts at once.
- Requirements
- Runs as a local process (Go install, Homebrew, prebuilt binary, Docker image, or Claude Desktop bundle). Needs one of EMAIL_CONFIG_FILE (path to a JSON account file) or EMAIL_ACCOUNTS (inline JSON), each account with id, email, username and password or OAuth2 credentials. Network access to the mail servers; optional OAuth2 client ID and secret for Gmail and Outlook.
Installation
In SourceWeft
- Open Email (IMAP/SMTP) in the dashboard and add it to a workspace.
- 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
mcp-server-email
[CI] [codecov] [Go] [License: MIT] [MCP]
Multi-account email server for the Model Context Protocol. Gives LLMs full email access — read, send, search, organize — over IMAP/SMTP with connection pooling, rate limiting, and retry. Designed as the remote-email counterpart to apple-bridge (local Mail.app access).
Quick Start
-
Install
-
Create a config file (
~/.config/mcp-email/accounts.json)For well-known providers (Gmail, Outlook, Yahoo, iCloud, Fastmail, Zoho), host and port are auto-detected from the email domain — just provide credentials:
For custom mail servers, specify host and port explicitly:
-
Add to Claude Code (
~/.claude.json) -
Restart Claude Code — the
email_*tools are now available.
Installation
Go Install (recommended for Go developers)
Homebrew (macOS/Linux)
Binary Download
Download pre-built binaries for your platform from GitHub Releases.
Available for: Linux (amd64, arm64), macOS (amd64, arm64), Windows (amd64, arm64).
Docker
MCP Bundle (Claude Desktop)
Download the .mcpb file from Releases and open in Claude Desktop.
Build from source
Configuration
Accounts are loaded once at startup. Changes require a server restart.
Config file vs environment variable
If both are set, EMAIL_ACCOUNTS takes precedence.
Account JSON schema
*Host and port are auto-detected for well-known providers (see below). Required for custom servers. **Not required when using OAuth2 authentication.
Provider auto-detection
When imap_host/smtp_host are omitted, the server detects settings from the email domain:
Explicit host/port in the config always takes precedence over auto-detection.
TLS modes
TLS mode is auto-detected from port:
Override with "use_starttls": true or "use_starttls": false in the account object. Omit for auto-detection (recommended).
OAuth2 authentication
For providers that support it (Gmail, Outlook), you can use OAuth2 instead of app passwords. This uses the device code flow (RFC 8628) — no browser redirect needed.
-
Create OAuth2 credentials in the provider's developer console (Google Cloud Console or Azure AD)
-
Configure the account with
auth_method: "oauth2": -
On first connection, the server initiates the device code flow — printing a verification URL and code to stderr. Visit the URL and enter the code to authorize.
-
Tokens are persisted in
~/.config/mcp-email/tokens/and automatically refreshed. Subsequent connections reuse the stored token without re-authorization.
Supported OAuth2 providers: Gmail (gmail.com, googlemail.com) and Outlook (outlook.com, hotmail.com, live.com).
Environment variables
*One of EMAIL_CONFIG_FILE or EMAIL_ACCOUNTS is required.
Config file permissions
The config file contains account passwords. Always restrict access:
Tools (22)
Account & folder tools
Message listing
Message operations
Attachments & threads
Send & drafts
All optional account params default to the configured default account.
Search
email_search searches both subject and body using IMAP SEARCH OR (SUBJECT "q") (BODY "q").
Optional filters narrow the candidate set server-side before body scanning:
The existing operation timeout (default 30s) prevents hung body searches on large mailboxes.
Attachments
email_send and email_draft_create accept an attachments parameter — an array of file references on the server host:
Limits (defaults): 18 MB per file, 18 MB total (pre-base64 encoding; stays under 25 MB SMTP cap after encoding). Configurable via MAX_ATTACHMENT_SIZE_MB and MAX_TOTAL_ATTACHMENT_SIZE_MB environment variables.
Download limit: Attachment downloads (email_attachment_get) are capped at 25 MB by default, configurable via MAX_DOWNLOAD_SIZE_MB.
Validation failures (missing file, non-absolute path, size exceeded) return INVALID_ARGUMENT.
Message IDs
Message IDs are composite strings encoding account, mailbox, and UID:
Example: hello:INBOX:12345
All CRUD tools (email_get, email_move, email_copy, email_delete, email_mark_read, email_flag, email_draft_send) extract the account and folder from the ID — no separate params needed.
Error Codes
All errors are returned as MCP tool errors with a structured code prefix:
Resources
Comparison with apple-bridge
This server and apple-bridge share an Email model and parameter semantics (limit, includeBody, folder, query) so LLMs can work with both interchangeably. Key differences:
Development
Prerequisites
- Go 1.24+
- golangci-lint
- Docker (for integration tests only)
Build
Unit tests
Unit tests use mock implementations of the imap.Operations and smtp.Operations interfaces — no live mail server needed.
Benchmarks
Fuzz testing
Fuzz targets ship with seed corpora in testdata/fuzz/ directories. Run a specific target:
Lint
Integration tests
Integration tests exercise the full IMAP/SMTP stack against a real mail server. They are isolated behind the integration build tag and never run during go test ./....
Mail server: Greenmail
Tests use Greenmail, a lightweight Java mail server packaged as a Docker image. Key details that affect how you run it:
Quick start (one command)
This starts a Greenmail container, runs all integration tests, then tears down the container — regardless of pass/fail.
Manual step-by-step
If you need to iterate on tests without restarting the container each time:
-
Start Greenmail
Wait ~3 seconds for the JVM to start.
-
Run integration tests
-
Tear down when done
Test environment variables
*If the corresponding HOST variable is unset, that test file's tests are skipped with a message (not failed).
What the tests cover
IMAP (internal/imap/integration_test.go — 7 tests):
SMTP (internal/smtp/integration_test.go — 4 tests):
Troubleshooting
CI
Integration tests run automatically in GitHub Actions via the integration job in .github/workflows/ci.yml. The job uses a Greenmail service container — no manual Docker setup needed. See the workflow file for the exact configuration.
Coverage
To generate a combined unit + integration coverage report:
Architecture
Tool handlers are decoupled from IMAP/SMTP clients via the imap.Operations and smtp.Operations interfaces, enabling comprehensive unit testing with mocks.
Dependencies
This project uses go-imap v2 (currently v2.0.0-beta.8).
The v2 API is not yet stable — breaking changes may occur before the v2.0.0 release.
We pin the exact version in go.mod and will upgrade promptly when stable is released.
License
Source: README.md at commit 0ba695c
Tools
0Version history
1- v1.0.1LatestSep 16, 2026
Score
50% 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
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- 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 listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts