モデルコンテキストプロトコル(MCP)用の Gmail サーバー
この MCP サーバーは Gmail と統合され、電子メールの送信、削除、読み取り、下書き、返信が可能になります。
注: このサーバーは、MCPクライアントがメールの読み取り、削除、送信を行うことを可能にします。ただし、クライアントはこれらの操作を行う前にユーザーに確認メッセージを表示します。
https://github.com/user-attachments/assets/5794cd16-00d2-45a2-884a-8ba0c3a90c90
コンポーネント
ツール
- メールを送信
- メールアドレスの受信者にメールを送信します
- 入力:
recipient_id
(文字列): 受信者のメールアドレスsubject
(文字列):メールの件名message
(文字列): メールの内容
- ステータスとmessage_idを返します
- ゴミ箱メール
- メールをゴミ箱に移動する
- 入力:
email_id
(文字列): メールの自動生成されたID
- 成功メッセージを返す
- メールを既読にする
- メールを既読にする
- 入力:
email_id
(文字列): メールの自動生成されたID
- 成功メッセージを返す
- 未読メールを取得する
- 未読メールを取得します
- メールIDを含むメールのリストを返します
- メールを読む
- 指定されたメールの内容を取得します
- 入力:
email_id
(文字列): メールの自動生成されたID
- メールのメタデータの辞書を返し、メールを既読としてマークします
- オープンメール
- ブラウザでメールを開く
- 入力:
email_id
(文字列): メールの自動生成されたID
- 成功メッセージを返し、指定されたメールをデフォルトのブラウザで開きます
設定
Gmail API のセットアップ
- 新しい Google Cloud プロジェクトを作成する
- Gmail APIを有効にする
- OAuth同意画面を設定する
- 「外部」を選択してください。ただし、アプリは公開されません。
- 個人のメールアドレスを「テストユーザー」として追加します。
- OAuth スコープを追加します
https://www.googleapis.com/auth/gmail/modify
- アプリケーションタイプ「デスクトップアプリ」のOAuth クライアント ID を作成します
- クライアントのOAuthキーのJSONファイルをダウンロードします
- キーファイルの名前を変更し、ローカルマシンの安全な場所に保存してください。保存場所をメモしておいてください。
- このファイルへの絶対パスは、サーバーの起動時にパラメーター
--creds-file-path
として渡されます。
- このファイルへの絶対パスは、サーバーの起動時にパラメーター
認証
サーバーが起動すると、システムブラウザで認証フローが開始されます。トークンの認証情報は、パラメータ--token-path
に渡された絶対ファイルパスに保存され、後で取得されます。
たとえば、ホーム フォルダー内のドット ディレクトリを使用して、 [your-home-folder]
を置き換えます。
パラメータ | 例 |
---|---|
--creds-file-path | /[your-home-folder]/.google/client_creds.json |
--token-path | /[your-home-folder]/.google/app_tokens.json |
デスクトップアプリでの使用
uvの使用をお勧めします。
このサーバーをMCPクライアントとしてClaude Desktopと統合するには、アプリのサーバー構成に以下のコードを追加してください。デフォルトでは、 ~/Library/Application\ Support/Claude/claude_desktop_config.json
に保存されています。
以下のパラメータを設定する必要があります
パラメータ | 例 |
---|---|
--directory | サーバーを含むgmail ディレクトリへの絶対パス |
--creds-file-path | Gmail API セットアップで作成された認証情報ファイルへの絶対パス。 |
--token-path | アプリケーションのアクセス トークンとリフレッシュ トークンを保存および取得するための絶対パス。 |
MCP Inspectorによるトラブルシューティング
サーバーをテストするには、 MCP Inspectorを使用します。gitリポジトリから、以下のコマンドを実行し、パラメータ引数を適宜変更してください。
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Gmail と統合して、モデル コンテキスト プロトコル (MCP) 経由で電子メールの送信、読み取り、下書き、管理を可能にし、ユーザーが自動化されたクライアント プロンプトを通じて電子メール タスクを操作できるようにします。
Related Resources
Related MCP Servers
- -securityFlicense-qualityA specialized Model Context Protocol (MCP) server that integrates Google services (Gmail, Calendar, etc.) into your AI workflows. This server enables seamless access to Google services through MCP, allowing AI agents to interact with Gmail, Google Calendar, and other Google services.Last updated -103TypeScript
- AsecurityFlicenseAqualityA simple MCP server that enables users to send emails using Resend's API, integrating with tools like Cursor and Claude Desktop for seamless email composition and delivery.Last updated -16321TypeScript
- -securityAlicense-qualityMCP server that integrates with Gmail to enable sending, reading, and managing emails through tools like send-email, trash-email, get-unread-emails, and read-email.Last updated -17PythonGPL 3.0
- AsecurityFlicenseAqualityAn MCP-based email tool that enables AI models to access email services through standardized interfaces, allowing AI assistants to perform various email operations like sending emails, reading inboxes, and handling attachments.Last updated -1716TypeScript