@diskd-ai/email-client-mcp

中文文档
0.1.51发布于 2026/09/14LGPL-3.0-or-laterTypeScriptES Module构建来源已验证近 30 天下载 6489

Drive-backed multi-account email MCP with reliable IMAP-to-mailboxes sync.

原始使用文档
文档目录7 节
  1. Install
  2. Tools
  3. Watcher reliability
  4. Configuration
  5. Development
  6. Releasing
  7. License

Email Client MCP

Multi-account email MCP server with reliable IMAP-to-mailboxes sync into a Drive-backed messagesStore (@diskd-ai/sdk). Read tools hit IMAP live; the watcher mirrors every configured account into the workspace store on an interval (>= 60s).

Address: end:comm/email-client-mcp.

Install

npx -y @diskd-ai/email-client-mcp stdio

The server speaks Model Context Protocol over stdio. JSON-RPC on stdout; logs to stderr.

Tools

All read tools fetch from IMAP live (BODY.PEEK, never silently flips \Seen):

  • list_accounts -- enumerate configured accounts (config-only; no IMAP).
  • list_mailbox_folder -- folders for an account, with optional unread counts and special-use flags.
  • find_mailbox_folder -- resolve real folders containing a given Message-Id (use before move_email for Gmail virtuals).
  • list_emails -- paginated metadata listing with filters (unread, flagged, from/to/subject, since).
  • get_email -- single message by UID. Formats: raw, text (HTML stripped), stripped (also drops quoted replies + signatures). markRead=true opt-in.
  • get_emails -- bulk variant of get_email (max 20).
  • move_email -- IMAP MOVE between folders. Refuses virtual mailboxes (e.g. [Gmail]/All Mail).
  • set_email_attributes -- set read/unread and flagged/unflagged state for IMAP messages, then patch the Drive mirror.
  • bulk_action -- mark_read | mark_unread | flag | unflag | move | delete over up to 100 UIDs.
  • get_watcher_status -- in-memory snapshot of the sync watcher.

Watcher reliability

The watcher synchronizes IMAP into the workspace messagesStore on every tick. Invariants:

  1. lastSyncedUid advances only after a successful idempotent upsertBatch.
  2. externalId = "${UIDVALIDITY}:${UID}" so a UIDVALIDITY rollover never collides with the previous generation.
  3. UIDVALIDITY mismatch on a folder triggers a clean drop + resync.
  4. Per-account in-flight lock: an overlapping tick is skipped, never queued.
  5. Folder metadata is the durable checkpoint -- restart resumes from there, never from in-memory state.
  6. Folders deleted in IMAP are pruned from Drive at the end of a tick.
  7. Sliding-window flag reconciliation bounds drift to flag_reconcile_window UIDs per tick.
  8. One rotating maintenance folder per tick prunes Drive messages that moved or disappeared in IMAP.

Tick interval is clamped to >= 60s.

Configuration

Default path: ~/.config/email-client-mcp/config.toml (override via EMAIL_CLIENT_MCP_CONFIG). When deployed by mcp-hub the file is mounted by the diskd-ai/email-client-mcp vault assembler.

[sdk]
api_key = "..."
base_url = "https://apis.example/"
# workspace_id falls back to MCP_HUB_WORKSPACE_ID env when omitted.

[watcher]
enabled = true
interval_ms = 60000
flag_reconcile_window = 500
# folders = ["INBOX", "Sent"]   # optional allowlist; empty = all

[[accounts]]
name = "work"
email = "[email protected]"
full_name = "You"
password = "..."

[accounts.imap]
host = "imap.example.com"
port = 993
tls = true
verify_ssl = false

For Gmail OAuth accounts, replace the password field with an [accounts.oauth2] block:

[[accounts]]
name = "gmail-work"
email = "[email protected]"
full_name = "You"

[accounts.oauth2]
provider = "google"
client_id = "..."
client_secret = "..."
refresh_token = "..."

[accounts.imap]
host = "imap.gmail.com"
port = 993
tls = true
verify_ssl = false

Development

bun install
bun run typecheck
bun run lint
bun run test          # vitest unit tests
bun run build         # tsc -> dist/
bun run start         # node dist/server.js stdio (needs config TOML)
bun run dev           # tsx src/server.ts stdio (live reload)

# stdio smoke test (initialize + tools/list + tool calls):
node scripts/smoke.mjs

Releasing

Auto-publish via .github/workflows/release.yml:

  • Tag-driven (preferred): npm version patch && git push --follow-tags from main; the v*.*.* tag triggers the workflow which typechecks, lints, tests, builds, and npm publishes.
  • One-click: in the GitHub Actions UI run the Release workflow with bump = patch | minor | major. The job bumps package.json, commits, tags, pushes, and publishes -- all in one job.

Both paths run bun install --frozen-lockfile, bun run typecheck, bun run lint, bun run test, and bun run build before publishing, with provenance attestation enabled.

Required repo secret:

SecretPurpose
NPM_TOKENnpmjs.com granular token, scope @diskd-ai/*, Bypass 2FA enabled.

License

LGPL-3.0-or-later. See LICENSE.

版本与发布记录

@diskd-ai/email-client-mcp 共发布 47 个版本,首次发布于 2026/04/29;过去 12 个月发布了 47 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.1.51latest2026/09/141 个月前
0.1.502026/08/312 个月前
0.1.492026/08/312 个月前
0.1.482026/08/302 个月前
0.1.472026/08/302 个月前
0.1.462026/08/302 个月前

关于 @diskd-ai/email-client-mcp 的常见问题

@diskd-ai/email-client-mcp 是什么?

Drive-backed multi-account email MCP with reliable IMAP-to-mailboxes sync.

如何安装 @diskd-ai/email-client-mcp?

在项目目录运行 npm install @diskd-ai/email-client-mcp,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 email-client-mcp,可以用 npx email-client-mcp 直接运行。

@diskd-ai/email-client-mcp 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@diskd-ai/email-client-mcp 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@diskd-ai/email-client-mcp 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=24.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@diskd-ai/email-client-mcp 可以商用吗?

@diskd-ai/email-client-mcp 使用 LGPL-3.0-or-later 许可。弱 Copyleft:作为库被调用时通常不要求开源你自己的代码,但修改库本身需以 LGPL 开源;前端打包合并后的适用边界存在不同理解。以上为概括,不构成法律意见,请以许可原文为准。

@diskd-ai/email-client-mcp 的下载量有多少?

根据 npm 官方下载统计,@diskd-ai/email-client-mcp 在 2026/10/13 – 2026/11/11 这 30 天内被下载 6,489 次,日均约 216 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@diskd-ai/email-client-mcp 还在维护吗?

最新版本 0.1.51 发布于 2026/09/14(1 个月前);至今共发布 47 个版本,其中过去 12 个月发布了 47 个;首次发布于 2026/04/29。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。