Skip to main content
Glama
Xallor Email MCP

Xallor Email MCP

Official
by xallor-ai

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-mcp

2. 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-mcp

3. 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/mcp

HTTP 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-mcp

Development

pnpm install
pnpm dev        # rebuild on save
pnpm dev:http   # HTTP on http://127.0.0.1:3000/mcp
pnpm test
pnpm typecheck
pnpm build

Configuration

Configuration is env-only. CLI flags only override transport, host, port, and data directory.

Env var

Purpose

Default

XALLOR_DATA_DIR

Account/token store

${XDG_DATA_HOME:-~/.local/share}/xallor-email-mcp

XALLOR_KEY

AES-256-GCM key (hex/base64) or passphrase

Auto-generated local key if unset

XALLOR_TRANSPORT

stdio or http

stdio (--http forces http)

XALLOR_HTTP_PORT

HTTP port

3000

XALLOR_HTTP_HOST

HTTP host

127.0.0.1

XALLOR_OUTLOOK_CLIENT_ID

Optional Entra public client ID

Built-in public client

XALLOR_OUTLOOK_TENANT_ID

Outlook tenant

common

XALLOR_GMAIL_CLIENT_ID

Optional Google OAuth client override

Built-in Desktop client

XALLOR_GMAIL_CLIENT_SECRET

Optional Google OAuth secret override

Built-in secret only for the built-in client ID

XALLOR_GMAIL_REDIRECT_URI

Hosted Gmail OAuth callback

Local loopback callback

XALLOR_TOOLS_ENABLED

Tool allowlist

Empty = no filtering

XALLOR_TOOLS_DISABLED

Tool blocklist

Empty = no filtering

XALLOR_DEBUG

Structured debug logs (1/true/yes/on/debug)

Off

Generate a key:

xallor-email-mcp generate-key

Tools

Most tools take an account argument (mailbox email). Omit account on search_emails / get_new_emails to work across all connected accounts.

Tool

Notes

list_accounts

Registered emails + provider metadata

add_account / complete_add_account

Provider onboarding (OAuth / device code / IMAP config)

remove_account

Delete stored credentials

get_account_settings / set_account_settings

Signature + style preferences

list_emails / search_emails / read_email / read_attachment

Browse and read

get_new_emails

Pull new inbox mail since last checkpoint

send_email / draft_email / edit_draft / send_draft

Compose (Markdown bodies)

archive_email / trash_email / move_email / mark_read / mark_unread

Organize

list_folders / create_folder / delete_folder / rename_folder

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

  1. add_account({ provider: "outlook" }) → device code + verification URL

  2. User completes sign-in in the browser

  3. Poll complete_add_account until status: "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).

  1. add_account({ provider: "gmail" }) → authorization URL

  2. User grants access in the browser

  3. Local installs can capture the loopback callback automatically; remote/hosted installs should paste the final redirect URL into complete_add_account as authorizationResponse

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_KEY and the data directory.

  • Use XALLOR_TOOLS_ENABLED / XALLOR_TOOLS_DISABLED to 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 handlers

License

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 tools
add_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

    A3.5/5.0

    Scored across 24 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count4/5

    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.

    Completeness4/5

    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

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to read, send, organize, and search emails across multiple IMAP/SMTP mailboxes.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to read, search, send, and manage emails via IMAP/SMTP with OAuth 2.1 authentication, supporting folders, drafts, replies, and forwarding.
      1
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables 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 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables 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 npm
      MIT