Skip to main content
Glama
MauricioPerera

mail-mcp

mail-mcp

CI Coverage Version Node.js Version License: MIT PRs Welcome

セルフホスト型、プロバイダ非依存のメールサービス。任意のメールボックスのIMAP/SMTP認証情報を指定するだけで、以下の機能を提供します:

  • REST API:一般的なメールボックス操作をミラーリング:フォルダ一覧、メッセージの一覧/取得/検索、送信、フラグ設定、移動、削除、クォータ(ベストエフォート)。

  • Webhookmessage.received):永続的なIMAP IDLEウォッチャー経由で、新着メールが到着するたびにHTTP POST(WebhookごとのBearerシークレット付き)を発行。受信エンドポイントが失敗した場合、指数バックオフ(最大6回試行)でリトライします。

  • MCPサーバー(Streamable HTTP、POST /mcp):同じ操作をツールとして公開するため、MCP互換のエージェントが直接利用可能。

最初からマルチメールボックス対応:config/accounts.jsonに必要なだけアカウントを追加できます。

REST APIのリクエストボディはZod(lib/schemas.js)で検証され、無効なペイロードはメール層に到達する前にフィールドレベルのエラーとともに422 ERR_VALIDATION_FAILEDを返します。Webhookの購読はフラットなJSONファイルではなくSQLite(config/webhooks.sqlitebetter-sqlite3経由)に永続化されます。MAIL_MCP_MAX_MESSAGE_SIZE(デフォルト25MB)より大きなメッセージは、メモリに巨大なメッセージを読み込まないよう、bodyTruncated: trueでパースされた本文/添付ファイルなしで返されます。

セットアップ

npm install
cp .env.example .env   # fill in MAIL_MCP_API_TOKEN and one MAILMCP_PASS_<ID> per account

config/accounts.json.exampleconfig/accounts.jsonにコピーします(gitignore対象 – このファイルにもパスワードは含まれず、パスワードは.envのみに存在します):

[
  {
    "id": "example",
    "user": "user@example.com",
    "imap": { "host": "imap.example.com", "port": 993, "secure": true },
    "smtp": { "host": "smtp.example.com", "port": 465, "secure": true }
  }
]

アカウントid: "example"のパスワードはMAILMCP_PASS_EXAMPLEから読み取られます。

node index.js

デフォルトでは127.0.0.1:4900で動作します(MAIL_MCP_PORTを参照)。ホスト外からアクセスする必要がある場合は、TLSを使用したリバースプロキシの背後に配置してください。

Related MCP server: Agent Email

systemd

サンプルユニットがdeploy/mail-mcp.serviceにあります。これを/etc/systemd/system/にコピーし、パスを調整すると、EnvironmentFile経由で/root/mail-mcp/.envからシークレットを読み込みます。

認証

すべてのRESTおよびMCPリクエストには、Authorization: Bearer <MAIL_MCP_API_TOKEN>が必要です。

テスト

npm test              # run once
npm run test:coverage # run with coverage report

カバレッジは純粋な/ロジックモジュール(lib/schemas.jslib/accounts.jslib/webhooks-store.js)を対象としています。lib/mailclient.jslib/idle-watcher.jsは実際のIMAP/SMTPサーバーと通信するため、ユニットテストではなく手動のエンドツーエンドテストで検証されています。これらはカバレッジバッジから除外されているため、誤解を招くことはありません。

A
license - permissive license
-
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    -
    quality
    D
    maintenance
    A generic IMAP and SMTP MCP server that enables AI agents to interact with email accounts for reading, searching, and sending messages. It provides high-level tools for managing email workflows like daily digests and folder organization across any standard email provider.
    1
    MIT
  • A
    license
    -
    quality
    A
    maintenance
    An open-source MCP server that provides AI agents with secure access to read, search, and manage emails via Microsoft 365 and Gmail. It features security-first defaults like recipient allowlists and markdown content conversion to facilitate safe agent interaction with mailboxes.
    4
    Apache 2.0
  • A
    license
    A
    quality
    D
    maintenance
    Provider-agnostic email MCP server that connects any IMAP mailbox to AI assistants, enabling email management through natural language.
    8
    AGPL 3.0
  • A
    license
    -
    quality
    C
    maintenance
    An MCP server that exposes IMAP operations as tools for AI assistants, enabling email management including listing mailboxes, reading, searching, moving, flagging emails, and creating drafts.
    47
    MIT

View all related MCP servers

Related MCP Connectors

  • Hosted email MCP for AI agents with inboxes, send/receive, memory, recovery, and credits.

  • Shipmail MCP server for AI agent custom-domain email inboxes with REST API and webhooks.

  • Self-hosted multi-domain email as MCP tools - register domains, real mailboxes, send/read mail.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/MauricioPerera/mail-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server