gmail-mcp-local

gmail-mcp-local

Local-first Gmail MCP server using PKCE + loopback OAuth flow that stores refresh tokens in the OS keychain, enabling secure read/write Gmail access via MCP tools without tokens leaving the device.

Category
访问服务器

README

gmail-mcp-local

local-first node MCP tests license

Your Gmail, inside Claude & Cursor — without handing your inbox to a server.

A local-first MCP server that lets AI assistants (Claude Desktop, Cursor, VS Code, …) search, read, label, draft, and send your Gmail. Your Google login (OAuth refresh token) is stored in your operating system's keychain and never leaves your machine — there is no cloud service in the middle, not even ours.

Why

  • 🔒 Private by design. Mail and tokens stay on your device. There is no server that ever sees your email — so no operator (including us) can read it.
  • 🧩 Cross-client. One install serves Claude Desktop, Cursor, VS Code, Windsurf.
  • 📬 Multi-account. Connect personal + work Gmail, tag them, pick per request.
  • 🛠️ 20 tools. The full read/write/organize Gmail toolkit (below).

Quick start

Prereqs: Node 20+, a desktop MCP client, and a Google Desktop-app OAuth client id + secret (free — 5-minute setup in SETUP_LIVE.md).

npx github:alexpekach/gmail-mcp-local      # or grab the installer from Releases
npm i @napi-rs/keyring                     # OS keychain backend (one time)

Add to your MCP client config (Claude Desktop / Cursor):

{
  "mcpServers": {
    "gmail-local": {
      "command": "node",
      "args": ["<path>/bin/gmail-mcp-local.js"],
      "env": {
        "GMAIL_MCP_CLIENT_ID": "<your-desktop-client-id>.apps.googleusercontent.com",
        "GMAIL_MCP_CLIENT_SECRET": "<non-confidential desktop secret>"
      }
    }
  }
}

Restart the client, then in chat:

connect_account({ ref: "work" })          # opens your browser; token lands in your keychain
search_threads({ account: "work", query: "newer_than:7d has:attachment" })
get_thread({ account: "work", thread_id: "…" })

Prefer a one-click setup? Download the installer from Releases and double-click install.cmd (Windows) or install.command (macOS).

What it can do (20 tools)

Group Tools
Accounts list_accounts · connect_account · remove_account · set_tag
Read search_threads · get_thread · list_labels · list_thread_attachments · get_attachment · check_account_scopes
Write create_draft · send_draft · send_message
Organize label_thread · label_message · create_label · update_label · delete_label · trash_thread · untrash_thread

Privacy & security

  • Tokens in the OS keychain — macOS Keychain / Windows Credential Manager / Linux libsecret. Never written to disk in plaintext; never sent anywhere.
  • PKCE + loopback OAuth (RFC 8252) — a public client; the auth code is exchanged with a one-time verifier, not a network-shared secret.
  • Local execution — the server runs as a subprocess of your MCP client. No telemetry, no remote storage of mail or tokens.
  • Least scope — request only the Gmail scopes you need (read-only by default).
  • Restricted Gmail scopes mean your Google OAuth app must be verified (or in Testing with ≤100 users). See SETUP_LIVE.md.

How it works (30 seconds)

Your client launches gmail-mcp-local as a local stdio subprocess → it runs Google OAuth in your browser → the refresh token is saved to your OS keychain → each tool call mints a short-lived access token and calls the Gmail API directly from your machine. A single tokenFor() chokepoint keeps every tool custody-agnostic, so the same code can later swap to a team/shared backend without touching tool logic.

Develop

npm test     # 82 tests — no network, no browser, no native deps

CommonJS, Node ≥ 20. Issues and PRs welcome.

Status

v0.1.0 — local-first core (20 tools) complete and tested; verified live (read + draft) against real Gmail. Roadmap: re-auth/scope-upgrade UX, signed installers, optional Pro features (shared team mailboxes via a funded backend).

License

MIT © ALEPEK Accounting and Consulting LLC.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选