Safe Google Workspace admin for AI agents: read-only by default, confirm-gated deletes, audit log.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
π‘ Paste into ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows)
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.
This server assumes the agent driving it is fallible. Three layers:
--allow-write (or
GWS_ADMIN_ALLOW_WRITE=1).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.~/.config/gws-admin-mcp/audit.log (mode 600), with passwords and secrets
redacted. Disable with GWS_ADMIN_AUDIT=0 if 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.
| Area | Read-only tools | Write tools (require --allow-write) |
|---|---|---|
| Users | users_list, users_get | users_create, users_update, users_suspend, users_unsuspend, users_reset_password, users_make_admin, users_move_ou, users_delete* |
| Groups | groups_list, groups_get, groups_list_members | groups_create, groups_update, groups_delete*, groups_add_member, groups_remove_member, groups_update_member |
| Org units | orgunits_list, orgunits_get | orgunits_create, orgunits_update, orgunits_delete* |
| Roles | roles_list, role_assignments_list | role_assignment_create, role_assignment_delete* |
| Domains / customer | domains_list, customer_get | β |
| Devices | devices_list_mobile, devices_list_chromeos | devices_action_mobile, devices_action_chromeos, devices_move_chromeos |
| Reports | reports_activities (audit log), reports_usage_user, reports_usage_customer | β |
| Group settings | groupsettings_get | groupsettings_update |
* 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*, ...).
You need a service account whose key the server uses to impersonate a Workspace super-admin. Two paths:
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).
~/.config/gws-admin-mcp/service-account.json with chmod 600.~/.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.
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:
~/.cursor/mcp.json)Read-only β the recommended default:
Write-enabled (use deliberately, ideally as a second entry you toggle on):
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).
| Symptom | Cause / fix |
|---|---|
unauthorized_client when minting a token | The domain-wide delegation grant is missing, uses the wrong client ID, or its scope list doesn't cover every scope the server requests. Re-paste the full scope string from above against the SA's OAuth2 client ID. Grants can take a few minutes to propagate. |
Service-account key not found at ... | Put the JSON key at ~/.config/gws-admin-mcp/service-account.json or set GOOGLE_SA_KEY to its path. |
DELEGATED_ADMIN ... is not set | Add delegatedAdmin to config.json or set the DELEGATED_ADMIN env var. |
403 Not Authorized to access this resource/api | The impersonated user is not a super-admin, or the Admin SDK API isn't enabled in the Cloud project. |
404 from Groups Settings calls | The Groups Settings API isn't enabled in the project (it's separate from the Admin SDK). |
| Write tools don't appear in the client | Working as intended β start the server with --allow-write or GWS_ADMIN_ALLOW_WRITE=1. |
A delete/wipe call returns Refused: ... destructive/irreversible | Working as intended β re-issue the call with "confirm": true. |
| Client shows the server as failed on startup | Run node dist/cli.js doctor in a terminal; it prints the exact failing check. Also confirm the args path in your MCP config is absolute. |
service-account.json like a domain-admin password: keep it out of
git (this repo's .gitignore already excludes key files, .env, and
config.json), keep it chmod 600, and rotate it periodically.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.
gws-admin-mcp.See LICENSE for the exact terms (no redistribution, no offering it as a hosted service).
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/gws-admin-mcp)<a href="https://allmcps.com/mcp/gws-admin-mcp"><img src="https://allmcps.com/api/badge/gws-admin-mcp?style=directory" alt="Gws Admin Mcp on AllMCPs" /></a>