Email Sender MCP server

Enables language models to compose and send emails with attachments through SMTP servers, supporting multiple providers and secure transmission for automated email workflows.
Back to servers
Provider
Tian Ming Guang
Release date
Mar 23, 2025
Language
Python
Package
Stats
3.4K downloads
34 stars

The MCP Email Server is a Model Context Protocol server that enables Large Language Models (LLMs) to compose and send emails, as well as search for attachments within specified directories. It provides a simple way to add email functionality to AI assistants through standardized tools.

Features

  • Send emails with multiple recipients
  • Support for email attachments
  • Search for files in directories based on pattern matching
  • Secure email transmission using SMTP

Installation

Prerequisites

Install the required dependencies:

pip install pydantic python-dotenv

Email Configuration

Create an email.json file with SMTP server configurations:

[
  {
    "domain": "@gmail.com",
    "server": "smtp.gmail.com", 
    "port": 587
  },
  {
    "domain": "@outlook.com",
    "server": "smtp.office365.com",
    "port": 587
  },
  {
    "domain": "@yahoo.com",
    "server": "smtp.mail.yahoo.com",
    "port": 587
  }
]

Usage

Running the Server

Start the MCP Email Server with the following command:

python -m mcp_email_server (--dir /path/to/attachment/directory)

The --dir parameter is optional and specifies the directory where attachments can be found.

Configure for Claude.app

Add the following configuration to your Claude settings:

Using Conda

{
  "mcpServers": {
    "email": {
      "command": "D:\\conda\\envs\\mcp\\python.exe",
      "args": [
        "C:\\Users\\YourUserName\\Desktop\\servers\\src\\email\\src\\mcp_server_email",
        "--dir",
        "C:\\Users\\YourUserName\\Desktop"
      ],
      "env": {
        "SENDER": "[email protected]",
        "PASSWORD": "your-password-or-app-password"
      }
    }
  }
}

Using UV

{
  "mcpServers": {
    "email": {
      "command": "uv",
      "args": [
        "~\\servers\\src\\email\\src\\mcp_server_email",
        "--dir",
        "C:\\Users\\YourUserName\\Desktop"
      ],
      "env": {
        "SENDER": "[email protected]",
        "PASSWORD": "your-password-or-app-password"
      }
    }
  }
}

Available Tools

The server provides two main tools:

Send Email

Sends emails with the following parameters:

  • receiver (array of strings, required): List of recipient email addresses
  • body (string, required): The main content of the email
  • subject (string, required): The subject line of the email
  • attachments (array of strings or string, optional): Email attachments (filenames)

Search Attachments

Searches for files in a specified directory:

  • pattern (string, required): The text pattern to search for in file names

Example Usage

Sending an Email

{
  "receiver": ["[email protected]"],
  "subject": "Test Email from MCP Server",
  "body": "This is a test email sent via the MCP Email Server.",
  "attachments": ["document.pdf", "image.jpg"]
}

Searching for Attachments

{
  "pattern": "report"
}

Security Notes

  • For Gmail and other services, you may need to use an app-specific password
  • The server supports a limited set of attachment file types for security reasons

Supported File Types

The server supports the following attachment file types:

  • Documents: doc, docx, xls, xlsx, ppt, pptx, pdf
  • Archives: zip, rar, 7z, tar, gz
  • Text files: txt, log, csv, json, xml
  • Images: jpg, jpeg, png, gif, bmp
  • Other: md

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later