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

mcp-email

v1.0.0

Published

通用邮箱MCP服务器 - 支持QQ、163、Gmail(由于谷歌政策不支持OAuth2.0,所以无法使用)、Outlook、企业邮箱等多种邮箱服务商的自动配置和邮件发送功能

Readme

📧 通用邮箱 MCP Server

npm version npm downloads License: MIT

一个让AI轻松接管邮箱的通用MCP服务器,基于 Model Context Protocol (MCP) 构建,支持在 MCP-X、Claude Desktop 等 MCP 客户端中使用。

支持多种邮箱服务商自动配置:QQ邮箱、163邮箱、Gmail、Outlook、腾讯企业邮箱、网易企业邮箱、阿里云邮箱、新浪邮箱、搜狐邮箱等。

📦 快速安装

# npm 安装
npm install -g mcp-email

# 使用 npx 运行(推荐)
npx mcp-email

✨ 功能特性

  • 📤 邮件发送: 支持发送HTML和纯文本邮件
  • 👥 多收件人: 支持多个收件人、抄送、密送
  • 📎 附件支持: 支持文件附件和Base64编码内容
  • 🔧 动态配置: 支持运行时配置邮箱服务器
  • 🔍 连接测试: 内置SMTP服务器连接测试
  • 🛡️ 安全认证: 支持微信企业邮箱授权码认证
  • 高性能: 优化的连接超时和重试机制

📚 详细配置指南

项目提供了详细的配置指南,包含各大邮箱服务商的配置说明:

📖 CONFIG_GUIDE.md - 完整配置指南,包含:

  • 📧 163邮箱详细配置教程
  • 🏢 微信企业邮箱配置指南
  • 🌐 QQ邮箱、Gmail等主流邮箱配置
  • 🛠️ 故障排除和常见问题解决

📋 系统要求

  • Node.js 16.x 或更高版本
  • 邮箱账号
  • MCP 客户端 (如 Claude Desktop)

🚀 快速开始

方式一:直接使用npm包(推荐)

1. 安装npm包

# 全局安装
npm install -g mcp-email

# 或本地安装
npm install mcp-email

2. 在MCP客户端中配置

MCP-X 配置示例:

{
  "mcpServers": {
    "universal-email": {
      "command": "npx",
      "args": ["mcp-email"],
      "env": {
        "EMAIL_USER": "[email protected]",
        "EMAIL_PASSWORD": "your-password-or-auth-code",
        "EMAIL_TYPE": "auto"
      }
    }
  }
}

方式二:从源码安装

1. 克隆项目

git clone https://github.com/TimeCyber/email-mcp.git
cd email-mcp

2. 安装依赖

npm install

3. 配置 MCP 客户端(源码安装)

MCP-X 配置:

{
  "mcpServers": {
    "universal-email": {
      "command": "node",
      "args": ["F:\\path\\to\\email-mcp\\index.js"],
      "env": {
        "EMAIL_USER": "[email protected]",
        "EMAIL_PASSWORD": "your-password-or-auth-code",
        "EMAIL_TYPE": "auto"
      }
    }
  }
}

企业邮箱配置:

{
  "mcpServers": {
    "enterprise-email": {
      "command": "node",
      "args": ["F:\\path\\to\\email-mcp\\index.js"],
      "env": {
        "EMAIL_USER": "[email protected]",
        "EMAIL_PASSWORD": "your-enterprise-auth-code",
        "EMAIL_TYPE": "exmail"
      }
    }
  }
}

4. 测试配置

# 测试邮件配置是否成功
node test-auto-config.js

📧 邮箱配置指南

获取授权码

不同邮箱的授权码获取方式:

腾讯企业邮箱:

  1. 访问 企业邮箱管理后台
  2. 进入 "设置""账户""客户端专用密码"
  3. 生成 客户端专用密码 (授权码)
  4. 进入 "设置""收发信设置""设置方法"
  5. 开启 "POP/IMAP/SMTP服务"

QQ邮箱:

  1. 登录QQ邮箱,进入**"设置"** → "账户"
  2. 开启**"POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务"**
  3. 生成授权码

163邮箱:

  1. 登录163邮箱,进入**"设置"** → "POP3/SMTP/IMAP"
  2. 开启**"POP3/SMTP/IMAP服务"**
  3. 设置客户端授权密码

💡 关键提示:

  • 企业邮箱必须设置 EMAIL_TYPE 字段!
  • 个人邮箱可以使用 EMAIL_TYPE: "auto" 自动识别

📖 CONFIG_GUIDE.md - 完整配置指南,包含所有邮箱类型详细说明

🔧 MCP 工具说明

1. send_email - 发送邮件

发送邮件,支持多种格式和收件人。

参数

  • to (必需): 收件人邮箱地址数组
  • subject (必需): 邮件主题
  • text (必需): 纯文本邮件内容
  • cc (可选): 抄送邮箱地址数组
  • bcc (可选): 密送邮箱地址数组
  • html (可选): HTML格式邮件内容
  • attachments (可选): 附件数组

使用示例

基本邮件发送:

{
  "to": ["[email protected]"],
  "subject": "测试邮件",
  "text": "这是一封测试邮件"
}

带抄送和HTML内容:

{
  "to": ["[email protected]", "[email protected]"],
  "cc": ["[email protected]"],
  "subject": "项目报告",
  "text": "请查看项目报告",
  "html": "<h1>项目报告</h1><p>项目进展顺利。</p>"
}

带附件的邮件:

{
  "to": ["[email protected]"],
  "subject": "带附件的邮件",
  "text": "请查看附件",
  "attachments": [
    {
      "filename": "report.pdf",
      "path": "C:\\path\\to\\report.pdf"
    },
    {
      "filename": "data.txt",
      "content": "SGVsbG8gV29ybGQ="
    }
  ]
}

2. get_recent_emails - 获取最近邮件

获取最近几天的邮件列表,自动选择最佳协议(IMAP/POP3)。

参数

  • limit (可选): 返回邮件数量限制,默认20
  • days (可选): 获取最近几天的邮件,默认3天

使用示例

{
  "limit": 10,
  "days": 7
}

3. get_email_content - 获取邮件内容

获取指定邮件的详细内容。

参数

  • uid (必需): 邮件唯一标识符(从邮件列表中获取)

使用示例

{
  "uid": "12345"
}

4. setup_email_account - 设置邮箱账号

自动识别邮箱类型并配置服务器,支持8大邮箱服务商。

参数

  • email (必需): 邮箱地址
  • password (必需): 邮箱密码或授权码
  • provider (可选): 邮箱提供商(手动指定,用于企业邮箱)

支持的邮箱类型

  • qq - QQ邮箱
  • 163 - 网易邮箱
  • gmail - Gmail
  • outlook - Outlook/Hotmail
  • exmail - 腾讯企业邮箱
  • netease-enterprise - 网易企业邮箱
  • aliyun - 阿里云邮箱
  • sina - 新浪邮箱
  • sohu - 搜狐邮箱

使用示例

个人邮箱(自动识别):

{
  "email": "[email protected]",
  "password": "your-auth-code"
}

企业邮箱(手动指定):

{
  "email": "[email protected]",
  "password": "your-enterprise-auth-code",
  "provider": "exmail"
}

5. list_supported_providers - 列出支持的邮箱

查看所有支持的邮箱服务商及其配置信息。

参数

无需参数

使用示例

{}

6. configure_email_server - 手动配置服务器

手动配置邮箱服务器设置(高级用户使用)。

参数

  • user (必需): 邮箱账号
  • password (必需): 邮箱密码或授权码
  • smtpHost (可选): SMTP服务器地址
  • smtpPort (可选): SMTP端口
  • smtpSecure (可选): 是否使用SSL
  • imapHost (可选): IMAP服务器地址
  • imapPort (可选): IMAP端口
  • imapSecure (可选): 是否使用SSL

使用示例

{
  "user": "[email protected]",
  "password": "your-password",
  "smtpHost": "smtp.domain.com",
  "smtpPort": 465,
  "smtpSecure": true
}

7. test_email_connection - 测试连接

测试邮箱服务器连接状态。

参数

  • testType (可选): 测试类型
    • smtp - 仅测试发送服务器
    • imap - 仅测试接收服务器
    • both - 测试全部(默认)

使用示例

{
  "testType": "smtp"
}

📊 支持的邮箱服务商

主流邮箱服务器配置

| 邮箱类型 | SMTP服务器 | SMTP端口 | IMAP服务器 | IMAP端口 | 推荐协议 | |---------|------------|----------|------------|----------|----------| | QQ邮箱 | smtp.qq.com | 587 | imap.qq.com | 993 | IMAP | | 网易邮箱 | smtp.163.com | 465 | imap.163.com | 993 | POP3* | | Gmail* | smtp.gmail.com | 587 | imap.gmail.com | 993 | IMAP | | Outlook | smtp-mail.outlook.com | 587 | outlook.office365.com | 993 | IMAP | | 腾讯企业邮箱 | smtp.exmail.qq.com | 465 | imap.exmail.qq.com | 993 | IMAP |