MCP Connector

Send Emails and Search Files via MCP

MCP Email Server sends emails with attachments and searches local files by pattern, routing SMTP per-domain via a simple config file.

Maintainer of this project? Claim this page to edit the listing.


90
Spark score
out of 100
Updated Apr 2025
Version 1.0.0
Models
universal

Add to Favorites

Why it matters

Enable LLMs to compose and send emails through various providers like Gmail and Outlook, with support for attachments and file search capabilities.

Outcomes

What it gets done

01

Send emails with attachments to multiple recipients.

02

Search for files within a specified directory using pattern matching.

03

Securely manage sender credentials for email transmission.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-email | bash

Capabilities

Tools your agent gets

send_email

Sends emails to multiple recipients with subject, content, and attachment support via SMTP

search_attachments

Searches for files in a directory matching a given pattern for email attachments

Overview

Email MCP Server

MCP Email Server exposes two tools to an LLM: send_email (multiple recipients, subject, body, optional attachments over SMTP) and search_attachments (find files in a directory by name pattern). SMTP server settings are resolved per-domain from an email.json config file. Use it when an agent needs to send email with attachments or locate an attachment file by pattern before sending. Attachments are restricted to a fixed set of file types for security, and some providers like Gmail need an app-specific password.

What it does

MCP Email Server lets an LLM compose and send emails and search for attachment files within a specified directory, over two tools: send_email (required receiver as an array of recipient addresses, required subject and body, optional attachments as one or more filenames) and search_attachments (required pattern, a text pattern matched against file names). The same two operations are also exposed as MCP prompts with matching arguments, so a client can drive either the tool or prompt interface. Email is sent over SMTP, with server settings resolved per-domain from an email.json configuration file - the example config maps @gmail.com to smtp.gmail.com:587, @outlook.com to smtp.office365.com:587, and @yahoo.com to smtp.mail.yahoo.com:587.

When to use - and when NOT to

Use it when an agent needs to send email directly - for example dispatching a report with attachments, or sending a notification - and when it needs to locate a specific attachment file by name pattern before sending it. It restricts attachments to a defined allowlist of file types for security, spanning documents (doc, docx, xls, xlsx, ppt, pptx, pdf), archives (zip, rar, 7z, tar, gz), text formats (txt, log, csv, json, xml), images (jpg, jpeg, png, gif, bmp), and markdown, so it is not a fit if you need to attach a file type outside that list. Skip it if you cannot use an app-specific password - the README notes Gmail and similar providers may require one instead of the account's normal password - or if you need anything beyond sending mail and finding local attachment files, since those are the server's only two capabilities.

Capabilities

  • Send an email to multiple recipients at once with a subject, body, and optional attachments.
  • Search a configured directory for attachment files by name pattern before referencing them in a send.
  • Per-domain SMTP routing via email.json, with Gmail, Outlook, and Yahoo mappings provided out of the box and further domains addable the same way.
  • Both the send and search operations are exposed as MCP tools and as MCP prompts with matching arguments.
  • Restricts attachments to a fixed set of file types (documents, archives, text formats, images, and markdown) as a security measure.

How to install

Install the Python dependencies:

pip install pydantic python-dotenv

Create an email.json file with your SMTP server mappings (Gmail, Outlook, and Yahoo examples are provided), then start the server, optionally pointing --dir at the directory search_attachments should search:

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

To use it with Claude, add an MCP server entry running the module either via a Conda-managed Python interpreter or via uv, setting SENDER and PASSWORD as environment variables - for Gmail and similar providers, PASSWORD may need to be an app-specific password rather than the account's normal login password.

Who it's for

Developers who want an agent able to send email with attachments directly - status reports, generated documents, or notifications - and to locate the right attachment file by pattern first, without wiring up SMTP and file search separately. Licensed under MIT.

Source README

MCP Email Server

A Model Context Protocol server that provides email functionality. This server enables LLMs to compose and send emails, as well as search for attachments within specified directories.
1742711978001

1742712768132

Features

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

Available Tools

  • send_email - Sends emails based on the provided subject, body, and receiver.

    • 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 that match a given pattern.

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

Prompts

  • send_email

    • Send an email with optional attachments
    • Arguments:
      • receiver (required): The list of recipient email addresses
      • body (required): The main content of the email
      • subject (required): The subject line of the email
      • attachments (optional): Email attachments
  • search_attachments

    • Search for files matching a pattern
    • Arguments:
      • pattern (required): The text pattern to search for in file names

Installation

Using pip

Install the required dependencies:

pip install pydantic python-dotenv

Email Configuration

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:

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

Configure for Claude.app

Add to your Claude settings:

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": "2593666979q@gmail.com",
        "PASSWORD": "tuogk......."
      }
    }
  }
}
UV
{
  "mcpServers": {
    "email": {
      "command": "uv",
      "args": [
        "~\\servers\\src\\email\\src\\mcp_server_email",
        "--dir",
        "C:\\Users\\YourUserName\\Desktop"
      ],
      "env": {
        "SENDER": "2593666979q@gmail.com",
        "PASSWORD": "tuogk......."
      }
    }
  }
}

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

Example Usage

Sending an Email

{
  "receiver": ["recipient@example.com"],
  "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"
}

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.