Logotipo de Google Contacts

Google Contacts

Comunidad
RayanZaki

A Google Contacts server using MCP

EditorRayanZaki
Repositoriomcp-google-contacts-server
IdiomaPython
Forks
26
Estrellas
33
Herramientas disponibles
0
Tipo de transportestdio
Categorías
LicenciaMIT
Enlaces
  • Conecta herramientas a flujos de trabajo con IA

    Google Contacts ofrece funciones MCP que pueden usar los clientes y agentes de IA compatibles.

  • 0 herramientas disponibles

    Explora a continuación las acciones que se pueden invocar, con sus nombres y descripciones cuando el servidor los proporcione.

  • Configuración lista para copiar

    Usa los ejemplos de instalación para configurar este servidor en tu cliente MCP preferido.

  • Indicadores de interés en el código abierto

    33 estrellas y 26 forks en el repositorio enlazado.

MseeP.ai Security Assessment Badge

📇 MCP Google Contacts Server

A Machine Conversation Protocol (MCP) server that provides Google Contacts functionality, allowing AI assistants to manage contacts, search your organization's directory, and interact with Google Workspace. Much updated from its original by Gemini AI in Gemini CLI.

✨ Features

  • List and search Google Contacts
  • Create, update, and delete contacts
  • Search Google Workspace directory
  • View "Other Contacts" (people you've interacted with but haven't added)
  • Access Google Workspace users in your organization

🚀 Installation

📋 Prerequisites

  • Python 3.12 or higher
  • Google account with contacts access
  • Google Cloud project with People API enabled
  • OAuth 2.0 credentials for Google API access

📦 Installation from Source

To install the mcp-google-contacts-server as a Python package:

  1. Clone the repository:

    bash
    git clone https://github.com/rayanzaki/mcp-google-contacts-server.git
    cd mcp-google-contacts-server
  2. Rename the source directory: The package expects the source code to be in a directory named mcp_google_contacts_server.

    bash
    mv src mcp_google_contacts_server
  3. Install the package: This will install the package and its dependencies, making the mcp-google-contacts command available in your PATH.

    bash
    pip install .

    Note: If you encounter import errors after installation, ensure that relative imports within the source files (main.py, tools.py, google_contacts_service.py, formatters.py, config.py) are updated to use absolute imports (e.g., from mcp_google_contacts_server.module_name import ...). This is typically handled automatically by pip install . but can sometimes require manual adjustment if the package structure is unusual.

🔑 Authentication Setup

The server requires Google API credentials to access your contacts. You have several options:

🔐 Option 1: Using a credentials.json file

  1. Create a Google Cloud project and enable the People API
  2. Create OAuth 2.0 credentials (Desktop application type)
  3. Download the credentials.json file
  4. Place it in one of these locations:
    • The root directory of this project
    • Your home directory (~/google-contacts-credentials.json)
    • Specify its location with the --credentials-file argument

🔐 Option 2: Using environment variables

Set the following environment variables:

  • GOOGLE_CLIENT_ID: Your Google OAuth client ID
  • GOOGLE_CLIENT_SECRET: Your Google OAuth client secret
  • GOOGLE_REFRESH_TOKEN: A valid refresh token for your account

Note: If your existing environment variables for Google OAuth client ID and client secret have different names (e.g., GOOGLE_OAUTH_CLIENT_ID), you can alias them in your .env file (e.g., GOOGLE_CLIENT_ID=$GOOGLE_OAUTH_CLIENT_ID) to ensure the server picks them up correctly. Use e.g. export GOOGLE_CLIENT_ID=$GOOGLE_OAUTH_CLIENT_ID && export GOOGLE_CLIENT_SECRET=$GOOGLE_OAUTH_CLIENT_SECRET in command line before: mcp-google-contacts :

env | grep GOOGLE
export GOOGLE_CLIENT_ID=$GOOGLE_OAUTH_CLIENT_ID && export GOOGLE_CLIENT_SECRET=$GOOGLE_OAUTH_CLIENT_SECRET
env | grep GOOGLE
mcp-google-contacts

{authentication evocation should happen here)

🚀 Initial Authorization (Recommended)

For the initial authorization flow to obtain your GOOGLE_REFRESH_TOKEN, it is recommended to run the mcp-google-contacts command directly in your terminal (outside of any MCP client that might obscure the interactive browser prompts).

Example:

bash
mcp-google-contacts

Follow the instructions in your terminal and browser to complete the authentication. Once the GOOGLE_REFRESH_TOKEN is displayed, you can set it as an environment variable for non-interactive use.

🛠️ Usage

🏃‍♂️ Basic Startup

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

This starts the server with the default stdio transport.

⚙️ Command Line Arguments

ArgumentDescriptionDefault Value
--transportTransport protocol to use (stdio or http)stdio
--hostHost for HTTP transportlocalhost
--portPort for HTTP transport8000
--client-idGoogle OAuth client ID (overrides environment variable)-
--client-secretGoogle OAuth client secret (overrides environment variable)-
--refresh-tokenGoogle OAuth refresh token (overrides environment variable)-
--credentials-filePath to Google OAuth credentials.json file-

📝 Examples

Start with HTTP transport:

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

Use specific credentials file:

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

Provide credentials directly:

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

🔌 Integration with MCP Clients

To use this server with MCP clients (like Anthropic's Claude with Cline), add it to your MCP configuration:

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

🧰 Available Tools

This MCP server provides the following tools:

ToolDescription
list_contactsList all contacts or filter by name
get_contactGet a contact by resource name or email
create_contactCreate a new contact
update_contactUpdate an existing contact
delete_contactDelete a contact by resource name
search_contactsSearch contacts by name, email, or phone number
list_workspace_usersList Google Workspace users in your organization's directory
search_directorySearch for people in the Google Workspace directory
get_other_contactsRetrieve contacts from the 'Other contacts' section

🔍 Detailed Tool Descriptions

📋 list_contacts

Lists all your Google contacts or filters them by name.

Parameters:

  • name_filter (optional): String to filter contacts by name
  • max_results (optional): Maximum number of contacts to return (default: 100)

Example:

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

👤 get_contact

Retrieves detailed information about a specific contact.

Parameters:

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

Example:

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

➕ create_contact

Creates a new contact in your Google Contacts.

Parameters:

  • given_name: First name of the contact
  • family_name (optional): Last name of the contact
  • email (optional): Email address of the contact
  • phone (optional): Phone number of the contact

Example:

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

✏️ update_contact

Updates an existing contact with new information.

Parameters:

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

Example:

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

🗑️ delete_contact

Deletes a contact from your Google Contacts.

Parameters:

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

Example:

python
delete_contact(resource_name="people/c12345678901234567")

🔍 search_contacts

Searches your contacts by name, email, or phone number.

Parameters:

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

Example:

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

🏢 list_workspace_users

Lists Google Workspace users in your organization's directory.

Parameters:

  • query (optional): Search term to find specific users
  • max_results (optional): Maximum number of results to return (default: 50)

Example:

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

🔭 search_directory

Performs a targeted search of your organization's Google Workspace directory.

Parameters:

  • query: Search term to find specific directory members
  • max_results (optional): Maximum number of results to return (default: 20)

Example:

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

👥 get_other_contacts

Retrieves contacts from the 'Other contacts' section - people you've interacted with but haven't added to your contacts.

Parameters:

  • max_results (optional): Maximum number of results to return (default: 50)

Example:

python
get_other_contacts(max_results=30)

🔒 Permissions

When first running the server, you'll need to authenticate with Google and grant the necessary permissions to access your contacts. The authentication flow will guide you through this process.

❓ Troubleshooting

  • 🔐 Authentication Issues: Ensure your credentials are valid and have the necessary scopes
  • ⚠️ API Limits: Be aware of Google People API quota limits
  • 📝 Logs: Check the console output for error messages and debugging information

👥 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Instalación

TypingMind
Requisitos:

Node.js 18+

{
  "mcpServers": {
    "google-contacts-server": {
      "command": "uvx",
      "args": [
        "mcp-google-contacts"
      ],
      "env": {
        "GOOGLE_CLIENT_ID": "",
        "GOOGLE_CLIENT_SECRET": "",
        "GOOGLE_REFRESH_TOKEN": ""
      }
    }
  }
}

Usa el MCP de Google Contacts con varios modelos de IA

TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que, una vez conectado Google Contacts, puedes usarlo con distintos modelos de IA en TypingMind sin tener que configurarlo por separado para cada modelo. Esta integración MCP se ejecuta localmente en tu dispositivo a través del conector MCP de TypingMind.

Guía de configuración para usar el conector local

Usa esta opción si el servidor MCP necesita acceder a archivos locales, aplicaciones o recursos privados de tu ordenador.

1

Abre los ajustes de MCP

En TypingMind, ve a Ajustes, luego a Ajustes avanzados y a Model Context Protocol, y elige Configurar conector.

  1. Abre TypingMind en tu navegador.
  2. Haz clic en el icono de Ajustes.
  3. Ve a Ajustes avanzados.
  4. Abre la sección Model Context Protocol.
  5. Haz clic en Configurar conector y elige Este dispositivo.
Pantalla de configuración del conector MCP de TypingMind con «Este dispositivo» seleccionado
2

Ejecuta el comando del conector

Elige Este dispositivo, copia el comando de TypingMind y ejecútalo en Terminal. Mantén el proceso en ejecución mientras uses MCP.

  1. Copia el comando de configuración que muestra TypingMind.
  2. Abre Terminal en macOS o Windows Terminal en Windows.
  3. Pega y ejecuta el comando.
  4. Acepta la instalación del paquete si Terminal te pide confirmación para continuar.
  5. Mantén el proceso en ejecución en la ventana de Terminal mientras uses las herramientas MCP.
3

Añade Google Contacts como servidor

Cuando el estado del conector sea «Listo», haz clic en «Edita servidores» y pega la configuración del servidor MCP.

  1. Espera hasta que el estado del conector indique «Listo».
  2. Haz clic en Edita servidores.
  3. Pega la configuración del servidor MCP de Google Contacts.
  4. Guarda la lista de servidores.
  5. Actualiza para comprobar que el conector sigue listo.
Ajustes de MCP de TypingMind con un servidor activo y el botón «Edita servidores»
{
  "mcpServers": {
    "google-contacts": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-google-contacts-server"
      ]
    }
  }
}
4

Úsala con distintos modelos

Guarda la lista de servidores, abre Plugins, activa las herramientas MCP de Google Contacts y selecciona cualquier modelo de IA compatible en TypingMind para usar las herramientas en el chat o asignárselas a un agente de IA.

  1. Abre la página Plugins en TypingMind.
  2. Activa las herramientas MCP de Google Contacts.
  3. Inicia un chat y elige el modelo de IA que quieras usar.
  4. Usa las herramientas MCP en el chat o asígnalas a un agente de IA.
  5. Cambia a otro modelo de IA cuando lo necesites sin volver a conectar MCP.
Chat de TypingMind que usa herramientas MCP activadas con un modelo de IA seleccionado
¿Puedes usar Google Contacts para ayudarme con esta tarea?
Google Contacts
Claro. Lo he leído.
Esto he encontrado usando Google Contacts.

Preguntas frecuentes

¿Para qué sirve el servidor MCP Google Contacts?

Google Contacts es un servidor MCP que permite a los clientes de IA compatibles conectarse a herramientas y contexto externos. En TypingMind, basta con añadir este servidor MCP una vez para que sus herramientas estén disponibles en tu espacio de trabajo de IA.

¿Puedo usar el servidor MCP Google Contacts con varios modelos de IA en TypingMind?

Sí. TypingMind conecta las herramientas MCP a nivel del espacio de trabajo, por lo que puedes usar Google Contacts con distintos modelos de IA, como Claude, ChatGPT, Gemini u otros que hayas configurado en TypingMind, sin configurar el servidor MCP por separado para cada modelo.

¿Por qué usar el conector MCP de Google Contacts con TypingMind?

TypingMind es una de las mejores interfaces de chat con LLM porque reúne varios modelos de IA, prompts, plugins, agentes de IA, claves de API y herramientas MCP en un solo espacio de trabajo. Con Google Contacts conectado, puedes usar sus herramientas MCP con tus modelos preferidos y mantener organizado tu flujo de trabajo de chat en TypingMind.

¿Cómo conecto el servidor MCP Google Contacts a TypingMind?

Google Contacts funciona a través del conector MCP local de TypingMind. Es la mejor opción cuando el servidor MCP necesita acceder a archivos locales, aplicaciones de escritorio, herramientas de línea de comandos o recursos privados de tu ordenador.

¿Qué herramientas ofrece el servidor MCP Google Contacts en TypingMind?

Google Contacts ofrece funciones MCP que puedes activar desde la página Plugins de TypingMind y usar en el chat o asignar a agentes de IA.

¿Tengo que compartir mis claves de API con TypingMind para usar el servidor MCP Google Contacts?

No. TypingMind prioriza el funcionamiento local y te permite mantener el control de tus proveedores de modelos, claves de API, prompts y configuración MCP. Si Google Contacts requiere autenticación, añade las cabeceras, los ajustes de OAuth o la configuración local necesarios para ese servidor MCP al crear la conexión.

Servidores MCP relacionados

Ver todos

Crea ya tu propio espacio de trabajo IA

Suscríbete a nuestro boletín para recibir avisos sobre nuevas funciones y próximos sorteos 👇