CD

cunicopia-dev/gmail-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

6 stars 4 forks 质量 79 趋势 34MIT

Multi-account Gmail MCP server — unified search/read/draft/labels across N Google accounts. Read + draft only by design (prompt-injection resistant).

概览

Most Gmail integrations — including the native connectors — bind a single account per OAuth grant: connect a second inbox and you disconnect the first. gmail-mcp keeps any number of accounts authorized at once. One Google Cloud client authorizes them all, each lands as a row in a local SQLite file, and every tool takes an account argument that routes to the right mailbox. search_all_accounts sweeps all of them in a single query. Python 3.12+ · MIT · stdio MCP server + auth CLI · local SQLite token store It's built to be : runs in-process over stdio, stores tokens in one SQLite file you can inspect, copy, or delete, talks only to Google and your MCP client, and hardcodes no secrets. It reads, searches, drafts, and labels. It doesn't send — create_draft leaves a draft for you to send yourself. That's a deliberate default (reasoning in Security model), not a hard stance; if you want autonomous send, it's a small addition or a different server. Authorize N accounts once via the CLI.

README

以下为原文 README 节选,完整内容请查看原文。

gmail-mcp

An MCP server that reads across all your Gmail accounts from one connection.

Most Gmail integrations — including the native connectors — bind a single account per OAuth grant: connect a second inbox and you disconnect the first. gmail-mcp keeps any number of accounts authorized at once. One Google Cloud client authorizes them all, each lands as a row in a local SQLite file, and every tool takes an account argument that routes to the right mailbox. search_all_accounts sweeps all of them in a single query.

Python 3.12+ · MIT · stdio MCP server + auth CLI · local SQLite token store

It’s built to be owned completely: runs in-process over stdio, stores tokens in one SQLite file you can inspect, copy, or delete, talks only to Google and your MCP client, and hardcodes no secrets.

It reads, searches, drafts, and labels. It doesn’t send — create_draft leaves a draft for you to send yourself. That’s a deliberate default (reasoning in Security model), not a hard stance; if you want autonomous send, it’s a small addition or a different server.


Contents


The idea in 30 seconds

Authorize N accounts once via the CLI. Then every tool takes an account, and search_all_accounts hits all of them at once:

search_all_accounts(query="invoice newer_than:30d")

  ── [email protected] ───────────────────────────────
  from: [email protected]    subject: Invoice #4821    (id 18f...)

  ── [email protected] ─────────────────────────────────
  from: [email protected]        subject: March invoice     (id 19a...)

One query, every inbox, each result tagged with its account and carrying the message id — so the agent can chain read_message(account, id) or create_draft(...) next.


Design notes

One OAuth client, many inboxes. A single Google Cloud project and one

在 GitHub 查看完整 README

安装

uvx multi-account-gmail-mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "gmail": { "command": "/path/to/gmail-mcp/.venv/bin/gmail-mcp" } } }