gmail-mcp
Multi-account Gmail MCP server for reading threads, managing labels, and creating drafts across multiple Gmail accounts.
README
gmail-mcp — multi-account Gmail MCP server
One local MCP server that serves several Gmail accounts, each under a short
alias (alice-work, bob-work, ...). Every tool takes an account
parameter, and the GMAIL_ACCOUNTS env var restricts a server instance to a
subset of accounts — so each Cowork workstream sees only its own two inboxes.
Capabilities: search/read threads, manage labels, create drafts.
Deliberately absent: sending. There is no send tool, so no agent connected
to this server can send mail — a human reviews drafts and sends from Gmail.
(Note: the underlying OAuth scope gmail.modify would technically allow
sending; the restriction is enforced by this server's tool surface, not by
Google. Don't point other software at the stored tokens.)
1. Google Cloud setup (once, ~5 minutes)
- Go to https://console.cloud.google.com/ and create a project (any name,
e.g.
gmail-mcp). - APIs & Services → Library → search "Gmail API" → Enable.
- APIs & Services → OAuth consent screen:
- User type: External, fill in the app name + your email.
- Under Audience / Test users, add all four Gmail addresses. (In Testing mode only listed test users can authorize — that's fine, and you skip Google's app verification entirely.)
- APIs & Services → Credentials → Create credentials → OAuth client ID:
- Application type: Desktop app.
- Download the JSON and save it as
~/.gmail-mcp/credentials.json.
Heads-up: in Testing mode Google expires refresh tokens after 7 days unless the consent screen is published. After everything works, go back to the consent screen and click Publish app (you can ignore the verification warning for personal use) so tokens stop expiring weekly.
2. Authorize each account (once per account)
uv run gmail-mcp auth alice-work # browser opens; sign in as that account
uv run gmail-mcp auth alice-personal
uv run gmail-mcp auth bob-work # the other person signs in here
uv run gmail-mcp auth bob-personal
uv run gmail-mcp accounts # verify: alias -> email [ok]
Sign in with the matching Google account each time — the alias is whatever
you type, so double-check the account picker. Tokens land in
~/.gmail-mcp/tokens/, readable only by your macOS user.
3. Wire into Claude — one server entry per workstream
Register the same server twice with different GMAIL_ACCOUNTS, then enable
the matching one in each workstream/session.
Claude Desktop / Cowork (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"gmail-stream-a": {
"command": "uv",
"args": ["run", "--project", "/path/to/gmail-mcp", "gmail-mcp", "serve"],
"env": { "GMAIL_ACCOUNTS": "alice-work,bob-work" }
},
"gmail-stream-b": {
"command": "uv",
"args": ["run", "--project", "/path/to/gmail-mcp", "gmail-mcp", "serve"],
"env": { "GMAIL_ACCOUNTS": "alice-personal,bob-personal" }
}
}
}
Claude Code, per workstream folder (or with claude mcp add), in
.mcp.json:
{
"mcpServers": {
"gmail": {
"command": "uv",
"args": ["run", "--project", "/path/to/gmail-mcp", "gmail-mcp", "serve"],
"env": { "GMAIL_ACCOUNTS": "alice-work,bob-work" }
}
}
}
If uv isn't on the app's PATH, use its absolute path (which uv).
Tools
| Tool | What it does |
|---|---|
list_accounts |
Aliases + emails this instance serves |
search_threads |
Gmail query syntax (from:, newer_than:7d, ...) |
get_thread |
Full thread with decoded message bodies |
list_labels / create_label |
Labels, incl. nested Clients/Acme |
modify_thread_labels |
Add/remove by name or ID; archive = remove INBOX |
create_draft |
New draft or threaded reply (reply_to_thread_id) |
list_drafts |
Existing drafts |
Layout
~/.gmail-mcp/credentials.json— OAuth client secret (shared by all accounts)~/.gmail-mcp/accounts.json— alias → email registry~/.gmail-mcp/tokens/<alias>.json— per-account tokensGMAIL_MCP_HOMEoverrides the config dir;GMAIL_ACCOUNTSrestricts visible accounts
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。