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 🙏

© 2026 – Pkg Stats / Ryan Hefner

email-smtp-imap-mcp

v2.0.4

Published

Email MCP Server with SMTP and IMAP support - simple, clean, and flexible

Readme

Email MCP Server

A clean, simple stdio MCP server for email operations supporting both SMTP (sending) and IMAP (reading).

npm version License: MIT

Features

  • Send emails with HTML and attachments
  • Search emails with flexible filters
  • Reply/Forward with proper threading
  • Organize (mark read, archive, flag)
  • Multi-account support for managing multiple email accounts
  • List folders to browse your mailbox structure

Quick Start

Installation

npx -y email-smtp-imap-mcp

Or install globally:

npm install -g email-smtp-imap-mcp

Configuration

Add to your Claude Desktop config file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "email": {
      "command": "npx",
      "args": ["-y", "email-smtp-imap-mcp"],
      "env": {
        "EMAIL_ACCOUNTS_JSON": "{\"work\":{\"smtp\":{\"host\":\"smtp.gmail.com\",\"port\":587,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.gmail.com\",\"port\":993,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"default_from_name\":\"Your Name\",\"sender_emails\":[\"[email protected]\"]}}",
        "DEFAULT_EMAIL_ACCOUNT": "work"
      }
    }
  }
}

⚠️ Important: Restart Claude Desktop after adding this configuration.

Email Provider Settings

Gmail

"EMAIL_ACCOUNTS_JSON": "{\"gmail\":{\"smtp\":{\"host\":\"smtp.gmail.com\",\"port\":587,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.gmail.com\",\"port\":993,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"default_from_name\":\"Your Name\",\"sender_emails\":[\"[email protected]\"]}}"

Setup: Create App Password

iCloud Mail

"EMAIL_ACCOUNTS_JSON": "{\"icloud\":{\"smtp\":{\"host\":\"smtp.mail.me.com\",\"port\":587,\"user\":\"[email protected]\",\"password\":\"app-specific-password\"},\"imap\":{\"host\":\"imap.mail.me.com\",\"port\":993,\"user\":\"[email protected]\",\"password\":\"app-specific-password\"},\"default_from_name\":\"Your Name\",\"sender_emails\":[\"[email protected]\"]}}"

Setup: Generate App-Specific Password

Outlook/Office 365

"EMAIL_ACCOUNTS_JSON": "{\"outlook\":{\"smtp\":{\"host\":\"smtp-mail.outlook.com\",\"port\":587,\"user\":\"[email protected]\",\"password\":\"your-password\"},\"imap\":{\"host\":\"outlook.office365.com\",\"port\":993,\"user\":\"[email protected]\",\"password\":\"your-password\"},\"default_from_name\":\"Your Name\",\"sender_emails\":[\"[email protected]\"]}}"

Multiple Accounts

"EMAIL_ACCOUNTS_JSON": "{\"work\":{\"smtp\":{\"host\":\"smtp.gmail.com\",\"port\":587,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.gmail.com\",\"port\":993,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"default_from_name\":\"John Doe\"},\"personal\":{\"smtp\":{\"host\":\"smtp.mail.me.com\",\"port\":587,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"imap\":{\"host\":\"imap.mail.me.com\",\"port\":993,\"user\":\"[email protected]\",\"password\":\"app-password\"},\"default_from_name\":\"John\"}}",
"DEFAULT_EMAIL_ACCOUNT": "work"

The server also accepts flat or single-account environment variables. For compatibility, SMTP_USERNAME/SMTP_PASSWORD are aliases for SMTP_USER/SMTP_PASS, IMAP_USERNAME/IMAP_PASSWORD are aliases for IMAP_USER/IMAP_PASS, and IMAP_USER/IMAP_PASS fall back to the SMTP credentials when omitted.

Available Tools

| Tool | Description | |------|-------------| | emails_find | Search emails with flexible filters (sender, subject, date, attachments, etc.) | | emails_modify | Mark as read/unread, flag, archive, or move emails | | email_send | Send new emails with HTML content and attachments | | email_respond | Reply or forward emails with proper threading | | folders_list | List all available email folders |

Usage Examples

Ask Claude to:

  • "Find unread emails from last week"
  • "Send an email to [email protected] about the meeting"
  • "Reply to the last email from Sarah"
  • "Archive all emails older than 30 days"
  • "List my email folders"
  • "Find emails with attachments from my boss"
  • "Mark all emails from [email protected] as read"

Security Notes

  • Never commit .env files or credentials to version control
  • Use app-specific passwords or app passwords, not your main account password
  • The server runs locally on your machine - credentials stay private
  • All email connections use TLS encryption (ports 587 for SMTP, 993 for IMAP)

Development

# Clone the repository
git clone https://github.com/samihalawa/email-smtp-imap-mcp.git
cd email-smtp-imap-mcp

# Install dependencies
npm install

# Build
npm run build

# Run locally
npm start

Troubleshooting

Authentication Errors

Server Not Starting

  • Verify your configuration JSON is properly escaped
  • Check that ports 587 (SMTP) and 993 (IMAP) are not blocked by your firewall
  • Restart Claude Desktop after configuration changes

Connection Issues

  • Confirm your email provider allows IMAP/SMTP access
  • Check your internet connection
  • Verify the SMTP/IMAP host and port settings for your provider

License

MIT License - see LICENSE file for details

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

Sami Halawa - GitHub


Made with ❤️ for the MCP community