← 返回
沟通协作 Key 中文

Google Workspace CLI (gws)

Google Workspace CLI (official Google release) for Drive, Gmail, Calendar, Sheets, Docs, Chat, Admin, and every Workspace API. Includes native MCP server mod...
Google Workspace 命令行工具(Google 官方发布),支持 Drive、Gmail、日历、表格、文档、Chat、管理员及所有 Workspace API,内置原生 MCP 服务器模式。
zero2ai-hub
沟通协作 clawhub v1.0.0 1 版本 99891.3 Key: 需要
★ 0
Stars
📥 919
下载
💾 11
安装
1
版本
#latest

概述

gws — Google Workspace CLI

Official Google-published CLI for all Workspace APIs. Dynamically built from Google Discovery Service — covers every API endpoint automatically as Google adds them.

Note: This is the official Google-org CLI (googleworkspace/cli), distinct from third-party alternatives. Prefer gws for new integrations — it has native MCP mode and active development from Google.


APIs Covered

  • Drive — files, folders, sharing, permissions
  • Gmail — messages, labels, drafts, send
  • Calendar — events, calendars, invites
  • Sheets — spreadsheets, values, formatting
  • Docs — documents read/write
  • Chat — spaces, messages
  • Admin — users, groups, org units
  • Tasks — task lists, tasks
  • Meet — meeting resources
  • ...and every other Workspace API via Discovery Service

Installation

npm install -g @googleworkspace/cli
# or: cargo install --git https://github.com/googleworkspace/cli --locked
# or: nix run github:googleworkspace/cli

Verify:

gws --version

Authentication (One-time Setup Required)

⚠️ Auth requires manual action — OAuth credentials must be set up once per account.

Option A: With gcloud (fastest)

gws auth setup   # creates GCP project, enables APIs, logs in
gws auth login   # subsequent logins / scope changes

Option B: Without gcloud (manual GCP console)

  1. Go to console.cloud.google.com → create project
  2. Enable Workspace APIs (Drive, Gmail, Calendar, etc.)
  3. Create OAuth 2.0 Client ID (Desktop app type)
  4. Download credentials JSON
  5. Set: export GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=/path/to/credentials.json
  6. Run: gws auth login

Option C: Service Account (server/headless)

export GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE=/path/to/service-account.json

Credentials are encrypted at rest (AES-256-GCM) with OS keyring.


Basic Usage

# List 10 most recent Drive files
gws drive files list --params '{"pageSize": 10}'

# Create a spreadsheet
gws sheets spreadsheets create --json '{"properties": {"title": "Q1 Budget"}}'

# List Gmail messages
gws gmail users messages list --params '{"userId": "me", "maxResults": 5}'

# Send a Gmail message
gws gmail users messages send --params '{"userId": "me"}' --json '{"raw": "<base64>"}'

# Inspect any method schema
gws schema drive.files.list

# Stream paginated results
gws drive files list --params '{"pageSize": 100}' --page-all | jq -r '.files[].name'

# Dry-run (preview request without executing)
gws chat spaces messages create --params '{"parent": "spaces/xyz"}' --json '{"text": "test"}' --dry-run

MCP Server Mode (AI Agent Use)

gws can act as an MCP server, exposing all Workspace APIs as structured tools for Claude, Cursor, VS Code, etc.

# Start MCP server (all services)
gws mcp

# Start MCP server (specific services only — recommended)
gws mcp -s drive,gmail,calendar

# Compact mode — reduces from 200-400 tools to ~26 meta-tools (saves context)
gws mcp -s drive,gmail,calendar --tool-mode compact

Add to your agent config (e.g. OpenClaw / mcporter):

{
  "mcpServers": {
    "google-workspace": {
      "command": "gws",
      "args": ["mcp", "-s", "drive,gmail,calendar,sheets,docs", "--tool-mode", "compact"]
    }
  }
}

OpenClaw Agent Usage

After auth setup, the agent can:

  • Read/send Gmail → automate email workflows
  • Read/write Calendar → schedule meetings, parse availability
  • Read/write Sheets → log data, pull reports
  • Manage Drive → organize files, share docs
  • Chat → send notifications to Google Chat spaces

Example — list recent emails:

gws gmail users messages list --params '{"userId": "me", "maxResults": 10, "q": "is:unread"}'

Notes

  • Auth is manual (one-time) — must complete gws auth setup before first use
  • Active development — pre-v1.0, expect breaking changes; check GitHub for latest
  • Official Google org — published by googleworkspace on GitHub, not a third-party
  • No boilerplate — structured JSON output, works with jq and scripts
  • MCP-native — expose any Workspace API as an MCP tool with a single command

Status

  • Viability: ✅ HIGH — official Google org, MCP-native, npm installable
  • Auth blocker: ⚠️ Manual one-time gws auth setup required (GCP project needed)
  • Replacement: Better long-term choice vs. gcloud scripting — auto-updates with Google API surface

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 17:09 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

communication-collaboration

Slack

steipete
当需要通过 slack 工具从 Clawdbot 控制 Slack 时使用,包括在频道或私信中回复消息或置顶/取消置顶项目。
★ 157 📥 47,748
communication-collaboration

Himalaya

lamelas
{"answer":"通过IMAP/SMTP管理邮件的CLI。可在终端使用 `himalaya` 收发、回复、转发、搜索及整理邮件。支持多账户与MML(MIME元语言)编写邮件。"}
★ 68 📥 45,630
productivity

Trading Journal

zero2ai-hub
记录每笔交易的完整背景(逻辑、入场、出场、盈亏、情绪、教训),生成周度与月度业绩报告,并分析盈亏模式...
★ 2 📥 2,951