Skip to main content
Glama
contributory

email-mcp

by contributory

✉️ Mail MCP — Xem & Gửi Email qua MCP Server

Ứng dụng email đầy đủ: MCP server (chuẩn Model Context Protocol) để xem/gửi email qua IMAP/SMTP + Web UI hiện đại để dùng trên trình duyệt. Web UI gọi MCP server qua in-memory MCP client, và cùng MCP server đó có thể kết nối với Claude Desktop, VS Code Copilot, hay bất kỳ MCP client nào qua stdio.

✨ Tính năng

MCP Server (6 tools)

Tool

Mô tả

list_emails

Liệt kê email (thư mục, giới hạn, từ ngày) kèm đoạn trích nội dung

read_email

Đọc chi tiết email: text/HTML, CC/BCC, danh sách file đính kèm

search_emails

Tìm kiếm theo người gửi / người nhận / tiêu đề / nội dung

send_email

Gửi email qua SMTP (To/Cc/Bcc, HTML, đính kèm base64)

get_attachment

Tải nội dung file đính kèm (base64)

get_account_info

Thông tin tài khoản + danh sách thư mục & số chưa đọc

mark_email_read

Đánh dấu đã đọc / chưa đọc

Web UI (Vietnamese)

  • 📥 Inbox 3 cột: thư mục + danh sách email + khung đọc, dark/light mode tự động

  • 📖 Đọc email: render HTML an toàn (sanitize XSS), text/plain, tải file đính kèm

  • ✍️ Soạn email: editor định dạng (B/I/U/list/trích dẫn/link), đính kèm file, reply/reply-all/forward

  • 🔍 Tìm kiếm với debounce, đánh dấu đã đọc tự động

  • ⚙️ Cài đặt tài khoản trực quan trên UI + kiểm tra kết nối

Related MCP server: Email MCP Server

🚀 Cài đặt

npm install
npm run build

▶️ Chạy

1. Web UI (kèm MCP server nội bộ)

npm start            # hoặc: npm run dev (hot reload)
# Mở http://localhost:3000 — lần đầu sẽ tự mở hộp thoại cấu hình tài khoản

2. MCP server qua stdio (cho Claude Desktop, VS Code Copilot…)

npm run mcp          # hoặc: node dist/index.js

Ví dụ cấu hình claude_desktop_config.json:

{
  "mcpServers": {
    "email-mcp": {
      "command": "node",
      "args": ["/duong/dan/tuyet-doi/to/email-mcp/dist/index.js"]
    }
  }
}

Hoặc cài toàn cục: npm link rồi dùng mcp-email.

⚙️ Cấu hình tài khoản

Có 2 cách (cách sau ghi đè cách trước):

  1. File .env — copy từ .env.example và điền thông tin

  2. Web UI → Cài đặt — lưu vào settings store (xem bên dưới)

Biến

Mô tả

Mặc định

IMAP_HOST / IMAP_PORT / IMAP_SECURE

Máy chủ IMAP

imap.gmail.com / 993 / true

IMAP_USER / IMAP_PASSWORD

Tài khoản IMAP

SMTP_HOST / SMTP_PORT / SMTP_SECURE

Máy chủ SMTP

smtp.gmail.com / 465 / true

SMTP_USER / SMTP_PASSWORD / SMTP_FROM

Tài khoản SMTP & địa chỉ From

= IMAP

PORT

Cổng Web UI

3000

SETTINGS_FILE

Đường dẫn file cài đặt (Node)

.mail-settings.json

💡 Gmail: bật 2 bước xác minh rồi tạo App password tại myaccount.google.com/apppasswords — không dùng mật khẩu đăng nhập thường.

Nơi lưu cài đặt (settings store) — tự chọn backend

src/config.ts tự động chọn nơi lưu theo môi trường chạy:

Môi trường

Backend

Chi tiết

Node.js local / MCP stdio

File fs

.mail-settings.json trong thư mục dự án (đổi qua SETTINGS_FILE)

EdgeOne Pages

KV binding my_kv

Key mail-mcp:settings — không cần filesystem

EdgeOne không cho ghi filesystem nên khi chạy trên EdgeOne, cấu hình KV binding my_kv trong dashboard EdgeOne Pages → cài đặt lưu vào KV, tự động dùng khi deploy. Chạy local thì dùng file như cũ — không cần đổi code.

🚀 Deploy lên EdgeOne Pages

npm run deploy        # EdgeOne Pages (đã có sẵn cấu hình deploy)
  1. Tạo KV namespace trong bảng điều khiển EdgeOne và bind tên my_kv vào Pages project

  2. Deploy: thư mục functions/ là entry EdgeOne (functions/index.tsx gọi src/edgeone.ts), public/ là file tĩnh

  3. Cài đặt tài khoản nhập qua Web UI sẽ lưu vào KV; hoặc đặt env vars trên dashboard

🗂️ Cấu trúc dự án

src/
├── config.ts          # Cấu hình env + settings store (tự chọn fs/KV) + mask mật khẩu
├── storage.ts         # Tầng lưu trữ: backend KV (EdgeOne) + backend file (Node)
├── email-service.ts   # Lõi IMAP (imapflow) + SMTP (nodemailer)
├── mcp-server.ts      # MCP server: 7 tools, stdio + in-memory client
├── api-app.ts         # Hono REST API (không phụ thuộc Node — chạy được trên EdgeOne)
├── web-server.ts      # Node web server: SPA + serve static (chỉ dùng local)
├── edgeone.ts         # Entry EdgeOne Functions: KV binding + phục vụ file tĩnh
└── index.ts           # CLI: `mcp-email` (stdio) | `mcp-email web` (port 3000)
public/                # Web UI: index.html + style.css + app.js
functions/             # EdgeOne Pages entry: index.tsx → src/edgeone.ts

🔌 API Web (REST)

Endpoint

Mô tả

GET /api/health

Kiểm tra MCP server

GET /api/account

Tài khoản + thư mục

GET /api/emails?folder=&limit=

Danh sách email

GET /api/emails/:uid?folder=

Chi tiết email

GET /api/emails/:uid/attachment/:partId

Tải file đính kèm

POST /api/emails/:uid/read

Đánh dấu đã đọc

GET /api/search?q=&folder=

Tìm kiếm

POST /api/send

Gửi email

GET/POST /api/settings

Xem / lưu cài đặt (mật khẩu được mask)

🔐 Bảo mật

  • Mật khẩu được mask khi trả về API (********)

  • HTML email được sanitize (chặn script, iframe, on*, javascript:…) trước khi render

  • File .mail-settings.json.env đã được gitignore — mật khẩu lưu dạng văn bản thuần, chỉ dùng cho máy cá nhân; trên EdgeOne cài đặt nằm trong KV my_kv (được bảo vệ bởi quyền truy cập platform)

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    -
    quality
    D
    maintenance
    An MCP server that enables AI models to read, search, and send emails via IMAP and SMTP protocols. It supports various providers like Gmail and Outlook, allowing for tasks such as retrieving unread messages, searching by sender, and managing mailbox folders.
    Last updated
  • A
    license
    -
    quality
    D
    maintenance
    A generic IMAP and SMTP MCP server that enables AI agents to interact with email accounts for reading, searching, and sending messages. It provides high-level tools for managing email workflows like daily digests and folder organization across any standard email provider.
    Last updated
    1
    MIT
  • A
    license
    -
    quality
    B
    maintenance
    MCP server for managing email via IMAP/SMTP, supporting multiple accounts and tools for reading, sending, searching, and organizing emails.
    Last updated
    18
    MIT

View all related MCP servers

Related MCP Connectors

  • Read, search, send, organize, draft and schedule email across your inboxes from any MCP client.

  • Hosted email MCP for AI agents with inboxes, send/receive, memory, recovery, and credits.

  • Shipmail MCP server for AI agent custom-domain email inboxes with REST API and webhooks.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/contributory/email-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server