Deep automation for Google Workspace through the Model Context Protocol
Drive · Docs · Sheets · Gmail · Calendar · Tasks · Forms · Apps Script — one local MCP server with 39 consolidated tools (20 in the default core profile), staged writes and server-side tool profiles.
Workspace Operator runs on your machine, talks to Google over your own OAuth client, and gives an AI agent the operations that turn "read my inbox" into "do the work and let me undo it": staged Apps Script updates, file transfer, sheet formatting, threaded replies and attachments.
39 tools · 3 resources · 3 resource templates · 7 prompts, every tool annotated with readOnlyHint / destructiveHint.
Nothing here is tied to a specific account, spreadsheet or document: every tool takes identifiers and ranges, and all examples use synthetic data.
Find the last message, read it, then move it to Trash. The message stays recoverable for 30 days.
Official servers are the right default for "ask my mail a question". Workspace Operator is for "change the workspace and be able to roll it back".
Plus 3 resources, 3 resource templates and 7 prompts — see the tool catalog.
Workspace Operator is a single-user server: one process, one Google account, one tool profile. "Several clients" does not mean "several users".
A bearer token only identifies a client in the audit log; it does not create a separate user. Anyone holding a valid token can call every exposed tool and cancel any bulk job in that instance. Read SECURITY.md before sharing an instance with other people.
Both paths need Google OAuth once. The HTTP path additionally needs a local MCP_AUTH_TOKEN string; it is not a Google credential and has nothing to do with your Google account.
stdio (recommended for a single desktop client)
pip install workspace-operator-mcp workspace-operator version Docker / HTTP (recommended for several clients)
docker pull ghcr.io/artoxem/workspace-operator:latest From source (development)
git clone https://github.com/Artoxem/workspace-operator.git cd workspace-operator python -m venv .venv && .venv\Scripts\activate # Windows pip install -r requirements.txt Python 3.10 or newer. The package installs the workspace-operator command; python -m workspace_operator works from a source checkout too.
workspace-operator doctor The first run opens a browser. Sign in, allow the scopes, and the token is saved to ~/.google/token.json.
No browser (server, SSH, Docker host)? Authorize on a machine with a browser, then copy token.json next to oauth.keys.json on the target and mount that directory read-write into the container. The server refreshes the token in place, so a read-only mount breaks it.
Changed scopes or upgraded a major version? Delete token.json and run workspace-operator doctor again. The doctor prints exactly which scopes are missing instead of failing silently.
Step by step: docs/AUTH_SETUP.md · docs/ru/AUTH_SETUP.md
cp config.example.yaml config.yaml client_secrets_file: "/home/you/.google/oauth.keys.json" token_file: "/home/you/.google/token.json" backup_dir: "/home/you/.google/backups" # mcp_auth_token: prefer the MCP_AUTH_TOKEN environment variable (see below) tool_profile: "core" # core | full | read-write | read-only The server looks for a config file itself: ./config.yaml (or .yml / .json), then workspace-operator/config.yaml in your OS config directory (%APPDATA%\workspace-operator\config.yaml on Windows, ~/.config/workspace-operator/config.yaml on Linux, Application Support on macOS). MCP_CONFIG_FILE or --config PATH overrides the lookup, and a file named there must exist — the server exits with a clear error instead of falling back to defaults. workspace-operator doctor prints which file was used.
On Windows use forward slashes (C:/Users/you/.google/oauth.keys.json) or double backslashes in YAML. Every key can be overridden by an environment variable; see docs/SECURITY.md.
Two different secrets, do not mix them up:
Over stdio mcp_auth_token is only an activation key. Over HTTP it is the real per-request bearer, so it must be random: the server refuses to start with a placeholder such as change_me or a token shorter than 24 characters.
Keep secrets out of config.yaml. Set MCP_AUTH_TOKEN as an environment variable (generate one with python -c "import secrets; print(secrets.token_urlsafe(32))"); workspace-operator doctor warns when the token sits in the config file, when secret files are readable by other users and when stale credentials (token.json.bak-*, service-account.json) are left next to the token. token.json is written atomically with owner-only permissions. If a secret may have leaked, follow docs/SECURITY.md.
stdio client — the client launches the installed command:
{ "mcpServers": { "workspace-operator": { "command": "workspace-operator", "args": ["serve"], "env": { "MCP_CONFIG_FILE": "C:/Users/you/.google/config.yaml", "MCP_AUTH_TOKEN": " " } } } } HTTP client — the container or workspace-operator serve --http is already running:
{ "mcpServers": { "workspace-operator": { "url": "http://127.0.0.1:8765/mcp", "headers": { "Authorization": "Bearer put-a-long-random-string-here" } } } } Per-client file locations: docs/IDE_SETUP.md · docs/ru/IDE_SETUP.md. Antigravity has its own walkthrough: antigravity/README.md.
If the client cannot start the command, check workspace-operator version in the same shell the client uses — IDEs often have a different PATH.
A profile is a server-side allow-list: tools outside it are neither listed nor callable. It complements OAuth scopes (what Google allows) and client permissions (what the agent may do without asking).
tool_profile: "core" # Optional, applied on top. Deny wins over allow. allowed_tools: ["workspace_search", "sheets_read", "read_doc", "gmail_read"] denied_tools: ["gmail_write", "drive_write"] Environment overrides: MCP_TOOL_PROFILE, MCP_ALLOWED_TOOLS, MCP_DENIED_TOOLS. A blocked call returns a clear explanation instead of failing silently.
Profiles are the second filter. At startup the server also hides tools whose Google OAuth scope is missing; see Scopes and tools.
See choosing a profile and the 2.0 migration guide.
python -m workspace_operator doctor # config, token, scopes, API reachability python -m workspace_operator doctor --offline # same, without network probes python -m workspace_operator tools # catalog (--profile read-only, --json) python -m workspace_operator serve # stdio server Feature How to use it What it does Dry run MCP_DRY_RUN=1 or dry_run: true Every non-read-only tool returns a preview instead of executing — safe demos, safe exploration Audit log MCP_AUDIT_LOG=~/.google/audit.jsonl One JSON line per call: tool, profile, status, duration, argument names (never values) Retries MCP_RETRY_ATTEMPTS=3 Transient Google API errors (429/5xx) are retried with exponential backoff Doctor python -m workspace_operator doctor Checks secrets, token, granted vs configured scopes and API reachability; exits 1 when a critical check fails Scope routing MCP_SCOPE_ROUTING=1 (default) Hides tools whose Google scope is missing; 0 disables hiding for debugging Public sharing MCP_ALLOW_PUBLIC_SHARING=0 (default) Public links stay blocked unless explicitly enabled Approval queue workspace-operator approvals list Shows pending destructive calls; approve / deny releases or blocks the exact hashed call; link prints the browser page link (it carries a secret the agent never sees) Upload guard MCP_UPLOAD_ROOTS=/a,/b drive_write(action="upload") always refuses OAuth secrets, .env*, keys and ~/.google/~/.ssh; the optional allow-list restricts it to chosen folders In dry-run the read-only tools still work, so an agent can explore data while every write is turned into an explicit preview.
python -m workspace_operator serve --http --port 8765 Profiles are exposed as stable paths: /mcp (config profile, default core), /mcp/read, /mcp/read-write and /mcp/full. Connect each client to the surface it needs; the list stays stable for that connection.
The container speaks HTTP. It cannot open a browser, so authorize Google on the host first:
cp .env.example .env # set MCP_AUTH_TOKEN and GOOGLE_DIR docker compose up -d curl http://127.0.0.1:8765/healthz docker-compose.yml mounts config.docker.yaml, the Google folder read-write, and ./data for the audit log and bulk jobs. The image itself binds 127.0.0.1; Compose adds --allow-network --insecure and publishes the port on the host loopback only. With a plain docker run, append --http --host 0.0.0.0 --allow-network --insecure to the command and keep the -p 127.0.0.1:8765:8765 mapping (otherwise the container is exposed without TLS). Uploads inside the container are limited to /home/app/data/upload. The shipped config.docker.yaml keeps the conservative core profile (20 tools); put MCP_TOOL_PROFILE=full (or read-write, read-only) in .env to change the exposed surface without editing the tracked config — Compose passes the variable through.
docker run -d --name workspace-operator --restart unless-stopped \ -p 127.0.0.1:8765:8765 \ -v "$HOME/.google:/home/app/.google" \ -v "$PWD/config.docker.yaml:/app/config.yaml:ro" \ -v "$PWD/data:/home/app/data" \ -e MCP_AUTH_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')" \ ghcr.io/artoxem/workspace-operator:latest \ --http --host 0.0.0.0 --port 8765 --allow-network --insecure docker run — Windows PowerShell
$token = python -c "import secrets; print(secrets.token_urlsafe(32))" docker run -d --name workspace-operator --restart unless-stopped ` -p 127.0.0.1:8765:8765 ` -v "${env:USERPROFILE}\.google:/home/app/.google" ` -v "${PWD}\config.docker.yaml:/app/config.yaml:ro" ` -v "${PWD}\data:/home/app/data" ` -e MCP_AUTH_TOKEN=$token ` ghcr.io/artoxem/workspace-operator:latest ` --http --host 0.0.0.0 --port 8765 --allow-network --insecure Point the HTTP client at http://127.0.0.1:8765/mcp with Authorization: Bearer . The Google folder is mounted read-write on purpose: the server refreshes token.json in place.
docker compose ps reports healthy and /healthz returns the running version.
stdio clients that only speak stdio can still use the image — the entrypoint takes the same arguments as the CLI:
docker run -i --rm \ -v "$HOME/.google:/home/app/.google" \ --entrypoint python \ ghcr.io/artoxem/workspace-operator:latest -m workspace_operator serve Something not working? See docs/TROUBLESHOOTING.md.
39 consolidated tools. The default core profile exposes 20; full adds formatting, destructive edits, Forms, Postmaster and Script actions.
Call a consolidated tool with an action, for example drive_read(action="metadata", file_id=...) or sheets_write(action="append", spreadsheet_id=..., range=..., values=...).
⚠️ An agent can reach everything your OAuth token can. Use read-only scopes and the read-only profile for sensitive accounts — docs/SECURITY.md.
server.py builds the MCP server and registers the request handlers workspace_operator/ ├─ toolset/ typed catalog, action router, scope/profile surface │ ├─ models.py ToolSpec / ActionSpec / Safety / Surface │ ├─ catalog.py 39 consolidated tools and action → handler map │ ├─ surface.py profile + scope filtering │ ├─ routing.py action validation and confirm gate │ └─ scopes.py granted Google scopes from the token file ├─ definitions/ tool and prompt definitions as data: one JSON per domain, │ order.json (the order of tools/list), prompts.json ├─ tool_router.py tools/call pipeline: resolve → validate → dry-run → approve → run ├─ prompts.py prompt messages built from live Gmail/Calendar/Drive/Sheets data ├─ resources.py read-only resources (Drive, Gmail, Calendar, Sheets, Docs) ├─ dispatch.py routing table: handler name → function + argument mapping ├─ profiles.py core / full / read-write / read-only ├─ config.py config file + environment overrides ├─ auth.py OAuth 2.0 credentials; token refresh under a file lock ├─ secure_files.py owner-only atomic writes, file lock, protected paths ├─ approvals.py human approval queue (per-approval secret, one-time ids) ├─ http_transport.py Streamable HTTP: bearer auth, DNS-rebinding guard, approval pages ├─ bulk/ plan → job engine: selector, store, run/cancel/undo ├─ text.py entity/whitespace normalisation, timestamps, error hints ├─ operations.py staged-operation store for Apps Script ├─ security.py token and email checks ├─ runtime.py retries, audit log, dry-run helpers ├─ cli.py doctor / tools / approvals / serve └─ handlers/ Google API implementations used by the catalog tests/ unit, surface and in-memory MCP checks antigravity/ ready-to-paste mcp_config.json skills/google-workspace/ Agent Skill: when to use which tool Design rules:
A handler is reachable through four places that must agree; the tests tell you which one you forgot:
Regenerate the golden snapshots only for an intentional change: UPDATE_GOLDEN=1 python -m pytest tests/test_handler_dispatch.py. JSON files must be listed in [tool.setuptools.package-data] (already covered for definitions/), or the wheel ships without them.
pip install -e ".[dev]" python -m pytest # 448 unit and in-memory MCP tests (coverage via --cov) python -m ruff check workspace_operator tests python -m mypy The suite covers the catalog, action router, profiles, scope filtering, HTTP security decisions, approvals, file/secret safety, handlers and documentation sync. GitHub Actions (.github/workflows/ci.yml) runs pytest on Linux and Windows (Python 3.10, 3.12, 3.13), ruff, mypy, bandit and a dependency audit; the PyPI and Docker publish workflows depend on it. Live Google calls are not part of CI; use /mcp/full with a test document when you want a manual smoke.
Knowing the edges is part of the contract:
You are responsible for what the agent does with your account. Read docs/SECURITY.md, start with read-only, keep backups on.
MIT licensed · built on the MCP Python SDK
Both files in this release have provenance metadata.
mcp model-context-protocol google gmail drive sheets docs slides calendar apps-script antigravity gemini-cli
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.
Both files in this release have been uploaded with provenance metadata.
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Nov 22, 2026 2 release files Full provenance
Nov 21, 2026 2 release files Full provenance
Nov 18, 2026 2 release files Full provenance
Nov 16, 2026 2 release files Full provenance
Nov 15, 2026 2 release files Full provenance
Nov 14, 2026 2 release files Full provenance
Nov 12, 2026 2 release files Full provenance
Nov 11, 2026 2 release files Full provenance
Nov 10, 2026 2 release files Full provenance
Nov 6, 2026 2 release files Full provenance




