Skip to main content
Glama

Gmail MCP Server

by jmonsellier

モデルコンテキストプロトコル(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 のセットアップ

  1. 新しい Google Cloud プロジェクトを作成する
  2. Gmail APIを有効にする
  3. OAuth同意画面を設定する
    • 「外部」を選択してください。ただし、アプリは公開されません。
    • 個人のメールアドレスを「テストユーザー」として追加します。
  4. OAuth スコープを追加しますhttps://www.googleapis.com/auth/gmail/modify
  5. アプリケーションタイプ「デスクトップアプリ」のOAuth クライアント ID を作成します
  6. クライアントのOAuthキーのJSONファイルをダウンロードします
  7. キーファイルの名前を変更し、ローカルマシンの安全な場所に保存してください。保存場所をメモしておいてください。
    • このファイルへの絶対パスは、サーバーの起動時にパラメーター--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に保存されています。

{ "mcpServers": { "gdrive": { "command": "uv", "args": [ "--directory", "[absolute-path-to-git-repo]", "run", "gmail", "--creds-file-path", "[absolute-path-to-credentials-file]", "--token-path", "[absolute-path-to-access-tokens-file]" ] } } }

以下のパラメータを設定する必要があります

パラメータ
--directoryサーバーを含むgmailディレクトリへの絶対パス
--creds-file-pathGmail API セットアップで作成された認証情報ファイルへの絶対パス。
--token-pathアプリケーションのアクセス トークンとリフレッシュ トークンを保存および取得するための絶対パス。

MCP Inspectorによるトラブルシューティング

サーバーをテストするには、 MCP Inspectorを使用します。gitリポジトリから、以下のコマンドを実行し、パラメータ引数を適宜変更してください。

npx @modelcontextprotocol/inspector uv run [absolute-path-to-git-repo]/src/gmail/server.py --creds-file-path [absolute-path-to-credentials-file] --token-path [absolute-path-to-access-tokens-file]
-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

Gmail と統合して、モデル コンテキスト プロトコル (MCP) 経由で電子メールの送信、読み取り、下書き、管理を可能にし、ユーザーが自動化されたクライアント プロンプトを通じて電子メール タスクを操作できるようにします。

  1. コンポーネント
    1. ツール
  2. 設定
    1. Gmail API のセットアップ
    2. 認証
    3. デスクトップアプリでの使用
    4. MCP Inspectorによるトラブルシューティング

Related MCP Servers

  • -
    security
    F
    license
    -
    quality
    A 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 -
    10
    3
    TypeScript
  • A
    security
    F
    license
    A
    quality
    A 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 -
    1
    6
    321
    TypeScript
    • Apple
  • -
    security
    A
    license
    -
    quality
    MCP 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 -
    17
    Python
    GPL 3.0
    • Apple
  • A
    security
    F
    license
    A
    quality
    An 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 -
    17
    16
    TypeScript
    • Apple
    • Linux

View all related MCP servers

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/jmonsellier/gmail-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server