Zum Inhalt springen

MCP Server / google workspace

google workspace

Control Gmail, Google Calendar, Docs, Sheets, Slides, Chat, Forms, Tasks, Search & Drive with AI - Comprehensive Google Workspace / G Suite MCP Server & CLI Tool

2,288von @taylorwilsdonMITGitHub →

Transport

stdiossehttp

Tools (20)

Variable

GOOGLE_OAUTH_CLIENT_ID

**required**

GOOGLE_OAUTH_CLIENT_SECRET

OAUTHLIB_INSECURE_TRANSPORT

**required***

USER_GOOGLE_EMAIL

GOOGLE_CLIENT_SECRET_PATH

GOOGLE_MCP_CREDENTIALS_DIR

WORKSPACE_MCP_BASE_URI

WORKSPACE_MCP_PORT

WORKSPACE_MCP_HOST

WORKSPACE_MCP_TRANSPORT

WORKSPACE_MCP_HTTP_PORT

WORKSPACE_EXTERNAL_URL

WORKSPACE_ATTACHMENT_DIR

WORKSPACE_MCP_URL

ALLOWED_FILE_DIRS

WORKSPACE_MCP_TOOLS

WORKSPACE_MCP_TOOL_TIER

WORKSPACE_MCP_READ_ONLY

WORKSPACE_MCP_PERMISSIONS

Dokumentation

Google Workspace MCP Server

Full natural language control over Google Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, Tasks, Contacts, and Chat through all MCP clients, AI assistants and developer tools.

Includes a full featured CLI & Code Mode for use with tools like Claude Code and Codex!

The most feature-complete Google Workspace MCP server, it can do things that Google's own tooling and the built in integrations with Claude and ChatGPT can't even dream of. With Remote OAuth2.1 multi-user support, fine-grained editing tools and the most extensive coverage of any Google Workspace tool in existance, Workspace MCP is in a different class. Offering native OAuth 2.1, stateless mode and external auth server support, it's also the only Workspace MCP you can host for your whole organization centrally & securely!

Support for all free Google accounts & Google Workspace plans (Starter, Standard, Plus, Enterprise, Non Profit) with expanded app options like Chat & Spaces. Interested in a private, managed cloud instance? That can be arranged.

See it in action:


Overview

Workspace MCP is the single most complete MCP server that integrates all major Google Workspace services with AI assistants. It supports both single-user operation and multi-user authentication via OAuth 2.1, making it a powerful backend for custom applications. Built with FastMCP for optimal performance, featuring advanced authentication handling, service caching, and streamlined development patterns. The entire toolset is available for CLI usage supporting both local and remote instances.

Simplified Setup: can use Google Desktop OAuth clients for local runs - no redirect URIs or port configuration needed!

Features

12 services  —  Gmail · Drive · Calendar · Docs · Sheets · Slides · Forms · Chat · Apps Script · Tasks · Contacts · Search

📧 Gmail — Complete email management, end-to-end coverage 📁 Drive — File operations with sharing, permissions, Office files, PDFs & images 📅 Calendar — Full event management with advanced features 📝 Docs — Deep, fine-grained editing, formatting & comments 📊 Sheets — Flexible cell management, formatting & conditional rules 🖼️ Slides — Presentation creation, updates & content manipulation 📋 Forms — Creation, publish settings & response management 💬 Chat — Space management, messaging & reactions

⚡ Apps Script — Cross-application workflow automation  Projects · deployments · versions · execution · debugging

✅ Tasks — Task & list management with hierarchy 👤 Contacts — People API with groups & batch operations 🔍 Custom Search — Programmable Search Engine integration


🔐 Authentication & Security OAuth 2.0 & 2.1 · auto token refresh · multi-user bearer tokens · transport-aware callbacks · CORS proxy


Security & Compliance

For Security Teams

This server sends no data anywhere except Google's APIs, on behalf of the authenticated user, using your own OAuth client credentials. There is no telemetry, no usage reporting, no analytics, no license server, and no SaaS dependency. The entire data path is: your infrastructure → Google APIs.

  • Fully open source — every line is auditable in this repo
  • Your OAuth client, your GCP project — credentials never leave your environment
  • You control the scopes — read-only, granular per-service permissions, or full access
  • You control the network — deploy behind your reverse proxy, in your VPC, on your own terms
  • No third-party services — no intermediary servers, no token relays, no hosted backends
  • Stateless mode — zero disk writes for locked-down container environments
  • Sensitive path blocking — local file reads default to the managed attachment directory, and validate_file_path() still blocks .env* files plus common home-directory credential stores such as ~/.ssh/ and ~/.aws/ even if ALLOWED_FILE_DIRS is broadened

Full dependency tree in pyproject.toml, pinned in uv.lock.

For Legal & Procurement

This project is MIT licensed — not "open core," not "source available," not "free with a CLA." There is no dual licensing, no commercial tier gating features, and no contributor license agreement.

  • Use commercially without restriction — build products, sell services, deploy internally
  • Fork, embed, redistribute — MIT requires only attribution
  • No CLA — contributions remain under MIT
  • No telemetry to disclose — nothing to flag in a privacy review
  • No network effects — the server never contacts any endpoint you didn't configure
  • Standard dependency licenses — MIT, Apache 2.0, and BSD throughout the dependency chain; no copyleft, no AGPL

The license is 21 lines and says what it means.


Quick Start

Set credentials → pick a launch command → connect your client

💡 New to Workspace MCP? Check out the Interactive Quick Start Guide → with step-by-step setup, screenshots, and troubleshooting tips!

Confidential Client Quick Start

# 1. Credentials
export GOOGLE_OAUTH_CLIENT_ID="..."
export GOOGLE_OAUTH_CLIENT_SECRET="..."

# 2. Launch — pick a tier
uvx workspace-mcp --tool-tier core       # essential tools
uvx workspace-mcp --tool-tier extended   # core + management ops
uvx workspace-mcp --tool-tier complete   # everything

# Or cherry-pick services
uv run main.py --tools gmail drive calendar

Secretless / Public OAuth 2.1 (PKCE) Quick Start

# 1. Credentials
export MCP_ENABLE_OAUTH21=true
export GOOGLE_OAUTH_CLIENT_ID="..."
export WORKSPACE_MCP_PORT=8000
export GOOGLE_OAUTH_REDIRECT_URI="http://localhost:${WORKSPACE_MCP_PORT}/oauth2callback"
export OAUTHLIB_INSECURE_TRANSPORT=1
# Leave GOOGLE_OAUTH_CLIENT_SECRET unset for public PKCE clients
export FASTMCP_SERVER_AUTH_GOOGLE_JWT_SIGNING_KEY="$(openssl rand -hex 32)"

# 2. Launch — OAuth 2.1 requires HTTP transport
uvx workspace-mcp --transport streamable-http --tool-tier core
uvx workspace-mcp --transport streamable-http --tool-tier extended
uvx workspace-mcp --transport streamable-http --tool-tier complete

# Or cherry-pick services
uv run main.py --transport streamable-http --tools gmail drive calendar

Credential setup → · All launch options → · Tier details →

| Variable | | Purpose | |----------|:---:|---------| | 🔐 Authentication | | | | GOOGLE_OAUTH_CLIENT_ID | required | OAuth client ID from Google Cloud | | GOOGLE_OAUTH_CLIENT_SECRET | | OAuth client secret for confidential clients; optional for public OAuth 2.1 PKCE clients | | OAUTHLIB_INSECURE_TRANSPORT | required* | Set to 1 for development — allows http:// redirect | | USER_GOOGLE_EMAIL | | Default email for single-user auth | | GOOGLE_CLIENT_SECRET_PATH | | Custom path to client_secret.json | | GOOGLE_MCP_CREDENTIALS_DIR | | Credential directory — default ~/.google_workspace_mcp/credentials | | 🖥️ Server | | | | WORKSPACE_MCP_BASE_URI | | Base server URI (no port) — default http://localhost | | WORKSPACE_MCP_PORT | | Listening port — default 8000. Also controls the stdio-mode OAuth callback port. The PORT env var takes precedence if set. | | WORKSPACE_MCP_HOST | | Bind host — default 0.0.0.0 | | WORKSPACE_MCP_TRANSPORT | | stdio or streamable-http; used when --transport is not passed | | WORKSPACE_MCP_HTTP_PORT | | Advanced legacy-stdio sidecar /mcp port for local workspace-cli access. Disabled when empty. Binds to 127.0.0.1 only and is accessible to local processes. | | WORKSPACE_EXTERNAL_URL | | External URL for reverse proxy setups | | WORKSPACE_ATTACHMENT_DIR | | Downloaded attachments dir and default trusted local attachment directory — default ~/.workspace-mcp/attachments/ | | WORKSPACE_MCP_URL | | Remote MCP endpoint URL for CLI | | ALLOWED_FILE_DIRS | | Colon-separated allowlist for local file reads | | 🧰 Tool Selection | | | | WORKSPACE_MCP_TOOLS | | Comma-separated services, e.g. gmail,drive,calendar; empty means all services | | WORKSPACE_MCP_TOOL_TIER | | core, extended, or complete; empty means all tools | | WORKSPACE_MCP_READ_ONLY | | true, 1, or yes to request read-only scopes and filter write tools | | WORKSPACE_MCP_PERMISSIONS | | Space-separated service:level entries, e.g. gmail:send drive:readonly; mutually exclusive with tools and read-only | | 🔑 OAuth 2.1 & Multi-User | | | | MCP_ENABLE_OAUTH21 | | true to enable OAuth 2.1 multi-user support | | EXTERNAL_OAUTH21_PROVIDER | | true for external OAuth flow with bearer tokens | | WORKSPACE_MCP_STATELESS_MODE | | true for stateless container-friendly operation | | GOOGLE_OAUTH_REDIRECT_URI | | Override OAuth callback URL — default auto-constructed | | OAUTH_CUSTOM_REDIRECT_URIS | | Comma-separated additional redirect URIs | | OAUTH_ALLOWED_ORIGINS | | Comma-separated additional CORS origins | | WORKSPACE_MCP_OAUTH_PROXY_STORAGE_BACKEND | | memory, disk, or valkey — see storage backends | | FASTMCP_SERVER_AUTH_GOOGLE_JWT_SIGNING_KEY | | Custom encryption key for OAuth proxy storage; required for public OAuth 2.1 clients when GOOGLE_OAUTH_CLIENT_SECRET is omitted | | WORKSPACE_MCP_ALLOWED_CLIENT_REDIRECT_URIS | | Comma-separated allowlist of redirect URIs that dynamically-registered OAuth clients may use. Default is unset (any URI permitted, per DCR). Supports FastMCP's glob patterns (*, *.example.com) | | 🗄️ Credential Store | | | | WORKSPACE_MCP_CREDENTIAL_STORE_BACKEND | | local_directory (default) or gcs — see credential store system | | WORKSPACE_MCP_CREDENTIALS_DIR | | Directory for the local_directory backend | | GOOGLE_MCP_CREDENTIALS_DIR | | Backward-compatible alias for WORKSPACE_MCP_CREDENTIALS_DIR | | WORKSPACE_MCP_GCS_BUCKET | | Required when backend is gcs — GCS bucket name | | WORKSPACE_MCP_GCS_PREFIX | | Optional object-name prefix for the gcs backend | | WORKSPACE_MCP_GCS_REQUIRE_CMEK | | true to require a bucket default KMS key at startup (fails fast if unset) | | 🔧 Service Account | | | | GOOGLE_SERVICE_ACCOUNT_KEY_FILE | | Path to service account JSON key file (domain-wide delegation) | | GOOGLE_SERVICE_ACCOUNT_KEY_JSON | | Inline service account JSON key (alternative to file) | | DWD_ALLOWED_DOMAINS | | Comma-separated domain allowlist for per-request impersonation (optional) | | 🔍 Custom Search | | | | GOOGLE_PSE_API_KEY | | API key for Programmable Search Engine | | GOOGLE_PSE_ENGINE_ID | | Search Engine ID for PSE |

*Required for development only. Claude Desktop stores credentials securely in the OS keychain — set them once in the extension pane.


Quick Start — Connect Claude to Google Workspace

The recommended setup is to run an instance and connect Claude to it via a Connector. Full instructions at workspacemcp.com/quick-start.


Prerequisites

Python 3.10+ · uv/uvx · Google Cloud Project with OAuth 2.0 credentials

If you want the GCS credential store backend, install the optional dependency first:

uv sync --extra gcs
# or
pip install "workspace-mcp[gcs]"

Configuration

  1. Create ProjectOpen Console → → Create new project

  2. Create OAuth Credentials — APIs & Services → Credentials → Create Credentials → OAuth Client ID

    • Choose Desktop Application for a public PKCE client (no redirect URIs needed) or Web Application for a confidential client
    • Download and note your Client ID and, if issued, Client Secret
  3. Enable APIs — APIs & Services → Library, then enable each service:

    | | | | | |:--|:--|:--|:--| | Calendar | Drive | Gmail | Docs | | Sheets | Slides | Forms | Tasks | | Chat | People | Custom Search | Apps Script |

  4. Set Credentials — see Environment Variable Reference above, or:

    export GOOGLE_OAUTH_CLIENT_ID="your-client-id"
    export GOOGLE_OAUTH_CLIENT_SECRET="your-secret"
    

    For public OAuth 2.1 PKCE clients, omit GOOGLE_OAUTH_CLIENT_SECRET and set FASTMCP_SERVER_AUTH_GOOGLE_JWT_SIGNING_KEY instead.

Full OAuth documentation → · Credential setup details →

Google Custom Search Setup

1. Create Search Engine

programmablesearchengine.google.com
/controlpanel/create

→ Configure sites or entire web
→ Note your Engine ID (cx)

Open Control Panel →

2. Get API Key

developers.google.com
/custom-search/v1/overview

→ Create/select project
→ Enable Custom Search API
→ Create credentials (API Key)

Get API Key →

3. Set Variables

export GOOGLE_PSE_API_KEY=\
  "your-api-key"
export GOOGLE_PSE_ENGINE_ID=\
  "your-engine-id"

Configure in environment

Complete Setup Process:

  1. Create Search Engine - Visit the Control Panel

    • Choose "Search the entire web" or specify sites
    • Copy the Search Engine ID (looks like: 017643444788157684527:6ivsjbpxpqw)
  2. Enable API & Get Key - Visit Google Developers Console

    • Enable "Custom Search API" in your project
    • Create credentials → API Key
    • Restrict key to Custom Search API (recommended)
  3. Configure Environment - Add to your shell or .env:

    export GOOGLE_PSE_API_KEY="AIzaSy..."
    export GOOGLE_PSE_ENGINE_ID="01764344478..."
    

Full Documentation →

Start the Server

📌 Transport Mode Guidance: Use streamable HTTP mode (--transport streamable-http) for all modern MCP clients including Claude Code, VS Code MCP, and MCP Inspector. For Claude Desktop, run an instance and connect via a Connector. Stdio mode is a legacy fallback. For deployments, prefer OAuth 2.1 with stateless mode (MCP_ENABLE_OAUTH21=true, WORKSPACE_MCP_STATELESS_MODE=true) unless you need local attachment or credential storage.

▶ Legacy Mode

uv run main.py

⚠️ Stdio mode (incomplete MCP clients only)

◆ HTTP Mode (Recommended)

uv run main.py \
  --transport streamable-http

✅ Full MCP spec compliance & OAuth 2.1

@ Single User

uv run main.py \
  --single-user

Simplified authentication ⚠️ Cannot be used with OAuth 2.1 mode

▶ Selective Tool Loading

# Load specific services only
uv run main.py --tools gmail drive calendar
uv run main.py --tools sheets docs

# Combine with other flags
uv run main.py --single-user --tools gmail

🔒 Read-Only Mode

# Requests only read-only scopes & disables write tools
uv run main.py --read-only

# Combine with specific tools or tiers
uv run main.py --tools gmail drive --read-only
uv run main.py --tool-tier core --read-only

Read-only mode provides secure, restricted access by:

  • Requesting only *.readonly OAuth scopes (e.g., gmail.readonly, drive.readonly)
  • Automatically filtering out tools that require write permissions at startup
  • Allowing read operations: list, get, search, and export across all services

🔐 Granular Permissions

# Per-service permission levels
uv run main.py --permissions gmail:organize drive:readonly

# Combine permissions with tier filtering
uv run main.py --permissions gmail:send drive:full --tool-tier core

Granular permissions mode provides service-by-service scope control:

  • Format: service:level (one entry per service)
  • Gmail levels: readonly, organize, drafts, send, full (cumulative)
  • Tasks levels: readonly, manage, full (cumulative; manage allows create/update/move but denies delete and clear_completed)
  • Other services currently support: readonly, full
  • --permissions and --read-only are mutually exclusive
  • --permissions cannot be combined with --tools; enabled services are determined by the --permissions entries (optionally filtered by --tool-tier)
  • With --tool-tier, only tier-matched tools are enabled and only services that have tools in the selected tier are imported

The WORKSPACE_MCP_TOOLS, WORKSPACE_MCP_TOOL_TIER, WORKSPACE_MCP_READ_ONLY, and WORKSPACE_MCP_PERMISSIONS environment variables provide the same controls for plugin and container installs. Empty strings are ignored. Non-empty malformed values fail closed at startup. Explicit CLI flags take precedence over mutually exclusive env vars.

Advanced legacy stdio sidecar

# Optional bridge only for local legacy stdio sessions
WORKSPACE_MCP_HTTP_PORT=8001 uv run main.py
workspace-cli --url http://127.0.0.1:8001/mcp list

The sidecar is disabled unless WORKSPACE_MCP_HTTP_PORT is set. It only exists to bridge local workspace-cli calls into a legacy stdio server. Do not use it for normal Claude Code, VS Code, hosted, or multi-user deployments; use streamable HTTP with OAuth 2.1 instead. When enabled, it validates ports in the 1..65535 range, binds to 127.0.0.1, and logs a warning if the port is already in use while keeping stdio running.

★ Tool Tiers

uv run main.py --tool-tier core      # ● Essential tools only
uv run main.py --tool-tier extended  # ◐ Core + additional
uv run main.py --tool-tier complete  # ○ All available tools

◆ Docker Deployment

docker build -t workspace-mcp .
docker run -p 8000:8000 -v $(pwd):/app \
  workspace-mcp --transport streamable-http

# With tool selection via environment variables
docker run -e TOOL_TIER=core workspace-mcp
docker run -e TOOLS="gmail drive calendar" workspace-mcp

Available Services: gmaildrivecalendardocssheetsformstaskscontactschatsearch

CLI

The workspace-cli command lists tools and calls them against a running server — with encrypted, disk-backed OAuth token caching so you only authenticate once. On first run it opens a browser for Google consent; subsequent runs reuse the cached tokens automatically.

Tokens are stored encrypted at ~/.workspace-mcp/cli-tokens/ using a Fernet key auto-generated at ~/.workspace-mcp/.cli-encryption-key.

▶ List Tools

uv run workspace-cli list
uv run workspace-cli --url https://custom.server/mcp list

# Or, if installed globally:
workspace-cli list
workspace-cli --url https://custom.server/mcp list

View all available tools

◆ Call a Tool

uv run workspace-cli call search_gmail_messages \
  query="is:unread" max_results=5

Execute a tool with key=value arguments

Set URL for remote endpoints with --url or the WORKSPACE_MCP_URL environment variable.

The upstream FastMCP CLI is also bundled and provides additional commands for schema inspection, client installation, and editor discovery. Note that fastmcp uses in-memory token storage, so each invocation may re-trigger the OAuth flow.

fastmcp inspect fastmcp_server.py                        # print tools, resources, prompts
fastmcp install claude-code fastmcp_server.py             # one-command client setup
fastmcp install cursor fastmcp_server.py
fastmcp discover                                          # find servers configured in editors

See fastmcp --help or the FastMCP CLI docs for the full command reference.

Tool Tiers

The server organizes tools into three progressive tiers for simplified deployment. Choose a tier that matches your usage needs and API quota requirements.

Available Tiers

● Core (--tool-tier core) Essential tools for everyday tasks. Perfect for light usage with minimal API quotas. Includes search, read, create, and basic modify operations across all services.

● Extended (--tool-tier extended) Core functionality plus management tools. Adds labels, folders, batch operations, and advanced search. Ideal for regular usage with moderate API needs.

● Complete (--tool-tier complete) Full API access including comments, headers/footers, publishing settings, and administrative functions. For power users needing maximum functionality.

Important Notes

Start with core and upgrade as needed ▶ Tiers are cumulative – each includes all previous ▶ Mix and match with --tools for specific services ▶ Configuration in core/tool_tiers.yamlAuthentication included in all tiers

Usage Examples

# Basic tier selection
uv run main.py --tool-tier core                            # Start with essential tools only
uv run main.py --tool-tier extended                        # Expand to include management features
uv run main.py --tool-tier complete                        # Enable all available functionality

# Selective service loading with tiers
uv run main.py --tools gmail drive --tool-tier core        # Core tools for specific services
uv run main.py --tools gmail --tool-tier extended          # Extended Gmail functionality only
uv run main.py --tools docs sheets --tool-tier complete    # Full access to Docs and Sheets

# Combine tier selection with granular permission levels
uv run main.py --permissions gmail:organize drive:full --tool-tier core

📋 Credential Configuration

🚀 Environment Variables

export GOOGLE_OAUTH_CLIENT_ID=\
  "your-client-id"
export GOOGLE_OAUTH_CLIENT_SECRET=\
  "your-secret"

Best for production

📁 File-based

# Download & place in project root
client_secret.json

# Or specify custom path
export GOOGLE_CLIENT_SECRET_PATH=\
  /path/to/secret.json

Traditional method

⚡ .env File

cp .env.oauth21 .env
# Edit .env with credentials

Best for development

Loading Priority

  1. Environment variables (export VAR=value)
  2. .env file in project root (warning - if you run via uvx rather than uv run from the repo directory, you are spawning a standalone process not associated with your clone of the repo and it will not find your .env file without specifying it directly)
  3. client_secret.json via GOOGLE_CLIENT_SECRET_PATH
  4. Default client_secret.json in project root

Why Environment Variables?

  • Docker/K8s ready - Native container support
  • Cloud platforms - Heroku, Railway, Vercel
  • CI/CD pipelines - GitHub Actions, Jenkins
  • No secrets in git - Keep credentials secure
  • Easy rotation - Update without code changes

🧰 Available Tools

Note: All tools support automatic authentication via @require_google_service() decorators with 30-minute service caching.

📖 Looking for detailed parameters? Visit the Complete Documentation → for comprehensive tool reference, examples, and API guides!

📅 Google Calendar calendar_tools.py

| Tool | Tier | Description | |------|------|-------------| | list_calendars | Core | List accessible calendars | | get_events | Core | Retrieve events with time range filtering | | manage_event | Core | Create, update, or delete calendar events | | create_calendar | Extended | Create a new secondary Google Calendar | | query_freebusy | Extended | Query free/busy information for calendars | | manage_out_of_office | Extended | Create, list, update, or delete Out of Office events | | manage_focus_time | Extended | Create, list, update, or delete Focus Time events |

📁 Google Drive drive_tools.py

| Tool | Tier | Description | |------|------|-------------| | search_drive_files | Core | Search files with query syntax | | get_drive_file_content | Core | Read file content (Office, PDF, image) | | get_drive_file_download_url | Core | Download Drive files to local disk | | create_drive_file | Core | Create files or fetch from URLs | | create_drive_folder | Core | Create empty folders in Drive or shared drives | | import_to_google_doc | Core | Import files (MD, DOCX, HTML, etc.) as Google Docs | | get_drive_shareable_link | Core | Get shareable links for a file | | list_drive_items | Extended | List folder contents or shared drives | | copy_drive_file | Extended | Copy existing files (templates) with optional renaming | | update_drive_file | Extended | Update file metadata, move between folders | | manage_drive_access | Extended | Grant, update, revoke permissions, and transfer ownership | | set_drive_file_permissions | Extended | Set link sharing and file-level sharing settings | | get_drive_file_permissions | Complete | Get detailed file permissions | | check_drive_file_public_access | Complete | Check public sharing status |

📧 Gmail gmail_tools.py

| Tool | Tier | Description | |------|------|-------------| | search_gmail_messages | Core | Search with Gmail operators | | get_gmail_message_content | Core | Retrieve message content | | get_gmail_messages_content_batch | Core | Batch retrieve message content | | send_gmail_message | Core | Send emails | | get_gmail_thread_content | Extended | Get full thread content | | modify_gmail_message_labels | Extended | Modify message labels | | list_gmail_labels | Extended | List available labels | | list_gmail_filters | Extended | List Gmail filters | | manage_gmail_label | Extended | Create/update/delete labels | | manage_gmail_filter | Extended | Create or delete Gmail filters | | draft_gmail_message | Extended | Create drafts | | get_gmail_threads_content_batch | Complete | Batch retrieve thread content | | batch_modify_gmail_message_labels | Complete | Batch modify labels | | start_google_auth | Complete | Legacy OAuth 2.0 auth (disabled when OAuth 2.1 is enabled) |

Both send_gmail_message and draft_gmail_message support attachments via two methods:

Option 1: File Path (local server only)

attachments=[{"path": "/path/to/report.pdf"}]

Reads file from disk, auto-detects MIME type. Optional filename override.

Option 2: Base64 Content (works everywhere)

attachments=[{
    "filename": "report.pdf",
    "content": "JVBERi0xLjQK...",  # base64-encoded
    "mime_type": "application/pdf"   # optional
}]

⚠️ Centrally Hosted Servers: When the MCP server runs remotely (cloud, shared instance), it cannot access your local filesystem. Use Option 2 with base64-encoded content. Your MCP client must encode files before sending.

When downloading Gmail attachments (get_gmail_attachment_content) or Drive files (get_drive_file_download_url), files are saved to a persistent local directory rather than a temporary folder in the working directory.

Default location: ~/.workspace-mcp/attachments/

Files are saved with their original filename plus a short UUID suffix for uniqueness (e.g., invoice_a1b2c3d4.pdf). In stdio mode, the tool returns the absolute file path for direct filesystem access. In HTTP mode, it returns a download URL via the /attachments/{file_id} endpoint.

To customize the storage directory:

export WORKSPACE_ATTACHMENT_DIR="/path/to/custom/dir"

Saved files expire after 1 hour and are cleaned up automatically.

📝 Google Docs docs_tools.py

| Tool | Tier | Description | |------|------|-------------| | get_doc_content | Core | Extract document text | | create_doc | Core | Create new documents | | modify_doc_text | Core | Insert, replace, and richly format text with tab/segment targeting, append-to-segment support, advanced typography, and link management | | search_docs | Extended | Find documents by name | | find_and_replace_doc | Extended | Find and replace text | | list_docs_in_folder | Extended | List docs in folder | | insert_doc_elements | Extended | Add tables, lists, page breaks | | update_paragraph_style | Extended | Apply advanced paragraph styling including headings, spacing, direction, pagination controls, shading, and bulleted/numbered/checkbox lists with nesting | | get_doc_as_markdown | Extended | Export document as formatted Markdown with optional comments | | insert_doc_image | Complete | Insert images from Drive/URLs | | update_doc_headers_footers | Complete | Create or update headers and footers with correct segment-aware writes | | batch_update_doc | Complete | Execute atomic multi-step Docs API operations including named ranges, section breaks, document/section layout, header/footer creation, segment-aware inserts, images, tables, and rich formatting | | inspect_doc_structure | Complete | Analyze document structure, including safe insertion points, tables, section breaks, headers/footers, and named ranges | | export_doc_to_pdf | Extended | Export document to PDF | | create_table_with_data | Complete | Create data tables | | debug_table_structure | Complete | Debug table issues | | list_document_comments | Complete | List all document comments | | manage_document_comment | Complete | Create, reply to, or resolve comments | | manage_doc_tab | Complete | Create, rename, delete, or populate tabs from markdown |

📊 Google Sheets sheets_tools.py

| Tool | Tier | Description | |------|------|-------------| | read_sheet_values | Core | Read cell ranges | | modify_sheet_values | Core | Write/update/clear cells | | create_spreadsheet | Core | Create new spreadsheets | | list_spreadsheets | Extended | List accessible spreadsheets | | get_spreadsheet_info | Extended | Get spreadsheet metadata | | format_sheet_range | Extended | Apply colors, number formats, text wrapping, alignment, bold/italic, font size | | list_sheet_tables | Extended | List structured tables with IDs, names, ranges, and columns | | create_sheet | Complete | Add sheets to existing files | | move_sheet_rows | Complete | Move rows between sheets within a spreadsheet | | append_table_rows | Complete | Append rows to a structured table, auto-extending the table range | | list_spreadsheet_comments | Complete | List all spreadsheet comments | | manage_spreadsheet_comment | Complete | Create, reply to, or resolve comments | | manage_conditional_formatting | Complete | Add, update, or delete conditional formatting rules |

🖼️ Google Slides slides_tools.py

| Tool | Tier | Description | |------|------|-------------| | create_presentation | Core | Create new presentations | | get_presentation | Core | Retrieve presentation details | | batch_update_presentation | Extended | Apply multiple updates | | get_page | Extended | Get specific slide information | | get_page_thumbnail | Extended | Generate slide thumbnails | | list_presentation_comments | Complete | List all presentation comments | | manage_presentation_comment | Complete | Create, reply to, or resolve comments |

📋 Google Forms forms_tools.py

| Tool | Tier | Description | |------|------|-------------| | create_form | Core | Create new forms | | get_form | Core | Retrieve form details & URLs | | set_publish_settings | Complete | Configure form settings | | get_form_response | Complete | Get individual responses | | list_form_responses | Extended | List all responses with pagination | | batch_update_form | Complete | Apply batch updates (questions, settings) |

✓ Google Tasks tasks_tools.py

| Tool | Tier | Description | |------|------|-------------| | list_tasks | Core | List tasks with filtering | | get_task | Core | Retrieve task details | | manage_task | Core | Create, update, delete, or move tasks | | list_task_lists | Complete | List task lists | | get_task_list | Complete | Get task list details | | manage_task_list | Complete | Create, update, delete task lists, or clear completed tasks |

👤 Google Contacts contacts_tools.py

| Tool | Tier | Description | |------|------|-------------| | search_contacts | Core | Search contacts by name, email, phone | | get_contact | Core | Retrieve detailed contact info | | list_contacts | Core | List contacts with pagination | | manage_contact | Core | Create, update, or delete contacts | | list_contact_groups | Extended | List contact groups/labels | | get_contact_group | Extended | Get group details with members | | manage_contacts_batch | Complete | Batch create, update, or delete contacts | | manage_contact_group | Complete | Create, update, delete groups, or modify membership |

💬 Google Chat chat_tools.py

| Tool | Tier | Description | |------|------|-------------| | list_spaces | Extended | List chat spaces/rooms | | get_messages | Core | Retrieve space messages | | send_message | Core | Send messages to spaces | | search_messages | Core | Search across chat history | | create_reaction | Core | Add emoji reaction to a message | | download_chat_attachment | Extended | Download attachment from a chat message |

🔍 Google Custom Search search_tools.py

| Tool | Tier | Description | |------|------|-------------| | search_custom | Core | Perform web searches (supports site restrictions via sites parameter) | | get_search_engine_info | Complete | Retrieve search engine metadata |

⚡ Google Apps Script apps_script_tools.py

| Tool | Tier | Description | |------|------|-------------| | list_script_projects | Core | List accessible Apps Script projects | | get_script_project | Core | Get complete project with all files | | get_script_content | Core | Retrieve specific file content | | create_script_project | Core | Create new standalone or bound project | | update_script_content | Core | Update or create script files | | run_script_function | Core | Execute function with parameters | | list_deployments | Extended | List all project deployments | | manage_deployment | Extended | Create, update, or delete script deployments | | list_script_processes | Extended | View recent executions and status |

Tool Tier Legend:Core — Essential tools for basic functionality · Minimal API usage · Getting started ● Extended — Core + additional features · Regular usage · Expanded capabilities ● Complete — All available tools including advanced features · Power users · Full API access


Connect to Claude Desktop

The recommended way to use Google Workspace MCP with Claude Desktop is to run a server instance and connect Claude to it via a Connector. This provides proper OAuth flow, multi-user support, and the best experience.

See the Quick Start Guide for setup instructions.

⚠️ Note: Stdio mode is a legacy fallback for clients that don't support Connectors. Prefer the Connector-based approach above.

  1. Open Claude Desktop Settings → Developer → Edit Config

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  2. Add the server configuration:

{
  "mcpServers": {
    "google_workspace": {
      "command": "uvx",
      "args": ["workspace-mcp"],
      "env": {
        "GOOGLE_OAUTH_CLIENT_ID": "your-client-id",
        "GOOGLE_OAUTH_CLIENT_SECRET": "your-secret",
        "OAUTHLIB_INSECURE_TRANSPORT": "1"
      }
    }
  }
}

Connect to LM Studio

Add a new MCP server in LM Studio (Settings → MCP Servers) using the same JSON format:

{
  "mcpServers": {
    "google_workspace": {
      "command": "uvx",
      "args": ["workspace-mcp"],
      "env": {
        "GOOGLE_OAUTH_CLIENT_ID": "your-client-id",
        "GOOGLE_OAUTH_CLIENT_SECRET": "your-secret",
        "OAUTHLIB_INSECURE_TRANSPORT": "1",
      }
    }
  }
}

2. Advanced / Cross-Platform Installation

If you’re developing, deploying to servers, or using another MCP-capable client, keep reading.

Instant CLI (uvx)

# Requires Python 3.10+ and uvx
# First, set credentials (see Credential Configuration above)
uvx workspace-mcp --tool-tier core  # or --tools gmail drive calendar

Note: Configure OAuth credentials before running. Supports environment variables, .env file, or client_secret.json.

Local Development Setup

# Install everything needed for linting, tests, and release tooling
uv sync --group dev

# Run the same linter that git hooks invoke automatically
uv run ruff check .

# Execute the full test suite (async fixtures require pytest-asyncio)
uv run pytest
  • uv sync --group test installs only the testing stack if you need a slimmer environment.
  • uv run main.py --transport streamable-http launches the server with your checked-out code for manual verification.
  • Ruff is part of the dev group because pre-push hooks call ruff check automatically—run it locally before committing to avoid hook failures.

OAuth 2.1 Support (Multi-User Bearer Token Authentication)

The server includes OAuth 2.1 support for bearer token authentication, enabling multi-user session management. OAuth 2.1 automatically reuses your existing GOOGLE_OAUTH_CLIENT_ID and, for confidential clients, GOOGLE_OAUTH_CLIENT_SECRET credentials - no additional Google-side configuration needed. Public PKCE clients are also supported: if you omit GOOGLE_OAUTH_CLIENT_SECRET, set FASTMCP_SERVER_AUTH_GOOGLE_JWT_SIGNING_KEY explicitly.

When to use OAuth 2.1:

  • Multiple users accessing the same MCP server instance
  • Need for bearer token authentication instead of passing user emails
  • Building web applications or APIs on top of the MCP server
  • Production environments requiring secure session management
  • Browser-based clients requiring CORS support

⚠️ Important: Mutually exclusive authentication modes

OAuth 2.1 mode (MCP_ENABLE_OAUTH21=true) cannot be used together with --single-user or service account mode:

  • Single-user mode: For legacy clients that pass user emails in tool calls
  • OAuth 2.1 mode: For modern multi-user scenarios with bearer token authentication
  • Service account mode: For headless/server-to-server use via domain-wide delegation

Choose one authentication method - combining incompatible modes will result in a startup error.

**Enabling OAuth 2.1: