
gws-admin-mcp
io.github.antct11由 GitHub 帳號 antct11 發布v0.3.0更新於 Oct 25, 2026
Safe Google Workspace admin for AI agents: read-only by default, confirm-gated deletes, audit log.
概覽
一個本機 MCP 伺服器,為 AI 助理提供安全的 Google Workspace 管理主控台:預設唯讀,破壞性操作需二次確認,並留有稽核記錄。
- 可以做什麼
- 列出並檢視使用者、群組、成員、組織單位、角色、網域、客戶資訊與群組設定,清單呼叫支援 Admin SDK 搜尋語法並自動分頁。檢視稽核記錄活動以及依使用者或依客戶的用量報表。啟用寫入模式後,可建立、更新、停權、重設密碼、移動或刪除使用者,並管理群組、組織單位、角色指派與群組設定。列出行動裝置與 ChromeOS 裝置,寫入模式下可移動裝置或執行抹除、取消佈建操作。
- 適用情境
- 適合讓助理回答 Google Workspace 網域內的問題,例如長期未登入的使用者或群組成員,或在變更窗口內執行受控的管理變更。預設唯讀模式適合日常查詢,寫入模式用於有人監督的明確變更。
- 執行需求
- 在本機執行,需要 Node.js 20 或更新版本。需要一個啟用 Admin SDK 與 Groups Settings API 的 Google Cloud 專案、服務帳戶 JSON 金鑰,並為該服務帳戶的用戶端 ID 授予網域層級委派。需在 config.json 的 delegatedAdmin 或 DELEGATED_ADMIN 變數中指定要模擬的 Workspace 超級管理員;也會讀取 GOOGLE_SA_KEY 與 CUSTOMER_ID。僅支援桌面版 MCP 用戶端。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 gws-admin-mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
gws-admin-mcp
A local Model Context Protocol (MCP) server that gives your AI agent (Cursor, Claude Desktop, or any MCP client) a safe Google Workspace admin console. It talks to the Admin SDK (Directory, Reports, Groups Settings) through a service account with domain-wide delegation, so the agent can answer questions like "which users haven't logged in for 90 days?" or "who is in the Finance group?" — and, only when you explicitly allow it, make changes.
Runs entirely on your machine. No third-party service, no telemetry, no data leaves your laptop except the Google API calls themselves.
Safety model
This server assumes the agent driving it is fallible. Three layers:
- Read-only by default. Out of the box only the 17 read tools are
registered — write tools are not hidden behind a runtime check, they simply
do not exist in the tool list, so the agent cannot call them. Mutations
require starting the server with
--allow-write(orGWS_ADMIN_ALLOW_WRITE=1). - Confirm gate on destructive calls. Even with writes enabled, the
irreversible operations —
users_delete,groups_delete,orgunits_delete,role_assignment_delete, mobile device wipe actions, and ChromeOS deprovision — are refused unless the call includes"confirm": true. The agent has to make the destructive intent explicit a second time. - Audit log. Every tool call is appended as JSON lines to
~/.config/gws-admin-mcp/audit.log(mode 600), with passwords and secrets redacted. Disable withGWS_ADMIN_AUDIT=0if you must.
Recommended pattern: run the read-only instance permanently, and start a second, write-enabled instance only for the duration of a change window.
Tools (40 total; 17 in read-only mode)
* Destructive — additionally requires "confirm": true in the call
(device tools only for wipe/deprovision actions).
List tools auto-paginate up to a maxResults cap, and users_list supports
the full Admin SDK search syntax (orgUnitPath='/Sales', isAdmin=true,
email:jdoe*, ...).
Requirements
- Node.js >= 20
- Super-admin access to a Google Workspace domain (to grant domain-wide delegation)
- A Google Cloud project (free — the Admin SDK has no usage cost)
Google Cloud setup
You need a service account whose key the server uses to impersonate a Workspace super-admin. Two paths:
Path A — scripted (needs gcloud)
The script creates/reuses the project, enables the Admin SDK + Groups
Settings APIs, creates the service account, writes the key and config to
~/.config/gws-admin-mcp/, and prints the client ID + scope string for the
final manual step (step 5 below — Google provides no API for that part).
Path B — manual (Cloud console)
- Create a project at console.cloud.google.com (or reuse one dedicated to admin tooling).
- Enable APIs: Admin SDK API and Groups Settings API (APIs & Services → Library).
- Create a service account (IAM & Admin → Service Accounts → Create). No project-level IAM roles are needed — its power comes entirely from the delegation grant in the next steps.
- Create a JSON key for it (Keys tab → Add key → JSON) and save it as
~/.config/gws-admin-mcp/service-account.jsonwithchmod 600. - Grant domain-wide delegation — this is the step people miss:
- Copy the service account's OAuth 2 client ID (a long number, shown on the service account details page).
- In the Admin console (admin.google.com): Security → Access and data control → API controls → Domain-wide delegation → Add new.
- Paste the client ID, and paste this exact scope list as one comma-separated line:
- Tell the server which admin to impersonate. Create
~/.config/gws-admin-mcp/config.json:
delegatedAdmin must be a super-admin of the domain. my_customer
resolves to that admin's own organization.
Environment variables override the config files: GOOGLE_SA_KEY (key path),
DELEGATED_ADMIN, CUSTOMER_ID, GWS_ADMIN_CONFIG_DIR (alternate config
directory). See .env.example.
Build and verify
doctor checks the key, mints a delegated token, and runs sample reads
against users, domains, roles, and the audit reports API. All four should say
PASS. Then optionally:
MCP client configuration
Cursor (~/.cursor/mcp.json)
Read-only — the recommended default:
Write-enabled (use deliberately, ideally as a second entry you toggle on):
Claude Desktop (claude_desktop_config.json)
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json ·
Windows: %APPDATA%\Claude\claude_desktop_config.json
Restart the client after editing. You should see the gws-admin server with
17 tools (read-only) or 40 (write-enabled).
Troubleshooting
Security notes
- The service-account key impersonates a super-admin with org-wide power.
Treat
service-account.jsonlike a domain-admin password: keep it out of git (this repo's.gitignorealready excludes key files,.env, andconfig.json), keep itchmod 600, and rotate it periodically. - Prefer a dedicated Cloud project for this service account so the key is easy to audit and revoke.
- Keep the permanent instance read-only. Enable writes in a separate instance only when you actually intend to change things, and turn it off after.
License & purchase
This repository is source-available, not open source: the code is public so you can read and audit every line before trusting it with a super-admin credential, but using it requires a license.
- Buy a license ($34): antchoutine.gumroad.com/l/gws-admin-mcp — perpetual, includes the full write-enabled edition and updates.
- Try it free: the read-only edition (17 tools, no mutating code) is on
npm as
gws-admin-mcp.
See LICENSE for the exact terms (no redistribution, no offering it as a hosted service).
來源:README.md,提交 e941550
工具
0版本歷史
1- v0.3.0最新Sep 16, 2026
評分
已滿足適用檢查項的 40%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
請在儲存庫或註冊中心條目中宣告授權條款。

