Blog

IMAP MCP server for Claude, ChatGPT and Cursor

Connect iCloud, Yahoo, Fastmail, Zoho, Exchange, or any other IMAP mailbox to an AI agent over MCP, with the server settings and app passwords each provider needs.

Richard Chu

Fluxmail Founder

5 min read

Paper envelopes of different sizes connected by threads to one glowing hub

Claude and ChatGPT have built-in connectors for Gmail and Microsoft 365. Most other mail providers don't have one, but nearly all of them support IMAP for reading mail and SMTP for sending it. An IMAP MCP server connects to your mailbox over those protocols and gives an AI agent tools to search, read, and organize mail and to write drafts.

Fluxmail is one. It connects IMAP mailboxes alongside Gmail and Outlook, and agents use the same tools and permission settings for all of them. Fluxmail Cloud is a hosted server at https://cloud.fluxmail.ai/mcp, and it's in Claude's connector directory. Self-hosted Fluxmail runs on your computer or in Docker and keeps your mailbox password there.

What you need

  • Your email address. Most providers use it as the IMAP and SMTP username.
  • An app password. iCloud, Yahoo, and Fastmail don't accept your regular password over IMAP, and Zoho needs an app password if you use two-factor sign-in. Each lets you create a separate password for one app, which you can revoke without changing your main one.
  • The server names and ports. Your provider's help pages list them. IMAP almost always runs on port 993 with TLS. SMTP uses port 465 with TLS or port 587 with STARTTLS.

Settings for common providers

Provider IMAP server SMTP server Guide
iCloud Mail imap.mail.me.com smtp.mail.me.com, port 587 Connect iCloud Mail
Yahoo Mail imap.mail.yahoo.com smtp.mail.yahoo.com, port 465 Connect Yahoo Mail
Fastmail imap.fastmail.com smtp.fastmail.com, port 465 Connect Fastmail
Zoho Mail imap.zoho.com or imappro.zoho.com smtp.zoho.com or smtppro.zoho.com, port 465 Connect Zoho Mail
Proton Mail 127.0.0.1, port 1143, through Proton Mail Bridge 127.0.0.1, port 1025 Connect Proton Mail
Exchange Server Set by your administrator Usually port 587 Connect on-premises Exchange

For a mailbox at a web host or on your own server, look up the settings in your host's help pages or in the account settings of a mail app you already use.

Connect with Fluxmail Cloud

  1. Sign up for Fluxmail Cloud. A new workspace gets a seven-day trial, and you don't need a card to start it.
  2. Open Mailboxes and choose Other email provider.
  3. Enter your address and app password. For iCloud, Yahoo, and Fastmail addresses, the dashboard fills in the servers. For anything else, enter them yourself and pick the port for each.
  4. Select Connect. Cloud tests both connections before it saves the mailbox and stores the password encrypted.

Add as many mailboxes as your plan allows. Then connect your client:

  • Claude: open Customize > Connectors, select Discover, search for Fluxmail, and select +. Pick the mailboxes and permissions you want on the consent screen.
  • ChatGPT, Cursor, Claude Code, and Codex: How to connect Gmail or Outlook to Claude, ChatGPT and Cursor has the steps for each. They are the same for IMAP mailboxes.

Cloud connects to your mail server over the internet. If your server is reachable only inside your company network or over a VPN, use self-hosted Fluxmail on a machine inside that network. The same goes for Proton Mail, whose Bridge app serves mail only to the computer it runs on.

Or run Fluxmail yourself

Install the CLI and create the local administrator:

npm install -g fluxmail
fluxmail setup --name "Your name" --email you@example.com

Connect a mailbox with its server names:

fluxmail accounts add imap \
  --email you@example.com \
  --imap-host imap.example.com \
  --smtp-host smtp.example.com

Fluxmail defaults to IMAP over TLS on port 993 and SMTP with STARTTLS on port 587, and it uses the email address as the username. For SMTP on port 465, add --smtp-port 465 --smtp-security tls. Use --imap-user and --smtp-user if your username isn't your address. Fluxmail asks for the password without showing it, tests both connections, and encrypts the password in its local database. Run the command again for each mailbox.

Then add Fluxmail to your agent. For Claude Code and Codex, start with read-only access:

claude mcp add fluxmail -- fluxmail stdio --profile read-only
codex mcp add fluxmail -- fluxmail stdio --profile read-only

Connect an MCP client covers Claude Desktop, Cursor, and clients that connect over HTTP. Connect IMAP/SMTP lists every option, including scripted setup and Docker.

What an agent can do over IMAP

With Fluxmail, an agent can search and read mail, download attachments, follow threads, write and update drafts, move messages between folders, archive and trash them, and mark them read or unread. If you allow sending, it can send, reply, and forward.

A few things depend on IMAP itself:

  • Folders, not labels. Each message lives in one folder. Ask the agent to move messages rather than label them.
  • Threads come from headers. Fluxmail groups replies into threads from the headers mail apps add, so mail from an app that leaves them out may not thread.
  • Search runs on your provider's server. Results depend on what that server indexes, and a narrow search by date or sender comes back faster than a broad one.
  • Mail only. IMAP doesn't carry calendars or contacts.

Set permissions

In Cloud, the consent screen offers Read only, Read and write, and Full mail access, which adds sending, and you choose which mailboxes each connection can reach. In self-hosted Fluxmail, the read-only, read-write, and full profiles do the same. Start with read-only. Move to read and write when you want drafts, and allow sending only for a workflow that needs it. How to give an AI agent access to your email safely goes through each setting.

If something looks off

  • The login is rejected. Most providers require an app password over IMAP. Check that IMAP is turned on, since some providers, including Zoho, have it off by default.
  • The connection fails right away. Check that the port and security match: 993 with TLS for IMAP, and 465 with TLS or 587 with STARTTLS for SMTP. Cloud also rejects servers that only support TLS versions older than 1.2. Ask your provider to turn on TLS 1.2 or later.
  • A folder is missing. Fluxmail finds Sent, Drafts, Trash, Archive, and Spam from the flags the server reports, then by common names. If it can't find one, set the folder by name under Folder mappings in Cloud, or with fluxmail accounts configure <account-id> in self-hosted Fluxmail.
  • Sent messages appear twice. Some servers save their own copy of mail sent over SMTP. Connect the mailbox again with Save sent mail to the Sent folder turned off in Cloud, or add --no-save-sent to the fluxmail accounts add imap command.

Next steps

Try Fluxmail Cloud

Connect your AI agent to your Gmail, Outlook, or IMAP email accounts.