Skip to main content
Glama
MCP Google Contacts Server

MCP Google Contacts Server

by RayanZaki

📇 MCP Google コンタクト サーバー

Google コンタクトの機能を提供する Machine Conversation Protocol(MCP)サーバー。AI アシスタントによる連絡先の管理、組織のディレクトリの検索、Google Workspace とのやり取りが可能になります。

✨ 特徴

  • Google 連絡先の一覧と検索

  • 連絡先の作成、更新、削除

  • Google Workspace ディレクトリを検索

  • 「その他の連絡先」(やり取りしたが追加していない人)を表示する

  • 組織内の Google Workspace ユーザーにアクセスする

Related MCP server: MCP Google Contacts Server

🚀 インストール

📋 前提条件

  • Python 3.12以上

  • 連絡先にアクセスできるGoogleアカウント

  • People API が有効になっている Google Cloud プロジェクト

  • Google API アクセス用の OAuth 2.0 認証情報

🧪 uv を使用する(推奨)

  1. まだインストールしていない場合は、uv をインストールします。

    pip install uv
  2. リポジトリをクローンします。

    git clone https://github.com/rayanzaki/mcp-google-contacts-server.git
    cd mcp-google-contacts-server
  3. 仮想環境を作成し、依存関係をインストールします。

    uv venv
    source .venv/bin/activate
    uv pip install -r requirements.txt

📦 pip の使用

  1. リポジトリをクローンします。

    git clone https://github.com/rayanzaki/mcp-google-contacts-server.git
    cd mcp-google-contacts-server
  2. 依存関係をインストールします:

    pip install -r requirements.txt

🔑 認証設定

サーバーが連絡先にアクセスするには、Google API 認証情報が必要です。いくつかのオプションがあります。

🔐 オプション 1: credentials.json ファイルを使用する

  1. Google Cloud プロジェクトを作成し、People API を有効にする

  2. OAuth 2.0 認証情報を作成する (デスクトップ アプリケーション タイプ)

  3. credentials.jsonファイルをダウンロードする

  4. 次のいずれかの場所に置きます。

    • このプロジェクトのルートディレクトリ

    • ホームディレクトリ (~/google-contacts-credentials.json)

    • --credentials-file引数でその場所を指定します

🔐 オプション2: 環境変数を使用する

次の環境変数を設定します。

  • GOOGLE_CLIENT_ID : Google OAuth クライアント ID

  • GOOGLE_CLIENT_SECRET : Google OAuth クライアントシークレット

  • GOOGLE_REFRESH_TOKEN : アカウントの有効なリフレッシュトークン

🛠️ 使用方法

🏃‍♂️ 基本的な起動

python src/main.py
# or
uv run src/main.py

これにより、デフォルトの stdio トランスポートを使用してサーバーが起動します。

⚙️ コマンドライン引数

口論

説明

デフォルト値

--transport

使用するトランスポートプロトコル( stdioまたはhttp )

stdio

--host

HTTPトランスポートのホスト

localhost

--port

HTTPトランスポートのポート

8000

--client-id

Google OAuth クライアント ID (環境変数をオーバーライド)

-

--client-secret

Google OAuth クライアント シークレット (環境変数をオーバーライド)

-

--refresh-token

Google OAuth リフレッシュ トークン (環境変数をオーバーライド)

-

--credentials-file

Google OAuth credentials.json ファイルへのパス

-

📝 例

HTTP トランスポートから開始します。

python src/main.py --transport http --port 8080

特定の資格情報ファイルを使用:

python src/main.py --credentials-file /path/to/your/credentials.json

資格情報を直接提供します:

python src/main.py --client-id YOUR_CLIENT_ID --client-secret YOUR CLIENT_SECRET --refresh-token YOUR_REFRESH_TOKEN

🔌 MCPクライアントとの統合

このサーバーを MCP クライアント (Anthropic の Claude with Cline など) で使用するには、MCP 構成に追加します。

{
  "mcpServers": {
    "google-contacts-server": {
      "command": "uv",
      "args": [
         "--directory",
         "/path/to/mcp-google-contacts-server",
         "run",
        "main.py"
      ],
      "disabled": false,
      "autoApprove": []
    }
  }
}

🧰 利用可能なツール

この MCP サーバーは次のツールを提供します。

道具

説明

list_contacts

すべての連絡先を一覧表示するか、名前でフィルタリングする

get_contact

リソース名またはメールアドレスで連絡先を取得する

create_contact

新しい連絡先を作成する

update_contact

既存の連絡先を更新する

delete_contact

リソース名で連絡先を削除する

search_contacts

名前、メールアドレス、電話番号で連絡先を検索

list_workspace_users

組織のディレクトリ内の Google Workspace ユーザーを一覧表示する

search_directory

Google Workspace ディレクトリでユーザーを検索する

get_other_contacts

「その他の連絡先」セクションから連絡先を取得する

🔍 詳細なツールの説明

📋 list_contacts

Google の連絡先をすべて一覧表示したり、名前でフィルタリングしたりします。

パラメータ:

  • name_filter (オプション): 名前で連絡先をフィルタリングする文字列

  • max_results (オプション):返される連絡先の最大数(デフォルト:100)

例:

list_contacts(name_filter="John", max_results=10)

👤 get_contact

特定の連絡先に関する詳細情報を取得します。

パラメータ:

  • identifier : リソース名 (people/*) または連絡先のメールアドレス

例:

get_contact("john.doe@example.com")
# or
get_contact("people/c12345678901234567")

➕ create_contact

Google 連絡先に新しい連絡先を作成します。

パラメータ:

  • given_name : 連絡先の名

  • family_name (オプション): 連絡先の姓

  • email (オプション): 連絡先のメールアドレス

  • phone (オプション): 連絡先の電話番号

例:

create_contact(given_name="Jane", family_name="Smith", email="jane.smith@example.com", phone="+1-555-123-4567")

✏️ update_contact

既存の連絡先を新しい情報で更新します。

パラメータ:

  • resource_name : 連絡先リソース名 (people/*)

  • given_name (オプション): 更新された名

  • family_name (オプション): 更新された姓

  • email (オプション): 更新されたメールアドレス

  • phone (オプション):更新された電話番号

例:

update_contact(resource_name="people/c12345678901234567", email="new.email@example.com")

🗑️ delete_contact

Google 連絡先から連絡先を削除します。

パラメータ:

  • resource_name : 削除する連絡先リソース名(people/*)

例:

delete_contact(resource_name="people/c12345678901234567")

🔍 search_contacts

名前、メールアドレス、電話番号で連絡先を検索します。

パラメータ:

  • query : 連絡先で検索する検索語

  • max_results (オプション): 返される結果の最大数 (デフォルト: 10)

例:

search_contacts(query="john", max_results=5)

🏢 list_workspace_users

組織のディレクトリ内の Google Workspace ユーザーを一覧表示します。

パラメータ:

  • query (オプション): 特定のユーザーを見つけるための検索語

  • max_results (オプション): 返される結果の最大数 (デフォルト: 50)

例:

list_workspace_users(query="engineering", max_results=25)

🔭 search_directory

組織の Google Workspace ディレクトリを対象に検索を実行します。

パラメータ:

  • query : 特定のディレクトリメンバーを見つけるための検索語

  • max_results (オプション): 返される結果の最大数 (デフォルト: 20)

例:

search_directory(query="product manager", max_results=10)

👥 get_other_contacts

「その他の連絡先」セクションから連絡先を取得します。これは、やり取りしたことがあるものの、連絡先に追加していない人々です。

パラメータ:

  • max_results (オプション): 返される結果の最大数 (デフォルト: 50)

例:

get_other_contacts(max_results=30)

🔒 権限

サーバーを初めて起動する際は、Googleで認証し、連絡先へのアクセスに必要な権限を付与する必要があります。認証フローが、このプロセスを案内します。

❓ トラブルシューティング

  • 🔐 認証の問題: 資格情報が有効であり、必要なスコープがあることを確認してください

  • ⚠️ API の制限: Google People API の割り当て制限に注意してください

  • 📝 ログ: コンソール出力でエラーメッセージとデバッグ情報を確認します

👥 貢献する

貢献を歓迎します!お気軽にプルリクエストを送信してください。

📄 ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています - 詳細については LICENSE ファイルを参照してください。

Available Tools

9 tools
create_contactB

Create a new contact.

    Args:
        given_name: First name of the contact
        family_name: Last name of the contact
        email: Email address of the contact
        phone: Phone number of the contact
    

Inputs: given_name (required), family_name, email, phone. Returns: result

delete_contactC

Delete a contact by resource name.

    Args:
        resource_name: Contact resource name (people/*) to delete
    

Inputs: resource_name (required). Returns: result

get_contactB

Get a contact by resource name or email.

    Args:
        identifier: Resource name (people/*) or email address of the contact
    

Inputs: identifier (required). Returns: result

get_other_contactsB

Retrieve contacts from the 'Other contacts' section.

    Other contacts are people you've interacted with but haven't added to your contacts list.
    These often include email correspondents that aren't in your main contacts.
    
    Args:
        max_results: Maximum number of results to return (default: 50)
    

Inputs: max_results. Returns: result

list_contactsB

List all contacts or filter by name.

    Args:
        name_filter: Optional filter to find contacts by name
        max_results: Maximum number of results to return (default: 100)
    

Inputs: name_filter, max_results. Returns: result

list_workspace_usersB

List Google Workspace users in your organization's directory.

    This tool allows you to search and list users in your Google Workspace directory,
    including their email addresses and other information.
    
    Args:
        query: Optional search term to find specific users (name, email, etc.)
        max_results: Maximum number of results to return (default: 50)
    

Inputs: query, max_results. Returns: result

search_contactsB

Search contacts by name, email, or phone number.

    Args:
        query: Search term to find in contacts
        max_results: Maximum number of results to return (default: 10)
    

Inputs: query (required), max_results. Returns: result

search_directoryB

Search for people specifically in the Google Workspace directory.

    This performs a more targeted search of your organization's directory.
    
    Args:
        query: Search term to find specific directory members
        max_results: Maximum number of results to return (default: 20)
    

Inputs: query (required), max_results. Returns: result

update_contactC

Update an existing contact.

    Args:
        resource_name: Contact resource name (people/*)
        given_name: Updated first name
        family_name: Updated last name
        email: Updated email address
        phone: Updated phone number
    

Inputs: resource_name (required), given_name, family_name, email, +1 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 9 tools

    Disambiguation4/5

    Most tools have distinct purposes, but there is some potential confusion between list_contacts, search_contacts, and search_directory. The descriptions clarify that search_directory targets Google Workspace directory specifically, while search_contacts is broader, but an agent might initially struggle to choose between them for certain queries. The other tools (create, delete, get, update, get_other_contacts, list_workspace_users) are clearly differentiated.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern with snake_case (e.g., create_contact, list_contacts, search_directory). The naming is predictable and readable throughout, with no deviations in style or convention.

    Tool Count5/5

    With 9 tools, this server is well-scoped for managing Google Contacts. It covers core CRUD operations (create, get, update, delete), listing and searching contacts, and includes specialized tools for other contacts and workspace users, which is appropriate for the domain without being overwhelming.

    Completeness5/5

    The tool surface provides complete coverage for the Google Contacts domain. It includes all essential CRUD operations (create, get, update, delete), multiple ways to retrieve contacts (list, search, get_other_contacts), and extends to workspace directory functionality. There are no obvious gaps that would hinder agent workflows.

    Maintenance

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers