Skip to main content
resource
6 min readMarch 5, 2026

Google Workspace CLI: A Command-Line Interface for AI Agents

Google has released an open-source CLI that lets AI agents interact with Google Workspace apps like Gmail, Drive, Calendar, and Docs directly from the terminal.

View original source

💡 Google has released an open-source CLI that lets AI agents interact with Gmail, Drive, Calendar, and Docs directly from the terminal. No more wrestling with OAuth flows and REST APIs — just simple commands your agent can call natively.

Why It Matters

AI coding assistants like Claude Code, Cursor, and GitHub Copilot operate in the terminal. Until now, interacting with Google Workspace meant:

  • Manual OAuth setup and token management
  • Writing custom API integration code
  • Dealing with complex scopes and permissions

The Google Workspace CLI wraps all of this in simple commands.

Supported Services

| Service | What You Can Do | |---|---| | Gmail | Read, search, compose, and send emails | | Google Drive | List, search, upload, and download files | | Google Calendar | View, create, and update events | | Google Docs | Read and edit document content | | Google Sheets | Read and modify spreadsheet data |

Getting Started

  1. 1
    Clone the repository from GitHub
  2. 2
    Install dependencies with npm install
  3. 3
    Build the CLI with npm run build
  4. 4
    Create OAuth credentials in Google Cloud Console
  5. 5
    Run the auth flow to connect your account

Installation

bashgit clone https://github.com/googleworkspace/cli.git
cd cli
npm install
npm run build

Authentication

bash# Download credentials from Google Cloud Console first
google-workspace auth login --credentials-file ./credentials.json

Basic Usage

bash# List recent emails
google-workspace gmail list --limit 10

# Search Drive files
google-workspace drive search "quarterly report"

# View today's calendar events
google-workspace calendar list --date today

# Read a Google Doc
google-workspace docs get <document-id>

Using as an MCP Server

Add to your Claude Code MCP configuration:

json{
  "mcpServers": {
    "google-workspace": {
      "command": "google-workspace",
      "args": ["mcp", "serve"]
    }
  }
}

Once configured, Claude Code can directly access your Google Workspace data through natural language requests.

Use Cases

Email Triage with AI

Let your AI agent scan your inbox, categorize emails by priority, and draft responses — all from the command line.

Document Research

Ask your agent to search Google Drive for relevant documents, extract key information, and summarize findings.

Calendar Management

Have your agent check availability, propose meeting times, and create calendar events based on email conversations.

Automated Reporting

Pull data from Google Sheets, generate analysis, and update shared documents — all orchestrated by your AI agent.

Agent-Friendly Design

| Feature | Details | |---|---| | Structured output | Returns JSON by default — easy for agents to parse | | MCP support | Runs as a Model Context Protocol server | | Batch operations | Bulk actions to minimize API calls | | Scoped auth | Request only the permissions you need |

Limitations

⚠️ Rate limits apply — Google Workspace APIs have per-user and per-project rate limits. Be mindful of what data you expose to AI agents, especially in shared workspace environments. Admin-managed accounts may need additional approval for OAuth scopes.

Who Should Use This

  • Developers building AI agent workflows that interact with Google Workspace
  • Teams looking to automate repetitive Workspace tasks via AI assistants
  • Power users who want CLI access to their Google Workspace data

Related Guides