EN
Developer guide

IMAP MCP: connect any mailbox to your AI agent, hosted

Bring any IMAP mailbox into your AI agent without running a server or pasting your password into its config. Unipile hosts it, for coding agents and AI assistants.

Claude Codeclaude code · helpdesk-appDeveloper MCP Build

Show each customer's emails on their ticket.

unipileread endpointGET /v2/{account_id}/emailsschema loaded

Added the email thread to the ticket view.2 files changed · tested on the Development app

Unipile IMAPAny IMAP mailbox: OVH, Zoho, Fastmail or your own server
ChatGPTChatGPTUser MCP Use

What came in on the support inbox this morning?

IMAPIMAPsearch unread emails7 unread

Three need a reply: a refund on order 4821, a new delivery date and a supplier invoice.

Short answer

An IMAP MCP server turns a mailbox into tools an AI client can call: list folders, search, read and draft. Unipile hosts one, and the IMAP password never sits in the assistant's configuration.

This guide is about your own mailbox, the inbox you already use.

The basics

What is an IMAP MCP server?

An IMAP MCP server exposes a mailbox as tools that an AI client calls through the Model Context Protocol. The model picks a tool; the server talks IMAP to read and SMTP to send.

1 · MCP client AI client ClaudeChatGPT and CodexCursorGemini CLI Reads the request and picks a tool.
2 · MCP server Tools list folderssearchreaddraft Describes what the agent can do.
3 · Protocols IMAP and SMTP IMAPport 993 · SSL/TLS IMAP reads the mailbox, SMTP sends.
4 · Mailbox Any provider IMAP Folders and threads.

Tools, not raw IMAP commands

The server decides which actions exist and returns clean emails, not raw IMAP responses. A read-only server leaves out the tools that write.

Host, port and encryption

Every IMAP connection needs a host, a port and an encryption mode: the IMAP server connection guide lists them by provider.

Why IMAP

Why IMAP, when ChatGPT and Claude already connect Gmail and Outlook?

Built-in connectors cover Gmail and Microsoft 365. Mailboxes at OVH, Zoho, Fastmail, Yahoo, iCloud or on a company mail server only speak IMAP, so they need an IMAP MCP server.

Covered by built-in connectors
GmailGmailGoogle sign-in
OutlookOutlook and Microsoft 365Microsoft sign-in, sometimes admin approval
Needs IMAP
OVHZoho MailFastmailYahoo MailiCloud MailYour web hostCompany mail server

IMAPLinked once to Unipile with the IMAP form.

Gmail and Outlook too: same connection, same tools

Unipile links Gmail and Outlook through their own sign-in, IMAP mailboxes through the IMAP form, and the agent gets one set of email tools for all of them.

Compare

Local IMAP MCP servers vs a hosted MCP: what changes

Most open-source IMAP MCP servers run on your machine, with host, username and password (often an app-specific password) in their configuration. A hosted MCP keeps credentials server side and lets an admin share access.

Local serverOpen source, self-run User MCPYour inbox in an assistant Developer MCPBuild email into a product
Where it runsLocal serverOn your computer, started by the AI clientUser MCPHosted by UnipileDeveloper MCPHosted by Unipile
Where the mailbox password livesLocal serverIn the client config or environment variablesUser MCPEntered once in the Unipile connection formDeveloper MCPEntered by each user in Hosted Auth
Sign-in to the AI clientLocal serverNone, it reads its own configUser MCPOAuth per person and per client, up to 30 daysDeveloper MCPAccount API key for real requests
MailboxesLocal serverOften one per serverUser MCPEvery account in the person's ScopeDeveloper MCPEvery mailbox your users link
Team access and revocationLocal serverEach person installs and configures a copyUser MCPGranted by an Owner or Admin, revocableDeveloper MCPDecided by your product
Outlook after Basic AuthLocal serverPassword sign-in being retired by MicrosoftUser MCPMicrosoft sign-in, as an Outlook accountDeveloper MCPMicrosoft sign-in, as an Outlook account
SendingLocal serverVaries, many are read-onlyUser MCPReads, searches, drafts for your reviewDeveloper MCPFrom the user's own mailbox, through the API

One mailbox on your laptop? A local server can do. For a shared inbox, a team or a product, a hosted MCP keeps passwords out of every client. On Outlook and Basic Authentication, see the IMAP connection guide.

Unipile MCP

Two Unipile MCP servers for IMAP: one to build, one to use

The developer MCP helps a coding agent build IMAP features into your product. The user MCP brings an IMAP inbox into a person's AI assistant. Both reach the same connected mailboxes, which also work with the REST API.

Developer MCPFor developers building a product
Coding agentClaude Code, Cursor, Codex
API keyNone to read the docs
Hosted AuthIMAP settings detected
Your productCalls the REST API
User MCPFor people using an assistant
AI assistantChatGPT, Claude, Grok
OAuth sign-inNo password in the client
ScopeSet by an Owner or Admin
Your mailboxPersonal or shared
Unipile platform One API, the same connected mailboxes IMAPAny IMAP mailbox, with SMTP for sending
Build email into your product

Developer MCP

Your coding agent reads the API reference with no key and tests real requests with an Account API key. Users connect their mailbox through Hosted Auth, which detects IMAP and SMTP settings.

Use your own inbox

User MCP

An Owner or Admin grants MCP Access and picks the Scope, which can include a shared mailbox. Each person authorizes each assistant with OAuth, for up to 30 days.

Setup

How to connect an IMAP inbox, step by step

Three steps on each path: one ends in your product, the other in your assistant.

Building a productDeveloper MCP, then the REST API
  1. Get an API key

    In your Development application, create an Account API key for your test mailboxes.

    Development appAccount API key

  2. Add the developer MCP to your coding agent

    Paste the configuration from the documentation into Claude Code, Cursor, Codex or Gemini CLI. Command on the Claude Code setup page.

  3. Let your users connect their mailbox

    In Hosted Auth, users type an address and password; Unipile detects the settings or asks for host, port and encryption.

    IMAPSettings detectedaccount_id

Using your own inboxUser MCP in ChatGPT, Claude or Grok
  1. Connect the mailbox to Unipile once

    Link it in My MCP accounts with its address and password. The assistant never sees them.

    IMAPsupport@yourcompany.comIMAP

  2. An admin adds it to a Scope

    An Owner or Admin grants MCP Access and picks the accounts each person can use.

    MCP AccessScope: Support inbox

  3. Add Unipile to your assistant and approve

    Add Unipile as a custom connector and authorize it with OAuth. See ChatGPT and Claude.

    Authorize this clientup to 30 daysAuthorize

Two-factor authentication. Your provider may ask for an app password when you connect the mailbox to Unipile; it is entered once, never in your AI client.

Capabilities

What an AI agent can do in an IMAP inbox

Both MCP servers sit on the same Unipile email API. Each action runs on behalf of the authenticated user.

Feature familyWhat the agent can do
FoldersList folders and emails
SearchBy sender, subject or unread status
ThreadsRead full threads and their attachments
DraftsDraft replies for a person to review
SendingSend from the user's own mailbox, through the API

The full list lives on the Unipile IMAP API page; the IMAP API guide compares it with raw IMAP.

Developer MCP

In a coding agent: an IMAP inbox, built into your CRM

The agent reads the exact schema, tests on your Development app and writes the code.

Claude Codeclaude code · crm-app

Add an IMAP inbox to the contact page of our CRM.

unipilesearch endpoints"emails"4 matches

unipileread endpointGET /v2/{account_id}/emailsschema loaded

unipilerun requestGET /v2/{account_id}/emails/{email_id}200 OK

// src/email/inbox.ts
export async function listEmails(accountId, apiKey) {
  const res = await fetch(
    `https://api.unipile.com/v2/${accountId}/emails`,
    { headers: { 'X-API-KEY': apiKey } }
  );
  return res.json();
}

Added the contact's emails and a reply box.3 files changed · tested on the Development app

User MCP

What you can ask your assistant about your inbox

Pick a chat to see the request, the Unipile calls the assistant makes on your IMAP mailbox, and the answer. Replies stay drafts until you confirm.

ChatGPTChatGPT

New chat Recent

Sort the unread emails in the support inbox.

Unipile2 calls

  • IMAPIMAPsearch unread emails11 unread
  • IMAPIMAPread emails11 emails

The support inbox, sorted:

  • Urgent: Nora Fischer asks for a refund on order 4821.
  • To answer: four questions on delivery dates.
  • No action: six notifications and receipts.

Draft a reply to NoraGroup the delivery questions

Find the Brightline invoice from October.

Unipile2 calls

  • IMAPIMAPsearch by sender3 emails
  • IMAPIMAPread attachments1 PDF

Found in your Invoices folder:

Invoice_Brightline_October.pdfReceived on 3 November, due on 30 NovemberOpen

It is the only October invoice from Brightline.

Forward it to accountingAny other invoice due?

Draft a reply to Paul about his delivery date.

Unipile2 calls

  • IMAPIMAPread threadPaul Martin
  • IMAPIMAPcreate draftSaved in Drafts

Paul asks if his order can arrive before 5 December. The draft is in your Drafts folder:

IMAPDraft to Paul Martin

Hi Paul, yes, we can ship on 2 December so it arrives before the 5th. I will send the tracking link.

ReviewNot nowNothing is sent until you confirm.

Where are we with Halden? Read the whole thread.

Unipile2 calls

  • IMAPIMAPsearch by subjectHalden
  • IMAPIMAPread thread9 emails

The Halden thread, in short:

  • 3 Nov: they approved the proposal.
  • 10 Nov: their legal team asked to change clause 4.
  • 18 Nov: you sent the new version, no reply yet.

Draft a follow-upWho is in the thread?

What were the important emails this week?

Unipile2 calls

  • IMAPIMAPsearch emails146 emails
  • IMAPIMAPread emails9 kept

Three things mattered this week:

  • Halden sent back the contract with one change.
  • Brightline invoice due on 30 November.
  • Nora Fischer still waits for her refund.

Draft a reply to NoraSame recap every Friday

What is new in my Clients folder?

Unipile2 calls

  • IMAPIMAPlist folders14 folders
  • IMAPIMAPlist emails7 new in Clients

Seven new emails, one needs care: Verano says their order arrived late. An apology to review:

IMAPDraft to Verano

Hello, sorry for the late delivery. We have checked the shipment and your next order ships first.

ReviewNot nowNothing is sent until you confirm.

Ask anything

UnipileUnipile

Use it in your assistant

  1. 1An Owner or Admin gives you MCP Access and picks the accounts in your Scope.
  2. 2Link your mailbox once in Unipile.
  3. 3Add Unipile as a custom connector in ChatGPT or Claude and approve with OAuth.
Security

Is it safe to give an AI agent access to your mailbox?

It depends on what the agent can reach, how long it keeps access and where the password lives.

What the agent can reach

Only the accounts in the person's Scope, chosen by an Owner or Admin. A shared Scope also covers accounts added later.

Consent and revocation

Each assistant asks for its own consent, valid up to 30 days and revocable at any time in My MCP accounts.

Where credentials live

The IMAP password goes into the Unipile connection form, once. It never sits in the assistant, the coding agent or a local config file. See the User MCP docs.

Build any IMAP inbox into your product with an AI agent

Start with the developer MCP, then ship on the REST API. The same API covers Gmail, Outlook, LinkedIn, WhatsApp and more.

IMAP MCP: FAQ

Quick answers on email and IMAP MCP servers.

An email MCP server gives an AI client tools to work in a mailbox: list folders, search, read and draft. It works in your own inbox, the one you read every day. For IMAP, Unipile hosts one.

Not for Gmail or Microsoft 365 alone: ChatGPT and Claude have built-in connectors. You need an MCP server for IMAP mailboxes such as OVH, Zoho, Fastmail or a company mail server.

An official server comes from the company behind the service; a community server is an open-source project you run yourself. IMAP has no single owner, so IMAP MCP servers are community projects or hosted services such as Unipile.

The Unipile developer MCP works with Claude Code, Cursor, Codex and Gemini CLI. Setup is on the Claude Code page.

No. Unipile is not affiliated with, endorsed by, or sponsored by LinkedIn. It is an independent technical intermediary: every call runs on behalf of the authenticated user who linked their own account.

No. Unipile is an independent company, not a Meta Partner, and it is not endorsed, sponsored or approved by Meta. Facebook, Instagram and WhatsApp are trademarks of Meta Platforms, Inc.

Still have questions? Our team is here to help.

Talk to an expert