aydu-mail-mcp
This server can verify IMAP connectivity and save a composed email as a draft, but cannot send or read mail in this configuration.
check_connection— verifies IMAP access and reports which mailbox receives drafts.save_draft— saves a message to Drafts with requiredto,subject,html, andtext, plus optionalcc; it does not send.Sending is unavailable: neither
send_emailnorsend_draftis registered.Reading/browsing and signatures are unavailable: the schema exposes no
list_mailboxes,list_messages,get_message,search_messages, orlist_signatures.
Provides draft composition and optional sending for a single GoDaddy (Professional Email/Workspace Email) mailbox over IMAP/SMTP, using GoDaddy's servers as secure defaults. Agents can build valid multipart HTML+plain-text UTF-8 messages and append them to the Drafts folder for human review, and — only when explicitly enabled — deliver the same message over SMTP, plus check IMAP connectivity and report the drafts mailbox.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@aydu-mail-mcp Draft an email to diana@example.com about the invoice and save it — don't send."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
aydu-mail-mcp
A minimal Model Context Protocol server for a single IMAP/SMTP mailbox.
It does four things well:
save_draft— prepares a message with correct MIME (HTML plus a plain-text alternative, both UTF-8) and appends it to the account'sDraftsfolder.list_mailboxes,list_messages,get_message,search_messages— the read side, so an agent can see a mailbox instead of composing blind. See Reading mail.send_email— sends over SMTP. Off by default. See Sending is opt-in.list_signatures— several local HTML signatures, chosen per message. Only when configured. See Signatures.
That asymmetry is the design. Most email MCP servers treat compose and send as one capability, which means an agent that can write a message can also deliver it. Here they are separate tools, and the destructive one does not exist unless you ask for it. The same rule governs signatures: no configured directory, no signature capability.
Why this exists
I audited the popular email MCP servers for a job that only needed drafts. None fit:
Server | Saves drafts | Correct HTML + UTF-8 | Notes |
| yes | no | builds headers by hand: no |
| no | n/a | compose means send; no draft path |
| no | yes | excellent engineering, but zero draft support |
Drafts are the interesting case: a human reviews the message in their real mail client before anything leaves the building. So this server does that one thing properly by handing the message to Nodemailer's MailComposer, then APPENDing it with the \Draft flag — and exposes sending separately, behind an explicit opt-in.
Related MCP server: mail-mcp
Tools
Tool | Available | Purpose |
| always | Builds a |
| always | Verifies IMAP connectivity and reports which mailbox would receive drafts |
| always | Mailbox paths with message and unseen counts |
| always | Message metadata, newest first, never a body |
| always | One message: headers, text, or HTML |
| always | IMAP search across a mailbox |
| only when | Lists the configured local signatures by name |
| only when | Delivers a stored draft by uid, exactly as stored |
| only when | Sends the same validated message over SMTP |
Each opt-in tool is not registered at all when its variable is absent — it does not appear in tools/list, so a client cannot call it and an agent never sees it. This is a capability boundary, not a guard clause. test/tools-list.test.mjs asserts it over the real stdio protocol.
Sending is opt-in
AYDU_MAIL_ALLOW_SEND=true # register send_emailWithout it, drafting is the only write path. Enable it when you actually want an agent to deliver mail.
send_email is irreversible outbound mail. If your workflow requires a human to press send, leave the variable unset and use save_draft.
Three ways out, in order of how much the agent can do alone
Path | Switch | What the tool accepts | What the agent can then reach |
| always on | the whole message | it can write drafts, and deliver nothing |
|
| a uid only | it can deliver anything already in Drafts |
|
| the whole message | it can compose and deliver in one step |
Read the middle row twice, because it is the one that misleads.
send_draft cannot compose: it takes a single uid, no recipient, no subject, no body, and delivers the stored bytes with the envelope read from their own headers. But save_draft is always registered, so a draft the agent wrote a moment ago is also "already in Drafts". Enabling AYDU_MAIL_ALLOW_SEND_DRAFT is a delivery switch, not a review gate. The human review happens because a human reviews, not because the tool prevents anything. If you need the agent to be structurally unable to deliver what it wrote, leave both delivery switches off and send from your client; that is the only configuration where the guarantee holds.
Two further consequences before you enable it. The draft is not deleted or moved after sending, so calling it twice delivers twice. And the switches are independent: setting AYDU_MAIL_ALLOW_SEND does not register send_draft, and setting AYDU_MAIL_ALLOW_SEND_DRAFT does not register send_email — but the second combination still lets a message out, which is exactly the point above.
Reading mail
Four read-only tools, registered in every configuration:
Tool | Returns |
| path, name, special-use flag, message count, unseen count |
| metadata for one page of messages, newest first |
| one message as headers, text, or HTML |
| metadata for messages matching |
Metadata and bodies are separate calls on purpose. list_messages never returns a body: a triage call that dumped fifty full messages would consume a model's context and tell it nothing useful. Fetch one message only when you need it.
Paging is UID-based, so it stays stable while new mail arrives. The uid of the oldest message on a page is the beforeUid of the next one:
Show me the last 10 messages in INBOX, then the 10 before those.
Limits are enforced, not trusted: limit defaults to 20 and is capped at 50, and one body is cut at 100000 bytes with truncated: true.
Reading never modifies mail. Each read opens the mailbox with EXAMINE and fetches with BODY.PEEK, so nothing is marked as read and no flag changes. There is no tool that moves, flags, or deletes a message.
Signatures
Keep several signatures on disk and choose one per message. Nothing is stored in this repository: a signature is a file you edit in place.
mkdir -p ~/.config/aydu-mail/signatures
$EDITOR ~/.config/aydu-mail/signatures/work.html # the HTML variant
$EDITOR ~/.config/aydu-mail/signatures/personal.htmlAYDU_MAIL_SIGNATURES_DIR=/home/you/.config/aydu-mail/signatures
AYDU_MAIL_DEFAULT_SIGNATURE=work # optionalThe name is the file stem. work.html is the signature work.
list_signaturesreturns the names and sizes; it never returns the HTML. Setting the directory registers the tool, and until then thesignatureargument does not exist in any schema.save_draftandsend_emailacceptsignature. Omitted,AYDU_MAIL_DEFAULT_SIGNATUREis applied. If neither is set, no signature is added.The HTML is inserted just before
</body>; the plain-text alternative gets it after the--delimiter, so both halves of themultipart/alternativecarry the signature.
Pair the HTML with a plain text version when the markup would render badly as text:
$EDITOR ~/.config/aydu-mail/signatures/work.txtWithout that file the text part is derived from the HTML: tags dropped, entities decoded, whitespace collapsed, <style> and <script> discarded. Good enough for a footer, not for a layout you care about.
A file larger than 64 KiB is refused rather than truncated, a name that would escape the directory is rejected, and a .txt companion that resolves outside it is refused too.
Requirements
Node.js 20 or newer
An IMAP account with a
Draftsfolder (any provider)Optional:
secret-tool(libsecret) if you want the launcher to read the password from your OS keyring
Install
git clone https://github.com/rafaga2469/aydu-mail-mcp.git
cd aydu-mail-mcp
npm installConfiguration
Everything comes from the environment. Nothing is read from a config file.
Variable | Required | Default | Description |
| yes | — | Full mailbox address; used as IMAP/SMTP user and as |
| yes | — | Mailbox password or app password |
| no | unset (off) | Set truthy ( |
| no | unset (off) | Set truthy to register |
| no | unset (off) | Directory of |
| no | unset | Signature applied when a tool call omits |
| no |
| IMAP host |
| no |
| IMAP port |
| no |
| Set |
| no |
| SMTP host |
| no |
| SMTP port |
| no |
| Set |
The defaults target GoDaddy (Professional Email / Workspace Email), which is what this was first written for. Point them anywhere: Gmail with an app password, Fastmail, a corporate relay.
A non-numeric port falls back to the default rather than producing NaN.
Keeping the password out of config files
MCP client configs are frequently plain text and frequently committed. The bundled launcher reads the password from the OS keyring instead:
secret-tool store --label='mailbox' service aydu-mail account you@example.comA password supplied through AYDU_MAIL_PASS takes precedence, which keeps the launcher usable from a shell, CI job, or systemd unit.
MCP client setup
{
"mcpServers": {
"mail": {
"command": "/absolute/path/to/aydu-mail-mcp/bin/aydu-mail-mcp",
"args": []
}
}
}Or skip the launcher and pass the environment directly:
{
"mcpServers": {
"mail": {
"command": "node",
"args": ["/absolute/path/to/aydu-mail-mcp/src/server.mjs"],
"env": {
"AYDU_MAIL_USER": "you@example.com",
"AYDU_MAIL_PASS": "app-password"
}
}
}
}Usage
Draft the message and let a human send it:
Draft the delivery email to diana@example.com with subject "Delivery final" and save it as a draft — don't send it.
save_draft returns the mailbox path and server-assigned UID:
{
"saved": true,
"mailbox": "Drafts",
"uid": 4212,
"to": "diana@example.com",
"subject": "Delivery final"
}With AYDU_MAIL_ALLOW_SEND=true, send_email returns delivery facts instead:
{
"sent": true,
"messageId": "<...@example.com>",
"accepted": ["diana@example.com"],
"to": "diana@example.com",
"subject": "Delivery final"
}Security notes
Send is a separate, opt-in capability. Not a flag inside a compose tool: the tool is absent unless enabled.
Header injection is rejected. Any
\r,\n, or NUL in a header value fails withDraftInputErrorbefore a message is built, so a crafted subject cannot injectBcc:or rewrite the envelope.Recipients are validated against an address pattern; malformed addresses are refused rather than passed through.
Send reuses the drafted bytes.
send_emailbuilds the message with the same validated code path and sends it asraw, so the delivered bytes match what a draft would have contained.Passwords are redacted from error messages, so a failed connection never echoes a credential into an agent transcript.
Reading cannot write. Read tools open mailboxes with
EXAMINEand fetch withBODY.PEEK; no read path calls STORE, and no tool moves or deletes a message.Signature files are read, never written. The server has no code that creates or edits a signature, so an agent cannot leave one behind. Names are plain file stems and every resolved path is checked with
realpath, so a symlink cannot read a file outside the configured directory.Connections are always closed, including on error paths.
See SECURITY.md for how to report a vulnerability.
Tests
npm testCovers MIME structure, UTF-8 handling, accent round-tripping, configuration defaults, signature resolution and rendering, the read-side shaping, the send opt-in rule, and rejection of header-injection attempts. No mail server required.
Two suites speak the real MCP protocol over stdio: test/tools-list.test.mjs asserts which tools a client can see in each configuration, and test/read-tools.test.mjs exercises the read handlers on the paths that provably cannot reach a server (validation, missing credentials, refused connection). CI has no mailbox, so the IMAP wire calls themselves are not under test — everything that decides what a caller sees is.
Limitations
One mailbox per process. Run separate instances for separate accounts.
Plain-text and HTML bodies only. Attachments are detected but cannot be fetched.
Drafts are appended, never edited. Re-drafting the same message creates a second draft.
send_emaildoes not thread replies (noIn-Reply-To/References).send_draftdoes not remove or move the draft after delivering it, so a repeated call sends the message again.
Contributing
See CONTRIBUTING.md. By participating you agree to the Code of Conduct.
License
MIT — see LICENSE. Every source file carries an SPDX identifier.
Available Tools
2 toolscheck_connectionA
Verify IMAP connectivity and report which mailbox would receive drafts. Sends nothing.
Inputs: no named parameters.
save_draftA
Save an email as a draft in the account's Drafts folder. It does not send: a human reviews and sends it. Provide both an HTML body and a plain-text alternative.
Inputs: to (required), html (required), text (required), subject (required), +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools serve entirely different purposes: one writes a draft, the other checks IMAP connectivity. There is no plausible way to confuse them, and the descriptions reinforce the boundary.
Both names follow a consistent snake_case verb_noun pattern (save_draft, check_connection). No mixing of conventions.
Two tools is on the thin side for a mail server; the surface is narrowly scoped to drafting. It works for the stated purpose but feels sparse.
The stated domain is draft handling, yet there is no way to list, retrieve, update, or delete drafts, only to save and verify connectivity. Notable gaps exist even within the narrow scope.
Maintenance
Related MCP Connectors
Give an agent its own inbox: send, receive, and pull signup codes from real email.
Gmail, Outlook, iCloud, Fastmail and any IMAP mailbox for your agent. Scoped OAuth, approved sends.
Safe email for AI agents: a mailbox with inbound scanning, outbound checks and human review.
Let AI agents send email from your own Gmail, Microsoft 365 or SMTP inbox, with guardrails.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI clients to search and read IMAP email, extract bounded attachments, and prepare and safely send SMTP messages with local previews and confirmation. It also generates client configurations and optional background-service files while keeping credentials on the host.MIT
- AlicenseAqualityBmaintenanceEnables MCP clients to manage multiple IMAP/SMTP mailboxes by listing folders, searching and reading messages, preparing Markdown drafts and replies, and sending only a draft the user has reviewed and confirmed.937 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables AI clients to search and read several IMAP mailboxes without altering them, place reply drafts in Drafts folders, and request sends that go out only after the owner approves each frozen message on a confirmation page.1Apache 2.0
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to work with existing IMAP/SMTP mailboxes through a native MCP endpoint, with granular token scopes for reading, searching, organizing, drafting, sending, and managing folders plus optional AI-assisted summaries and replies. Drafts are saved to real IMAP Drafts folders, and permissions are enforced by the shared mail engine.AGPL 3.0