Gmail MCP サーバー
MCP(Message Control Protocol)フレームワークを使用して構築された、強力で柔軟なGmail統合サーバーです。このサーバーは、Gmail APIと連携するための堅牢なインターフェースを提供し、プログラムによるメールの読み取り、送信、管理機能を提供します。
特徴
- 複数のGmailアカウントからメールを読む
- 添付ファイル付きのメールを送信する
- 高度なクエリオプションでメールを検索する
- メールの添付ファイルをダウンロードする
- メールの会話やスレッドを処理する
- リアルタイムのメール監視
- 複数のGmailアカウントのサポート
前提条件
Gmail MCP サーバーを実行する前に、次のものを用意してください。
- Python 3.12以上
- Gmail API が有効になっている Google Cloud プロジェクト
- OAuth 2.0 クライアントID認証情報
- 必要な Python パッケージ (pyproject.toml で指定)
インストール
Smithery経由でインストール
Smithery経由で Claude Desktop 用の Gmail 統合サーバーを自動的にインストールするには:
- リポジトリをクローンします。
- 仮想環境を作成してアクティブ化します。
- 依存関係をインストールします:
Google Cloud プロジェクトの設定
- Google Cloud Consoleにアクセスします
- 新しいプロジェクトを作成するか、既存のプロジェクトを選択してください
- プロジェクトで Gmail API を有効にする
- OAuth 2.0 認証情報を作成します。
- 「APIとサービス」>「認証情報」に移動します
- 「認証情報を作成」>「OAuthクライアントID」をクリックします
- アプリケーションの種類として「デスクトップアプリ」を選択します
- クライアント構成ファイルをダウンロードする
- ダウンロードしたファイルの名前を
client_secret.json
に変更し、プロジェクトのルートディレクトリに配置します。
構成
gmail_token_creator.py
でメール識別子を設定します。
- トークン クリエーターを実行して Gmail アカウントを認証します。
- 統合したいGmailアカウントごとにこのプロセスを繰り返します
サーバー構造
gmail_server.py
: メイン MCP サーバーの実装gmail_api.py
: Gmail API のインタラクション関数google_apis.py
: Google API 認証ユーティリティ- サポートファイル:
read_emails.py
: メール読み取り機能search_emails.py
: メール検索機能send_emails.py
: メール送信機能
使用法
サーバーの起動
利用可能なツール
- メールを送信:
- メールを検索:
- 最新のメールを読む:
- 添付ファイルをダウンロード:
セキュリティに関する考慮事項
client_secret.json
を安全に保存し、バージョン管理にコミットしないでください。- トークンファイルを安全に保ち、
.gitignore
に追加します。 - 機密情報には環境変数を使用する
- OAuth認証情報を定期的にローテーションする
- APIの使用状況を監視し、適切な割り当てを設定する
エラー処理
サーバーには包括的なエラー処理とログ記録が含まれています。
- ログは
gmail_mcp.log
に書き込まれます - ファイルとコンソールの両方のログが有効になっています
- デバッグのための詳細なエラーメッセージ
貢献
- リポジトリをフォークする
- 機能ブランチを作成する
- 変更をコミットする
- ブランチにプッシュする
- プルリクエストを作成する
ライセンス
Apacheライセンス2.0
サポート
問題や機能のリクエストについては、GitHub の問題追跡ツールを使用してください。
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Gmail APIを介してGmailと連携し、メールの閲覧、送信、管理が可能です。複数のGmailアカウントをサポートし、リアルタイム監視機能、メール検索機能、添付ファイル処理機能などの高度な機能も備えています。
Related Resources
Related MCP Servers
- -securityAlicense-qualityIntegrates with Gmail to enable sending, reading, drafting, and managing emails via the Model Context Protocol (MCP), allowing users to interact with email tasks through automated client prompts.Last updated -PythonGPL 3.0
- -securityFlicense-qualityEnables users to manage Gmail accounts using AI agent-assisted operations via an MCP protocol, supporting email search, reading, deletion, and sending with a voice-powered interface.Last updated -25TypeScript
- -securityAlicense-qualityProvides IMAP and SMTP capabilities, enabling developers to manage email services with seamless integration and automated workflows.Last updated -38PythonBSD 3-Clause
- -securityAlicense-qualityProvides comprehensive Gmail integration with LLM processing capabilities, allowing users to read, search, filter emails and handle attachments through the Model Context Protocol.Last updated -31TypeScriptMIT License