development
location
documentation
public
Google Workspace
What is The most feature-complete Google Workspace MCP server with Remote OAuth2.1 multi-user support.?
A production-ready 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.
Documentation
Google Workspace MCP Server
The most feature-complete Google Workspace MCP server, now with Remote OAuth2.1 multi-user support and 1-click Claude installation.
Full natural language control over Google Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, Tasks, and Chat through all MCP clients, AI assistants and developer tools.
Support for all free Google accounts (Gmail, Docs, Drive etc) & Google Workspace plans (Starter, Standard, Plus, Enterprise, Non Profit etc) with their expanded app options like Chat & Spaces.
See it in action:
A quick plug for AI-Enhanced Docs
This README was written with AI assistance, and here's why that matters
As a solo dev building open source tools that many never see outside use, comprehensive documentation often wouldn't happen without AI help. Using agentic dev tools like Roo & Claude Code that understand the entire codebase, AI doesn't just regurgitate generic content - it extracts real implementation details and creates accurate, specific documentation.
In this case, Sonnet 4 took a pass & a human (me) verified them 7/10/25.
Overview
A production-ready 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.
Features
π Advanced OAuth 2.0 & OAuth 2.1: Secure authentication with automatic token refresh, transport-aware callback handling, session management, centralized scope management, and OAuth 2.1 bearer token support for multi-user environments with innovative CORS proxy architecture
π Google Calendar: Full calendar management with event CRUD operations
π Google Drive: File operations with native Microsoft Office format support (.docx, .xlsx)
π§ Gmail: Complete email management with search, send, and draft capabilities
π Google Docs: Document operations including content extraction, creation, and comment management
π Google Sheets: Comprehensive spreadsheet management with flexible cell operations and comment management
πΌοΈ Google Slides: Presentation management with slide creation, updates, content manipulation, and comment management
π Google Forms: Form creation, retrieval, publish settings, and response management
β Google Tasks: Complete task and task list management with hierarchy, due dates, and status tracking
π¬ Google Chat: Space management and messaging capabilities
π Google Custom Search: Programmable Search Engine (PSE) integration for custom web searches
π All Transports: Stdio, Streamable HTTP & SSE, OpenAPI compatibility via mcpo
β‘ High Performance: Service caching, thread-safe sessions, FastMCP integration
π Quick Start# 1. One-Click Claude Desktop Install (Recommended)
Download: Grab the latest google_workspace_mcp.dxt from the βReleasesβ page
Install: Double-click the file β Claude Desktop opens and prompts you to Install
Configure: In Claude Desktop β Settings β Extensions β Google Workspace MCP, paste your Google OAuth credentials
Use it: Start a new Claude chat and call any Google Workspace tool
Why DXT?
Desktop Extensions (.dxt) bundle the server, dependencies, and manifest so users go from download β working MCP in one click β no terminal, no JSON editing, no version conflicts.
Required Configuration
Variable
Purpose
GOOGLE_OAUTH_CLIENT_ID
OAuth client ID from Google Cloud (used by both legacy auth and OAuth 2.1)
GOOGLE_OAUTH_CLIENT_SECRET
OAuth client secret (used by both legacy auth and OAuth 2.1)
Download credentials as client_secret.json in project root
To use a different location, set GOOGLE_CLIENT_SECRET_PATH (or legacy GOOGLE_CLIENT_SECRETS) environment variable with the file path
Option C: .env File (Recommended for Development)
Copy the provided .env.oauth21 example file to .env in the project root:
cp .env.oauth21 .env
Edit the .env file to add your GOOGLE_OAUTH_CLIENT_ID and GOOGLE_OAUTH_CLIENT_SECRET.
The server automatically loads variables from this file on startup, simplifying local development.
Credential Loading Priority:
The server loads credentials in the following order of precedence:
Manually set environment variables (e.g., export VAR=value).
Variables defined in a .env file in the project root.
client_secret.json file specified by GOOGLE_CLIENT_SECRET_PATH.
Default client_secret.json file in the project root.
Why Environment Variables?
β Containerized deployments (Docker, Kubernetes)
β Cloud platforms (Heroku, Railway, etc.)
β CI/CD pipelines
β No secrets in version control
β Easy credential rotation
Environment:
export OAUTHLIB_INSECURE_TRANSPORT=1 # Development only
export [email protected] # Optional: Default email for auth - use this for single user setups and you won't need to set your email in system prompt for magic auth
export GOOGLE_PSE_API_KEY=your-custom-search-api-key # Optional: Only needed for Google Custom Search tools
export GOOGLE_PSE_ENGINE_ID=your-search-engine-id # Optional: Only needed for Google Custom Search tools
Server Configuration:
The server's base URL and port can be customized using environment variables:
WORKSPACE_MCP_BASE_URI: Sets the base URI for the server (default: http://localhost). Note: do not include a port in WORKSPACE_MCP_BASE_URI - set that with the variable below.
WORKSPACE_MCP_PORT: Sets the port the server listens on (default: 8000).
GOOGLE_OAUTH_REDIRECT_URI: Override the OAuth redirect URI (useful for reverse proxy setups - see below).
USER_GOOGLE_EMAIL: Optional default email for authentication flows. If set, the LLM won't need to specify your email when calling start_google_auth.
Google Custom Search Setup
To use the Google Custom Search tools, you need to:
uv run main.py
# HTTP mode (for web interfaces and debugging)
uv run main.py --transport streamable-http
# Single-user mode (simplified authentication)
uv run main.py --single-user
# Selective tool registration (only register specific tools)
uv run main.py --tools gmail drive calendar tasks
uv run main.py --tools sheets docs
uv run main.py --single-user --tools gmail # Can combine with other flags
# Docker
docker build -t workspace-mcp .
docker run -p 8000:8000 -v $(pwd):/app workspace-mcp --transport streamable-http
Available Tools for --tools flag: gmail, drive, calendar, docs, sheets, forms, tasks, chat, search
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 GOOGLE_OAUTH_CLIENT_SECRET credentials - no additional configuration needed!
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
Enabling OAuth 2.1:
To enable OAuth 2.1, set the MCP_ENABLE_OAUTH21 environment variable to true.
export MCP_ENABLE_OAUTH21=true
uv run main.py --transport streamable-http
If MCP_ENABLE_OAUTH21 is not set to true, the server will use legacy authentication, which is suitable for clients that do not support OAuth 2.1.
This implementation solves two critical challenges when using Google OAuth in browser environments:
Dynamic Client Registration: Google doesn't support OAuth 2.1 dynamic client registration. Our server provides a clever proxy that accepts any client registration request and returns the pre-configured Google OAuth credentials, allowing standards-compliant clients to work seamlessly.
CORS Issues: Google's OAuth endpoints don't include CORS headers, blocking browser-based clients. We implement intelligent proxy endpoints that:
Proxy authorization server discovery requests through /auth/discovery/authorization-server/{server}
Proxy token exchange requests through /oauth2/token
Add proper CORS headers to all responses
Maintain security by only proxying to known Google OAuth endpoints
This architecture enables any OAuth 2.1 compliant client to authenticate users through Google, even from browser environments, without requiring changes to the client implementation.
Connect to Claude Desktop
The server supports two transport modes:
Stdio Mode (Default - Recommended for Claude Desktop)
Guided Setup (Recommended if not using DXT)
python install_claude.py
This script automatically:
Prompts you for your Google OAuth credentials (Client ID and Secret)
Creates the Claude Desktop config file in the correct location
Sets up all necessary environment variables
No manual file editing required!
After running the script, just restart Claude Desktop and you're ready to go.
Manual Claude Configuration (Alternative)
Open Claude Desktop Settings β Developer β Edit Config
Run instantly without manual installation - you must configure OAuth credentials when using uvx. You can use either environment variables (recommended for production) or set the GOOGLE_CLIENT_SECRET_PATH (or legacy GOOGLE_CLIENT_SECRETS) environment variable to point to your client_secret.json file.
Reverse Proxy Setup
If you're running the MCP server behind a reverse proxy (nginx, Apache, Cloudflare, etc.), you'll need to configure GOOGLE_OAUTH_REDIRECT_URI to match your external URL:
Problem: When behind a reverse proxy, the server constructs redirect URIs using internal ports (e.g., http://localhost:8000/oauth2callback) but Google expects the external URL (e.g., https://your-domain.com/oauth2callback).
Solution: Set GOOGLE_OAUTH_REDIRECT_URI to your external URL:
export GOOGLE_OAUTH_REDIRECT_URI="https://your-domain.com/oauth2callback"
# Or with custom port if needed
export GOOGLE_OAUTH_REDIRECT_URI="https://your-domain.com:8443/oauth2callback"
Important:
The redirect URI must exactly match what's configured in your Google Cloud Console
The server will use this value for all OAuth flows instead of constructing it from WORKSPACE_MCP_BASE_URI and WORKSPACE_MCP_PORT
Your reverse proxy must forward /oauth2callback requests to the MCP server
export GOOGLE_OAUTH_CLIENT_ID="your-client-id.apps.googleusercontent.com"
export GOOGLE_OAUTH_CLIENT_SECRET="your-client-secret"
# Start the server with all Google Workspace tools
uvx workspace-mcp
# Start with specific tools only
uvx workspace-mcp --tools gmail drive calendar tasks
# Start in HTTP mode for debugging
uvx workspace-mcp --transport streamable-http
Requires Python 3.10+ and uvx. The package is available on PyPI.
Development Installation
For development or customization:
git clone https://github.com/taylorwilsdon/google_workspace_mcp.git
cd google_workspace_mcp
uv run main.py
Perform web searches using Programmable Search Engine
get_search_engine_info
Retrieve search engine metadata and configuration
search_custom_siterestrict
Search within specific sites/domains
π οΈ Development# Project Structure
google_workspace_mcp/
βββ auth/ # Authentication system with decorators
βββ core/ # MCP server and utilities
βββ g{service}/ # Service-specific tools
βββ main.py # Server entry point
βββ client_secret.json # OAuth credentials (not committed)
βββ pyproject.toml # Dependencies
Adding New Tools
from auth.service_decorator import require_google_service
@require_google_service("drive", "drive_read") # Service + scope group
async def your_new_tool(service, param1: str, param2: int = 10):
"""Tool description"""
# service is automatically injected and cached
result = service.files().list().execute()
return result # Return native Python objects
Architecture Highlights
Service Caching: 30-minute TTL reduces authentication overhead
Scope Management: Centralized in SCOPE_GROUPS for easy maintenance
Error Handling: Native exceptions instead of manual error construction
Multi-Service Support: @require_multiple_services() for complex tools
π Security
Credentials: Never commit client_secret.json or .credentials/ directory
OAuth Callback: Uses http://localhost:8000/oauth2callback for development (requires OAUTHLIB_INSECURE_TRANSPORT=1)
Transport-Aware Callbacks: Stdio mode starts a minimal HTTP server only for OAuth, ensuring callbacks work in all modes
Production: Use HTTPS for callback URIs and configure accordingly
Network Exposure: Consider authentication when using mcpo over networks
Scope Minimization: Tools request only necessary permissions
π Integration with Open WebUI
To use this server as a tool provider within Open WebUI:
Instant Start (No Config Needed)
Just copy and paste the below, set your values and you're off!