Skip to main content
Glama

Google Toolbox

py-mcp-google-toolbox

バージョンライセンス

AI アシスタントに、Gmail、Google カレンダー、Google ドライブ、Google 検索などの Google サービスとやり取りするための強力なツールを提供する MCP サーバー。

概要

py-mcp-google-toolbox は、次の Google 関連機能を提供します。

  • Gmail の操作(読み取り、検索、送信、変更)
  • Google カレンダーの管理(イベントの作成、一覧表示、更新、削除)
  • Google ドライブの操作(検索、ファイルの読み取り)
  • Google 検索統合(ウェブ検索)

目次

前提条件

  1. Python : Python 3.12以降をインストールします
  2. Google Cloud Console のセットアップ:
    • Google Cloud Consoleに移動
    • 新しいプロジェクトを作成するか、既存のプロジェクトを選択してください
    • サービス API を有効にします。
      1. 「APIとサービス」>「ライブラリ」に移動します
      2. 「Gmail API」を検索して有効にします
      3. 「Google カレンダー API」を検索して有効にします
      4. 「Google Drive API」を検索して有効にします
      5. 検索フォームで「カスタム検索API」を有効にする
    • GCP から OAuth 2.0 認証情報を設定します。
      1. 「APIとサービス」>「認証情報」に移動します
      2. 「認証情報を作成」>「OAuthクライアントID」をクリックします
      3. 「Webアプリケーション」を選択
      4. クライアントIDとクライアントシークレットを書き留めます
        • クライアントID
        • クライアントシークレット
      5. secret json をダウンロードし、credentials.json に名前を変更します。
    • APIキーを生成する
  3. カスタム検索エンジンにアクセスしてIDを取得します

インストール

Gitクローン
git clone https://github.com/jikime/py-mcp-google-toolbox.git cd py-mcp-google-toolbox
構成
  1. UV パッケージ マネージャーをインストールします。
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. 仮想環境を作成してアクティブ化します。
uv venv -p 3.12 source .venv/bin/activate # On MacOS/Linux # or .venv\Scripts\activate # On Windows
  1. 依存関係をインストールします:
uv pip install -r requirements.txt
  1. リフレッシュトークンを取得します(トークンの有効期限が切れている場合はこれを実行できます)
uv run get_refresh_token.py

これにより、次のようになります。

  • Google OAuth認証のためにブラウザを開きます
  • 次の権限を要求します。
    • https://www.googleapis.com/auth/gmail.modify
    • https://www.googleapis.com/auth/calendar
    • https://www.googleapis.com/auth/gmail.send
    • https://www.googleapis.com/auth/gmail.readonly
    • https://www.googleapis.com/auth/drive
    • https://www.googleapis.com/auth/drive.file
    • https://www.googleapis.com/auth/drive.readonly
  • 資格情報をtoken.jsonに保存します
  • コンソールにリフレッシュトークンを表示する
  1. 環境変数:
cp env.example .env vi .env # change with your key GOOGLE_API_KEY=your_google_api_key GOOGLE_CSE_ID=your_custom_search_engine_id GOOGLE_CLIENT_ID=your_google_client_id GOOGLE_CLIENT_SECRET=your_google_client_secret GOOGLE_REFRESH_TOKEN=your_google_refresh_token
  1. credentials.json をプロジェクトのルートフォルダにコピーします (py-mcp-google-toolbox)
Dockerの使用
  1. Docker イメージをビルドします。
docker build -t py-mcp-google-toolbox .
  1. コンテナを実行します。
docker run py-mcp-google-toolbox
ローカルの使用
  1. サーバーを実行します。
mcp dev server.py

MCP設定を構成する

MCP 設定ファイルにサーバー構成を追加します。

クロードデスクトップアプリ
  1. Smithery経由で自動的にインストールするには:
npx -y @smithery/cli install @jikime/py-mcp-google-toolbox --client claude
  1. 手動でインストールするには~/Library/Application Support/Claude/claude_desktop_config.jsonを開きます。

これをmcpServersオブジェクトに追加します。

{ "mcpServers": { "Google Toolbox": { "command": "/path/to/bin/uv", "args": [ "--directory", "/path/to/py-mcp-google-toolbox", "run", "server.py" ] } } }
カーソルIDE

~/.cursor/mcp.jsonを開く

これをmcpServersオブジェクトに追加します。

{ "mcpServers": { "Google Toolbox": { "command": "/path/to/bin/uv", "args": [ "--directory", "/path/to/py-mcp-google-toolbox", "run", "server.py" ] } } }
Docker用
{ "mcpServers": { "Google Toolbox": { "command": "docker", "args": [ "run", "-i", "--rm", "py-mcp-google-toolbox" ] } } }

ツールドキュメント

Gmailツール

  • list_emails : Gmailの受信トレイからフィルタリングオプション付きで最近のメールを一覧表示します
  • search_emails : 詳細なメール内容の取得を伴う高度な Gmail 検索を実行します
  • send_email : CC、BCC 受信者をサポートしてメールを作成して送信します
  • modify_email : ラベルを変更してメールの状態(既読/未読、アーカイブ、ゴミ箱)を変更します

カレンダーツール

  • list_events : 指定された時間範囲内の今後のカレンダーイベントを取得します。
  • create_event : 出席者、場所、説明を含む新しいカレンダーイベントを作成します
  • update_event : 柔軟なパラメータ更新で既存のカレンダーイベントを変更します
  • delete_event : イベントIDでカレンダーイベントを削除します

ドライブツール

  • read_gdrive_file : Google ドライブのファイルからコンテンツを読み取り、取得します
  • search_gdrive : カスタマイズ可能なクエリを使用して Google ドライブ内のファイルを検索します

検索ツール

  • search_google : Google検索を実行し、フォーマットされた結果を返します

発達

ローカルテストの場合は、付属のクライアント スクリプトを使用できます。

# Example: List emails uv run client.py list_emails max_results=5 query="is:unread" # Example: Search emails uv run client.py search_emails query="from:test@example.com" # Example: Send email uv run client.py send_email to="test@example.com" subject="test mail" body="Hello" # Example: Modify email uv run client.py modify_email id=MESSAGE_ID remove_labels=INBOX add_labels=ARCHIVED # Example: List events uv run client.py list_events time_min=2025-05-01T00:00:00+09:00 time_max=2025-05-02T23:59:59+09:00 max_results=5 # Example: Create event uv run client.py create_event summary="new event" start=2025-05-02T10:00:00+09:00 end=2025-05-02T11:00:00+09:00 attendees="user1@example.com,user2@example.com" # Example: Update event uv run client.py update_event event_id=EVENT_ID summary="update event" start=2025-05-02T10:00:00+09:00 end=2025-05-02T11:00:00+09:00 attendees="user1@example.com,user2@example.com" # Example Delete event uv run client.py delete_event event_id=EVENT_ID # Example: Search Google uv run client.py search_google query="what is the MCP?" # Example: Search Google Drive uv run client.py search_gdrive query=mcp # Example: Read file uv run client.py read_gdrive_file file_id=1234567890

ライセンス

MITライセンス

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/jikime/py-mcp-google-toolbox'

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