
MCP fork of Google Workspace CLI
io.github.shigechika由 GitHub 帳號 shigechika 發布v0.22.5-mcp.38更新於 Oct 24, 2026
MCP fork of Google Workspace CLI (Gmail, Drive, Calendar, and more)
概覽
Google Workspace CLI 的 MCP 分支,讓助理在 Drive、Gmail、日曆、試算表、文件、Chat 等 Workspace API 上讀取與操作資料。
- 可以做什麼
- 處理 Drive 檔案:列出、建立、上傳與下載,支援自動分頁與 NDJSON 串流輸出。
- 操作 Gmail:寄送、回覆、全部回覆、轉寄、整理未讀郵件、監看新郵件。
- 管理日曆活動與行程,讀取或附加 Google 試算表數值與文件文字。
- 傳送 Chat 訊息、推送 Apps Script 專案,並使用站立會議報告、會議準備、每週摘要等工作流程輔助指令。
- 查詢任一 Workspace API 方法的請求與回應結構並直接呼叫,因為指令介面是在執行時由 Google Discovery Service 動態產生。
- 適用情境
- 適合讓助理在真實 Google Workspace 帳號中工作:彙整郵件、草擬回覆、安排或檢視會議、更新試算表與文件、上傳檔案。適用於已有 Google Cloud 專案、並願意授予 OAuth 權限的個人或團隊自動化情境。
- 執行需求
- 以本機程序執行,此處為透過 stdio 啟動的 Docker 映像。需要可存取 Workspace 的 Google 帳號,以及具備 OAuth 憑證的 Google Cloud 專案(桌面應用程式類型的 OAuth 用戶端或服務帳戶金鑰)。憑證可來自互動式登入,或來自 GOOGLE_WORKSPACE_CLI_TOKEN、GOOGLE_WORKSPACE_CLI_CREDENTIALS_FILE,或 GOOGLE_WORKSPACE_CLI_CLIENT_ID 搭配 GOOGLE_WORKSPACE_CLI_CLIENT_SECRET。選用的初始化指令需要 gcloud CLI;需要連線至 Google API 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 MCP fork of Google Workspace CLI,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
gws
One CLI for all of Google Workspace — built for humans and AI agents.
Drive, Gmail, Calendar, and every Workspace API. Zero boilerplate. Structured JSON output. 40+ agent skills included.
[!NOTE] This is not an officially supported Google product.
[npm version] [license] [CI status] [install size]
⬇️ Download the latest release for your OS
gws doesn't ship a static list of commands. It reads Google's own Discovery Service at runtime and builds its entire command surface dynamically. When Google Workspace adds an API endpoint or method, gws picks it up automatically.
[!IMPORTANT] This project is under active development. Expect breaking changes as we march toward v1.0.
Contents
- Prerequisites
- Installation
- Quick Start
- Why gws?
- Authentication
- AI Agent Skills
- Advanced Usage
- Environment Variables
- Exit Codes
- Architecture
- Troubleshooting
- Development
Prerequisites
- Node.js 18+ — for
npm install(or download a pre-built binary from GitHub Releases) - A Google Cloud project — required for OAuth credentials. You can create one via the Google Cloud Console or with the
gcloudCLI or with thegws auth setupcommand. - A Google account with access to Google Workspace
Installation
The recommended way to install gws is to download the pre-built binary for your OS and architecture from the GitHub Releases page. Extract the archive and place the gws binary in your $PATH.
For convenience, you can also use npm to automate downloading the appropriate binary from GitHub Releases:
Or build from source:
A Nix flake is also available at github:googleworkspace/cli
On macOS and Linux, you can also install via Homebrew:
Quick Start
Why gws?
For humans — stop writing curl calls against REST docs. gws gives you --help on every resource, --dry-run to preview requests, and auto‑pagination.
For AI agents — every response is structured JSON. Pair it with the included agent skills and your LLM can manage Workspace without custom tooling.
Authentication
The CLI supports multiple auth workflows so it works on your laptop, in CI, and on a server.
Which setup should I use?
Interactive (local desktop)
Credentials are encrypted at rest (AES-256-GCM) with the key stored in your OS keyring (or ~/.config/gws/.encryption_key when GOOGLE_WORKSPACE_CLI_KEYRING_BACKEND=file).
gws auth setuprequires thegcloudCLI. If you don't havegcloud, use the manual setup below instead.
[!WARNING] Scope limits in testing mode: If your OAuth app is unverified (testing mode), Google limits consent to ~25 scopes. The
recommendedscope preset includes 85+ scopes and will fail for unverified apps (especially for@gmail.comaccounts). Choose individual services instead to filter the scope picker:
Manual OAuth setup (Google Cloud Console)
Use this when gws auth setup cannot automate project/client creation, or when you want explicit control.
- Open Google Cloud Console in the target project:
- OAuth consent screen:
https://console.cloud.google.com/apis/credentials/consent?project=<PROJECT_ID> - Credentials:
https://console.cloud.google.com/apis/credentials?project=<PROJECT_ID>
- OAuth consent screen:
- Configure OAuth branding/audience if prompted:
- App type: External (testing mode is fine)
- Add your account under Test users
- Create an OAuth client:
- Type: Desktop app
- Download the client JSON and save it to:
~/.config/gws/client_secret.json
[!IMPORTANT] You must add yourself as a test user. In the OAuth consent screen, click Test users → Add users and enter your Google account email. Without this, login will fail with a generic "Access blocked" error.
Then run:
Browser-assisted auth (human or agent)
You can complete OAuth either manually or with browser automation.
- Human flow: run
gws auth login, open the printed URL, approve scopes. - Agent-assisted flow: the agent opens the URL, selects account, handles consent prompts, and returns control once the localhost callback succeeds.
If consent shows "Google hasn't verified this app" (testing mode), click Continue. If scope checkboxes appear, select required scopes (or Select all) before continuing.
Headless / CI (export flow)
- Complete interactive auth on a machine with a browser.
- Export credentials:
- On the headless machine:
Service Account (server-to-server)
Point to your key file; no login needed.
Pre-obtained Access Token
Useful when another tool (e.g. gcloud) already mints tokens for your environment.
Precedence
Environment variables can also live in a .env file.
AI Agent Skills
The repo ships 100+ Agent Skills (SKILL.md files) — one for every supported API, plus higher-level helpers for common workflows and 50 curated recipes for Gmail, Drive, Docs, Calendar, and Sheets. See the full Skills Index for the complete list.
OpenClaw setup
The gws-shared skill includes an install block so OpenClaw auto-installs the CLI via npm if gws isn't on PATH.
Gemini CLI Extension
-
Authenticate the CLI first:
-
Install the extension into the Gemini CLI:
Installing this extension gives your Gemini CLI agent direct access to all gws commands and Google Workspace agent skills. Because gws handles its own authentication securely, you simply need to authenticate your terminal once prior to using the agent, and the extension will automatically inherit your credentials.
Advanced Usage
Multipart Uploads
Pagination
Google Sheets — Shell Escaping
Sheets ranges use ! which bash interprets as history expansion. Always wrap values in single quotes:
Helper Commands
Some services ship hand-crafted helper commands alongside the auto-generated Discovery surface. Helper commands are prefixed with + so they are visually distinct and never collide with Discovery-generated method names.
Time-aware helpers (+agenda, +standup-report, +weekly-digest, +meeting-prep) automatically use your Google account timezone (fetched from Calendar Settings API and cached for 24 hours). Override with --timezone/--tz on +agenda, or set the --timezone flag for explicit control.
Run gws <service> --help to see both Discovery methods and helper commands together.
Full helper reference:
Examples:
Model Armor (Response Sanitization)
Integrate Google Cloud Model Armor to scan API responses for prompt injection before they reach your agent.
Environment Variables
All variables are optional. See .env.example for a copy-paste template.
Environment variables can also be set in a .env file (loaded via dotenvy).
Exit Codes
gws uses structured exit codes so scripts can branch on the failure type without parsing error output.
Architecture
gws uses a two-phase parsing strategy:
- Read
argv[1]to identify the service (e.g.drive) - Fetch the service's Discovery Document (cached 24 h)
- Build a
clap::Commandtree from the document's resources and methods - Re-parse the remaining arguments
- Authenticate, build the HTTP request, execute
All output — success, errors, download metadata — is structured JSON.
Troubleshooting
"Access blocked" or 403 during login
Your OAuth app is in testing mode and your account is not listed as a test user.
Fix: Open the OAuth consent screen in your GCP project → Test users → Add users → enter your Google account email. Then retry gws auth login.
"Google hasn't verified this app"
Expected when your app is in testing mode. Click Advanced → Go to <app name> (unsafe) to proceed. This is safe for personal use; verification is only required to publish the app to other users.
Too many scopes / consent screen error
Unverified (testing mode) apps are limited to ~25 OAuth scopes. The recommended scope preset includes many scopes and will exceed this limit.
Fix: Select only the scopes you need:
gcloud CLI not found
gws auth setup requires the gcloud CLI to automate project creation. You have three options:
- Install gcloud and use
gclouddirectly. - Re-run
gws auth setupwhich wrapsgcloudcalls. - Skip
gcloudentirely — set up OAuth credentials manually in the Cloud Console
redirect_uri_mismatch
The OAuth client was not created as a Desktop app type. In the Credentials page, delete the existing client, create a new one with type Desktop app, and download the new JSON.
API not enabled — accessNotConfigured
If a required Google API is not enabled for your GCP project, you will see a
403 error with reason accessNotConfigured:
gws also prints an actionable hint to stderr:
Steps to fix:
- Click the
enable_urllink (or copy it from theenable_urlJSON field). - In the GCP Console, click Enable.
- Wait ~10 seconds, then retry your
gwscommand.
[!TIP] You can also run
gws auth setupwhich walks you through enabling all required APIs for your project automatically.
Development
License
Apache-2.0
Disclaimer
[!CAUTION] This is not an officially supported Google product.
來源:README.md,提交 d12261b
工具
0版本歷史
2- v0.22.5-mcp.38最新Oct 1, 2026
- v0.22.5-mcp.36Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分