Gmail MCP

Gmail MCP

Local MCP server providing Gmail tools (search, read, draft, send, trash) via Google's official API, integrated with GitHub Copilot CLI.

Category
访问服务器

README

Gmail MCP

CI

Local Gmail tools for GitHub Copilot CLI, backed by Google's official Gmail API.

This project is a standalone local MCP server, not a Copilot plugin. Copilot starts it as a user-configured stdio process.

[!IMPORTANT] OAuth credentials and direct Gmail API traffic remain on this PC, but email content returned by MCP tools may be sent to GitHub Copilot's hosted model services. Do not use this integration if mailbox content must never leave the computer.

Documentation

Safety model

  • Requests gmail.modify for mailbox actions and gmail.settings.basic for filter management, never the permanent-delete https://mail.google.com/ scope.
  • Sending is draft-first. gmail_send_draft returns a state-bound confirmation token before it can send.
  • Deletion accepts message IDs only and moves them to recoverable Gmail Trash.
  • OAuth refresh tokens are stored in Windows Credential Manager. Access tokens remain in memory.
  • Write tools are marked as mutating/destructive for Copilot confirmations. Keep confirmations enabled and do not use /allow-all with this server.
  • Persistent filters cannot forward mail or automate Trash/Spam actions.
  • Attachment download is explicit, bounded to 25 MiB, writes only to an existing absolute local directory, and never overwrites a file.

Google Cloud setup

See Setup and operations for the complete Google Cloud workflow, including multiple-account selection, test users, scope setup, missing JSON downloads, client-secret compatibility, publishing, and cleanup.

Quick start

git clone https://github.com/Evyatar108/gmail-mcp.git
Set-Location gmail-mcp
.\scripts\setup-copilot.ps1
.\scripts\install-oauth-client.ps1 -Path C:\Downloads\client_secret.json
.\.venv\Scripts\gmail-mcp.exe auth
.\.venv\Scripts\gmail-mcp.exe status

Authorization opens the system browser, requests offline access, verifies the authenticated account and granted scopes, and stores the refresh token in Windows Credential Manager.

setup-copilot.ps1 registers the exact 16-tool allowlist using the cloned repository's absolute executable path and installs the three public safety/setup skills.

The server is non-interactive. If authorization is absent or revoked, Gmail tools return an error directing you to run gmail-mcp auth; the stdio server never launches a browser.

Typical flow

  1. Search: Use gmail_search to find receipts from last month.
  2. Read: Use gmail_get_message for message ID ...
  3. Download: select attachment metadata, then save that exact attachment to an existing absolute directory with gmail_download_attachment.
  4. Draft: Create a draft reply, but do not send it.
  5. Send: call gmail_send_draft without confirmation to receive the exact preview token, review it, then call again with that token.
  6. Trash: call gmail_trash without confirmation to receive the exact preview token, review the listed message IDs, then call again with that token.
  7. Rules: create a label, preview a safe filter, then approve the native destructive-tool prompt before filter creation or deletion.

Gmail Trash retention is time-limited. gmail_untrash works only while Gmail still retains the message.

For complete schemas, limits, and confirmation behavior, see Tool reference.

Credential status and revocation

.\.venv\Scripts\gmail-mcp.exe status
.\.venv\Scripts\gmail-mcp.exe revoke

Revocation removes the Google grant and then deletes the WinVault entry. Already in-flight Google requests cannot be cancelled, and an issued access token may remain accepted briefly after revocation. Each new tool call rechecks WinVault and fails closed once the record is removed or changed.

Development

uv run pytest
uv build

Install or refresh all three public Gmail skills:

.\scripts\install-user-skill.ps1

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选