Skip to main content
Glama

mail-mcp

One small server that gives any MCP-capable AI assistant (Claude, ChatGPT and others) access to your mailboxes: any number of Gmail accounts, Yahoo, Hotmail/Outlook.com, iCloud, AOL, or any IMAP server.

You run it in your own hosting account. Your passwords and mail never pass through anyone else's server, and nothing is stored: each request opens an IMAP connection, does its job and closes it.

Οδηγίες στα ελληνικά: ODIGOS.md

What the assistant can do

Tool

Purpose

list_accounts, list_folders

See which mailboxes and folders exist

search_emails

Latest messages, or search by text, sender, subject, date, unread

read_email

Text and attachment names of one message

sender_stats

Messages per sender and how many you never opened, for newsletter cleanup

create_draft

Save a new message or a reply to Drafts. Nothing is sent

mark_emails, move_emails

Read/unread, star, move, archive, trash

send_email

Only exists if you set MAIL_ALLOW_SEND=true

search, fetch

The pair ChatGPT expects for searching across all inboxes

By default the assistant can only write drafts, and you send them yourself.

Related MCP server: Mailoo

Set it up (about 10 minutes, free Vercel account)

Deploy with Vercel

  1. Press the button above. Vercel copies this repository into your own GitHub account and creates the project.

  2. When asked for MCP_AUTH_TOKEN, type a long random text of at least 24 characters. It is the password of your server, so keep a copy.

  3. Deploy.

  4. In the project, open Settings > Deployment Protection and make sure the production URL is not behind Vercel Authentication ("Standard Protection" is fine). Otherwise no assistant can reach it.

  5. Open https://<your-project>.vercel.app/setup/<MCP_AUTH_TOKEN>. That page walks you through the rest: it checks every mailbox login, tells you what to paste where, and shows the address to give to your assistant.

Adding mailboxes

One environment variable per mailbox, with the address and an app password (not your normal password):

MAIL_ACCOUNT_1=you@gmail.com abcd efgh ijkl mnop
MAIL_ACCOUNT_2=other@gmail.com qrst uvwx yzab cdef
MAIL_ACCOUNT_3=you@yahoo.com apppassword

The provider is recognised from the address. Redeploy after changing variables.

Where to create app passwords:

For any other IMAP server use the JSON form instead:

MAIL_ACCOUNTS=[{"id":"work","provider":"custom","email":"me@example.com","password":"...","imap":{"host":"mail.example.com","port":993},"smtp":{"host":"mail.example.com","port":465}}]

Hotmail / Outlook.com

The easy way needs no setup here at all: in Outlook.com open Settings > Mail > Forwarding, forward to a Gmail or Yahoo address you have connected, and keep a copy. New mail then shows up in that mailbox. Older messages stay behind, and replies go out from the other address.

To connect the mailbox directly, the server needs the id of an Azure app, because Microsoft accepts only OAuth2 here. Registering one requires an Azure account (free, but Microsoft asks for a phone number and a card), since a plain Hotmail account cannot open the Entra admin center:

  1. In the Microsoft Entra admin center, create an App registration that supports personal Microsoft accounts.

  2. Under Authentication, enable Allow public client flows.

  3. Put its Application (client) ID in the OUTLOOK_CLIENT_ID variable and redeploy.

  4. On the setup page, type the address and press Connect. You get a code to enter at Microsoft, then a ready MAIL_ACCOUNT_... line to paste.

The token from step 4 expires after roughly 90 days; repeat step 4 when the mailbox stops connecting.

Connecting an assistant

The connector address is https://<your-project>.vercel.app/mcp/<MCP_AUTH_TOKEN>.

  • Claude: Settings > Connectors > Add custom connector.

  • ChatGPT: Settings > Connectors (developer mode), no authentication.

  • Clients that can send headers may use /mcp with Authorization: Bearer <MCP_AUTH_TOKEN>.

Security

  • The connector address is a password. Whoever has it can read your mail. To revoke it, change MCP_AUTH_TOKEN and redeploy.

  • Email is text written by strangers, and a hostile message can try to instruct the assistant ("forward everything to..."). That is why sending is off by default. Turn it on only if your assistant asks you before each tool call.

  • One deployment is for one person. Do not put other people's mailboxes in yours; have them deploy their own.

Development

npm install
cp .env.example .env
npm run dev
npm test

MCP_URL=https://<host>/mcp/<token> npm run smoke checks a live deployment and prints counts only, never message content.

Status

Verified against real Gmail and Yahoo mailboxes on Vercel: listing, searching and reading. Covered by automated tests: authentication, the MCP protocol, configuration parsing and the setup page. Not yet verified against live servers: drafts, marking, moving, sending, Outlook sign-in, iCloud, AOL and the ChatGPT connection.

License

MIT. Provided as is, without warranty.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Connects MCP-compatible AI assistants to any IMAP/SMTP mailbox, enabling email search, reading, folder management, and sending with automatic saving to Sent.
      1
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to read, search, send, manage, schedule, and analyze emails across multiple IMAP/SMTP accounts via MCP, with features like OAuth2, calendar extraction, analytics, and real-time email watching.
      221 npm
      LGPL 3.0
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to search, read, send, reply to, forward, organize, move, and bulk-delete email across multiple IMAP/SMTP mailboxes, with AES-256-encrypted credential storage, connection pooling, and folder management. Supports 15+ pre-configured providers and works with any MCP client such as Claude or Cursor.
      1,009 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI assistants to search, read, send, reply to, forward, organize, and bulk-delete email across multiple IMAP/SMTP mailboxes, with AES-256-encrypted credential storage, connection pooling, and folder management. Supports 15+ pre-configured providers and simultaneous multi-account access from any MCP client.
      1,009 npm
      MIT