Skip to main content
Glama
duc-long

Google Workspace MCP for Antigravity IDE

by duc-long

Antigravity IDE x Google Workspace (Docs, Sheets, Drive) MCP

License: MIT PRs Welcome Node Version Token Savings

A standalone, token-optimized Model Context Protocol (MCP) server integration connecting Antigravity IDE with Google Docs, Google Sheets, Google Drive, Gmail, and Google Calendar.

Engineered with token-reduction protocols (AGENTS.md) designed to reduce context consumption by 70% to 90%, accelerating agent latency and preserving the LLM context window.


Table of Contents

  1. Overview & Capabilities

  2. Prerequisites

  3. Step 1: Google Cloud OAuth 2.0 Credentials

  4. Step 2: Interactive Setup & Management Script

  5. Step 3: IDE Activation

  6. Token Optimization Strategy

  7. Turnkey Templates, Recipes & Antigravity Skill

  8. Project Workspace Starter Kit (Your Own Project)

  9. Credential Management & Revocation

  10. Example Prompt Templates

  11. Troubleshooting & FAQ

  12. Contributing & Pull Requests

  13. License


Related MCP server: google-connections-mcp

Overview & Capabilities

Once integrated, Antigravity IDE gains direct access to your Google Workspace environment:

  • Google Docs: Author new documents, read content as token-lean Markdown, insert structured tables, conduct surgical text replacements (findAndReplace, replaceRangeWithMarkdown), and append revisions.

  • Google Sheets: Provision spreadsheets, inspect schema metadata, perform 2D batch writes, set cell formatting/borders, and compute formula ranges.

  • Google Drive: Search folders/files, inspect file metadata, create directory structures, and manage file hierarchies.

  • Gmail & Calendar: Compose and draft messages, list recent inbox threads, schedule meetings, and modify calendar events.


Prerequisites

  • Node.js: Version 18.0.0 or higher.

  • npm: Version 8.0.0 or higher.

  • PowerShell: Windows PowerShell 5.1 or PowerShell Core 7+.

  • Google Cloud Platform (GCP) Account: Access to create an OAuth 2.0 Client ID.


Step 1: Google Cloud OAuth 2.0 Credentials

To authorize access to your Google Workspace resources:

  1. Open Google Cloud Console: Navigate to console.cloud.google.com.

  2. Create or Select a Project: Select the project dropdown in the top navigation bar and click New Project (e.g., Antigravity-Workspace-MCP).

  3. Enable Workspace APIs: In the top search bar, locate and enable each of the following:

    • Google Docs API

    • Google Sheets API

    • Google Drive API

    • (Optional) Gmail API, Google Calendar API.

  4. Configure OAuth Consent Screen:

    • Navigate to APIs & Services > OAuth consent screen (or Google Auth Platform).

    • User Type: Select External, then click Create.

    • Input App Name (e.g., Antigravity MCP), User support email, and Developer contact information.

    • Scopes: Click Add or remove scopes and select:

      • .../auth/documents

      • .../auth/spreadsheets

      • .../auth/drive

    • Test Users: Under the Audience / Test users section, click Add Users and add your personal Google account email address.

  5. Create OAuth Client ID:

    • Navigate to APIs & Services > Credentials.

    • Click + Create Credentials > OAuth client ID.

    • Application type: Select Desktop app.

    • Click Create.

    • Note down:

      • Client ID (xxx...apps.googleusercontent.com)

      • Client Secret (GOCSPX-xxx...)


Step 2: Interactive Setup & Management Script

This repository includes setup.ps1, an interactive management console providing automated setup, credential updating, browser authentication, diagnostics, and complete uninstallation/permission revocation.

Launching the Management Console:

.\setup.ps1

The script displays an interactive menu:

======================================================================
    Google Workspace MCP for Antigravity IDE - Management Console
======================================================================
  [1] Complete Setup / Install (Dependencies, OAuth & IDE Config)
  [2] Update OAuth Credentials (Client ID & Client Secret)
  [3] Re-authenticate Account (OAuth Browser Sign-in)
  [4] Revoke Permissions & Uninstall (Revoke Token, Remove Config)
  [5] View Diagnostics & Connection Status
  [0] Exit
======================================================================

Script Execution Modes:

  • Interactive Menu: Run .\setup.ps1 with no arguments to navigate the interactive console.

  • Direct Parameter Execution:

    # Non-interactive automated install
    .\setup.ps1 -ClientID "your-client-id" -ClientSecret "your-client-secret"
    
    # Or invoke specific actions
    .\setup.ps1 -Action Install
    .\setup.ps1 -Action UpdateCredentials
    .\setup.ps1 -Action Reauth
    .\setup.ps1 -Action Uninstall
    .\setup.ps1 -Action Status

Step 3: IDE Activation

After completing setup:

  1. Launch Antigravity IDE.

  2. Press Ctrl + Shift + P (or Cmd + Shift + P on macOS) to open the Command Palette.

  3. Type and select Reload Window.

  4. Antigravity IDE will automatically detect and load the google-docs MCP server. You can verify connection status under Additional Options (...) > MCP Servers.


Token Optimization Strategy

Large documents and spreadsheets can rapidly exhaust context windows if unoptimized. The rules codified in AGENTS.md enforce surgical, token-efficient interactions:

Operation

Inefficient Approach (Excessive Tokens)

Optimized Strategy (70-90% Reduction)

Reading Google Docs

JSON AST format (~15,000 tokens for 5 pages).

Request Markdown via format: "markdown" (~1,500 tokens).

Modifying Docs

Reading full doc and overwriting entirely.

Use findElement with replaceRangeWithMarkdown or modifyText.

Reading Sheets

Unbounded range read (e.g. A:Z with empty cells).

Query getSpreadsheetInfo first; read bounded active bounds (e.g. A1:F25).

Writing to Sheets

Repeated single-cell write calls.

Aggregate into 2D arrays and issue a single writeSpreadsheet or batchWrite.

Agent Response

Echoing complete document contents back to chat.

Return success status, resource URL, and a 1-2 bullet diff summary.


Turnkey Templates, Recipes & Antigravity Skill

This repository provides pre-built templates, styling recipes, and an Antigravity Skill automatically discovered by the IDE to streamline document authoring and minimize token overhead.

1. Antigravity Skill & Rule (.agents/)

2. Ready-to-Use Document & Spreadsheet Templates (templates/)

3. Execution Recipes & Architecture Guides (recipes/)


Project Workspace Starter Kit (Use in Your Own Project)

Want Antigravity to understand and manipulate Google Docs and Sheets directly inside your own application codebase? We provide a pre-packaged starter kit under workspace-template/:

your-project-folder/
├── .agents/
│   └── rules/
│       └── project-google-context.md   # Automatic Antigravity discovery rule
├── google-workspace.json               # Maps "spec" & "tracker" to actual Google IDs
├── DOCS_INDEX.md                       # Local outline cache (< 200 tokens)
└── WORKSPACE_GUIDE.md                  # Comprehensive user guide

1-Click Scaffolding:

Run from this repository:

.\setup.ps1 -Action InitProject -TargetDir "C:\Projects\MyAwesomeApp"

Or select [6] Scaffold Project Workspace from the interactive menu!

How Antigravity Uses It:

  1. Never type URLs or IDs again: Antigravity automatically resolves "the spec" to your configured Doc ID and "the sprint tracker" to your Sheet ID.

  2. Instant Understanding: Antigravity reads local DOCS_INDEX.md in ~150 tokens to know where headings, sections, and tables live before calling Google APIs.

  3. Natural Prompting:

    • "Read Section 3 of our spec and explain the database schema."

    • "Add a new task 'Implement Redis cache' to our sprint tracker with priority High."

    • "In the technical spec, update Section 2.1 with postgres connection parameters."


Credential Management & Revocation

If you need to rotate keys, switch Google accounts, or revoke all permissions:

Option A: Via the Interactive Menu

Run .\setup.ps1:

  • Select [2] Update OAuth Credentials: Allows updating GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET across both local configuration and IDE settings.

  • Select [3] Re-authenticate Account: Triggers a fresh browser consent screen without altering configuration keys.

  • Select [4] Revoke Permissions & Uninstall:

    1. Sends a revocation request directly to Google Identity (https://oauth2.googleapis.com/revoke), immediately invalidating access on your Google account.

    2. Deletes local token storage (~/.config/google-docs-mcp/token.json).

    3. Removes the google-docs entry from Antigravity IDE's configuration (~/.gemini/config/mcp_config.json).

    4. Offers to clean up local .env and environment variables.

Option B: Manual Revocation

  • Google Account Permissions: Visit myaccount.google.com/permissions to view and revoke third-party app authorizations directly.

  • Local Stored Tokens: Delete %USERPROFILE%\.config\google-docs-mcp\token.json.

  • IDE Configuration: Remove "google-docs" from %USERPROFILE%\.gemini\config\mcp_config.json.


Example Prompt Templates

You can interact with your Google Workspace using natural language in Antigravity IDE:

Google Docs:

  • "Create a Google Doc titled 'Q4 Engineering Roadmap' with sections for Goals, Architecture, and Timeline."

  • "Read the document at [DOCUMENT_ID] as markdown and provide a 3-bullet executive summary."

  • "In document [DOCUMENT_ID], find the section 'Budget Estimates' and insert a 3-column table with projected infrastructure costs."

Google Sheets:

  • "Create a Google Sheet titled '2026 Sprint Velocity' with columns: Sprint, Planned Points, Completed Points, Completion Rate."

  • "Read the range A1:D10 from spreadsheet [SHEET_ID] and calculate the average completion rate."

  • "Append 5 new test result rows to the end of spreadsheet [SHEET_ID]."

Google Drive:

  • "Search my Google Drive for files containing 'Architecture Spec' created in the last 30 days."

  • "Create a directory named 'Release Artifacts' and move file [FILE_ID] into it."


Troubleshooting & FAQ

1. "Access blocked: This app has not been verified"

  • Cause: The authenticated Google account is not listed under Test Users in the Google Cloud Console.

  • Resolution: In Google Cloud Console, navigate to APIs & Services > OAuth consent screen > Test users, click Add Users, and add your email address.

2. "Apps Script API has not been used..."

3. MCP Server does not appear in Antigravity IDE

  • Verify that ~/.gemini/config/mcp_config.json contains the google-docs entry.

  • Trigger Reload Window via Ctrl + Shift + P.

  • Run .\setup.ps1 and choose [5] View Diagnostics & Connection Status to diagnose file paths and token state.


Contributing & Pull Requests

Contributions, bug reports, and feature proposals are warmly welcome!


License

This project is open-source software licensed under the MIT License. Copyright (c) 2026 Duc Long.

Related MCP Connectors

Related MCP Servers