The Google Workspace extension for Gemini CLI brings the power of your Google Workspace apps to your command line. Manage your documents, spreadsheets, presentations, emails, chat, and calendar events without leaving your terminal.
This repo also ships a self-hostable remote MCP server on Cloudflare Workers.
The public /mcp surface is code-mode-first (search + execute — the entire
toolset in ~1k tokens regardless of tool count): clients discover with
code_mode_search (which filters the catalog inside a sandbox and returns only
the subset needed), then use code_mode_run to orchestrate the internal Google
Workspace tools (await tools.<name>(args)) — a far smaller token footprint
than advertising every native tool directly (per Cloudflare's
Code Mode).
The Worker still provides stateless JSON-RPC over /mcp, single-Worker
deployment, D1-backed operation/asset logging, and per-user Google OAuth
(multi-user, keyed by Google account). See
/gws/setup (served at /gws/setup once
deployed) for the full setup and deploy walkthrough: OAuth client creation,
wrangler secret put, KV/D1 bindings, pnpm run migrate:remote, pnpm run deploy, and connecting an MCP client with the session bearer token.
Before using the Google Workspace extension, you need to be logged into your Google account.
Install the Google Workspace extension by running the following command from your terminal:
gemini extensions install https://github.com/gemini-cli-extensions/workspaceOnce the extension is installed, you can use it to interact with your Google Workspace apps. Here are a few examples:
Create a new Google Doc:
"Create a new Google Doc with the title 'My New Doc' and the content '# My New Document\n\nThis is a new document created from the command line.'"
List your upcoming calendar events:
"What's on my calendar for today?"
Search for a file in Google Drive:
"Find the file named 'my-file.txt' in my Google Drive."
This extension provides a variety of commands. Here are a few examples:
Command: /calendar:get-schedule [date]
Shows your schedule for today or a specified date.
Command: /drive:search <query>
Searches your Google Drive for files matching the given query.
If you're using the extension over SSH, WSL, Cloud Shell, or another environment without a local browser, you can authenticate using the headless login tool:
npm run auth-utils -- loginThis prints an OAuth URL you can open in any browser (local machine, phone,
etc.). After signing in, paste the credentials JSON into the CLI. Credentials
are read securely from /dev/tty and are never exposed to the AI model. See the
development docs for more
details.
If you want to host your own version of this extension's infrastructure, see the GCP Recreation Guide.
- Documentation: Detailed documentation on all the available tools.
- GitHub Issues: Report bugs or request features.
When exposing any language model to untrusted data, there's a risk of an indirect prompt injection attack. Agentic tools like Gemini CLI, connected to MCP servers, have access to a wide array of tools and APIs.
This MCP server grants the agent the ability to read, modify, and delete your Google Account data, as well as other data shared with you.
- Never use this with untrusted tools
- Never include untrusted inputs into the model context. This includes asking Gemini CLI to process mail, documents, or other resources from unverified sources.
- Untrusted inputs may contain hidden instructions that could hijack your CLI session. Attackers can then leverage this to modify, steal, or destroy your data.
- Always carefully review actions taken by Gemini CLI on your behalf to ensure they are correct and align with your intentions.
Contributions are welcome! Please read the CONTRIBUTING.md file for details on how to contribute to this project.
- License: Apache License 2.0
- Terms of Service: Terms of Service
- Privacy Policy: Privacy Policy
- Security: Security Policy