Skip to main content
Glama
SinoEdwards

Mail Agent MCP

by SinoEdwards

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
PORTNoPort for the legacy local setup UI only.3000
NO_PROXYNoComma-separated hosts that should bypass the proxy. Should include 127.0.0.1 and localhost for the OAuth callback.
HTTP_PROXYNoHTTP proxy for Gmail OAuth/token requests. Lowercase variants are also accepted.
HTTPS_PROXYNoHTTPS proxy for Gmail OAuth/token requests. Lowercase variants are also accepted.
IMAP_DOWNLOAD_DIRNoRoot for uploaded and downloaded attachment files.current user's Downloads/imap-attachments directory
IMAP_SPAM_DOMAINSNoComma-separated local spam domain additions.
IMAP_MCP_READ_ONLYNoTruthy values (`1`, `true`, `yes`, `on`) expose the 16-tool mailbox-read-only subset.false
IMAP_UPLOAD_TTL_MSNoLifetime of uploaded temporary attachment files.24 hours
IMAP_MCP_CONFIG_DIRNoOptional account-metadata directory override for isolated profiles and clean-room testing.~/.imap-mcp
IMAP_MCP_MAIL_PROXYNoOptional explicit HTTP CONNECT, HTTPS, or SOCKS proxy override shared by IMAP and SMTP transports.
IMAP_MAX_UPLOAD_SIZENoMaximum decoded attachment upload size in bytes.25 MiB
IMAP_MCP_ENABLED_TOOLSNoComma-separated MCP tool allowlist; names may omit the `imap_` prefix. A non-empty allowlist takes precedence over IMAP_MCP_READ_ONLY.
IMAP_WHITELIST_DOMAINSNoComma-separated local allowlist domain additions.
IPQUALITYSCORE_API_KEYNoReferenced by a legacy internal reputation helper, but no currently registered MCP tool calls that helper.
IMAP_SEARCH_ALL_TIMEOUT_MSNoOverall cross-folder-search deadline in milliseconds, including folder discovery.30000
IMAP_SEARCH_FOLDER_TIMEOUT_MSNoPer-folder cross-folder-search deadline in milliseconds.10000

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": true
}

Tools

Functions exposed to the LLM to take actions

NameDescription
imap_add_accountC

Add a new IMAP account configuration

imap_update_accountA

Update an existing IMAP account. Useful for fixing SMTP settings without removing and re-adding the account.

imap_list_accountsA

List all configured IMAP accounts

imap_remove_accountB

Remove an IMAP account configuration

imap_connectC

Connect to an IMAP account

imap_disconnectB

Disconnect from an IMAP account

imap_test_accountA

Test an existing account connection without re-entering credentials. Validates IMAP connectivity and returns folder count and message count.

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.

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.

imap_upload_fileA

Upload a file to the attachment root and return a path for imap_preview_send_email attachments. Preview the message, then use imap_confirm_send only after explicit user confirmation. This avoids putting large attachment bytes in the context window. Max size: 26214400 bytes (configurable via IMAP_MAX_UPLOAD_SIZE). Uploads are auto-deleted after 86400000 ms (configurable via IMAP_UPLOAD_TTL_MS).

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 and other files are saved only inside the configured download directory. Use when the user wants the actual file contents, not just the message body.

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

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.

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.

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.

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.

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.

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.

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.

imap_bulk_deleteB

Delete multiple emails at once with chunking and auto-reconnection. Processes deletions in batches to prevent connection timeouts.

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.

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.

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

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.

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.

imap_preview_send_emailA

Preview and freeze a new email without sending it. Confirm the returned draftId with imap_confirm_send.

imap_preview_reply_to_emailA

Preview and freeze a threaded reply without sending it. Confirm the returned draftId with imap_confirm_send.

imap_preview_forward_emailA

Preview and freeze a forward without sending it. Confirm the returned draftId with imap_confirm_send.

imap_confirm_sendA

Send a previously frozen safe-send draft exactly once.

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").

imap_folder_statusC

Get status information about a folder

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.

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.

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.

imap_delete_spamC

Find and delete emails from known spam/disposable email domains.

imap_domain_statsA

Get statistics about sender domains in a folder. Useful for identifying bulk senders or spam patterns.

imap_add_spam_domainA

Add a domain to the custom spam list. Emails from this domain will be flagged as spam.

imap_remove_spam_domainA

Remove a domain from the custom spam list.

imap_add_whitelist_domainA

Add a domain to the whitelist. Emails from whitelisted domains will never be flagged as spam.

imap_list_spam_domainsA

List all known spam domains (built-in and custom).

imap_delete_by_domainB

Delete all emails from a specific domain. Useful for cleaning up unwanted newsletters or spam.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription

No resources

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/SinoEdwards/mail-agent-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server