MCP Server for Mac Email: Local IMAP Setup for Claude Desktop
Fix the get_email_attachment "not found" MCP error on Mac, or connect Claude Desktop to your mail through Mailloft's local IMAP MCP server.
TroubleshootingUpdated 7 min read
On this page
You asked Claude (or Cursor, or another AI app) to read an email attachment through an Apple Mail MCP server, and it came back with this:
Error calling tool 'get_email_attachment': Attachment 'GCEMEARSD0000290714-2.pdf' not found in email 437629.Your own file name and email ID will differ. This article covers a quick workaround, why this kind of error happens, and how to set up a local MCP mail server that doesn't depend on Mail.app.
Why the error happens
The message says the server found email 437629 but could not find an attachment with that name inside it. We can't see inside someone else's server, so we can't tell you which bug caused yours. These are the likely causes, most common first:
- The server scripts Mail.app. Apple Mail MCP servers of this kind drive Mail through AppleScript, so they depend on what Mail.app returns for a given message. If Mail reports a different attachment name or index than the server expects, the lookup fails.
- The email ID doesn't match the message you mean. An ID the AI app remembers from an earlier search may no longer point at the same message.
- The AI app passes a stale or wrong attachment name. Models sometimes reuse a name from an earlier listing.
We don't know which of these applies to you. All three share one root: a script layer sits between your AI app and your mail.
Work around the error today
- Open the message in your mail app and save the attachment to a folder such as Downloads.
- Give that file to your AI app using its own file attachment or file access feature.
- Ask the AI app to work from the file and the message text instead of calling the attachment tool again.
This skips the tool, so it works with any server.
Report the bug
If you want the server fixed, file a report with its developer. Include:
- The full error text, with your own attachment name and email ID.
- Your macOS version and the version of the MCP server.
- The AI app you used (Claude Desktop, Claude Code, Cursor and so on).
- The mail provider the message came from, and whether the mailbox is very large.
Use a local MCP server over IMAP instead
Mailloft is a native Mac mail client with its own IMAP and SMTP stack. Its MCP server is part of the app, so there is no AppleScript layer. It is off by default. The AI app connects through a Unix socket at ~/Library/Application Support/Mailloft/mcp.sock, which only your user account can use. There is no network listener.
Before you start
- Add a mail account to Mailloft over IMAP (see Add an email account to Mailloft).
- Gmail, iCloud, Fastmail and Yahoo sign in with an app password (how to create one). Mailloft has no Google sign-in.
- For Outlook and Microsoft 365, read Outlook, Hotmail and Microsoft 365 accounts in Mailloft first.
- Move Mailloft to your Applications folder before copying the setup text, so the path in it stays valid.
Set it up
- Open Mailloft and press ⌘, to open Settings.
- Choose AI.
- Under AI Apps, turn on Let AI apps use your mail.
- Under Connect an app, click Copy Setup for Claude Desktop, Claude Code, Cursor, VS Code, Codex CLI or Gemini CLI.
- Paste the text into the file Mailloft names for that app, then restart the app.
- When the AI app connects for the first time, Mailloft asks Allow or Don't Allow. Choose Allow only for apps you recognize.
If the AI app launches the server while Mailloft is closed, Mailloft starts in the background.
What the AI app can do
| Tool | What it does | Default |
|---|---|---|
list_mailboxes | Lists mailboxes | On with the server |
list_messages | Lists messages | On with the server |
search_messages | Searches mail | On with the server |
get_thread | Reads a conversation | On with the server |
create_draft | Creates a draft | Off until you tick it |
archive | Archives messages | Off until you tick it |
move | Moves messages | Off until you tick it |
flag | Flags messages | Off until you tick it |
mark_read | Marks messages read | Off until you tick it |
send_draft | Sends a draft | Always asks you first |
Other controls in the same pane:
- Accounts: per-account inclusion toggles choose which of your Mailloft accounts the server exposes.
- Apps: each connected app has an Allowed setting and a Forget button.
- Tools: each tool has its own toggle.
- Sending:
send_draftalways opens a floating panel in Mailloft for your approval, then goes through the Outbox, so Undo Send applies. Only drafts made bycreate_draftcan be sent. - Limits: Junk and Trash are never exposed. A request covering more than 25 conversations asks you first.
- Codes and links: one-time codes and sign-in links are hidden from the AI app, which sees "[code hidden]".
- Activity log: Activity… lists what the AI app did, with Undo for changes.
About attachments
Mailloft's tool list has no attachment-download tool, so there is no equivalent of get_email_attachment. Handle attachments in Mailloft itself. Click one or press Space to Quick Look it, drag it to Finder, or use Save… or Save All… from its context menu. Then give the file to your AI app, the same workaround as above.
If the MCP server doesn't connect
| Symptom | Cause | Fix |
|---|---|---|
| "Mailloft isn't reachable…" | The switch is off | Turn on Let AI apps use your mail |
| The AI app can't start the server | Mailloft moved after you copied the setup text | Move it to Applications, click Copy Setup again, paste, restart the AI app |
| Calls are refused | The license is locked (trial over) | Choose Enter License… from the Mailloft app menu |
| A change tool does nothing | Change tools are off by default | Tick create_draft, archive, move, flag or mark_read under AI Apps |
send_draft fails | Draft wasn't made by create_draft, or the panel wasn't approved | Let the AI app create the draft, then approve the floating panel |
| Mail is missing | Account not included, or the mail is in Junk or Trash | Check the per-account toggles |
| "[code hidden]" | Deliberate | Open the message in Mailloft and press ⇧⌘C to Copy Code |
The full text of the first message is: "Mailloft isn't reachable. Open Mailloft and turn on Settings ▸ AI ▸ Let AI apps use your mail."
Checklist before you try again
- Mailloft is in Applications.
- Let AI apps use your mail is on.
- You pasted a fresh Copy Setup text and restarted the AI app.
- You clicked Allow when Mailloft asked about the app.
- The 7-day trial hasn't ended, or a license is entered.
- The account you want is included, and the tool you need is ticked.
If nothing works
For a third-party server, contact its developer. For Mailloft, use macsuite.app/support and also see Troubleshoot Mailloft. Include your macOS version, the AI app you connected, the exact message you saw, the time it happened, and the steps above you already tried.
Subject: Mailloft MCP server not connecting to Claude Desktop
macOS version:
AI app and version: Claude Desktop
Mailloft version (About Mailloft):
Setup: Settings > AI > AI Apps > Copy Setup, pasted and app restarted
Exact message or error:
Time it happened:
Already tried: moved Mailloft to Applications, re-copied setup, restarted the AI appWhen a Mail.app-based server is enough
If you only need to read and search mail you already keep in Apple Mail, a Mail.app-based MCP server may do the job and you don't have to change mail apps. Mailloft makes sense if you are willing to read your mail in it. It is IMAP and SMTP only, has no iPhone app, and doesn't sync Screener decisions or settings between Macs.
Mailloft is part of MacSuite. As of November 2026 the suite costs $349 one time, and you can try it free for 7 days. More on the AI features is in TL;DR, Rewrite, Translate and AI apps over MCP.
Common questions
Does the AI app send my email to a cloud service?
That depends on the AI app. Mailloft's socket only connects the two apps on your Mac, but the AI app passes what it reads to its own model. With a cloud model, that text goes to that provider.
Can the AI app send email without asking me?
No. send_draft always opens a floating approval panel in Mailloft, and the message then goes through the Outbox, so Undo Send applies. It can only send drafts that create_draft made.
Can I stop a single tool, like archive?
Yes. Each tool has its own toggle, and the change tools are off until you tick them. You can also turn off accounts or use Forget to revoke an app.
Can I undo something the AI app changed?
Open Activity… in the AI Apps pane. It logs what the AI app did and offers Undo for changes.