mailpit-mcp-server
Enables AI assistants to read, search, and manage emails from Mailpit, an email and SMTP testing tool, during development and testing.
README
mailpit-mcp-server
A Model Context Protocol server for Mailpit, the email & SMTP testing tool. It lets AI assistants (Claude Code, Claude Desktop, Cursor, VS Code, …) read, search and manage the emails your application sends during development and testing.
- Streamable HTTP transport — run it as a network service next to Mailpit (Docker Compose friendly), or
- stdio transport — let your MCP client spawn it locally
- Bearer-token auth for the HTTP endpoint, so it can safely sit behind a tunnel/reverse proxy
- Single small dependency surface: the official
@modelcontextprotocol/sdk, Express and Zod
Tools
| Tool | Description |
|---|---|
list_messages |
List mailbox messages, newest first (paginated) |
search_messages |
Search with Mailpit query syntax (from:, subject:, is:unread, tag: …) |
get_message |
Full message by ID or latest — headers, text/HTML bodies, attachment metadata |
get_message_headers |
Raw headers of a message |
get_message_source |
Full raw RFC-822 source (headers + MIME parts) |
get_attachment |
Download an attachment — images returned as images, text as text, other as base64 |
check_html |
HTML compatibility analysis across email clients |
get_message_links |
Extract all URLs without requesting them — safe retrieval of confirmation/reset/unsubscribe links for e2e flows |
check_links |
Verify links by requesting them (real GETs — may trigger one-click actions; auth-protected links can return 302/401/403 without being broken) |
send_message |
Compose and inject a test email via the Mailpit API (captured, not delivered) |
wait_for_message |
Poll until a new (optionally matching) message arrives — great for e2e flows |
set_read_status |
Mark messages read/unread, by ID or all |
delete_messages |
Delete messages by ID, or all messages |
get_mailbox_info |
Mailpit version, message/unread counts, database size |
Quick start (Docker Compose)
services:
mailpit:
image: axllent/mailpit:latest
ports:
- "8025:8025" # web UI
- "1025:1025" # SMTP
healthcheck:
test: ["CMD", "/mailpit", "readyz"]
interval: 30s
start_period: 10s
mailpit-mcp:
image: ghcr.io/cedjey/mailpit-mcp-server:1
ports:
- "3000:3000" # MCP endpoint: http://localhost:3000/mcp
environment:
MAILPIT_URL: http://mailpit:8025
# Recommended: require "Authorization: Bearer <token>" on /mcp
# MCP_AUTH_TOKEN: your-secret-token
depends_on:
mailpit:
condition: service_healthy
Or standalone against an existing Mailpit:
docker run -d -p 3000:3000 \
-e MAILPIT_URL=http://your-mailpit-host:8025 \
-e MCP_AUTH_TOKEN=your-secret-token \
ghcr.io/cedjey/mailpit-mcp-server:1
Connecting clients
Claude Code:
claude mcp add --transport http mailpit http://localhost:3000/mcp \
--header "Authorization: Bearer your-secret-token"
.mcp.json / Cursor / VS Code:
{
"mcpServers": {
"mailpit": {
"type": "http",
"url": "http://localhost:3000/mcp",
"headers": { "Authorization": "Bearer ${MAILPIT_MCP_TOKEN}" }
}
}
}
Claude Desktop (stdio):
{
"mcpServers": {
"mailpit": {
"command": "docker",
"args": ["run", "-i", "--rm",
"-e", "MCP_TRANSPORT=stdio",
"-e", "MAILPIT_URL=http://host.docker.internal:8025",
"ghcr.io/cedjey/mailpit-mcp-server:1"]
}
}
}
Or without Docker (Node 20+): clone the repo, npm ci, and use "command": "node", "args": ["/path/to/server.js"] with MCP_TRANSPORT=stdio.
Built-in agent context
The server ships the context an AI agent needs — no extra prompting required by consumers:
- Server instructions (delivered via the MCP initialize handshake): what the mailbox is, the standard workflows (inspect, e2e wait-then-verify, template QA, attachments), search syntax, and warnings — clients inject these into the model's context automatically.
- Tool annotations: the ten read-only tools carry
readOnlyHint,delete_messagescarriesdestructiveHint— clients can auto-approve reads and gate deletes. - MCP prompts:
verify_email(wait for a message matching a query, then verify structure, links and client compatibility against an optional checklist) andinspect_mailbox(summarize mailbox state, flag anomalies). Claude Code exposes these as slash commands.
Claude Code plugin
The easiest way to use this from Claude Code — one install, prompted for your endpoint and token, no manual MCP or skill setup:
/plugin marketplace add CeDJeY/mailpit-mcp-server
/plugin install mailpit@cedjey
On enable, Claude Code asks for:
- Mailpit MCP endpoint URL — e.g.
http://your-host:3000/mcp - Bearer token — the server's
MCP_AUTH_TOKEN(leave empty if auth is disabled)
The plugin bundles the MCP connection plus two skills:
verify-email— the verification workflow: wait for the email, inspect structure, extract links safely, check HTML compatibility, report a PASS/FAIL verdict.route-mail-to-mailpit— the prerequisite the verification depends on: configure the application under test to send SMTP to Mailpit, prove it with a canary email, and flag configurations that could leak test mail to real SMTP providers.
Plugin source lives in plugin/; non-plugin users can copy the skills into their project's .claude/skills/ manually.
Configuration
| Variable | Default | Description |
|---|---|---|
MAILPIT_URL |
http://localhost:8025 |
Base URL of the Mailpit instance |
MCP_TRANSPORT |
http |
http (network service) or stdio (spawned by client) |
MCP_HTTP_PORT |
3000 |
Port for the HTTP endpoint |
MCP_AUTH_TOKEN |
(empty = auth off) | When set, /mcp requires Authorization: Bearer <token> |
MAILPIT_AUTH_USER / MAILPIT_AUTH_PASS |
(none) | Basic-auth credentials if Mailpit's API is protected |
MAILPIT_SMTP_ADVERTISE |
(none) | SMTP host:port applications must send to (as reachable by them); exposed to agents via get_mailbox_info (SMTPEndpoint) and the server instructions so they can verify app mail routing |
The HTTP mode also serves GET /healthz (no auth) for container healthchecks.
Security notes
Mailpit captures every email your app sends — treat the MCP endpoint as sensitive. Set MCP_AUTH_TOKEN whenever the port is reachable beyond localhost, and prefer keeping it off the public internet (private network, VPN, or an authenticated tunnel). delete_messages is destructive; scope access accordingly.
Development
npm ci
MAILPIT_URL=http://localhost:8025 npm start # HTTP mode on :3000
node mcp-test.js # e2e check against a running server
mcp-test.js honours MCP_URL and MCP_AUTH_TOKEN.
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。