MCP Google Contacts Server
📇 MCP Google 通讯录服务器
提供 Google 通讯录功能的机器对话协议 (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(推荐)
如果尚未安装 uv,请安装它:
pip install uv克隆存储库:
git clone https://github.com/rayanzaki/mcp-google-contacts-server.git cd mcp-google-contacts-server创建虚拟环境并安装依赖项:
uv venv source .venv/bin/activate uv pip install -r requirements.txt
📦使用 pip
克隆存储库:
git clone https://github.com/rayanzaki/mcp-google-contacts-server.git cd mcp-google-contacts-server安装依赖项:
pip install -r requirements.txt
🔑 身份验证设置
服务器需要 Google API 凭据才能访问您的联系人。您有以下几种选择:
🔐 选项 1:使用 credentials.json 文件
创建 Google Cloud 项目并启用 People API
创建 OAuth 2.0 凭据(桌面应用程序类型)
下载 credentials.json 文件
将其放置在以下位置之一:
本项目的根目录
您的主目录(~/google-contacts-credentials.json)
使用
--credentials-file参数指定其位置
🔐 选项 2:使用环境变量
设置以下环境变量:
GOOGLE_CLIENT_ID:您的 Google OAuth 客户端 IDGOOGLE_CLIENT_SECRET:您的 Google OAuth 客户端密钥GOOGLE_REFRESH_TOKEN:您帐户的有效刷新令牌
🛠️ 使用方法
🏃♂️ 基本启动
python src/main.py
# or
uv run src/main.py这将使用默认的 stdio 传输启动服务器。
⚙️ 命令行参数
争论 | 描述 | 默认值 |
| 要使用的传输协议( |
|
| HTTP 传输的主机 |
|
| HTTP 传输端口 |
|
| Google OAuth 客户端 ID(覆盖环境变量) | - |
| Google OAuth 客户端密钥(覆盖环境变量) | - |
| Google OAuth 刷新令牌(覆盖环境变量) | - |
| 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 和 Cline)一起使用,请将其添加到您的 MCP 配置中:
{
"mcpServers": {
"google-contacts-server": {
"command": "uv",
"args": [
"--directory",
"/path/to/mcp-google-contacts-server",
"run",
"main.py"
],
"disabled": false,
"autoApprove": []
}
}
}🧰 可用工具
该 MCP 服务器提供以下工具:
工具 | 描述 |
| 列出所有联系人或按姓名过滤 |
| 通过资源名称或电子邮件获取联系人 |
| 创建新联系人 |
| 更新现有联系人 |
| 按资源名称删除联系人 |
| 按姓名、电子邮件或电话号码搜索联系人 |
| 列出您组织目录中的 Google Workspace 用户 |
| 在 Google Workspace 目录中搜索人员 |
| 从“其他联系人”部分检索联系人 |
🔍 详细工具描述
📋 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 配额限制
📝 日志:检查控制台输出中的错误消息和调试信息
👥 贡献
欢迎贡献代码!欢迎提交 Pull 请求。
📄 许可证
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅 LICENSE 文件。
Available Tools
9 toolscreate_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
Scored across 9 tools
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.
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.
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.
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
Related MCP Connectors
Hosted Google Calendar MCP server for AI agents. No self-hosting or Google Cloud setup.
MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
MCP server for OnceAsk, the AI-native current-address layer for people and agents.
Hosted MCP server for Gmail, Outlook, iCloud, Fastmail & Yahoo Mail with per-workspace controls.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceA full-featured Model Context Protocol server that gives AI assistants real-time access to Google Workspace services including Drive, Gmail, Calendar, Sheets, Docs, and Apps Script.2,330 PyPI12MIT
- AlicenseNot gradedqualityDmaintenanceGives AI assistants access to Google Contacts, supporting listing, searching, creating, updating, and deleting contacts, as well as searching Google Workspace directories.MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol (MCP) server that integrates Google Contacts with Claude, enabling contact management directly from your AI assistant.MIT
- AlicenseNot gradedqualityBmaintenanceA CardDAV MCP server that exposes contacts and address books as tools for AI assistants.572 npm2MIT