Advanced Google Workspace MCP Server - Gmail, Calendar, Drive, Docs, Sheets, Slides, Forms, Tasks, Chat, Search with bidirectional sync
Project description
Google Workspace MCP Advanced
Advanced Model Context Protocol (MCP) server for Google Workspace integration.
This project is an advanced fork of taylorwilsdon/google_workspace_mcp, merged with advanced file synchronization features from the drive-synapsis MCP. It provides AI assistants with comprehensive access to Gmail, Google Drive, Calendar, Docs, Sheets, Chat, Forms, Slides, Tasks, and Search with bidirectional sync capabilities.
Features
- 10 Google Services: Gmail, Drive, Calendar, Docs, Sheets, Chat, Forms, Slides, Tasks, Search
- 100+ Tools: Comprehensive API coverage for each service
- Advanced Sync Tools: Bidirectional file synchronization between local files and Google Drive (based on
drive-synapsis) - Search Aliases: Quick reference to search results using A-Z aliases
- OAuth 2.0/2.1: Secure authentication with persistent session management
- Session Persistence: Credentials survive server restarts - no re-authentication required
- Async Architecture: Non-blocking operations for high performance
Quick Start
Prerequisites
- Python 3.11+
- uv (recommended) or pip
- Node.js 18+ (only required for
npxdistribution usage)
Installation
# Clone the repository
cd google-workspace-mcp-advanced
# Install with uv
uv pip install -e .
# Or with pip
pip install -e .
Distribution Channels (npm/npx)
# Stable channel (npm latest)
npx -y google-workspace-mcp-advanced --transport stdio
# Prerelease channel (npm next)
npx -y google-workspace-mcp-advanced@next --transport stdio
# Pinned deterministic version (recommended for production rollouts)
npx -y google-workspace-mcp-advanced@1.0.0 --transport stdio
Notes:
- The npm launcher executes the matching Python release through
uvx(oruv tool runfallback). - Override Python package resolution with
GWS_MCP_PYPI_SPEC, for example:GWS_MCP_PYPI_SPEC=google-workspace-mcp-advanced==1.0.0 npx -y google-workspace-mcp-advanced --transport stdio - Release sequencing, provenance, and rollback guidance:
docs/DISTRIBUTION_RELEASE.md.
Running the Server
# STDIO mode (default, for MCP clients)
uv run google-workspace-mcp-advanced --transport stdio
# HTTP mode (for web-based clients)
uv run google-workspace-mcp-advanced --transport streamable-http
# Single-user mode (bypasses session mapping)
uv run google-workspace-mcp-advanced --single-user
# Load specific services only
uv run google-workspace-mcp-advanced --tools gmail drive calendar
MCP Client Configuration
Add to your MCP client configuration (e.g., Claude Desktop, OpenCode):
{
"mcpServers": {
"google-workspace": {
"command": "npx",
"args": ["-y", "google-workspace-mcp-advanced", "--transport", "stdio"],
"env": {
"USER_GOOGLE_EMAIL": "your.email@gmail.com"
}
},
"google-workspace-dev": {
"command": "uv",
"args": [
"run",
"--project",
"/path/to/google-workspace-mcp-advanced",
"google-workspace-mcp-advanced",
"--transport",
"stdio"
],
"env": {
"USER_GOOGLE_EMAIL": "your.email@gmail.com"
}
}
}
}
Use the npx server entry for stable releases and keep the uv run --project entry for local development.
User docs entry point: docs/INDEX.md.
Contributor docs entry points: AGENTS.md and agent-docs/INDEX.md.
Authentication
This server uses OAuth 2.0/2.1 credentials. On first use:
- The server will provide an OAuth URL
- Open the URL in your browser
- Sign in with your Google account
- Grant the requested permissions
- Credentials are stored in
~/.config/gws-mcp-advanced/credentials/
Environment Variables
| Variable | Description | Default |
|---|---|---|
USER_GOOGLE_EMAIL |
Your Google email | Required |
GOOGLE_OAUTH_CLIENT_ID |
OAuth client ID | Required |
GOOGLE_OAUTH_CLIENT_SECRET |
OAuth client secret | Required |
MCP_SINGLE_USER_MODE |
Bypass session mapping | false |
WORKSPACE_MCP_PORT |
HTTP server port | 9876 |
WORKSPACE_MCP_CONFIG_DIR |
Directory for credentials | ~/.config/gws-mcp-advanced |
AUTH_DIAGNOSTICS |
Enable auth debug logging | false |
WORKSPACE_MCP_ALLOW_UNVERIFIED_JWT |
Break-glass: allow identity extraction from unverified JWT claims (not recommended) | false |
Available Tools
Gmail
search_gmail_messages- Search emailsget_gmail_message_content- Read email contentsend_gmail_message- Send emailsdraft_gmail_message- Create drafts- And more...
Google Drive
search_google_drive- Search files (results cached with A-Z aliases)read_google_drive_file- Read file contentcreate_google_doc- Create documentsupload_file- Upload files- Sync Tools:
link_local_file- Link local file to Driveupdate_google_doc- Upload local to Drive (dry-run default)download_google_doc- Download Drive to local (dry-run default)upload_folder- Recursive folder uploadmirror_drive_folder- Recursive folder downloaddownload_doc_tabs- Multi-tab document sync
Google Calendar
get_events- List calendar eventscreate_event- Create eventsmodify_event- Update eventsdelete_event- Delete events
Google Docs
get_document_outline- Get document structureread_document_section- Read specific sectionsappend_to_google_doc- Append contentreplace_doc_text- Find and replace
Google Sheets
read_sheet_range- Read cell rangesupdate_sheet_cell- Update cellscreate_sheet- Create spreadsheetsappend_to_sheet- Append rows
Google Chat
list_spaces- List chat spacesget_messages- Read messagessend_message- Send messages
Google Forms
get_form- Get form detailslist_form_responses- List responsescreate_form- Create forms
Google Slides
get_presentation- Get presentation detailscreate_presentation- Create presentationsbatch_update_presentation- Update slides
Google Tasks
list_tasks- List taskscreate_task- Create tasksupdate_task- Update tasks
Google Search
search_custom- Programmable Search Engine
Search Aliases
When you search Google Drive, results are automatically cached with aliases:
Search results:
[A] Project Plan - Google Doc
[B] Budget 2024 - Google Sheet
[C] Team Photo - Image
Use aliases in subsequent commands:
read_google_drive_file(file_id="A") # Reads "Project Plan"
Sync Tools
The sync tools enable bidirectional synchronization between local files and Google Drive:
Linking Files
link_local_file(local_path="docs/notes.md", file_id="A")
Uploading Changes (Safe by Default)
# Dry run - shows diff without making changes
update_google_doc(local_path="docs/notes.md")
# Apply changes
update_google_doc(local_path="docs/notes.md", dry_run=False)
Downloading Changes (Safe by Default)
# Dry run - shows diff without making changes
download_google_doc(local_path="docs/notes.md")
# Apply changes
download_google_doc(local_path="docs/notes.md", dry_run=False)
Development
Project Structure
google-workspace-mcp-advanced/
├── auth/ # OAuth and authentication
│ ├── google_auth.py # Core auth logic
│ ├── google_oauth_config.py # Embedded credentials
│ └── service_decorator.py # @require_google_service
├── core/ # Shared utilities
│ ├── errors.py # Custom error types
│ ├── managers.py # SearchManager, SyncManager
│ └── server.py # FastMCP server instance
├── gdrive/ # Google Drive tools
│ ├── drive_tools.py # Core Drive tools
│ └── sync_tools.py # Sync tools
├── gmail/ # Gmail tools
├── gcalendar/ # Calendar tools
├── gdocs/ # Docs tools
├── gsheets/ # Sheets tools
├── gchat/ # Chat tools
├── gforms/ # Forms tools
├── gslides/ # Slides tools
├── gtasks/ # Tasks tools
├── gsearch/ # Search tools
├── main.py # CLI entry point
├── fastmcp_server.py # FastMCP Cloud entry point
└── pyproject.toml # Package configuration
Running Tests
# Run all tests
uv run pytest
# Run with coverage
uv run pytest tests/ --cov=.
# Run specific test file
uv run pytest tests/integration/test_auth_flow.py
Linting & Formatting
# Check linting
uv run ruff check .
# Auto-fix issues
uv run ruff check --fix .
# Format code
uv run ruff format .
Recent Updates
v0.9.1 - Codebase Refactor
- Modular Architecture: Split monolithic tool files into domain-specific modules
- Improved Maintainability: Clearer separation of concerns for Gmail, Drive, and Docs
- Public API Preservation: Backward-compatible package structure
- Circular Dependency Fixes: Resolved import cycles in core/auth modules
v0.9.0 - Session Persistence & Auth Improvements
- Session persistence: Credentials now survive server restarts
- Atomic file writes: Prevents credential corruption on crash
- Credential recovery: Automatic recovery from file store on restart
- Auth diagnostics: Enable with
AUTH_DIAGNOSTICS=1for debugging - 100+ tools: Expanded tool coverage across all services
v0.8.0 - Architecture Improvements
- Consolidated auth providers and middleware
- Added DI container and extended error hierarchy
- Improved single-user mode auto-recovery
License
MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file google_workspace_mcp_advanced-1.0.0.tar.gz.
File metadata
- Download URL: google_workspace_mcp_advanced-1.0.0.tar.gz
- Upload date:
- Size: 214.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da987a63784b3e5530b1f182aa61e0bc6ac5cd50badd943ae5368ca63fb87ae9
|
|
| MD5 |
2bb2c7194f87b2075a39d48e5500b81d
|
|
| BLAKE2b-256 |
dac302ecd3c01ed59db8479a99e9d973929eb7d1188fe15e0b2ae84a99e8e492
|
Provenance
The following attestation bundles were made for google_workspace_mcp_advanced-1.0.0.tar.gz:
Publisher:
release-pypi.yml on Skeptomenos/google-workspace-mcp-advanced
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
google_workspace_mcp_advanced-1.0.0.tar.gz -
Subject digest:
da987a63784b3e5530b1f182aa61e0bc6ac5cd50badd943ae5368ca63fb87ae9 - Sigstore transparency entry: 1008618346
- Sigstore integration time:
-
Permalink:
Skeptomenos/google-workspace-mcp-advanced@e714355a2b0270afec8202ee063b0adb26fa779e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Skeptomenos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@e714355a2b0270afec8202ee063b0adb26fa779e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file google_workspace_mcp_advanced-1.0.0-py3-none-any.whl.
File metadata
- Download URL: google_workspace_mcp_advanced-1.0.0-py3-none-any.whl
- Upload date:
- Size: 252.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
96e69949a1145228fcbfdea23bccaa09a62726864a1839d0d47f1c107fb81db4
|
|
| MD5 |
369cdfa360afc6fd20843886b629c0f4
|
|
| BLAKE2b-256 |
b8f30276e94f58c86eeb4d8a064da0e48ff6544036f2c8a4b6875988a181813c
|
Provenance
The following attestation bundles were made for google_workspace_mcp_advanced-1.0.0-py3-none-any.whl:
Publisher:
release-pypi.yml on Skeptomenos/google-workspace-mcp-advanced
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
google_workspace_mcp_advanced-1.0.0-py3-none-any.whl -
Subject digest:
96e69949a1145228fcbfdea23bccaa09a62726864a1839d0d47f1c107fb81db4 - Sigstore transparency entry: 1008618348
- Sigstore integration time:
-
Permalink:
Skeptomenos/google-workspace-mcp-advanced@e714355a2b0270afec8202ee063b0adb26fa779e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Skeptomenos
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-pypi.yml@e714355a2b0270afec8202ee063b0adb26fa779e -
Trigger Event:
workflow_dispatch
-
Statement type: