Back to MCP directory
publicPublicdnsLocal runtime

google-workspace-mcp

Google Workspace管理工具,通过Admin SDK提供用户、邮件和日历等资源的管理功能

article

README

🚀 Google Workspace MCP

Google Workspace MCP 是一个用于管理 Google Workspace 资源的 Model Context Protocol (MCP) 服务器,它借助 Admin SDK 提供实用工具,能有效助力 Google Workspace 资源的管理工作。

🚀 快速开始

先决条件

  • 启用 Admin SDK API 的 Google Cloud Platform 项目。
  • 具备适当权限的服务账户。
  • 用于代入的 Google Workspace 管理员用户邮箱。

设置

服务账户配置

  1. 在 Google Cloud Console 中创建一个服务账户。
  2. 授予该服务账户使用 Google Workspace Admin SDK 的适当权限。
  3. 创建并下载服务账户的 JSON 密钥文件。
  4. 启用该服务账户的域范围委托功能。
  5. 在 Google Workspace 管理控制台中授予服务账户必要的 OAuth 作用域。

环境变量

应用程序需要以下环境变量: | 变量 | 描述 | |------|------| | GOOGLE_SERVICE_ACCOUNT | 服务账户 JSON 密钥文件的路径 | | GOOGLE_ADMIN_EMAIL | Google Workspace 管理员用户的邮箱地址 |

📦 安装指南

构建

make build

配置示例

{
  "mcpServers": {
     "googleworkspace-mcp": {
      "command": "/go/bin/google-workspace-mcp",
      "args": [],
      "env": {
        "GOOGLE_SERVICE_ACCOUNT": "test.json",
        "GOOGLE_ADMIN_EMAIL": "admin@yourdomain.com"
      },
      "disabled": false,
      "autoApprove": []
    }
  }
}

⚠️ 重要提示

确保您的服务账户在 Google Cloud Console 中启用了必要的 API 访问权限(Admin SDK API、Gmail API 和 Calendar API)。

💻 使用示例

基础用法

本项目提供了一系列实用工具,可用于管理 Google Workspace 资源,以下是各工具的介绍:

  • directory_users - 列出 Google Workspace 目录中的所有用户。
  • create_user - 创建新的 Google Workspace 用户。
  • list_gmail - 列出最近的 Gmail 信息(需要 Gmail API 访问权限)。
  • list_calendar_events - 列出某个用户的即将进行的日历事件(需要 Calendar API 访问权限)。
  • create_calendar_event - 创建新的日历事件(需要 Calendar API 访问权限)。

高级用法

在设置服务账户的域范围委托时,请授予以下 OAuth 作用域,以确保工具的正常使用:

  • https://www.googleapis.com/auth/admin.directory.user - 用于访问和管理目录用户信息。
  • https://www.googleapis.com/auth/gmail.readonly - 用于读取 Gmail 信息。
  • https://www.googleapis.com/auth/calendar - 用于读取和写入日历事件。
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client