Integrations
Enables complete email management through Gmail, including sending emails with attachments, reading and searching emails, managing labels and organization, handling drafts, and performing batch operations on multiple emails.
Integrates with Google Cloud for authentication and API access, allowing the MCP server to securely connect to Gmail services through OAuth 2.0 credentials.
Gmail MCP サーバー
Claude AI が Gmail と直接やり取りできるようにする強力な Model Context Protocol (MCP) サーバー。
📖 目次
📋 概要
Gmail MCPサーバーは、ClaudeのようなAIアシスタントが自然言語でGmailと直接やり取りできるようにする包括的な実装です。メール管理のための豊富なツールセットを公開し、会話型AIと受信トレイのシームレスな統合を実現します。
💡主な機能
- 完全なメール管理
- 添付ファイル付きのプレーンテキストおよびHTMLメールを送信する
- 複雑なメッセージ構造を適切に解析してメールを読む
- Gmail の強力なクエリ構文で受信トレイを検索
- 下書きメールの作成と更新
- ラベル、既読/未読ステータス、ゴミ箱を管理する
- 複数のメールに対して一括操作を実行する
- 高度な統合
- async/await パターンを使用した最新の Python コードベース
- 包括的なエラー処理と回復
- 詳細な進捗報告
- 安全なOAuth認証フロー
- 複数のトランスポートモード(STDIOおよびSSE)
- さまざまな展開シナリオのサポート
🚀 クイックスタート
前提条件
- Python 3.8以上
- Gmail API が有効になっている Google Cloud プロジェクト
- Gmail API の OAuth 2.0 認証情報
インストール
- リポジトリをクローンするCopy
- 仮想環境をセットアップするCopy
- 依存関係をインストールするCopy
- Google Cloud と OAuth 認証情報を設定するGoogle Cloud Consoleにアクセスして次の操作を行います。
- 新しいプロジェクトを作成する
- Gmail APIを有効にする
- OAuth同意画面を設定する
- OAuth クライアント ID 資格情報を作成する (デスクトップ アプリケーション)
- 資格情報はプロジェクトルートの
credentials.json
としてダウンロードします。
初回実行と認証
認証するにはサーバーを 1 回実行します。
ブラウザウィンドウが開き、Googleアカウントでの認証を求められます。認証後、 token.json
ファイルが作成され、今後使用するために保存されます。
Claudeデスクトップの設定
- Claude Desktop 構成ファイルを編集します。
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- macOS:
- Gmail MCP サーバーを構成に追加します。Copy
- ファイルを保存し、Claude Desktopを再起動します。
注: "/absolute/path/to/gmail-mcp-server/gmail_server.py"
を、クローンしたリポジトリ内のgmail_server.py
ファイルへの実際の絶対パスに置き換えます。
🧰 利用可能なツール
Gmail MCP サーバーは、Claude に次のツールを公開します。
メール送信
send_email
- テキスト/HTMLコンテンツを含む基本的なメールを送信するsend_email_with_attachment
- ファイルを添付したメールを送信するsend_email_with_multiple_attachments
- 複数の添付ファイル付きのメールを送信する
メールの読み上げ
read_email
- IDで特定のメールの内容を読むget_unread_emails
- 未読メールのリストを取得するget_important_emails
- 重要とマークされたメールを取得するget_emails_with_attachments
- 添付ファイルのあるメールを取得するget_recent_emails
- 過去X日間のメールを取得する
メールの検索と整理
search_emails
- Gmail のクエリ構文を使用してメールを検索しますget_email_labels
- Gmailのすべてのラベル/フォルダを一覧表示するcreate_email_label
- 新しいラベルを作成するdelete_email_label
- 既存のラベルを削除するlabel_email
- メールにラベルを適用するremove_email_label
- メールからラベルを削除する
メールステータス管理
mark_as_read
- メールを既読にするmark_as_unread
- メールを未読としてマークするdelete_email
- メールをゴミ箱に移動する
ドラフト管理
create_email_draft
- 新しいメールの下書きを作成するupdate_email_draft
- 既存の下書きを更新するlist_email_drafts
- 利用可能な下書きを一覧表示するsend_draft
- 既存の下書きを送信する
バッチ操作
batch_apply_label
- 複数のメールにラベルを適用するbatch_delete_emails
- 複数のメールをゴミ箱に移動する
アカウント情報
get_email_profile
- Gmail プロフィール情報を取得するsummarize_recent_emails
- 最近のメールの要約を作成する
💬 使用例
以下に、Claude に対するプロンプトの例を示します。
🔧 詳細設定
環境変数
サーバーはカスタマイズのために複数の環境変数をサポートしています。
変数 | 説明 |
---|---|
GMAIL_TOKEN_PATH | OAuth トークンを保存するためのカスタムパス |
GMAIL_CREDENTIALS_PATH | OAuth 認証情報へのカスタムパス |
GOOGLE_CLIENT_ID | OAuth クライアント ID (資格情報ファイルの代替) |
GOOGLE_CLIENT_SECRET | OAuth クライアント シークレット (資格情報ファイルの代替) |
MCP_PORT | SSEトランスポートのポート(デフォルト: 3000) |
DEBUG | デバッグモードを有効にする( true またはfalse ) |
SSE サーバーモード
サーバーは、HTTP ベースの統合のために SSE (Server-Sent Events) モードで実行できます。
これにより、指定されたポート (デフォルト: 3000) でサーバーが起動し、HTTP 経由でアクセスできるようになります。
📚 ドキュメント
- MCP仕様- モデルコンテキストプロトコルについて学ぶ
- Gmail API ドキュメント- Gmail API 機能のリファレンス
- Google Cloud OAuth - 認証フローの詳細
🔒 セキュリティに関する考慮事項
- サーバーは安全なGmail API認証にOAuth 2.0を使用します
- すべてのアクションはローカルマシン上で実行されます。メールはサードパーティのサーバーを通過することはありません。
- 認証トークンはローカルに保存され、いつでも取り消すことができます。
- サーバーは添付ファイルの読み取りにのみローカルファイルアクセスを必要とします
- クロードはメールを送信または削除する前に必ず確認を求めます
🤝 貢献する
貢献を歓迎します!お気軽にプルリクエストを送信してください。
- リポジトリをフォークする
- 機能ブランチを作成します(
git checkout -b feature/amazing-feature
) - 変更をコミットします (
git commit -m 'Add some amazing feature'
) - ブランチにプッシュする (
git push origin feature/amazing-feature
) - プルリクエストを開く
📝 ライセンス
このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細についてはLICENSEファイルを参照してください。
🙏 謝辞
- Gmail API の Google
- クロードとモデルコンテキストプロトコルの人類学的考察
- Python Gmail API クライアント ライブラリの貢献者
This server cannot be installed
Claude AI が Gmail と対話できるようにし、自然言語コマンドによるメールの送信、読み取り、検索、ラベル付け、下書き管理、バッチ操作をサポートするモデル コンテキスト プロトコル サーバーです。
Related MCP Servers
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants to interact with Gmail services, supporting email operations, draft management, and calendar functionality through Google API integration.Last updated -TypeScript
- -securityAlicense-qualityA Model Context Protocol server that provides a seamless email management interface through Claude, allowing users to search, read, and send emails directly through natural language conversations.Last updated -40PythonMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables AI assistants like Claude to interact with Gmail through natural language, providing comprehensive email management capabilities including sending, reading, organizing, searching, and managing drafts and labels.Last updated -PythonGPL 3.0
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants to access and manage email through IMAP, supporting browsing, searching, reading, and organizing emails while learning user preferences over time.Last updated -2Python