SuperAPIAI Directory

smtp-mcp

github.com · AI developer platforms

Send, reply to and forward mail over SMTP, restricted to a recipient allowlist, with each message approved by a person before sending.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)

About this tool

smtp-mcp is a Model Context Protocol (MCP) server for sending email via the SMTP protocol. It enables MCP clients (such as Claude Code, Claude Desktop, or Codex) to send, reply to, and forward email from a configured address, but every email requires human approval.

Purpose

This server is dedicated solely to the "send email" function, complementing imap-mcp, which handles reading mailboxes. Separating sending and reading into different processes with different credentials is an important foundation of its security.

Main capabilities

  • Send, reply to, and forward email, with the sender address fixed to SMTP_FROM; the model cannot choose the sender.
  • Recipient allowlist: SMTP_ALLOWED_RECIPIENTS must be set to enable sending, and all addresses in To, Cc, and Bcc are checked before a connection is established.
  • Human confirmation: every email requests human approval via MCP elicitation, and the confirmation information is bound to the specific email (a SHA-256 fingerprint of the recipient list and a content digest), preventing approval from being reused for other recipients or content.
  • Disabled by default: SMTP_ALLOW_SEND defaults to false, and the send tools are not registered until it is enabled, so they do not appear in tools/list.
  • Tool selection: SMTP_ALLOW_TOOLS and SMTP_DENY_TOOLS control which tools are registered, supporting comma-separated tool names or prefixes with a single trailing *. The essential preset contains five tools: get_server_info, validate_recipients, preview_mail, send_mail, and reply_mail.
  • Structured output: each tool declares an outputSchema and returns structuredContent, making it easy for clients to use the results directly.
  • Secure handling: HTML removes scripts, event handlers, remotely loaded images, and unsafe URL schemes, and reports each removal; attachments come only from SMTP_ATTACHMENT_DIR and undergo an extension allowlist, symlink rejection, and magic-number checks; quoted original text is passed through as-is, and possible prompt-injection patterns are flagged in the dialog.
  • Logging: every accepted email is logged to stderr, and optionally to a fileitems, but never logs the body.

Usage

Requires Node.js 22 or later, and an SMTP account that can be used for sending (a submission server on port 587 or 465, with a username and password). Providers using two-factor authentication usually require an app-specific password. TLS is recommended; SMTP_TLS=starttls is the default, requiring an upgrade rather than attempting one.

For clients that cannot spawn a local process (such as ChatGPT connectors, Claude on the web, Cursor, LibreChat), smtp-mcp can be accessed through mcp-hub. mcp-hub is a container that serves multiple stdio MCP servers over Streamable HTTP, with support for OAuth 2.1 login and long-lived tokens. Its /config/mcp.json uses the Claude Code format.

Use Cases

Suitable for scenarios where an AI agent needs to send email but strict security controls are required, for example: the agent needs to reply to customer emails but must go through human approval; the agent needs to forward emails but recipients are restricted; during development and testing, use the Mailpit sandbox instead of a real mailbox.

Limitations

  • No from parameter is provided; the sender can only be SMTP_FROM.
  • Confirmation cannot be skipped; there is no force or "trusted caller" mode.
  • It does not read email; reading is handled by imap-mcp.
  • Arbitrary email headers are not supported; threading uses in_reply_to and references, with no header name passthrough.
  • It does not perform DKIM signing; the submission server signs on its behalf.
  • Sending is disabled by default; the tool does not exist until it is enabled.
  • If the recipient allowlist is not set, startup fails rather than allowing everyone; to allow everyone, you must explicitly write *.
  • Attachments come only from a specified directory and are restricted by an extension allowlist, symlink rejection, and magic number checks.
  • The same email will not be sent repeatedly; accepted emails are remembered until the time when approval may still be redeemable ends.

For more information, see SECURITY.md and the full guide, tool reference, and security notes at smtp-mcp.ni-c.de. The project is licensed under the MIT License, copyright Willi Thiel.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools