by taylorwilsdon
Control Gmail, Calendar, Drive, Docs, Sheets, Slides, Chat, Forms, Tasks, Search and other Google Workspace services through natural‑language prompts and AI assistants, all via a single MCP server backend.
Provides a production‑ready backend that connects AI models and assistants to the full suite of Google Workspace APIs (Gmail, Calendar, Drive, Docs, Sheets, Slides, Forms, Tasks, Chat and Custom Search). The server handles OAuth 2.1 multi‑user authentication, token refresh, and service caching, exposing each capability as MCP tools that can be called from any MCP‑compatible client.
GOOGLE_OAUTH_CLIENT_ID
and GOOGLE_OAUTH_CLIENT_SECRET
(environment variables, .env
file, or client_secret.json
).uvx workspace-mcp
(or uv run main.py
for development).--tool-tier core|extended|complete
) or specify individual services (--tools gmail drive calendar
).--transport streamable-http
..dxt
) and seamless stdio integration.Q: Do I need a Google Cloud project? A: Yes – create a project, enable the required APIs, and generate Desktop OAuth credentials.
Q: Can multiple users share the same server instance?
A: Enable OAuth 2.1 (MCP_ENABLE_OAUTH21=true
) and run the server in HTTP mode; each user authenticates with their own bearer token.
Q: Which Python version is required? A: Python 3.10 or newer.
Q: How do I limit the permissions each tool requests? A: Scopes are grouped per service in the code; only the scopes needed for the selected tier are requested.
Q: Is there a Docker image?
A: Yes – build with docker build -t workspace-mcp .
and run exposing port 8000.
Q: How does Claude Desktop integration work?
A: Install the provided .dxt
file; Claude Desktop launches the server automatically and injects the required environment variables.
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.
The most feature-complete Google Workspace MCP server, now with Remote OAuth2.1 multi-user support and 1-click Claude installation.
Support for all free Google accounts (Gmail, Docs, Drive etc) & Google Workspace plans (Starter, Standard, Plus, Enterprise, Non Profit) with expanded app options like Chat & Spaces. Interested in a private cloud instance? That can be arranged.
See it in action:
This README was written with AI assistance, and here's why that matters
As a solo dev building open source tools, 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 8/16/25.
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.
Simplified Setup: Now uses Google Desktop OAuth clients - no redirect URIs or port configuration needed!
@ Gmail • ≡ Drive • ⧖ Calendar ≡ Docs
≡ Forms • @ Chat • ≡ Sheets • ≡ Slides
⊠ Authentication & Security
✓ Tasks • ◆ Custom Search • ↻ Transport Support
mcpo
⊠ Credentials
export GOOGLE_OAUTH_CLIENT_ID="..."
export GOOGLE_OAUTH_CLIENT_SECRET="..."
▶ Launch Commands
uvx workspace-mcp --tool-tier core
uv run main.py --tools gmail drive
★ Tool Tiers
core
- Essential toolsextended
- Core + extrascomplete
- Everything
Details →google_workspace_mcp.dxt
from the “Releases” pageWhy 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
Variable | Purpose |
---|---|
GOOGLE_OAUTH_CLIENT_ID |
OAuth client ID from Google Cloud |
GOOGLE_OAUTH_CLIENT_SECRET |
OAuth client secret |
OAUTHLIB_INSECURE_TRANSPORT=1 |
Development only (allows http:// redirect) |
Optional
Variable | Purpose |
---|---|
USER_GOOGLE_EMAIL |
Default email for single-user auth |
GOOGLE_PSE_API_KEY |
API key for Custom Search |
GOOGLE_PSE_ENGINE_ID |
Search Engine ID for Custom Search |
MCP_ENABLE_OAUTH21 |
Set to true for OAuth 2.1 support |
Claude Desktop stores these securely in the OS keychain; set them once in the extension pane.
1. Create Project
console.cloud.google.com
→ Create new project
→ Note project name
2. OAuth Credentials
APIs & Services → Credentials
→ Create Credentials
→ OAuth Client ID
→ Desktop Application
Download & save credentials
3. Enable APIs
APIs & Services → Library
Search & enable:
Calendar, Drive, Gmail,
Docs, Sheets, Slides,
Forms, Tasks, Chat, Search
See quick links below
Complete Setup Process:
Create OAuth 2.0 Credentials - Visit Google Cloud Console
Enable Required APIs - In APIs & Services → Library
Configure Environment - Set your credentials:
export GOOGLE_OAUTH_CLIENT_ID="your-client-id"
export GOOGLE_OAUTH_CLIENT_SECRET="your-secret"
1.1. Credentials: See Credential Configuration for detailed setup options
◆ Development Mode
export OAUTHLIB_INSECURE_TRANSPORT=1
Allows HTTP redirect URIs
@ Default User
export USER_GOOGLE_EMAIL=\
your.email@gmail.com
Single-user authentication
◆ Custom Search
export GOOGLE_PSE_API_KEY=xxx
export GOOGLE_PSE_ENGINE_ID=yyy
Optional: Search API setup
◆ Base Configuration
export WORKSPACE_MCP_BASE_URI=
http://localhost
export WORKSPACE_MCP_PORT=8000
Server URL & port settings
↻ Proxy Support
export MCP_ENABLE_OAUTH21=
true
Leverage multi-user OAuth2.1 clients
@ Default Email
export USER_GOOGLE_EMAIL=\
your.email@gmail.com
Skip email in auth flows in single user mode
Variable | Description | Default |
---|---|---|
WORKSPACE_MCP_BASE_URI |
Base server URI (no port) | http://localhost |
WORKSPACE_MCP_PORT |
Server listening port | 8000 |
GOOGLE_OAUTH_REDIRECT_URI |
Override OAuth callback URL | Auto-constructed |
USER_GOOGLE_EMAIL |
Default auth email | None |
1. Create Search Engine
programmablesearchengine.google.com
/controlpanel/create
→ Configure sites or entire web
→ Note your Engine ID (cx)
2. Get API Key
developers.google.com
/custom-search/v1/overview
→ Create/select project
→ Enable Custom Search API
→ Create credentials (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:
Create Search Engine - Visit the Control Panel
017643444788157684527:6ivsjbpxpqw
)Enable API & Get Key - Visit Google Developers Console
Configure Environment - Add to your shell or .env
:
export GOOGLE_PSE_API_KEY="AIzaSy..."
export GOOGLE_PSE_ENGINE_ID="01764344478..."
▶ Quick Start
uv run main.py
Default stdio mode
◆ HTTP Mode
uv run main.py \
--transport streamable-http
Web interfaces & debugging
@ Single User
uv run main.py \
--single-user
Simplified authentication
▶ 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
★ 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: gmail
• drive
• calendar
• docs
• sheets
• forms
• tasks
• chat
• search
The server organizes tools into three progressive tiers for simplified deployment. Choose a tier that matches your usage needs and API quota requirements.
● 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.
▶ 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.yaml
▶ Authentication included in all tiers
# 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
🚀 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
export VAR=value
).env
file in project rootclient_secret.json
via GOOGLE_CLIENT_SECRET_PATH
client_secret.json
in project rootWhy Environment Variables?
Note: All tools support automatic authentication via
@require_google_service()
decorators with 30-minute service caching.
calendar_tools.py
Tool | Tier | Description |
---|---|---|
list_calendars |
Core | List accessible calendars |
get_events |
Core | Retrieve events with time range filtering |
create_event |
Core | Create events with attachments & reminders |
modify_event |
Core | Update existing events |
delete_event |
Extended | Remove events |
drive_tools.py
Tool | Tier | Description |
---|---|---|
search_drive_files |
Core | Search files with query syntax |
get_drive_file_content |
Core | Read file content (Office formats) |
list_drive_items |
Extended | List folder contents |
create_drive_file |
Core | Create files or fetch from URLs |
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 |
manage_gmail_label |
Extended | Create/update/delete labels |
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 | Initialize authentication |
docs_tools.py
Tool | Tier | Description |
---|---|---|
get_doc_content |
Core | Extract document text |
create_doc |
Core | Create new documents |
modify_doc_text |
Core | Modify document text |
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 |
insert_doc_image |
Complete | Insert images from Drive/URLs |
update_doc_headers_footers |
Complete | Modify headers and footers |
batch_update_doc |
Complete | Execute multiple operations |
inspect_doc_structure |
Complete | Analyze document structure |
create_table_with_data |
Complete | Create data tables |
debug_table_structure |
Complete | Debug table issues |
*_document_comments |
Complete | Read, Reply, Create, Resolve |
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 |
create_sheet |
Complete | Add sheets to existing files |
*_sheet_comment |
Complete | Read/create/reply/resolve comments |
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 |
*_presentation_comment |
Complete | Read/create/reply/resolve comments |
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 |
tasks_tools.py
Tool | Tier | Description |
---|---|---|
list_tasks |
Core | List tasks with filtering |
get_task |
Core | Retrieve task details |
create_task |
Core | Create tasks with hierarchy |
update_task |
Core | Modify task properties |
delete_task |
Extended | Remove tasks |
move_task |
Complete | Reposition tasks |
clear_completed_tasks |
Complete | Hide completed tasks |
*_task_list |
Complete | List/get/create/update/delete task lists |
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 |
search_tools.py
Tool | Tier | Description |
---|---|---|
search_custom |
Core | Perform web searches |
get_search_engine_info |
Complete | Retrieve search engine metadata |
search_custom_siterestrict |
Extended | Search within specific domains |
Tool Tier Legend:
The server supports two transport modes:
In general, you should use the one-click DXT installer package for Claude Desktop.
If you are unable to for some reason, you can configure it manually via claude_desktop_config.json
Manual Claude Configuration (Alternative)
Open Claude Desktop Settings → Developer → Edit Config
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
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"
}
}
}
}
If you’re developing, deploying to servers, or using another MCP-capable client, keep reading.
# 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, orclient_secret.json
.
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:
Enabling OAuth 2.1:
To enable OAuth 2.1, set the MCP_ENABLE_OAUTH21
environment variable to true
.
# OAuth 2.1 requires HTTP transport mode
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:
/auth/discovery/authorization-server/{server}
/oauth2/token
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.
MCP Inspector: No additional configuration needed with desktop OAuth client.
Claude Code Inspector: No additional configuration needed with desktop OAuth client.
{
"servers": {
"google-workspace": {
"url": "http://localhost:8000/mcp/",
"type": "http"
}
}
}
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
).
You also have options for:
| OAUTH_CUSTOM_REDIRECT_URIS
(optional) | Comma-separated list of additional redirect URIs |
| OAUTH_ALLOWED_ORIGINS
(optional) | Comma-separated list of additional CORS origins |
Solution: Set GOOGLE_OAUTH_REDIRECT_URI
to your external URL:
# External URL without port (nginx/Apache handling HTTPS)
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:
WORKSPACE_MCP_BASE_URI
and WORKSPACE_MCP_PORT
/oauth2callback
requests to the MCP server# Configure credentials first (see Credential Configuration section)
# Start with specific tools only
uvx workspace-mcp --tools gmail drive calendar tasks
# Start with tool tiers (recommended for most users)
uvx workspace-mcp --tool-tier core # Essential tools
uvx workspace-mcp --tool-tier extended # Core + additional features
uvx workspace-mcp --tool-tier complete # All tools
# Start in HTTP mode for debugging
uvx workspace-mcp --transport streamable-http
Requires Python 3.10+ and uvx. The package is available on PyPI.
For development or customization:
git clone https://github.com/taylorwilsdon/google_workspace_mcp.git
cd google_workspace_mcp
uv run main.py
Development Installation (For Contributors):
{
"mcpServers": {
"google_workspace": {
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/repo/google_workspace_mcp",
"main.py"
],
"env": {
"GOOGLE_OAUTH_CLIENT_ID": "your-client-id",
"GOOGLE_OAUTH_CLIENT_SECRET": "your-secret",
"OAUTHLIB_INSECURE_TRANSPORT": "1"
}
}
}
}
If you need to use HTTP mode with Claude Desktop:
{
"mcpServers": {
"google_workspace": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:8000/mcp"]
}
}
}
Note: Make sure to start the server with --transport streamable-http
when using HTTP mode.
The server uses Google Desktop OAuth for simplified authentication:
When calling a tool:
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
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
SCOPE_GROUPS
for easy maintenance@require_multiple_services()
for complex toolsThe server includes an abstract credential store API and a default backend for managing Google OAuth credentials with support for multiple storage backends:
Features:
CredentialStore
base class defines standard operations (get, store, delete, list users)LocalDirectoryCredentialStore
implementation stores credentials as JSON filesGOOGLE_MCP_CREDENTIALS_DIR
sets storage locationConfiguration:
# Optional: Set custom credentials directory
export GOOGLE_MCP_CREDENTIALS_DIR="/path/to/credentials"
# Default locations (if GOOGLE_MCP_CREDENTIALS_DIR not set):
# - ~/.google_workspace_mcp/credentials (if home directory accessible)
# - ./.credentials (fallback)
Usage Example:
from auth.credential_store import get_credential_store
# Get the global credential store instance
store = get_credential_store()
# Store credentials for a user
store.store_credential("user@example.com", credentials)
# Retrieve credentials
creds = store.get_credential("user@example.com")
# List all users with stored credentials
users = store.list_users()
The credential store automatically handles credential serialization, expiry parsing, and provides error handling for storage operations.
.env
, client_secret.json
or the .credentials/
directory to source control!http://localhost:8000/oauth2callback
for development (requires OAUTHLIB_INSECURE_TRANSPORT=1
)mcpo
over networks# Set credentials & launch in one command
GOOGLE_OAUTH_CLIENT_ID="your_id" \
GOOGLE_OAUTH_CLIENT_SECRET="your_secret" \
uvx mcpo --port 8000 --api-key "secret" \
-- uvx workspace-mcp
config.json
:{
"mcpServers": {
"google_workspace": {
"type": "streamablehttp",
"url": "http://localhost:8000/mcp"
}
}
}
mcpo --port 8001 --config config.json
http://localhost:8001/google_workspace
--api-key
(if set)MIT License - see LICENSE
file for details.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.