Skip to main content
Glama

Gmail MCP Server

by jasonsum

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

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Gmail と統合され、send-email、trash-email、get-unread-emails、read-email などのツールを通じてメールの送信、読み取り、管理を可能にする MCP サーバー。

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

Related MCP Servers

  • -
    security
    A
    license
    -
    quality
    Integrates 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 -
    Python
    GPL 3.0
  • 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
    F
    license
    -
    quality
    An MCP server that allows Claude Desktop or Cursor to send emails directly using Resend's API, eliminating the need to copy-paste email content.
    Last updated -
    6
    TypeScript
  • -
    security
    A
    license
    -
    quality
    An MCP server that enables sending emails directly through AWS SES without copy-pasting, supporting plain text and HTML emails with features like CC, BCC, and reply-to functionality.
    Last updated -
    TypeScript
    MIT License
    • Linux
    • Apple

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

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