Skip to main content
Glama
Tencent Mail Agent MCP Server

Tencent Mail Agent MCP Server

by wuenhouse
README.md
# Tencent Mail Agent MCP Server

這是一個基於 Model Context Protocol (MCP) 的伺服器,提供從 騰訊企業郵 (Tencent Exmail) 或任何支援 IMAP 協定的郵件服務中獲取並分析郵件的工具。此伺服器旨在與 Claude Desktop 等 MCP 客戶端配合使用。

## 功能特點

- **list_yesterday_emails**: 獲取昨天的郵件。
  - 自動依據日期範圍過濾(SINCE 昨天, BEFORE 今天)。
  - 回傳的 metadata 包含:UID、寄件者 (From)、主旨 (Subject)、日期 (Date) 以及內文片段 (snippet,前 500 個字元)。
  - 效能優化:預設限制獲取最新的 100 封郵件(可設定)。

## 前置需求

- [Node.js](https://nodejs.org/) (建議 v18 或更高版本)
- [npm](https://www.npmjs.com/)
- 騰訊企業郵帳號或任何 IMAP 帳號。

## 安裝步驟

1. 複製專案庫:
   ```bash
   git clone <repository-url>
   cd mail-agent-mcp
   ```

2. 安裝依賴套件:
   ```bash
   npm install
   ```

3. 編譯專案:
   ```bash
   npm run build
   ```

## 設定方法

1. 將 `.env.example` 複製並重新命名為 `.env`:
   ```bash
   cp .env.example .env
   ```

2. 編輯 `.env` 並提供您的郵件登入資訊:
   ```env
   EMAIL_USER=your-email@example.com
   EMAIL_PASSWORD=your-app-password
   EMAIL_HOST=imap.exmail.qq.com
   EMAIL_PORT=993
   ```
   > [!NOTE]
   > 對於騰訊企業郵,如果您啟用了兩階段驗證 (2FA),則需要使用 **應用專用密碼 (App Password)**。

## 使用方法

### 開發模式 (Development Mode)
```bash
npm run dev
```

### 正式模式 (Production Mode)
```bash
npm start
```

## 整合至 Claude Desktop

若要將此伺服器加入 Claude Desktop,請在您的 `claude_desktop_config.json` 中新增以下設定:

```json
{
  "mcpServers": {
    "mail-agent": {
      "command": "node",
      "args": ["/絕對路徑/至/mail-agent-mcp/dist/index.js"],
      "env": {
        "EMAIL_USER": "your-email@example.com",
        "EMAIL_PASSWORD": "your-app-password",
        "EMAIL_HOST": "imap.exmail.qq.com",
        "EMAIL_PORT": "993"
      }
    }
  }
}
```

## 授權條款 (License)

ISC

TDQS

A3.6/5.0

Scored across 1 tool

Disambiguation5/5

With only one tool, there is no possibility of confusion or overlap. The tool's purpose is singular and clear.

Naming Consistency5/5

The single tool name 'list_yesterday_emails' follows a clear verb_noun pattern and is descriptive. Consistency is trivially maintained.

Tool Count3/5

One tool feels thin for a mail server, but it is not entirely trivial—it does one specific task. The count is borderline and could be part of a larger intended set.

Completeness1/5

The server appears to be for email management, yet it only lists yesterday's emails. Missing send, read, search, and other lifecycle operations represent severe gaps for the domain.