Skip to main content
Glama
SDK-E

mailbox-mcp

by SDK-E

mailbox

CI npm license

一个本地开发邮件接收器:为整台机器运行一个 SMTP 服务器和一个 HTTP API,让每个项目都指向它。邮件永远不会离开你的设备——而是落入一个可检查的收件箱,配有 Web UI、CLI 和面向 AI 代理的 MCP 服务器。

共享一个实例可消除各项目之间的端口冲突:启动一次,即可连接多个。

Install

pnpm add -D @sdk-e/mailbox   # or npm i -D / yarn add -D

或者临时运行:

npx @sdk-e/mailbox

Related MCP server: qmailing MCP server

Quick start

mailbox            # SMTP on :11025, inbox UI on http://localhost:11090

从任何应用(nodemailer、Resend 开发模式等)向 smtp://127.0.0.1:11025 发送邮件,然后:

open http://localhost:11090   # or: mailbox-cli open

Bins

Bin

用途

mailbox

运行接收器(SMTP + HTTP + 收件箱 UI)

mailbox-cli

list, read <id>, wait [match] [--timeout s], clear, health, open

mailbox-mcp

MCP 服务器(list_emails, read_email, clear_emails, wait_for_email)

CLI examples

mailbox-cli list
mailbox-cli read 3
mailbox-cli wait "verification code" --timeout 10   # blocks until a new matching message arrives
mailbox-cli clear

wait 只匹配它启动之后到达的消息——在触发发送之前启动它。

Library use

import { startMailbox } from "@sdk-e/mailbox";

const mailbox = await startMailbox({ smtpPort: 0, httpPort: 0 }); // 0 = ephemeral
console.log(mailbox.smtpPort, mailbox.url);
await mailbox.close();

非常适合需要隔离的一次性收件箱的集成测试。

HTTP API(稳定的传输协议)

路由

方法

响应

/api/health

GET

{ ok, smtpPort, httpUrl, messageCount }

/api/email

GET

数组 { id, receivedAt, from, to, subject, text, html }

/api/email/:id

GET

上述消息加上 raw 源;如果缺失则返回 404 {"error": …}

/api/email/all

DELETE

{ ok: true, messageCount: 0 }

/

GET

收件箱 UI

Configuration

环境变量(如果存在,会加载工作目录中的 .env.local,然后是 .env):

变量

默认值

用途

MAIL_SMTP_PORT

11025

SMTP 监听端口

MAIL_HTTP_PORT

11090

HTTP API/UI 端口

MAIL_HTTP_URL

由端口推导

CLI/MCP 用于访问接收器的基本 URL

MAILBOX_HOST

127.0.0.1

绑定接口(默认回环)

在本地将应用的邮件程序指向 smtp://127.0.0.1:$MAIL_SMTP_PORT;在生产环境中继续使用你的真实提供商。当 NODE_ENV=production 时,服务器拒绝启动。

Why high ports?

1025/1080(经典的 MailHog 风格默认值)经常冲突。mailbox 默认使用 11025/11090,这样多个 SDK-E 项目可以共享一个实例,而不会相互干扰或影响其他本地工具。

Development

pnpm install
pnpm verify     # format, lint, typecheck, test, build

参见 CONTRIBUTING.md。

License

MIT

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables LLMs to read, send, and manage emails via POP3 and SMTP with TLS support.
    6
    -
  • F
    license
    B
    quality
    D
    maintenance
    Enables AI agents to send and receive emails via POP3 and SMTP, with tools for polling, reading, deleting, and sending emails.
    5
    1
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to interact with email accounts via IMAP and SMTP, supporting mailbox listing, email search, retrieval, sending, and management.
    MIT