Email Agent Mcp

by UseJunior

3 stars
467 downloads
Not rated
GitHub

About

Local email connectivity for AI agents — read, draft, send, and organize Outlook mail via MCP. Apache-2.0 licensed.

Details

Author
UseJunior
GitHub stars
3
Downloads
467
Categories
Communication, Other, Automation, Productivity, AI

- 15 MCP tools for reading, writing, and managing email
- Send allowlist empty by default; agents cannot send until configured
- Delete disabled by default; requires explicit operator opt-in
- Error sanitization that strips API keys, file paths, and stack traces
- Body file sandboxing with path traversal protection
- Outbound attachments via file path or inline base64 (25 MB cap)

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Email Agent Mcp
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Run npx -y email-agent-mcp to start the interactive setup wizard, which walks you through OAuth configuration and mailbox selection. Then add the server to your MCP client’s settings (e.g., Claude Code settings.json, Cursor .cursor/mcp.json, or Gemini CLI). For OpenClaw, configure an mcp block in ~/.openclaw/openclaw.json. An optional email watcher polls your mailbox and sends wake signals to OpenClaw when new email arrives.

list_emails

List recent emails with filtering by unread status, folder, sender, and limit. Use offset for pagination. A row with `isDraft: true` is an unsent draft — it has NOT been sent, and its `receivedAt` is provider-supplied metadata, not evidence of delivery. Never describe such a row as a sent, delivered, or received email.

read_email

Read the full content of an email by ID, transformed to token-efficient markdown. When the response has `isDraft: true` the message is an unsent draft — it has NOT been sent, and `receivedAt` is provider-supplied metadata, not evidence of delivery; never describe it as a sent, delivered, or received email. Set format to 'html' to get the raw body HTML instead of markdown — use this when you need to preserve inline styling (colour, background-colour, underline, strikethrough) that the markdown conversion discards, e.g. to change one sentence of a formatted body and leave the rest alone. Raw HTML costs far more tokens than markdown, so leave the default alone unless you need the styling; check `bodyFormat` (`text` means the message had no HTML part, so do not send it as HTML) before writing a body back, and never write one back with `bodyTruncated: true` — you do not have the whole body. strip_quoted_history and strip_signatures are markdown-shaped text transforms and are NOT applied when format is 'html'; the HTML is returned verbatim. To write it back, call create_draft/update_draft with format: 'html' AND force_black: false — force_black defaults to true and wraps your HTML in a force-black div, so leaving it on nests another wrapper on every round trip. Set strip_quoted_history to true to drop the terminal "On … wrote:" / Outlook-header / `>`-prefix reply chain and replace it with a short marker. Set strip_signatures to true to remove detected signatures and legal disclaimers; it defaults to false here for MCP compatibility even though the core action defaults to true.

search_emails

Search emails using full-text query across one or all mailboxes. Use offset for pagination. Results include unsent drafts: a row with `isDraft: true` has NOT been sent — its `receivedAt` is provider-supplied metadata, not evidence of delivery. Never describe such a row as a sent, delivered, or received email.

get_mailbox_status

Get mailbox connection status, unread count, and warnings

list_mailboxes

List every configured mailbox: its logical `name` (pass this as the `mailbox` argument to other tools), its `emailAddress`, provider, connection status, and which one is the default. Reports mailboxes that failed to authenticate too, so it stays useful for diagnosing a broken setup.

get_thread

Retrieve all messages in a conversation thread by message ID. A thread can end with an unsent draft reply: a message with `isDraft: true` has NOT been sent, so it is not a sent reply — though earlier sent replies from the same author may exist elsewhere in the thread. Never describe such a message as a sent, delivered, or received email.

send_email

Compose and send a new email. Gated by send allowlist. Draft mode bypasses allowlist. If a send fails with SEND_STATUS_UNKNOWN, the message may already have been delivered; do not resend without checking Sent Items.

reply_to_email

Reply to an email within an existing thread. Default reply_all=true cc's the original thread; pass reply_all=false to reply only to the sender. Send path validates all effective recipients against the send allowlist; draft path bypasses. If a send fails with SEND_STATUS_UNKNOWN, the message may already have been delivered; do not resend without checking Sent Items.

create_draft

Create an email draft. Supports body_file with YAML frontmatter. Use reply_to for threaded reply drafts, where to and subject are derived from the parent message and may be omitted; pass reply_all=false with reply_to to draft a sender-only reply.

send_draft

Send a previously created draft. Enforces send allowlist before sending. Rate-limited. If a send fails with SEND_STATUS_UNKNOWN, the message may already have been delivered; do not resend without checking Sent Items.

update_draft

Update a draft email. Body edits are refused for reply drafts; non-reply body edits require replace_body=true and replace the body wholesale. Subject, recipients, and attachments remain editable. Allowlist is enforced at send_draft time, not here.

cancel_scheduled_send

Cancel a pending provider-held scheduled send. Only verified scheduled drafts can be cancelled.

list_scheduled_sends

List pending provider-held scheduled sends for a mailbox

list_attachments

List attachments for a specific email message

download_attachment

Download a single attachment as inline base64. Default max_size_mb=5 (hard ceiling 25). File attachments only — Microsoft item/reference attachments return NOT_SUPPORTED.

label_email

Apply labels or categories to one or more emails

flag_email

Flag or unflag an email as important/starred

mark_read

Mark an email as read or unread

delete_email

Delete an email (disabled by default, requires explicit configuration)

move_to_folder

Move an email to a specific folder (inbox, archive, trash, etc.). Returns the new message ID since Graph assigns a new ID after moving.

list_folders

Recursively list mail folders, including computed paths for nested folders

create_folder

Create a custom child mail folder (defaults to a child of Inbox)

delete_folder

Delete a custom mail folder, including any mail it contains (disabled by default, requires explicit configuration). Well-known/system folders are protected.

list_inbox_rules

List server-side inbox rules with all fields reported by the provider

create_inbox_rule

Create a persistent server-side inbox rule using safe actions only; forwarding, redirection, and deletion are blocked. Confirm with the user before calling — this creates a rule that keeps acting on the mailbox 24/7 after the session ends.

delete_inbox_rule

Delete a server-side inbox rule by id (disabled by default, requires explicit configuration). Removing a rule can silently re-expose the mailbox to mail the rule was filtering.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "email agent mcp": {
            "email-agent-mcp": {
                "command": "npx",
                "args": [
                    "-y",
                    "email-agent-mcp"
                ]
            }
        }
    }
}

McpServers

{
    "email-agent-mcp": {
        "command": "npx",
        "args": [
            "-y",
            "email-agent-mcp"
        ]
    }
}

BYOK: hand the credentials to email-agent-mcp

npx email-agent-mcp configure \ --provider gmail \ --mailbox personal \ --client-id YOUR_GOOGLE_CLIENT_ID \ --client-secret YOUR_GOOGLE_CLIENT_SECRET

Or set the two namespaced environment variables and omit the flags:

export AGENT_EMAIL_GMAIL_CLIENT_ID=YOUR_GOOGLE_CLIENT_ID export AGENT_EMAIL_GMAIL_CLIENT_SECRET=YOUR_GOOGLE_CLIENT_SECRET npx email-agent-mcp configure --provider gmail --mailbox personal

Both halves are required. Supplying only one exits with an error rather than silently falling back to the default client. Supplying neither selects the default OAuth client.

Your browser opens Google's consent screen, the CLI catches the callback on loopback, exchanges the code with PKCE, and writes the mailbox to~/.email-agent-mcp/tokens/<safe-key>.jsonwith"source": "byok"alongside yourclientId,clientSecret, and the resultingrefreshToken. Token refreshes then go straight to Google's token endpoint; no broker is involved.](https://console.cloud.google.com/projectcreate)

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.