gmail-cleanup-mcp
Gmail Cleanup MCP Server
Gmail インボックス整理に特化した Model Context Protocol サーバー — メールのゴミ箱移動、フィルタ管理、配信停止リンクの抽出を行います。読み取り・検索・下書き・送信を担当する Anthropic 組み込みの Gmail コネクタを補完するように設計されています。
dcerniglia/gmail-cleanup-mcp(MIT ライセンス)のパッチ適用フォークです。このフォークは、
search_and_trashとbatch_trash_emailsが失敗を黙って見逃してリトライしなかったバグを修正しています — 50 件の同時ゴミ箱移動リクエストを発火すると Gmail のレート制限に抵触し、バッチの約半数がエラー表示なしで失われる可能性がありました。現在は両ツールともバッチサイズを小さくし、バックオフ、自動リトライを行い、失敗したメッセージごとに実際のエラーを報告します。
ツール
ツール | 説明 |
| 単一のメールをゴミ箱に移動(30 日間の安全ネット) |
| メッセージ ID で最大 500 件のメールをゴミ箱に移動(50 件単位のバッチ処理) |
| Gmail クエリでメールを検索してゴミ箱に移動 — ドライランプレビュー対応 |
| 自動アーカイブ、自動ラベル付け、自動削除、転送を行うフィルタを作成 |
| 条件とアクションを含む既存の Gmail フィルタをすべて一覧表示 |
| ID で Gmail フィルタを削除 |
| メールから |
Related MCP server: Gmail AutoAuth MCP Server
前提条件
Node.js 18+
Gmail API が有効な Google Cloud プロジェクト
OAuth 2.0 認証情報(デスクトップアプリタイプ)
セットアップ
1. Google Cloud OAuth
別の Gmail MCP サーバーで
~/.gmail-mcp/gcp-oauth.keys.jsonをすでにお持ちですか?手順 2 に進んでください — このサーバーは同じ認証情報の場所を使用します。
プロジェクトを作成(または既存のものを再利用)し、Gmail API を有効化
認証情報 → 認証情報を作成 → OAuth クライアント ID に移動
デスクトップアプリを選択し、JSON をダウンロード
~/.gmail-mcp/gcp-oauth.keys.jsonとして保存(またはプロジェクトディレクトリにgcp-oauth.keys.jsonを配置 — 初回実行時に自動的にコピーされます)
2. インストールとビルド
git clone https://github.com/davidcerniglia/gmail-cleanup-mcp.git
cd gmail-cleanup-mcp
npm install
npm run build3. 認証
npm run authGoogle OAuth の同意画面がブラウザで開きます。認証情報は 0600 パーミッション(所有者のみ)で ~/.gmail-mcp/credentials.json に保存されます。
4. Claude Desktop に追加
macOS の ~/Library/Application Support/Claude/claude_desktop_config.json に追加:
{
"mcpServers": {
"gmail-cleanup": {
"command": "node",
"args": ["/absolute/path/to/gmail-cleanup-mcp/dist/index.js"]
}
}
}または Claude Code の場合は、.claude/settings.json に追加:
{
"mcpServers": {
"gmail-cleanup": {
"command": "node",
"args": ["/absolute/path/to/gmail-cleanup-mcp/dist/index.js"]
}
}
}使用例
プロンプト | 動作 |
"6 か月以上前の newsletter@spam.com からのメールをすべてゴミ箱に移動して" | Gmail クエリ構文を使用した |
"ドライランして — LinkedIn からゴミ箱に移動されるものを表示して" |
|
"nextdoor.com からのメールを自動アーカイブするフィルタを作成して" |
|
"そのマーケティングメールに配信停止リンクがあるか確認して" |
|
Claude 組み込みの Gmail との連携
組み込みの Gmail コネクタ | このサーバー | |
検索と読み取り | 対応 | — |
下書きと送信 | 対応 | — |
メールのゴミ箱移動 | — | 対応 |
一括クリーンアップ | — | 対応(最大 500 件/呼び出し) |
フィルタ管理 | — | 対応 |
配信停止情報の抽出 | — | 対応 |
セキュリティ
最小スコープ:
gmail.modify+gmail.settings.basic— ゴミ箱移動とフィルタ操作に必要な最小限削除ではなくゴミ箱移動: すべての削除は Gmail のゴミ箱(30 日間の復元期間)を使用し、完全削除は行いません
ドライランモード:
search_and_trashは実行前に一致をプレビュー可能制限的なファイルパーミッション: 認証情報は
0600(所有者のみ読み書き)で保存添付ファイルの処理なし: パストラバーサルのリスクゼロ
~/.gmail-mcp/の認証情報保存以外のファイルシステムアクセスなし
環境変数
変数 | デフォルト | 説明 |
|
| OAuth クライアントキーのパス |
|
| 保存済み認証情報のパス |
ライセンス
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables comprehensive Gmail management through the Gmail API, including sending/receiving emails, organizing labels and threads, managing drafts, and configuring account settings with secure OAuth2 authentication.641,3981MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail through natural language interactions, supporting email operations (send, read, search, draft), comprehensive attachment handling (send, receive, download), label management, filters, and batch operations with automatic OAuth2 authentication.192MIT
- AlicenseNot gradedqualityFmaintenanceProvides comprehensive Gmail integration with 25+ tools for intelligent email management, including AI-powered categorization, advanced search and filtering, automated archiving and cleanup, analytics, and secure OAuth2 authentication.1922MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail through natural language, supporting operations like sending, searching, and reading emails. It includes comprehensive label management, batch processing, and a streamlined OAuth2 auto-authentication flow.MIT
Related MCP Connectors
Manage Gmail end-to-end: search, read, send, draft, label, and organize threads. Automate workflow…
Manage Gmail messages, threads, labels, drafts, and settings from your workflows. Send and organiz…
AI email automation, follow-ups, training, previews, and mailbox troubleshooting.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/adityai4/gmail-cleanup-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server