Xallor Email MCP
OfficialProvides tools to connect and manage Gmail/Google Workspace mailboxes via the Gmail API, including reading, searching, composing, replying, forwarding, organizing, managing folders, handling attachments, and account onboarding through Google OAuth.
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., "@Xallor Email MCP Search all my mailboxes for invoices from last month"
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.
Xallor Email MCP is an open-source Model Context Protocol server that lets AI agents manage Gmail, Outlook, Microsoft 365, and IMAP mailboxes through one unified tool surface. Connect personal and work accounts, then pass an email address — Xallor routes each request to the right provider.
Run it locally over stdio or self-host over Streamable HTTP. MIT licensed.
What can your agent do?
Read and find email — browse inboxes, search one or all connected accounts, read messages, and download attachments.
Write and reply — compose Markdown emails, reply to threads, forward messages, and create or edit drafts before sending.
Organize mailboxes — archive, trash, move messages, mark them read or unread, and manage folders.
Work across accounts — one tool surface for different providers, with per-account signatures and style preferences.
Check for new mail — poll for new inbox messages on your agent's schedule.
Related MCP server: yandex-mail-mcp
Supported mailboxes
Mailbox | Connection | Setup |
Gmail / Google Workspace | Gmail API with Google OAuth | Built-in Desktop client by default; custom OAuth clients remain optional. Gmail |
Outlook / Microsoft 365 | Microsoft Graph with device-code sign-in | Personal or work Microsoft account. Outlook |
IMAP mailboxes | IMAP for reading/managing; SMTP for sending | Provider IMAP/SMTP settings plus password or app password. IMAP |
Quick start
Requires Node.js 20+ and an MCP-compatible client.
1. Install
# from this repository (recommended while the npm name is settling)
npm install -g github:xallor-ai/email-mcp
xallor-email-mcp --help
# or once published
# npm install -g xallor-email-mcp2. Connect your agent
{
"mcpServers": {
"xallor-email": {
"command": "npx",
"args": ["-y", "github:xallor-ai/email-mcp"]
}
}
}Claude Code:
claude mcp add xallor-email -- npx -y github:xallor-ai/email-mcp3. Add a mailbox
Reload the MCP client, then ask:
Connect my Outlook account using Xallor Email MCP.
The agent calls add_account and walks you through sign-in. Add more accounts to the same server as needed.
4. Put it to work
Search all my connected mailboxes for invoices from last month.
Draft a reply from my work account. Save it for review; do not send it.
Move the selected messages to Receipts and mark them as read.
Configure your MCP client to require confirmation for sending or destructive actions.
Self-hosting
HTTP server
xallor-email-mcp --http --port 3847 --host 0.0.0.0
# endpoint: http://<host>:3847/mcpHTTP has no built-in authentication. Keep it on a private network or behind an authenticated reverse proxy. See docs/hosting.md.
Docker
docker build -t xallor-email-mcp .
docker run -d \
--name xallor-email-mcp \
-p 127.0.0.1:3847:3000 \
-e XALLOR_KEY \
-e XALLOR_OUTLOOK_CLIENT_ID \
-e XALLOR_OUTLOOK_TENANT_ID \
-v xallor-email-data:/var/lib/mcp \
xallor-email-mcpDevelopment
pnpm install
pnpm dev # rebuild on save
pnpm dev:http # HTTP on http://127.0.0.1:3000/mcp
pnpm test
pnpm typecheck
pnpm buildConfiguration
Configuration is env-only. CLI flags only override transport, host, port, and data directory.
Env var | Purpose | Default |
| Account/token store |
|
| AES-256-GCM key (hex/base64) or passphrase | Auto-generated local key if unset |
|
|
|
| HTTP port |
|
| HTTP host |
|
| Optional Entra public client ID | Built-in public client |
| Outlook tenant |
|
| Optional Google OAuth client override | Built-in Desktop client |
| Optional Google OAuth secret override | Built-in secret only for the built-in client ID |
| Hosted Gmail OAuth callback | Local loopback callback |
| Tool allowlist | Empty = no filtering |
| Tool blocklist | Empty = no filtering |
| Structured debug logs ( | Off |
Generate a key:
xallor-email-mcp generate-keyTools
Most tools take an account argument (mailbox email). Omit account on search_emails / get_new_emails to work across all connected accounts.
Tool | Notes |
| Registered emails + provider metadata |
| Provider onboarding (OAuth / device code / IMAP config) |
| Delete stored credentials |
| Signature + style preferences |
| Browse and read |
| Pull new inbox mail since last checkpoint |
| Compose (Markdown bodies) |
| Organize |
| Folders |
Pull new emails
get_new_emails replaces server-side push. Agents or harnesses call it on their own schedule (for example every 30–60 seconds). First call per account initializes the checkpoint and returns no messages. See examples/hermes.
Add-account flows
Outlook
add_account({ provider: "outlook" })→ device code + verification URLUser completes sign-in in the browser
Poll
complete_add_accountuntilstatus: "ready"
IMAP
Provide host/user/password (or app password) synchronously. If TCP/TLS succeeds but login fails, verify IMAP is enabled and credentials are correct.
Gmail
Gmail uses OAuth authorization-code flow (Google rejects device-code for Gmail scopes).
add_account({ provider: "gmail" })→ authorization URLUser grants access in the browser
Local installs can capture the loopback callback automatically; remote/hosted installs should paste the final redirect URL into
complete_add_accountasauthorizationResponse
For hosted HTTP, set your own Google Web client and XALLOR_GMAIL_REDIRECT_URI.
Security
Run locally or on infrastructure you control.
Account tokens/passwords are encrypted at rest with AES-256-GCM. Protect
XALLOR_KEYand the data directory.Use
XALLOR_TOOLS_ENABLED/XALLOR_TOOLS_DISABLEDto shrink the tool surface.HTTP mode is not authenticated — put it behind a reverse proxy for any shared network.
Project layout
src/
cli.ts # entry + arg parsing
server.ts # MCP server (stdio + HTTP)
config/ # env-only config loading
store/ # encrypted multi-account store
providers/ # gmail, outlook, imap backends
tools/ # MCP tool handlersLicense
This project is released under the MIT License. The LICENSE file retains the original copyright notice and full MIT text from Mateo Tiedra.
See also NOTICE for attribution.
This project incorporates code from Hypermail MCP, originally created by Mateo Tiedra and licensed under the MIT License.
Available Tools
24 toolsadd_accountA
Start adding an email account. For Outlook this returns a device code the user must enter at the verification URL; then call complete_add_account with the returned handle to finalize. For Gmail, share the authorization link AND explicitly ask the user to paste the full final redirected URL from the browser address bar after consent, even if the callback page fails to load. Do not just ask them to say when they are done. Pass that URL as authorizationResponse to complete_add_account with provider 'gmail' and the returned handle. Follow the returned verification.message instructions.
Inputs: provider (required), email, config. Returns: handle, status, account, verification
archive_emailA
Archive a message using the provider-native behavior: Gmail removes only the Inbox label (the message stays in All Mail); other providers use their archive folder. Returns webUrl, the shareable native web-client link for the post-operation message; it may be omitted with webUrlUnavailableReason.
Inputs: id (required), account (required). Returns: id, webUrl, archived, webUrlUnavailableReason
complete_add_accountA
Poll/finalize a pending add_account flow. For Outlook, poll after the user completes the device-code step. For Gmail, pass the full final redirected URL supplied by the user as authorizationResponse, with provider 'gmail' and the original handle; preserve all query parameters, including code and state. Polling without the URL only works if the server received the browser callback automatically. Returns ready when the account is persisted.
Inputs: handle (required), provider (required), code, state, +1 more. Returns: error, status, account
create_folderB
Create a new mail folder. Creates under the root folder by default, or under the specified parent when parentFolderId is provided.
Inputs: account (required), displayName (required), parentFolderId. Returns: folder, created
delete_folderC
Delete a mail folder by ID.
Inputs: account (required), folderId (required). Returns: id, deleted
draft_emailA
Create a draft email from the given account without sending it. Body content must be Markdown only, without raw HTML; use a blank line between paragraphs. Works identically to send_email — when include_signature is true, uses Gmail's signature first and local fallback only when Gmail returns none. Do not also include a signature in the body; fails if no signature exists or lookup fails. Applies style and supports replies and forwards — but saves the message to the Drafts folder instead of sending. Returns the draft message ID and the draft's Markdown body (draftMarkdown). Copy selections from this complete current body or read_email in Markdown. Explicit HTML remains available through read_email(format: 'html'). Returns the draft's shareable webUrl when available; recipients must have access to the mailbox to open it.
Inputs: to (required), body (required), account (required), subject (required), +7 more. Returns: id, draft, webUrl, warning, +3 more
edit_draftA
Edit an existing draft email by ID. Only the fields you provide are updated — unmentioned fields stay unchanged. Body edits work like an exact text edit: provide old_text copied from the current draft Markdown (draftMarkdown or a complete current read_email Markdown body) and new_text in Markdown only, without raw HTML, to replace that exact section. Use a blank line between paragraphs. The match must occur exactly once, and all unselected content — including reply/forward history — is preserved. Deprecated body is accepted only as an alias for new_text when old_text is also provided. Returns the draft ID and the draft's updated Markdown body (draftMarkdown). Does not support changing inReplyTo or forwardMessageId — those are set at creation time via draft_email. Returns the draft's shareable webUrl when available; recipients must have access to the mailbox to open it.
Inputs: id (required), account (required), cc, to, +8 more. Returns: id, edited, webUrl, attachments, +2 more
get_account_settingsB
Get the effective HTML signature and local style preferences. Gmail's signature takes precedence, with local fallback only when Gmail returns none; lookup failures return an error.
Inputs: account (required). Returns: style, signature
get_new_emailsA
Fetch a bounded batch of inbox emails not previously returned by this tool. Agents should call this on their own schedule. Bodies are returned as markdown and may be truncated. Each email may include webUrl, a user-shareable native-client link that requires mailbox access, or webUrlUnavailableReason when no link is available.
Inputs: limit, account. Returns: count, emails, errors
list_accountsA
List all email accounts known to this server (no secrets). Use the returned email value as the account argument to other tools. hasSignature reports only a locally stored custom signature; use get_account_settings for the effective signature.
Inputs: no named parameters. Returns: accounts
list_emailsB
List recent emails in a folder of the given account. Pass the user's email address as account; the server routes to the correct backend automatically. Each item may include webUrl, a user-shareable native-client link that requires mailbox access, or webUrlUnavailableReason when no link is available.
Inputs: account (required), skip, limit, folder, +1 more. Returns: skip, count, items, account, +1 more
list_foldersA
List available mail folders. Returns top-level folders by default, or child folders of the given parent when parentFolderId is provided.
Inputs: account (required), parentFolderId. Returns: count, items, account
mark_readC
Mark a message as read. Returns webUrl, the shareable native web-client link for the post-operation message; it may be omitted with webUrlUnavailableReason.
Inputs: id (required), account (required). Returns: id, isRead, marked, webUrl, +1 more
mark_unreadB
Mark a message as unread. Returns webUrl, the shareable native web-client link for the post-operation message; it may be omitted with webUrlUnavailableReason.
Inputs: id (required), account (required). Returns: id, isRead, marked, webUrl, +1 more
move_emailB
Move a message to any folder by well-known name (e.g. 'inbox', 'drafts', 'junkemail', 'sentitems', 'outbox') or custom folder ID. Returns webUrl, the shareable native web-client link for the post-operation message; it may be omitted with webUrlUnavailableReason.
Inputs: id (required), account (required), destination (required). Returns: id, moved, webUrl, destination, +1 more
read_attachmentA
Download an email attachment to a temporary file and return its path. Use messageId and attachmentId from a prior read_email call. The response may include the parent message's webUrl, a user-shareable native-client link that requires mailbox access, or webUrlUnavailableReason when no link is available.
Inputs: account (required), messageId (required), attachmentId (required). Returns: name, path, webUrl, contentType, +1 more
read_emailA
Fetch a single email with full body and recipients by id. Body is returned as body with bodyFormat indicating the format. Default format is 'markdown' — HTML is automatically converted to save context tokens. The response may include webUrl, a user-shareable native-client link that requires mailbox access, or webUrlUnavailableReason when no link is available.
Inputs: id (required), account (required), format. Returns: cc, id, to, bcc, +12 more
remove_accountC
Forget an account and delete its stored tokens.
Inputs: email (required). Returns: email, removed
rename_folderC
Rename an existing mail folder.
Inputs: account (required), newName (required), folderId (required). Returns: folder, renamed
search_emailsA
Search emails using optional free text and address filters. cc searches both CC and BCC. Supplied criteria are combined with AND. Pass account to search one account, or omit it to search all registered accounts in parallel. Each item may include webUrl, a user-shareable native-client link that requires mailbox access, or webUrlUnavailableReason when no link is available.
Inputs: cc, to, from, limit, +2 more. Returns: count, items, errors, account, +1 more
send_draftA
Send an existing draft email by ID. Use this with draft IDs returned by draft_email or edit_draft. Returns the resulting message's shareable webUrl when available; recipients must have access to the mailbox to open it.
Inputs: id (required), account (required). Returns: id, sent, webUrl, webUrlUnavailableReason
send_emailA
Send an email from the given account using Markdown only; raw HTML is not supported. Use a blank line between paragraphs. Applies account style preferences and appends Gmail's signature first, falling back to the local signature only when Gmail returns none, when include_signature is true. Do not also include a signature in the body. Fails if no signature exists or lookup fails. When inReplyTo is set, sends as a reply (or reply-all) which preserves thread history and conversation threading. When forwardMessageId is set, sends as a forward of the specified message, preserving the original content. inReplyTo and forwardMessageId are mutually exclusive. Returns the resulting message's shareable webUrl when available; recipients must have access to the mailbox to open it.
Inputs: to (required), body (required), account (required), subject (required), +7 more. Returns: id, sent, webUrl, webUrlUnavailableReason
set_account_settingsA
Set local signature (HTML snippet) and/or style preferences for an account. For Gmail, the local signature is fallback only when Gmail returns none. Returns the saved local signature, not Gmail's signature. Clearing local does not clear Gmail; use include_signature: false to omit either source. Use signaturePath to load a signature from a file (useful for signatures with base64 images). signature and signaturePath are mutually exclusive.
Inputs: account (required), style, signature, signaturePath. Returns: style, signature
trash_emailC
Move a message to the Deleted Items (trash) folder. Returns webUrl, the shareable native web-client link for the post-operation message; it may be omitted with webUrlUnavailableReason.
Inputs: id (required), account (required). Returns: id, webUrl, trashed, webUrlUnavailableReason
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 24 tools
Most tools have clearly distinct resource+action targets (folders, accounts, drafts, message actions). The main mild overlap is the read-side trio list_emails / get_new_emails / search_emails, where the boundaries are semantic (all vs unseen vs filtered) rather than structural, but descriptions make the intent clear enough.
All 24 tools follow snake_case verb_noun form (list_accounts, create_folder, send_email, mark_read, edit_draft). No camelCase or stylistic mixing; even the draft family (draft_email, edit_draft, send_draft) reads consistently as verb+object.
24 tools sits at the heavy end of the range, but the email domain genuinely branches into accounts, folders, reading, composition, and message actions, and each tool maps to a real distinct operation. Slightly over what an agent can scan comfortably, but nothing appears redundant.
Coverage is broad: account lifecycle (add/list/remove/settings), folder CRUD, read/search/list, compose/draft/edit/send, plus archive/trash/move/mark actions and attachment download. Minor gaps exist — no way to attach files when sending, no permanent delete/purge, and no thread-level view — but agents can work around these for most workflows.
Maintenance
Related MCP Connectors
Email for AI agents: read, search and send from your Gmail, Outlook, Yahoo, iCloud or IMAP inbox.
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
- MyAgentMailDeprecatedcom.myagentmail
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Email inboxes for AI agents: read, search, reply, send, bulk send and read attachments.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to read, send, organize, and search emails across multiple IMAP/SMTP mailboxes.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to read, search, send, and manage emails via IMAP/SMTP with OAuth 2.1 authentication, supporting folders, drafts, replies, and forwarding.1MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to work with multiple email accounts over IMAP and SMTP: search, read, send, reply, forward, move, mark, and bulk-delete messages, plus list folders and check unread counts. Credentials are stored with AES-256 encryption and connections are pooled, with auto-configured settings for Gmail, Outlook, Yahoo, and other providers.819 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.819 npmMIT