Provides access to Google Contacts functionality, allowing users to list, search, create, update, and delete contacts, as well as search the Google Workspace directory and access 'Other Contacts'.
Requires a Google Cloud project with the People API enabled for authentication and access to Google's contact management capabilities.
📇 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:
- Clone the repository:
- Rename the source directory:
The package expects the source code to be in a directory named
mcp_google_contacts_server
. - Install the package:
This will install the package and its dependencies, making the
mcp-google-contacts
command available in your PATH.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 bypip 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
- Create a Google Cloud project and enable the People API
- Create OAuth 2.0 credentials (Desktop application type)
- Download the credentials.json file
- 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 IDGOOGLE_CLIENT_SECRET
: Your Google OAuth client secretGOOGLE_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
:
{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:
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
This starts the server with the default stdio transport.
⚙️ Command Line Arguments
Argument | Description | Default Value |
---|---|---|
--transport | Transport protocol to use (stdio or http ) | stdio |
--host | Host for HTTP transport | localhost |
--port | Port for HTTP transport | 8000 |
--client-id | Google OAuth client ID (overrides environment variable) | - |
--client-secret | Google OAuth client secret (overrides environment variable) | - |
--refresh-token | Google OAuth refresh token (overrides environment variable) | - |
--credentials-file | Path to Google OAuth credentials.json file | - |
📝 Examples
Start with HTTP transport:
Use specific credentials file:
Provide credentials directly:
🔌 Integration with MCP Clients
To use this server with MCP clients (like Anthropic's Claude with Cline), add it to your MCP configuration:
🧰 Available Tools
This MCP server provides the following tools:
Tool | Description |
---|---|
list_contacts | List all contacts or filter by name |
get_contact | Get a contact by resource name or email |
create_contact | Create a new contact |
update_contact | Update an existing contact |
delete_contact | Delete a contact by resource name |
search_contacts | Search contacts by name, email, or phone number |
list_workspace_users | List Google Workspace users in your organization's directory |
search_directory | Search for people in the Google Workspace directory |
get_other_contacts | Retrieve 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 namemax_results
(optional): Maximum number of contacts to return (default: 100)
Example:
👤 get_contact
Retrieves detailed information about a specific contact.
Parameters:
identifier
: Resource name (people/*) or email address of the contact
Example:
➕ create_contact
Creates a new contact in your Google Contacts.
Parameters:
given_name
: First name of the contactfamily_name
(optional): Last name of the contactemail
(optional): Email address of the contactphone
(optional): Phone number of the contact
Example:
✏️ update_contact
Updates an existing contact with new information.
Parameters:
resource_name
: Contact resource name (people/*)given_name
(optional): Updated first namefamily_name
(optional): Updated last nameemail
(optional): Updated email addressphone
(optional): Updated phone number
Example:
🗑️ delete_contact
Deletes a contact from your Google Contacts.
Parameters:
resource_name
: Contact resource name (people/*) to delete
Example:
🔍 search_contacts
Searches your contacts by name, email, or phone number.
Parameters:
query
: Search term to find in contactsmax_results
(optional): Maximum number of results to return (default: 10)
Example:
🏢 list_workspace_users
Lists Google Workspace users in your organization's directory.
Parameters:
query
(optional): Search term to find specific usersmax_results
(optional): Maximum number of results to return (default: 50)
Example:
🔭 search_directory
Performs a targeted search of your organization's Google Workspace directory.
Parameters:
query
: Search term to find specific directory membersmax_results
(optional): Maximum number of results to return (default: 20)
Example:
👥 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:
🔒 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.
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
A Machine Conversation Protocol server that enables AI assistants to manage Google Contacts and search Google Workspace directories, providing tools for listing, creating, updating, and deleting contacts within your Google account.
Related MCP Servers
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants to interact with Gmail services, supporting email operations, draft management, and calendar functionality through Google API integration.Last updated -461
- -securityAlicense-qualityA server that provides a Machine Control Protocol (MCP) interface to search, access, and interact with Google Drive files and folders, enabling AI assistants to work with Google Drive content.Last updated -5MIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI agents to interact with Google Workspace services including Drive, Docs, and Sheets through natural language commands.Last updated -8MIT License
- -securityAlicense-qualityA Model Context Protocol server that enables AI assistants to manage Gmail through natural language interactions with features like sending emails, searching, and label management.Last updated -2,670MIT License