VMail MCP
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., "@VMail MCP show my unread VMail from today"
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.
vmail-mcp
Unofficial community project, not affiliated with Viettel.
An MCP (Model Context Protocol) server that lets AI assistants (Claude, Cursor, ChatGPT, …) read, search, organize and send mail in your Viettel VMail mailbox.
Server settings are built in — you only need your VMail address and password:
Host | Port | Security | |
IMAP |
| 993 | SSL |
SMTP |
| 465 | SSL |
⚠️ Check your organization's policy first. The MCP server talks only to VMail, but the content of the emails your assistant reads is sent to the AI provider (Anthropic, OpenAI, …). Confirm with your information-security team that this is allowed before connecting a work mailbox.
Based on imap-mcp-server by Michael Nikolaus (MIT).
Quick start
Requires Node.js 22.12 or newer. Check with
node --version.
1. Add your VMail account (opens a local setup page in your browser):
npx -p vmail-mcp vmail-mcp-setup --skip-claude--skip-claude skips the optional Claude Desktop auto-configuration (use step 2 instead).
Enter your full VMail address (e.g. name@viettel.com.vn) and password, click Continue. The wizard tests the connection and stores the credentials AES-256 encrypted in ~/.vmail-mcp/.
2. Add the server to your AI client — see Configuration. For Claude Code:
claude mcp add vmail -- npx -y vmail-mcp3. Ask away — "Show my unread VMail from today", "Reply to Lan's last email and say I'll join".
🔒 Do not type your password into the chat.
imap_add_accountexists, but anything you type in the chat is sent to the AI provider. Use the setup wizard or environment variables instead.
Credentials via environment variables
To keep the password out of ~/.vmail-mcp/ entirely, tick "Do not save; set later using environment variable" in the wizard, then provide it in your MCP client config. The variable name is derived from the account name (by default your email address), uppercased with every non-alphanumeric character replaced by _:
IMAP_MCP_ACCOUNT_NAME_VIETTEL_COM_VN_IMAP_PASSWORDThe variables are read once at startup, kept only in memory (encrypted) and removed from the process environment.
Already using
imap-mcp-server? vmail-mcp keeps its accounts in~/.vmail-mcp/, separate from~/.imap-mcp/, so add your VMail account again with the wizard.
Related MCP server: MCP Email
Configuration
Claude Code (CLI)
Option A — via npx (no clone/build needed)
claude mcp add vmail -- npx -y vmail-mcpThis always runs the latest published version and requires no local build.
Option B — from a local clone
If you use Claude Code in the terminal, add the MCP server with a single command:
Step 1: Make sure you have built the project first (npm install && npm run build).
Step 2: Run this command in your terminal:
claude mcp add vmail -- node /absolute/path/to/vmail-mcp/dist/index.jsImportant: Replace
/absolute/path/to/vmail-mcpwith the actual path where you cloned the repository. For example:# macOS/Linux example: claude mcp add vmail -- node /Users/yourname/vmail-mcp/dist/index.js # Windows example: claude mcp add vmail -- node C:\Users\yourname\vmail-mcp\dist\index.js
Step 3: Verify it was added:
claude mcp listYou should see vmail in the list of configured MCP servers. That's it — the IMAP tools are now available in your Claude Code sessions.
Tip: If you want to remove the server later, run:
claude mcp remove vmail
Claude Desktop (GUI App)
Add the IMAP MCP server to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Option A — via npx (recommended, no clone/build needed):
{
"mcpServers": {
"vmail": {
"command": "npx",
"args": ["-y", "vmail-mcp"],
"env": {}
}
}
}Option B — from a local clone:
{
"mcpServers": {
"vmail": {
"command": "node",
"args": ["/path/to/vmail-mcp/dist/index.js"],
"env": {}
}
}
}Restricting tool access (read-only mode / allowlist)
By default all tools are exposed. You can restrict which tools the agent sees
using two environment variables (set them under the env key of your MCP
config). This is useful when you want to give an assistant read-only access
to a mailbox, or expose only a hand-picked subset of tools.
Variable | Effect |
| When truthy ( |
| Comma-separated allowlist of tool names — only these are registered. Names are case-insensitive and the |
Example — read-only access:
{
"mcpServers": {
"vmail": {
"command": "npx",
"args": ["-y", "vmail-mcp"],
"env": { "IMAP_MCP_READ_ONLY": "true" }
}
}
}Example — explicit allowlist:
{
"mcpServers": {
"vmail": {
"command": "npx",
"args": ["-y", "vmail-mcp"],
"env": { "IMAP_MCP_ENABLED_TOOLS": "imap_search_emails,imap_get_email,imap_get_latest_emails" }
}
}
}The read-only subset is: imap_list_accounts, imap_connect, imap_disconnect,
imap_test_account, imap_search_emails, imap_get_email,
imap_get_latest_emails, imap_download_attachment, imap_find_thread_messages,
imap_find_email_by_message_id, imap_list_folders, imap_folder_status,
imap_get_unread_count, imap_check_spam, imap_domain_stats,
imap_list_spam_domains.
Usage
Once configured, the IMAP MCP server provides the following tools in Claude:
Choosing an account. For the email and folder tools,
accountIdis optional and backward-compatible. You may instead passaccountName, and if you only have a single account configured you can omit both — that account is used by default. With multiple accounts and no selector, the tool returns a clear error listing your options (imap_list_accounts).
Account Management
imap_add_account: Add your VMail account (server settings are built in)
Example: { "email": "name@viettel.com.vn", "password": "…" } Parameters: - email: Full VMail address (also used as the login) - password: VMail password - name: Friendly name for the account (optional — defaults to the email) - sentFolder: Explicit Sent-folder name for sent-mail copies (optional — only needed when auto-detection fails) - defaultBcc: Optional BCC address(es) applied automatically to every outbound send, reply, forward, and draft for this account. Merged with any per-call `bcc` (duplicates removed case-insensitively)Only
emailandpasswordare required. Prefer the setup wizard so the password is not typed into the chat.imap_update_account: Update an existing account (fix SMTP settings, rename, etc.)
Parameters: - accountId: ID of the account to update - name, host, port, user, password, tls, allowStartTLS, email: IMAP fields (all optional) - smtpHost, smtpPort, smtpSecure, smtpUser, smtpPassword: SMTP fields (optional) - host and smtpHost must be *.viettel.vn hostnames (any other value is rejected); they are only needed if Viettel changes the VMail servers - saveToSent: Save sent emails to the Sent folder (optional) - sentFolder: Explicit Sent-folder override (optional). Pass an empty string to clear the override and re-enable auto-detection - defaultBcc: Optional default BCC address(es) (optional). Pass an empty string to clearimap_list_accounts: List all configured accounts
imap_remove_account: Remove an account
Parameters: - accountId: ID of the account to removeimap_connect: Connect to an account
Parameters: - accountId OR accountName: Account identifierimap_disconnect: Disconnect from an account
Parameters: - accountId: Account to disconnect
Email Operations
imap_search_emails: Search for emails
Parameters: - accountId: Account ID - folder: Folder name (default: INBOX; ignored when searchAllFolders is true) - searchAllFolders: Search across ALL folders at once (default: false). Skips Trash/Spam/Drafts and non-selectable folders by default. Use when a message may have been filed/moved/archived and you don't know its folder. - includeTrash, includeSpam, includeDrafts: Opt those noisy folders back into a searchAllFolders run (default: false each) - from, to, subject, body: Search criteria - since, before: Date filters - seen, flagged: Status filters - keywords: Match messages with ANY of these custom keywords (server-side OR). Read a mailbox's available custom keywords from `imap_folder_status`'s `customKeywords` field first. - unKeywords: Exclude messages with ANY of these custom keywords (result has NONE of them). Same keyword source as `keywords`. - limit: Max results (default: 50) - includeBody: Include parsed message body in the response (default: false). Fetches the RFC822 source once and parses it with mailparser, so you get uid + body in a single tool call instead of paying the N+1 cost of one `imap_get_email` per match. Body is rendered per `bodyFormat` and capped at `bodyMaxLength` per field. - bodyFormat: How to render the body when `includeBody` is true — `markdown` (default, clean Markdown via Turndown), `text`, `html`, or `auto`. - bodyMaxLength: Per-field cap when `includeBody` is true (default: 10000).With
searchAllFolders, results include afolderfield per message plusfoldersSearched, and any folder that failed to open is reported infoldersErrored(so a 0-result answer is never silently incomplete).includeBodyis honored in the single-folder path only. For a cross-folder sweep the lightweight header shape is preserved by design — pulling RFC822 source for every match across many folders would multiply bandwidth and parse cost. Follow up withimap_get_emailfor the specific uids whose bodies you need.On some servers a "flagged"/starred message carries a custom keyword (e.g. an Open-Xchange color label or Apple's
$MailFlagBit*) instead of, or in addition to, the\Flaggedsystem flag — after any flagged search, check each result'scustomKeywordsfield before concluding a message is or isn't flagged.imap_get_email: Get full email content
Parameters: - accountId: Account ID - folder: Folder name - uid: Email UID - maxContentLength: Max characters for text/html body (default: 10000) - includeAttachmentText: Include text attachment previews (default: true) - maxAttachmentTextChars: Max characters per text attachment (default: 100000)imap_get_latest_emails: Get recent emails
Parameters: - accountId: Account ID - folder: Folder name (default: INBOX) - count: Number of emails (default: 10) - includeBody: Include parsed message body (default: false). Same semantics as the `includeBody` option on `imap_search_emails` — one round-trip instead of N×`imap_get_email`. - bodyFormat: `markdown` (default), `text`, `html`, or `auto`. - bodyMaxLength: Per-field cap (default: 10000).imap_mark_as_read/unread: Change email read status
Parameters: - accountId: Account ID - folder: Folder name - uid: Email UID, OR an array of UIDs to flag in one call. Batch uses a single IMAP STORE so the operation is atomic at the server level — all UIDs are flagged, or none. Useful when triaging many messages at once.imap_flag_email/unflag_email: Star/unstar an email (sets or clears the IMAP \Flagged system flag — shows as a "star" in Gmail and Apple Mail). Some servers/clients (Open-Xchange, Apple Mail) also set a separate custom keyword (e.g.
$cl_N,$MailFlagBit*) when flagging; unflag only clears\Flagged, so if a message still shows as flagged, checkcustomKeywordsviaimap_get_emailand clear it withimap_remove_keyword.Parameters: - accountId: Account ID - folder: Folder name - uid: Email UIDimap_add_keyword/remove_keyword: Set or clear an arbitrary custom (non-system) IMAP keyword/label on an email, passed through verbatim (e.g. provider color labels like Open-Xchange's
$cl_1..$cl_10or Apple Mail's$MailFlagBit0..$MailFlagBit2, or any other custom keyword). Backslash-prefixed system flags (e.g.\Flagged,\Seen,\Deleted) are rejected — use the dedicated flag/read tools for those. Not every server permits custom-keyword changes (see the mailbox's PERMANENTFLAGS); if the server rejects or silently ignores the change, the call fails instead of reporting success.Parameters: - accountId: Account ID - folder: Folder name - uid: Email UID - keyword: IMAP keyword to set/remove (e.g. "$cl_3")imap_delete_email: Delete an email
Parameters: - accountId: Account ID - folder: Folder name - uid: Email UIDimap_move_email: Move an email from one folder to another
Parameters: - accountId: Account ID - folder: Source folder name (default: INBOX) - uid: Email UID, OR an array of UIDs to move in one call. Batch moves are attributed per-uid in the response (`results[]` with per-uid `uidMap` and any errors). Single-uid calls return the legacy response shape. - targetFolder: Destination folder name - createDestinationIfMissing: Create the destination folder if it does not exist (default: false)imap_find_thread_messages: Find inbox messages that belong to the same conversation threads as messages already sorted into another folder. Uses RFC 3501 HEADER search on In-Reply-To and References — works on any IMAP server.
Parameters: - accountId: Account ID - sourceFolder: Folder containing the already-sorted thread messages - searchFolder: Folder to search for related messages (default: INBOX) - searchReferences: Also match the References header for multi-level threads (default: true) - includeBody: Include parsed message body for each found thread message (default: false). Same semantics as the `includeBody` option on `imap_search_emails` — one round-trip instead of N×`imap_get_email`. - bodyFormat: `markdown` (default), `text`, `html`, or `auto`. - bodyMaxLength: Per-field cap (default: 10000).imap_download_attachment: Download an email attachment (returns images inline, extracts text from PDFs, or saves to downloads directory)
Parameters: - accountId: Account ID - folder: Folder name (default: INBOX) - uid: Email UID - filename: Attachment filename or contentId (as listed by imap_get_email; NFC/NFD spellings of accented characters are treated as equal, and a contentId may be passed with or without angle brackets) - savePath: Optional file path to save the attachment to - extractText: For PDFs, extract and return text content inline (default: true)imap_bulk_delete: Delete multiple emails at once with chunking and auto-reconnection
Parameters: - accountId: Account ID - folder: Folder name (default: INBOX) - uids: Array of email UIDs to delete - chunkSize: Emails to delete per batch (default: 50)imap_bulk_delete_by_search: Search for emails matching criteria and delete them all
Parameters: - accountId: Account ID - folder: Folder name (default: INBOX) - from, to, subject: Search criteria (optional) - before, since: Date filters (optional) - chunkSize: Emails to delete per batch (default: 50) - dryRun: Preview what would be deleted without deleting (default: false)At least one concrete criterion (
from,to,subject,before, orsince) is required — a call with no criteria is refused, so it can never match and delete an entire folder. On servers whose SEARCH is broken (see Troubleshooting → Search returns nothing) this tool,imap_delete_spamandimap_delete_by_domainreturn an error instead of deleting from a client-side match.imap_send_email: Send a new email
Parameters: - accountId: Account ID to send from - to: Recipient email address(es) — an array, or a single comma-separated string - subject: Email subject - text: Plain text content (optional) - html: HTML content (optional) - cc: CC recipients (optional) - bcc: BCC recipients (optional) - replyTo: Reply-to address (optional) - attachments: Array of attachments (optional) - filename: Attachment filename - content: Base64 encoded content; provide exactly one of `content` or `path` - path: Readable local file path to attach; provide exactly one of `path` or `content` - contentType: MIME type (optional; detected from the filename extension when omitted) - contentDisposition: "attachment" (default) or "inline" — use "inline" for images shown in the HTML body via cid: - cid: Content-ID for inline attachments; must match the `cid:` value used in an `<img src="cid:...">` tag in `html` - dryRun: Validate attachments and compose MIME without sending or saving to Sent (optional, default: false)Attachments are validated before SMTP is contacted. Invalid base64, unreadable paths, missing filenames, ambiguous sources, and inline attachments without
cidfail fast. Successful sends and dry-runs returnattachmentCountand safeattachmentDiagnostics: filename, MIME type, size, source, disposition, and cid. Diagnostics omit bytes, raw MIME, and local file paths.For large files, upload with
imap_upload_filefirst and pass its returned localpath; for inline images, setcontentDisposition: "inline"and a matchingcid.After sending, a copy is saved to the account's Sent folder (unless
saveToSentis disabled on the account). The folder is resolved via the account'ssentFolderoverride → the server's\SentSPECIAL-USE flag → a list of known localized names ("Sent", "Gesendet", "Éléments envoyés", …). The response reports the outcome:savedToSent(boolean),sentFolder(the folder used), and — when the save fails —sentSaveErrorexplaining why, instead of failing silently. The same applies toimap_reply_to_emailandimap_forward_email.When the account has
defaultBccconfigured, those address(es) are always BCC'd on send, reply, forward, and draft (merged with any per-callbcc; duplicates removed case-insensitively). The Bcc header is kept in the MIME stored for drafts and Sent-folder copies so mail clients show it.imap_save_draft: Save an email as a draft (no send). Takes the same fields as
imap_send_email, plusinReplyTo,references, and an optionalfolderoverride for the Drafts folder.imap_reply_to_email: Reply to an existing email
Parameters: - accountId: Account ID - folder: Folder containing the original email - uid: UID of the email to reply to - text: Plain text reply content (optional) - html: HTML reply content (optional) - replyAll: Reply to all recipients (default: false) - bcc: BCC recipients (optional; merged with account defaultBcc) - attachments: Array of attachments (optional, same shape as imap_send_email, including contentDisposition/cid for inline images)imap_forward_email: Forward an existing email
Parameters: - accountId: Account ID - folder: Folder containing the original email - uid: UID of the email to forward - to: Forward to email address(es) - text: Additional text to include (optional) - bcc: BCC recipients (optional; merged with account defaultBcc) - includeAttachments: Include original attachments (default: true)
Folder Operations
imap_list_folders: List all folders
Parameters: - accountId: Account IDEach folder includes its
attributes(raw IMAP LIST flags) and, when the server advertises it,specialUse— the RFC 6154 role (\Sent,\Drafts,\Trash,\Junk,\Archive) that identifies a folder independent of its localized display name (e.g. "Gesendet" carriesspecialUse: "\Sent").imap_folder_status: Get folder information
Parameters: - accountId: Account ID - folder: Folder name Returns: - messages: { total, new, unseen } — from IMAP STATUS - uidvalidity, uidnext - flags, permanentFlags: string arrays - customKeywords: the mailbox's non-system keywords, usable as the `keywords` / `unKeywords` input of imap_search_emailsimap_create_folder: Create a new IMAP folder/mailbox. Most servers also create any missing parent folders. Returns success even if the folder already exists.
Parameters: - accountId: Account ID - folder: Full folder path to create (e.g. "Archives/2026/2026-05" or "INBOX.Archive")imap_get_unread_count: Count unread emails
Parameters: - accountId: Account ID - folders: Specific folders (optional)
Security
Credentials are encrypted using AES-256-CBC encryption
Encryption keys are stored separately in
~/.vmail-mcp/.keyAccount configurations are stored in
~/.vmail-mcp/accounts.jsonThe store directory,
.key, andaccounts.jsonare written owner-only (0700/0600) so other local users cannot read the key or the credentialsThe web setup wizard's HTTP API never returns stored passwords to the browser
Downloaded attachments are confined to the downloads directory; sender-supplied filenames cannot write outside it
Never commit or share your encryption key or account configurations
Development
Running in Development Mode
npm run devBuilding
npm run buildProject Structure
src/
├── index.ts # MCP server entry point
├── services/
│ ├── imap-service.ts # IMAP connection management
│ ├── smtp-service.ts # SMTP service for sending emails
│ └── account-manager.ts # Account configuration
├── tools/
│ ├── index.ts # Tool registration
│ ├── account-tools.ts # Account management tools
│ ├── email-tools.ts # Email operation tools (including send/reply/forward)
│ └── folder-tools.ts # Folder operation tools
└── types/
└── index.ts # TypeScript type definitionsExample Usage in Claude
Add an account: "Add my VMail account name@viettel.com.vn"
Check new emails: "Show me the latest 5 emails from my VMail account"
Search emails: "Search for emails from boss@company.com in the last week"
Send an email: "Send an email to client@example.com with subject 'Project Update'"
Reply to emails: "Reply to the latest email from my boss"
Forward emails: "Forward the email with subject 'Meeting Notes' to team@company.com"
Move an email: "Move the invoice email from INBOX to my Taxes folder"
Manage folders: "List all folders in my email account and show unread counts"
Troubleshooting
Connection Issues
Check that you entered your full VMail address (e.g. name@viettel.com.vn) and password
Check that your network can reach imap.vmail.viettel.vn:993 and smtp.vmail.viettel.vn:465
Verify that IMAP is enabled in your email account settings
For sending emails, ensure your account has SMTP access enabled
Recipients arriving as ["a@x.com","b@y.com"]
to, cc, bcc, references and uid accept either a single value or an
array. In JSON Schema that is an anyOf, and some MCP clients drop the anyOf
before showing the schema to the model — the field then looks untyped or
string-typed, and the client serializes the model's array into a string. The
server used to pass that string straight to nodemailer, which folded the
literal [ and ] into the first and last address, so every recipient was
rejected by the receiving mail server (issue #127).
The server now detects a stringified array and restores it, both when
validating tool input and again before composing the message, and logs a
warning to stderr naming the field. Nothing needs to change on your side. If
you want to bypass the client behavior entirely, pass recipients as one
comma-separated string: "Alice <alice@example.com>, Bob <bob@example.org>".
License
MIT
Original work © 2024 Michael Nikolaus; modifications © 2026 Ông Tùng Dương.
Contributing
Contributions are welcome! Open issues and pull requests at https://github.com/ongtungduong/vmail-mcp.
Available Tools
40 toolsimap_add_accountA
Add a Viettel VMail account. Server settings (imap.vmail.viettel.vn:993 SSL, smtp.vmail.viettel.vn:465 SSL) are filled in automatically — only the email address and password are needed. Prefer asking the user to run the setup wizard (npx -p vmail-mcp vmail-mcp-setup) so the password never passes through the chat; use this tool only when the user explicitly provides the credentials here.
Inputs: email (required), password (required), name, defaultBcc, +1 more.
imap_add_keywordA
Set an arbitrary custom (non-system) IMAP keyword/label on an email — e.g. a provider color label like Open-Xchange's $cl_1..$cl_10, Apple Mail's $MailFlagBit0..$MailFlagBit2, or an app tag such as $promotion. Unlike imap_flag_email (which only ever sets the system \Flagged flag), this passes the keyword through verbatim, but rejects backslash-prefixed system flags (e.g. \Flagged, \Seen, \Deleted) — use the dedicated flag/read tools for those. Not every IMAP server permits custom keywords (see the mailbox's PERMANENTFLAGS) — if the server rejects or silently ignores the change, this call fails rather than reporting success.
Inputs: uid (required), keyword (required), folder, accountId, +1 more.
imap_add_spam_domainA
Add a domain to the custom spam list. Emails from this domain will be flagged as spam.
Inputs: domain (required).
imap_add_whitelist_domainA
Add a domain to the whitelist. Emails from whitelisted domains will never be flagged as spam.
Inputs: domain (required).
imap_bulk_deleteB
Delete multiple emails at once with chunking and auto-reconnection. Processes deletions in batches to prevent connection timeouts.
Inputs: uids (required), folder, accountId, chunkSize, +1 more.
imap_bulk_delete_by_searchA
Search for emails matching criteria and delete them all. Useful for cleaning up spam or unwanted emails. At least one concrete criterion (from, to, subject, before, or since) is REQUIRED — a call with no criteria is refused so it can never wipe an entire folder. Supports dryRun to preview matches first.
Inputs: to, from, since, before, +6 more.
imap_check_spamA
Check emails in a folder for spam. Combines sender-domain checks (known spam/disposable domains, suspicious patterns) with deterministic raw-header analysis: bulk-mailer X-Mailer/User-Agent signatures, Precedence: bulk, DMARC/SPF/DKIM failures in Authentication-Results, and List-Unsubscribe / Reply-To domains that do not match the sender. Header checks catch scam mail from fresh, unlisted domains that pass the domain check. Returns domain-based spam, a separate list of header-flagged mails, and domain statistics.
Inputs: accountId (required), from, limit, since, +2 more.
imap_connectC
Connect to an IMAP account
Inputs: accountId, accountName.
imap_create_folderA
Create a new IMAP folder/mailbox. Most servers also create any missing parent folders (e.g. creating "Archives/2026/2026-05" auto-creates "Archives" and "Archives/2026"). Returns success even if the folder already exists.
Inputs: folder (required), accountId, accountName.
imap_delete_by_domainB
Delete all emails from a specific domain. Useful for cleaning up unwanted newsletters or spam.
Inputs: domain (required), accountId (required), dryRun, folder.
imap_delete_emailA
Delete ONE email by folder + uid (moves to Trash or expunges, server-dependent). Destructive and not easily undone — confirm the user means this specific message. To remove many at once use imap_bulk_delete (known uids) or imap_bulk_delete_by_search (by criteria, supports dryRun). To file an email away instead of deleting, use imap_move_email.
Inputs: uid (required), folder, accountId, accountName.
imap_delete_spamC
Find and delete emails from known spam/disposable email domains.
Inputs: accountId (required), limit, dryRun, folder, +1 more.
imap_disconnectB
Disconnect from an IMAP account
Inputs: accountId (required).
imap_domain_statsA
Get statistics about sender domains in a folder. Useful for identifying bulk senders or spam patterns.
Inputs: accountId (required), limit, folder, minCount.
imap_download_attachmentA
Download a single attachment from an email (folder + uid + attachment filename/contentId, as listed by imap_get_email). Images are returned inline for viewing; PDFs are saved and their text is extracted inline (extractText); other files are saved to the shared downloads directory (or savePath). Use when the user wants the actual file contents, not just the message body.
Inputs: uid (required), filename (required), folder, savePath, +3 more.
imap_find_email_by_message_idA
Locate an email by its RFC822 Message-ID across folders and return its current { folder, uid } plus basic envelope. Robust to the message having been moved or archived (IMAP UIDs are folder-relative). Pass the returned folder + uid to imap_reply_to_email or imap_get_email. Without folders, searches Gmail \All Mail when present, else INBOX → Archive → Sent → remaining folders.
Inputs: accountId (required), messageId (required), folders.
imap_find_thread_messagesA
Find messages in searchFolder that belong to the same conversation threads as messages already in sourceFolder. Useful for catching replies that arrived after a thread was sorted. Works on any IMAP server (uses RFC 3501 HEADER search on In-Reply-To and References). Set includeBody=true to also return the parsed body for each found thread message in one round-trip — avoids the N+1 cost of calling imap_get_email per thread member.
Inputs: sourceFolder (required), accountId, bodyFormat, accountName, +4 more.
imap_flag_emailA
Flag an email — sets the IMAP \Flagged system flag (shows as a star in Gmail / a flag in Apple Mail). Use this tool when a user asks to star, flag, or mark a message as important.
Inputs: uid (required), folder, accountId, accountName.
imap_folder_statusC
Get status information about a folder
Inputs: folder (required), accountId, accountName.
imap_forward_emailA
Forward an existing email (folder + uid) to new recipients, quoting the original message and headers. Optionally include the original attachments. Use when the user wants to pass an existing message on to someone else; use imap_reply_to_email instead to respond to the sender. Account defaultBcc addresses are always BCC'd when configured.
Inputs: to (required), uid (required), bcc, body, +5 more.
imap_get_emailA
Read the FULL content of a single email by its UID (body, sender/recipients, date, attachment list, optional raw headers and text-attachment previews). By default the body is returned as clean Markdown in markdownContent and raw HTML is omitted so it never crosses the boundary; set bodyFormat to "html" for the legacy raw htmlContent, or "text" for plain text only. Use after imap_search_emails or imap_get_latest_emails gives you a uid. Body text is truncated to maxContentLength to protect the context window — raise it for long messages. To fetch attachment bytes, use imap_download_attachment.
Inputs: uid (required), folder, accountId, bodyFormat, +5 more.
imap_get_latest_emailsA
Get the most recent emails from a folder, newest first. Use this for "what just came in?" / "show my latest inbox messages" when no search filter is needed. By default returns lightweight headers (uid, from, subject, date); set includeBody=true to also return the parsed body in one round-trip instead of paying the N+1 cost of calling imap_get_email per message. To filter by sender/subject/date instead, use imap_search_emails.
Inputs: count, folder, accountId, bodyFormat, +3 more.
imap_get_unread_countA
Count unread (unseen) emails per folder, plus a total. Use for "how many unread do I have?" overviews. Defaults to all folders; pass a folders list to limit scope and speed it up.
Inputs: folders, accountId, accountName.
imap_list_accountsA
List all configured IMAP accounts
Inputs: no named parameters.
imap_list_foldersA
List all folders/mailboxes for an account (names, hierarchy delimiter, attributes, RFC 6154 special-use role). Use this first to discover exact folder names before searching, moving, or creating subfolders — folder naming varies by provider (e.g. "Archive" vs "[Gmail]/All Mail" vs "INBOX.Archive"). The specialUse field ("\Sent", "\Drafts", "\Trash", "\Junk", "\Archive") identifies a folder's role independent of its localized name (e.g. "Gesendet" is the Sent folder when specialUse is "\Sent").
Inputs: accountId, accountName.
imap_list_spam_domainsA
List all known spam domains (built-in and custom).
Inputs: no named parameters.
imap_mark_as_readA
Mark one or many emails as read. Accepts a single UID or an array — pass an array to flag N messages in one IMAP STORE round-trip (useful when triaging).
Inputs: uid (required), folder, accountId, accountName.
imap_mark_as_unreadA
Mark one or many emails as unread. Accepts a single UID or an array — pass an array to flag N messages in one IMAP STORE round-trip.
Inputs: uid (required), folder, accountId, accountName.
imap_move_emailA
Move an email from one folder to another (e.g., INBOX to Taxes, or INBOX to Archive). Optionally creates the destination folder if it does not exist.
Inputs: uid (required), targetFolder (required), folder, accountId, +2 more.
imap_remove_accountB
Remove an IMAP account configuration
Inputs: accountId (required).
imap_remove_keywordA
Remove an arbitrary custom (non-system) IMAP keyword/label from an email — e.g. a provider color label like Open-Xchange's $cl_1..$cl_10, Apple Mail's $MailFlagBit0..$MailFlagBit2, or an app tag such as $promotion. Unlike imap_unflag_email (which only ever clears the system \Flagged flag), this passes the keyword through verbatim, but rejects backslash-prefixed system flags (e.g. \Flagged, \Seen, \Deleted) — use the dedicated flag/read tools for those. Not every IMAP server permits custom keywords (see the mailbox's PERMANENTFLAGS) — if the server rejects or silently ignores the change, this call fails rather than reporting success.
Inputs: uid (required), keyword (required), folder, accountId, +1 more.
imap_remove_spam_domainA
Remove a domain from the custom spam list.
Inputs: domain (required).
imap_reply_to_emailA
Reply to an existing email identified by folder + uid. Automatically sets the recipient to the original sender, prefixes the subject with "Re:", and preserves threading (In-Reply-To/References). Set replyAll to also include the original recipients. Use this instead of imap_send_email whenever the user is responding to a message already in a mailbox. Account defaultBcc addresses are always BCC'd when configured.
Inputs: uid (required), bcc, body, html, +6 more.
imap_save_draftA
Save an email as a draft in the Drafts folder (no send). Takes the same fields as imap_send_email (including account defaultBcc when configured).
Inputs: cc, to, bcc, body, +10 more.
imap_search_emailsA
Note: on some servers a 'flagged' or starred message carries a custom keyword (e.g. an Open-Xchange color label or Apple's $MailFlagBit*) instead of, or in addition to, the \Flagged system flag. After any flagged search, inspect each result's customKeywords field before concluding a message is or isn't flagged — do not rely on the flagged filter alone. Search for emails matching criteria (sender, recipient, subject, body text, date range, read/flagged status). Use this to FIND messages when you know something about them but not their UID — e.g. "emails from amazon last week", "unread invoices". By default searches a single folder (INBOX). Set searchAllFolders=true to scan every mailbox at once — this catches messages filed away by rules (e.g. a receipt routed to a custom folder); Trash/Spam/Drafts are skipped unless you opt in. By default returns lightweight headers (uid, from, subject, date, and folder when searching across folders); set includeBody=true to also return the parsed body in one round-trip instead of paying the N+1 cost of calling imap_get_email per match. For the newest messages without criteria, prefer imap_get_latest_emails.
Inputs: to, body, from, seen, +18 more.
imap_send_emailA
Compose and send a NEW email via the account's SMTP server (a copy is saved to Sent unless disabled; account defaultBcc addresses are always BCC'd when configured). Use for fresh outbound messages. To respond to an existing message use imap_reply_to_email (keeps threading); to pass a message on use imap_forward_email; to store without sending use imap_save_draft. Supports to/cc/bcc, text and/or HTML, and attachments by base64 content or by file path (see imap_upload_file for large files).
Inputs: to (required), subject (required), cc, bcc, +8 more.
imap_test_accountA
Test an existing account connection without re-entering credentials. Validates IMAP connectivity and returns folder count and message count.
Inputs: accountId (required).
imap_unflag_emailA
Unflag an email — removes the IMAP \Flagged system flag (the star in Gmail, the flag in Apple Mail). Note: some servers (e.g. Open-Xchange / Network Solutions) and Apple Mail also write a separate custom keyword such as $cl_N or $MailFlagBit* when a message is flagged in their client. Removing \Flagged alone does not clear that keyword, so the message may still display as flagged. If it does, check the message's customKeywords via imap_get_email and remove the lingering label with imap_remove_keyword.
Inputs: uid (required), folder, accountId, accountName.
imap_update_accountA
Update an existing VMail account (password, name, Sent folder, default BCC, …) without removing and re-adding it. The host/port/TLS/SMTP fields are only needed if Viettel changes the VMail server settings — new accounts get them automatically.
Inputs: accountId (required), tls, host, name, +13 more.
imap_upload_fileA
Upload a file to the server for use as an email attachment. Returns a path that can be used with imap_send_email attachments. This allows sending large attachments without hitting context window limits. Max size: 26214400 bytes (configurable via IMAP_MAX_UPLOAD_SIZE). Uploads are auto-deleted after 86400000 ms (configurable via IMAP_UPLOAD_TTL_MS).
Inputs: content (required), filename (required), contentType.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 40 tools
Most tools have clearly distinct purposes and descriptions explicitly cross-reference alternatives (e.g., search vs latest, reply vs forward). However, several deletion tools (single, bulk, by search, by domain, spam) and flag/keyword tools overlap enough that an agent could misselect without careful reading. Minor ambiguity also exists around imap_connect vs imap_test_account.
Nearly all tools use the imap_ prefix with snake_case, and the majority follow a verb_noun pattern (imap_search_emails, imap_send_email). A few deviate to noun-first (imap_folder_status, imap_domain_stats) or verb-only (imap_connect, imap_disconnect), but the overall convention is highly predictable.
40 tools is well above the 3-15 sweet spot and exceeds the 25+ threshold for 'too many.' While each tool arguably covers a feature, many could be consolidated (e.g., multiple bulk-delete and spam-management tools), making the surface heavy for an MCP client.
The server covers account lifecycle, reading/searching, sending/replying/forwarding, attachments, flags/keywords, folders, and spam management with good depth. Gaps include folder deletion/rename and some bulk operations, but the core email workflow is complete.
Related MCP Connectors
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Connect any mailbox to Claude, ChatGPT & AI: read, send, reply, schedule & search emails.
Separate, real mailboxes for AI agents: get verification codes, read, search and send email.
Connect Gmail, iCloud Mail, Outlook, Yahoo Mail, Fastmail and other IMAP inboxes to ChatGPT, Claude and compatible AI assistants. Find emails by meaning across languages with semantic search. Ask AI to find customer conversations, summarize deadlines and draft follow-ups. Give a sales rep access to a shared outreach inbox or bring email into a compatible CRM. Share an iCloud custom-domain inbox with teammates without their own Apple ID or iCloud+ plan. Search results may be incomplete or stale; separate permissions control mail actions.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to read, search, compose, and send emails by connecting to any IMAP/SMTP provider. It supports comprehensive mailbox management, including draft handling and message deletion, directly through natural language.10233 npm11MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to read, send, organize, and search emails across multiple IMAP/SMTP mailboxes.MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to search, read, send, reply to, forward, move, and bulk-delete emails across multiple mailboxes through IMAP and SMTP, with AES-256-encrypted credential storage and connection pooling. Supports folder listing, unread counts, and 15+ pre-configured providers configurable via a web setup wizard.1,009 npmMIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to securely manage multiple email accounts via IMAP and SMTP, including searching, reading, sending, replying, forwarding, organizing folders, marking, and bulk deleting messages.1,009 npmMIT