
mail-index
io.github.alunsoldantarctica由 GitHub 账号 alunsoldantarctica 发布v1.0.0更新于 Nov 3, 2026
Local-first, read-only MCP server for recall over your Gmail: search, contacts, threads, digests.
概览
本地优先、默认只读的 MCP 服务器,在你自己的机器上为 Gmail 建立索引,让助手能搜索、总结并回忆整个邮箱。
- 可以做什么
- 在本地索引上搜索与回忆邮件,用排序后的摘要片段回答模糊问题
- 读取单封邮件、会话与联系人,并遍历联系人、域名和会话构成的通信图谱
- 生成摘要与「补进度」汇总,每个响应带新鲜度信息,读到过期数据会自动后台同步
- 在明确开启写入授权后,可选地归档邮件以及添加或移除标签
- 通过命令行执行同步、信息补全、图谱构建、策展、压缩与状态查询
- 适用场景
- 适合让助手跨整个 Gmail 邮箱回答问题,例如购物、收据、预订、谁说过什么、快速补进度,而不是逐条发出精确的 Gmail 搜索查询。也适合希望邮件索引留在本机的人。
- 运行要求
- 通过 npx 以 stdio 在本地运行,需要 Node 24+ 和一个 Gmail MailSource 适配器(推荐 gog,或 gws)。读取 Gmail 需要 Google OAuth 客户端:可使用厂商的 beta 客户端(需申请名额),或自备 Google Cloud 客户端。使用 MCP 服务器前必须先连接并同步邮箱。可选的远程模式需在你自己的 Cloudflare 账户部署 Worker。
安装
在 SourceWeft 中
- 打开 控制台中的 mail-index,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
mail-index
[npm version] [npm downloads] [GitHub stars] [GitHub forks] [CI] [License: MIT] [Node] [deps]
mail-index downloads a preview of your whole inbox to your machine, then smartly fetches the full text of the messages that matter as you use it. That local index lets your AI agent run true summarization and recall over your entire mailbox — instead of being trapped behind Gmail's search bar.
It works through a local MCP server, so any agent (Claude, Codex, any MCP
client) can query it. Local-first — the default index never leaves your machine.
Operators who need an always-on connector can instead deploy the optional,
single-tenant remote Worker Deployment in their own
Cloudflare account; mail-index operates no hosting service.
Read-only by default — it never mutates your mail unless you explicitly opt
into archive + label edits (a gmail.modify re-auth) or, on the remote
Deployment, drafts (a gmail.compose re-auth). It never sends or deletes mail.
Both opt-in scopes can send at the token level, so that guarantee is enforced in
code (a send guard on the Gmail runner plus test/drafts.test.ts), not by the
scope. See ADR-0007 and
ADR-0011.
[Claude answering a vague inbox question through the mail-index MCP server, locally, with zero network calls]
Ask a vague question → one local MCP call → ranked, snippet-first answer.
Interactive version →
Status: v1.5 — published. Progressive sync, the correspondence graph, the interest engine, curation, the full MCP surface, and the write-back loops are built and tested — and
mail-indexis live on npm with a.mcpbbundle. Still in progress: the bundled Option A OAuth client and signed one-click installers. Architecture lives in docs/PLAN.md; start with docs/INSTALL.md; every release is recorded in CHANGELOG.md.
[!TIP] New in v1.5 — the optional remote Deployment. mail-index can now also run as a single-tenant Cloudflare Worker in your own account: always-on, synced on a cron, and reachable by remote agents over authenticated MCP (plus a small A2A surface). It serves the same tool registry as the local server, backed by a D1 storage driver that passes the same FTS ranking conformance suite, and it can push — Trigger rules match new mail as it lands and fire signed webhooks. Long O(N) work becomes a queued Job instead of a command handback. You can seed a fresh Deployment straight from your existing local index with
mail-index export→ D1 import, so it starts with your history already indexed. The local CLI + stdio path is unchanged and stays the default, and mail-index still operates no hosting service — the Worker is code you deploy to infrastructure you own. See docs/INSTALL-worker.md, docs/WORKER-SEED.md, ADR-0008.Also new locally: every MCP response carries a freshness block and any stale read now auto-triggers a background sync (previously only the digest composites did).
[!TIP] From v1.4 — opt-in mailbox writes + human-readable labels. mail-index can archive a message and edit its labels directly on Gmail — via the
archive/labelCLI commands and thearchive_message/modify_labelsMCP tools, on both the gog and gws adapters. It stays read-only by default: writes are unreachable until you opt in with agmail.modifygrant (mail-index never sends or deletes; the scope could send, so a code guard enforces this, see ADR-0011) — enable per account withmail-index setup --account <email> --enable-writesor the bundledscripts/enable-writes.sh. Labels render as their human names everywhere (the index caches Gmail's label catalogue and resolvesLabel_3546…→ "Expedition Insure" in both directions), and you can pass a friendly label name tolabel --add/--remove. See ADR-0007.
How it works
- Progressive sync — metadata for the whole mailbox in minutes; bodies fetched selectively.
- Graph — contacts, domains, threads; centrality + communities over your human (non-bulk) mail.
- Interest — an engagement score per contact from read/reply/star/importance signals. A seed for your curation, not an autonomous decision.
- Curate — you (via your agent, or a CLI wizard) confirm who/what matters; that profile drives which bodies get fetched.
- Query — your agent searches, traverses the graph, and reads the messages that matter, all locally via MCP.
[mail-index prewarms a local SQLite index with the important messages, then the MCP server serves the agent from it, fetching from Gmail again only on a miss]
Important messages prewarm a local index; the MCP reads from it, touching
Gmail again only when a needed body isn't there yet.
Interactive version →
Quick start
Requires Node 24+ and a Gmail MailSource adapter — gog (recommended)
or gws. Reading Gmail needs a Google OAuth client, and you get one two
ways: use the mail-index beta client (skip Google Cloud entirely;
request access
to join the ~100-user test list) or bring your own Google Cloud client (no
cap, no request — we walk you through it). See
docs/INSTALL.md §2
and docs/oauth-and-verification.md.
(Prefer source? git clone …, pnpm install && pnpm build, then run the bins
as node dist/cli/index.js ….)
Add to Claude
The MCP server registers in one step, but it still needs a mailbox connected
first (see the walkthrough). A .mcpb/claude mcp add only adds the server —
it doesn't install the adapter, sign you in, or sync.
- Claude Code:
claude mcp add --transport stdio mail-index -- npx -y -p mail-index mail-index-mcp(on Windows, prefix withcmd /c:… -- cmd /c npx -y -p mail-index mail-index-mcp— barenpx/.cmdwon't spawn. See docs/INSTALL.md §7.) - Any MCP client (manual):
- Claude Desktop: download the
.mcpbbundle and double-click it (unsigned during beta — you may need to allow it in System Settings / Windows SmartScreen). The bundle is self-contained (ships its own dependencies, run by Claude Desktop's bundled Node — no npx, network, or system Node needed) so it installs identically on Windows/macOS/Linux. A signed all-in-one installer that also installs the adapter, signs you in, and syncs is still in progress; there is noclaude://install link.
Teach your agent the common moves. The MCP server already tells the agent when to reach for it (purchases, receipts, bookings, "who said what", "catch me up"), and the repo ships a Claude Agent Skill with the typical recipes (find purchases, catch up, find a contact's mail, summarize a sender). Drop it in for Claude Code/Desktop:
Full walkthrough (auth, curation, enrichment, scheduled sync, desktop-app gotchas) → docs/INSTALL.md. Driving setup with an agent → docs/agent-install.md.
What to expect — time & storage
The index keeps metadata for every message and full text only where it earns it,
so it grows with message count, not mailbox size — about 1.5% of your Gmail.
First sync runs ~50 messages/min (one-time, incremental after); search is instant.
Start with --since 1mo for value in minutes, then expand. Sizing table & growth
path → docs/INSTALL.md §9.
Why it's lighter than Gmail search
Stock Gmail-API MCPs are query-based lookup tools — exact query, a network round-trip per call, raw payloads dumped into the model's context. mail-index answers vague questions from a local recall index. Across a 100-question suite on a real mailbox it answered every question for 15× fewer tokens — and the gap widens exactly where a query-based MCP has no primitive at all: summarizing, relationships, and commitments.
Per-category tables, the read-one-message comparison, the tool-by-tool landscape, and how to reproduce it all → docs/COMPARISON.md.
Stack
TypeScript · node:sqlite (no native deps) · SQLite FTS5 · Graphology ·
@modelcontextprotocol/sdk. Node 24+. Pluggable MailSource adapters; ships two
Gmail transports — gog (recommended) and
Google's gws.
CLI
Two bins ship: mail-index (CLI) and mail-index-mcp (the stdio MCP server).
Writes are off by default. Enable archive + label edits for an account with
mail-index setup --account <email> --enable-writes (or the bundled
scripts/enable-writes.sh <email>), a gmail.modify grant. On the remote
Deployment, create_draft is a third opt-in writer, enabled with a separate
gmail.compose grant (&drafts=1). Both scopes can send at the token level;
mail-index never sends or deletes because the Gmail runner refuses send paths
and test/drafts.test.ts fails CI on any new one. See
ADR-0007 and
ADR-0011.
Documentation
- docs/INSTALL.md — generic onboarding (install, authenticate a MailSource, init, sync, curate, enrich, add the MCP server, scheduled-sync snippet).
- docs/MCP.md — the 18-tool MCP reference for agent
integrators: args, compact result shapes, the
index_as_offreshness + command-handback contracts. - docs/ADAPTERS.md — the
MailSourcecontract and how to write + contract-test a new adapter (gws,gog,gmail-rest). - docs/INSTALL-worker.md — deploy the optional single-tenant remote Worker to your own Cloudflare account: D1 / Queue / KV resources, secrets, the operator allowlist, connecting an agent, and a verification checklist.
- docs/STAFF-SENT-EVIDENCE.md — disabled private fresh SENT-evidence service, caller/grant fences, and activation prerequisites.
- docs/WORKER-SEED.md — seed a fresh Deployment's D1
from an existing local index (
mail-index export→ import), instead of re-syncing the whole mailbox from Gmail. - docs/PLAN-worker.md — the remote-Deployment design: locked decisions, milestones, and the local↔remote parity constraints.
- CHANGELOG.md — what changed in every released version.
- docs/PLAN.md — architecture, data model, and the key decisions (ADR digest).
- SECURITY.md + docs/THREAT-MODEL.md
— privacy posture, trust boundaries, prompt-injection stance, and a
"verify our claims yourself" runbook. The local-only promise is enforced in CI
by an egress guard test — the core (
src/) makes no network calls; the one exception is the opt-out launch-shim self-updater (bin/selfupdate.mjs, throttled npm-version check,MAIL_INDEX_NO_AUTOUPDATE=1to disable), audited by the same guard.
About
Built by Unsold Group — a travel & insurtech company building the groundwork to operate as an AI-native business: local-first, agent-native infrastructure that gives AI real, queryable context to work from. mail-index is one piece of that — giving agents durable memory of a mailbox without handing them the keys to it.
More: unsold.group/al
Project growth
Feedback & contact
There's no telemetry in the local install. A self-hosted remote Deployment
sends tool-usage metadata (never arguments or results) only if its operator sets
POSTHOG_PROJECT_TOKEN (INSTALL-worker.md). We only
know what you tell us, so feedback is genuinely welcome:
- 💬 Discussions — questions, ideas, how you use it
- 🐞 Report a bug · 💡 Request a feature
- 🔒 Security/privacy issues → SECURITY.md (private)
- 🌐 unsold.group/al
Inside your agent you can also just say "report a mail-index bug" — the MCP server points the agent to a GitHub link for you to submit (it never sends anything itself). See SUPPORT.md.
License
来源:README.md,提交 ad9e036
工具
0版本历史
1- v1.0.0最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分

