# mcp4mail [Health: Active]

**Category:** 💬 Communication  
**Repository:** https://github.com/jchsoft/mcp4mail  
**GitHub Stars:** 0  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp4mail

## Description
Your IMAP mailbox as an MCP server: read, search and (if you allow it) organize mail. Open source.

## Tools
Capabilities this server exposes over MCP:

- **list_mail_accounts** — Lists the mail accounts you connected, with the ids the other tools take.
- **get_mail_account** — Shows the connection details of one account (never its password).
- **list_folders** — Lists the folders of one account.
- **search_messages** — Searches by subject, sender, recipients, attachment names and date.
- **get_message** — Reads one message.
- **get_attachment** — Downloads an attachment of a message: a short-lived link, or with `inline: true` the file itself (up to 5 MB) inside the MCP answer.
- **search_contacts** — Finds addresses you have corresponded with.
- **get_outgoing_status** — Tells whether an email handed to `send_message` has gone out.
- **set_flags** — Flags a message or marks it read / unread. *Write.*
- **move_message** — Moves a message to another folder. *Write.*
- **trash_message** — Moves a message to Trash. *Write.*
- **create_folder** — Creates a folder. *Write.*
- **create_draft** — Saves a draft. *Write.*
- **send_message** — Prepares an email; it is sent only after you approve it. *Write.*

## Claude Desktop Quick Installation
Remote MCP endpoint (confidence: high). Install path detected from listing signals. Add as a URL/SSE server in your client:

```json
"mcpServers": {
  "mcp4mail": {
    "url": "https://mcp4mail.online/mcp"
  }
}
```

## Documentation

## What mcp4mail does

mcp4mail exposes an IMAP mailbox through the Model Context Protocol. Connected clients can list available accounts and folders, search messages by subject, participants, attachment name, or date, and retrieve message content. The server can also find contacts based on previous correspondence and provide access to attachments through short-lived links or inline file content up to 5 MB.

Mailbox changes are supported but gated. Each account starts in read-only mode, and an owner must enable AI changes and select the permitted operations. Available write actions include changing flags and read status, moving messages, creating folders, moving mail to Trash, saving drafts, and preparing outgoing messages. Sending requires a separate human approval step after the message is prepared.

## How it works

The hosted service uses the MCP endpoint at `https://mcp4mail.online/mcp`; self-hosted deployments use their own `/mcp` URL. An MCP client connects to the endpoint after the user signs in and selects the connected mail account. Tools resolve accounts within the authenticated user’s scope, so an account identifier belonging to another user is rejected.

Mail is accessed over IMAP with a username and password. The server opens folders for inspection without marking messages as seen. It also stores message headers—such as sender, recipients, subject, date, flags, and size—in its database and refreshes them every 15 minutes to support searching.

## Setup and configuration

For the hosted option, create an account at `mcp4mail.online`, connect an IMAP mailbox, and add the MCP URL to a compatible client. To run the application yourself, copy `.env.example` to `.env`, provide the configuration values, and start the services with Docker Compose:

```bash
cp .env.example .env
docker compose up -d
```

Self-hosted production deployments need a public URL whose value matches `HITCH_RESOURCE_URI` exactly. Mailbox passwords are encrypted at rest with Rails Active Record Encryption. Production keys can be supplied through encrypted credentials or the `ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY`, `ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY`, and `ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT` variables.

Use an app-specific password when the mail provider supports one. Gmail, iCloud, Fastmail, Outlook.com, and Yahoo are listed as examples; Gmail accounts require two-step verification and an app password. Google Workspace administrators may restrict IMAP or app-password use.

## Tools and capabilities

The 14 MCP tools cover:

- Account and folder discovery with `list_mail_accounts`, `get_mail_account`, and `list_folders`.
- Message search and retrieval with `search_messages` and `get_message`.
- Attachment retrieval with `get_attachment`.
- Contact lookup through `search_contacts`.
- Delivery checks through `get_outgoing_status`.
- Controlled mailbox changes with `set_flags`, `move_message`, `trash_message`, `create_folder`, and `create_draft`.
- Human-approved outgoing mail through `send_message`.

## Limitations and notes

Write tools are refused unless the mailbox owner enables the corresponding permission. `send_message` prepares an email but does not send it automatically; the message is released only after the owner approves it. Inline attachment responses are limited to 5 MB, while other attachments are represented by short-lived download links.

Reading mail still exposes its contents to the connected AI client, so only trusted clients should be authorized. The service applies a limit of 120 requests per minute for each user and client pair.

_Full upstream README: https://allmcps.com/mcp/mcp4mail/readme_

