npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

sendmail-mcp

v1.0.1

Published

A Model Context Protocol (MCP) server for sending emails via SMTP.

Downloads

191

Readme

Mail MCP Server

A Model Context Protocol (MCP) server that provides email sending capabilities using Nodemailer. This server allows AI agents (like Gemini CLI, Claude, etc.) to send emails on your behalf using your own SMTP credentials.

Features

  • Send Email: Send plain text and HTML emails to any recipient.
  • Secure: Uses your own SMTP server credentials (Gmail, Outlook, AWS SES, etc.).
  • Logging: Automatically logs email activities to daily files in the log/ directory for audit and debugging.

Prerequisites

  • Node.js: v14 or higher.
  • SMTP Credentials: Host, port, user, and password for your email provider.

MCP Client Configuration

To use this server with your MCP client, you need to configure it to run the index.js script. You have two main ways to integrate and provide your SMTP credentials:

Option 1: Local Installation (Recommended for Development)

This method is ideal when you're developing locally or want to run the server directly from its cloned repository. You will provide the absolute path to the index.js file.

  1. Clone the repository:

    git clone https://github.com/u1pns/sendmail-mcp.git
    cd sendmail-mcp
  2. Install dependencies:

    npm install
  3. Configure Environment Variables: You can pass the environment variables directly in your MCP client's configuration file (preferred for portability) or use a .env file in the project's root directory.

    • Using env block in client config (Recommended):

      Gemini CLI (settings.json)

      Add this to your mcpServers object in the .gemini/settings.json file:

      {
        "mcpServers": {
          "sendmail-mcp": {
            "command": "node",
            "args": ["/absolute/path/to/sendmail-mcp/index.js"],
            "env": {
              "SMTP_HOST": "smtp.example.com",
              "SMTP_PORT": "465",
              "SMTP_SECURE": "true",
              "SMTP_USER": "[email protected]",
              "SMTP_PASS": "your_password",
              "MAIL_FROM": "[email protected]"
            }
          }
        }
      }
      • Important: Replace /absolute/path/to/sendmail-mcp/index.js with the full path to your cloned index.js file on your computer (e.g., /Users/jpons/mcp/sendmail-mcp/index.js).

      Claude Desktop (claude_desktop_config.json)

      Add this to your mcpServers object:

      {
        "mcpServers": {
          "sendmail-mcp": {
            "command": "node",
            "args": ["/absolute/path/to/sendmail-mcp/index.js"],
            "env": {
              "SMTP_HOST": "smtp.example.com",
              "SMTP_PORT": "465",
              "SMTP_SECURE": "true",
              "SMTP_USER": "[email protected]",
              "SMTP_PASS": "your_password",
              "MAIL_FROM": "[email protected]"
            }
          }
        }
      }
    • Using a .env file (Alternative for local setup):

      1. Create a .env file in the root of the sendmail-mcp directory (use .env.example as a template).
      2. Fill in your SMTP credentials in the .env file.
      3. Configure your MCP client to just run the script without the env block.

      Generic Configuration (Gemini/Claude)

      {
        "mcpServers": {
          "sendmail-mcp": {
            "command": "node",
            "args": ["/absolute/path/to/sendmail-mcp/index.js"]
          }
        }
      }

      The server will automatically load the credentials from the .env file located in the same directory as index.js.

Option 2: Using npx

This method is similar to how chrome-devtools-mcp is used, where you can reference the package directly via npx after it has been published to the npm registry. This provides a more convenient and globally accessible way to use the server.

  • Prerequisite: This sendmail-mcp package must be published to npm (e.g., npm publish).

Gemini CLI (settings.json)

Add this to your mcpServers object in the .gemini/settings.json file:

{
  "mcpServers": {
    "sendmail-mcp": {
      "command": "npx",
      "args": ["sendmail-mcp@latest"],
      "env": {
        "SMTP_HOST": "smtp.example.com",
        "SMTP_PORT": "465",
        "SMTP_SECURE": "true",
        "SMTP_USER": "[email protected]",
        "SMTP_PASS": "your_password",
        "MAIL_FROM": "[email protected]"
      }
    }
  }
}

Claude Desktop (claude_desktop_config.json)

Add this to your mcpServers object:

{
  "mcpServers": {
    "sendmail-mcp": {
      "command": "npx",
      "args": ["sendmail-mcp@latest"],
      "env": {
        "SMTP_HOST": "smtp.example.com",
        "SMTP_PORT": "465",
        "SMTP_SECURE": "true",
        "SMTP_USER": "[email protected]",
        "SMTP_PASS": "your_password",
        "MAIL_FROM": "[email protected]"
      }
    }
  }
}

Environment Variables Reference

Regardless of the method you use, these are the variables you need to set:

| Variable | Description | Example | | :--- | :--- | :--- | | SMTP_HOST | Hostname of your SMTP server | smtp.gmail.com | | SMTP_PORT | Port number (usually 465 for SSL or 587 for TLS) | 465 | | SMTP_SECURE | Set to true for port 465, false for others | true | | SMTP_USER | Your email username | [email protected] | | SMTP_PASS | Your email password (or App Password) | secret | | MAIL_FROM | The email address to send from | [email protected] |

Tools

This server exposes a single tool to the MCP client:

send_email

Sends an email using the configured SMTP server.

Inputs:

  • to (string, required): The recipient's email address.
  • subject (string, required): The subject line of the email.
  • text (string, required): The plain text content of the email.
  • html (string, optional): The HTML content of the email (for rich text).

Usage

Once configured, you can use natural language to interact with the server through your AI agent.

Example Prompts:

"Send an email to [email protected] saying I'll be late to the meeting."

"Email the weekly report to the team with the subject 'Weekly Status' and the body 'All systems go'."

"Send a test email to myself to verify the SMTP connection."

Development

If you want to modify or contribute to this project:

  1. Clone the repository:

    git clone <your-repo-url>
    cd mail-mcp
  2. Install dependencies:

    npm install
  3. Local Testing: You can create a .env file for local testing during development (though the MCP client configuration handles env vars in production usage).

    cp .env.example .env

Server Lifecycle

It's important to understand that this MCP server operates as a child process of your MCP client (e.g., Gemini CLI). This means:

  • Starts with Client: The server process is automatically launched by the MCP client when the client starts or when it first needs to interact with the server's tools.
  • Stops with Client: When you close your MCP client (e.g., exit Gemini CLI), the client will automatically terminate the server process. It does not run indefinitely in the background.

Troubleshooting

  • Authentication Failed: If using Gmail, ensure you have 2-Factor Authentication enabled and are using an App Password, not your main password.
  • Connection Refused: Check your firewall settings and ensure SMTP_PORT is correct.
  • Logs: Check the log/ directory in the project folder. Logs are rotated daily (e.g., 2025-12-01.log).

License

MIT License

Copyright (c) 2025

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.