by taylorwilsdon
Google Workspace MCP Server is a comprehensive Model Context Protocol (MCP) server designed to provide natural language control over various Google Workspace services. It integrates with AI assistants and developer tools, allowing users to manage Google Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, and Chat through an AI-driven interface.
Google Workspace MCP Server is a comprehensive Model Context Protocol (MCP) server designed to provide natural language control over various Google Workspace services. It integrates with AI assistants and developer tools, allowing users to manage Google Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, and Chat through an AI-driven interface. Built with FastMCP, it emphasizes performance, advanced authentication, and streamlined development.
Quick Start (Recommended via uvx
):
GOOGLE_OAUTH_CLIENT_ID
and GOOGLE_OAUTH_CLIENT_SECRET
environment variables.uvx workspace-mcp
to start with all tools, or uvx workspace-mcp --tools gmail drive calendar
for specific tools.Development Installation:
git clone https://github.com/taylorwilsdon/google_workspace_mcp.git
cd google_workspace_mcp
uv run main.py
Configuration:
http://localhost:8000/oauth2callback
as a redirect URI.client_secret.json
in the project root.OAUTHLIB_INSECURE_TRANSPORT=1
for development and optionally USER_GOOGLE_EMAIL
for simplified authentication.Connecting to Claude Desktop:
python install_claude.py
to automate configuration.claude_desktop_config.json
file, specifying command, arguments, and environment variables.First-Time Authentication: The server handles OAuth callbacks automatically. Upon the first tool call, it will return an authorization URL to be opened in a browser. After authorization, the server processes the callback and retries the original request.
mcpo
.list_calendars
, create_event
, search_drive_files
, send_gmail_message
, get_doc_content
, read_sheet_values
, create_presentation
, create_form
, send_message
, and more.Q: How do I handle OAuth credentials securely?
A: It is recommended to use environment variables (GOOGLE_OAUTH_CLIENT_ID
, GOOGLE_OAUTH_CLIENT_SECRET
) for production deployments. Avoid committing client_secret.json
or .credentials/
to version control.
Q: What is OAUTHLIB_INSECURE_TRANSPORT=1
for?
A: This environment variable is for development purposes only and allows OAuth callbacks over insecure HTTP. For production, always use HTTPS for callback URIs.
Q: How does the server handle first-time authentication?
A: The server features transport-aware OAuth callback handling. In Stdio mode, it starts a minimal HTTP server on port 8000 for callbacks. In HTTP mode, it uses the existing FastAPI server. Both modes use http://localhost:8000/oauth2callback
for consistency. You will be prompted to authorize in your browser.
Q: Can I select which Google Workspace tools to enable?
A: Yes, you can start the server with specific tools only using the --tools
flag, e.g., uvx workspace-mcp --tools gmail drive calendar
.
Q: How can I integrate this server with Open WebUI?
A: You need to create an mcpo
configuration file, start the mcpo
proxy, and then configure Open WebUI by adding the mcpo
server URL as a tool connection. This makes the streamable HTTP endpoint available as an OpenAPI spec tool.
This is the single most feature-complete Google Workspace MCP server
Full natural language control over Google Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, and Chat through all MCP clients, AI assistants and developer tools
See it in action:
This README was crafted with AI assistance, and here's why that matters
As a solo developer building open source tools that may only ever serve my own needs, 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 6/28/25.
A production-ready MCP server that integrates all major Google Workspace services with AI assistants. Built with FastMCP for optimal performance, featuring advanced authentication handling, service caching, and streamlined development patterns.
mcpo
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 legacyGOOGLE_CLIENT_SECRETS
) environment variable to point to yourclient_secret.json
file.
# Set OAuth credentials via environment variables (recommended)
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
# Start in HTTP mode for debugging
uvx workspace-mcp --transport streamable-http
Requires Python 3.11+ 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
Google Cloud Setup:
Create OAuth 2.0 credentials (web application) in Google Cloud Console
Enable APIs: Calendar, Drive, Gmail, Docs, Sheets, Slides, Forms, Chat
Add redirect URI: http://localhost:8000/oauth2callback
Configure credentials using one of these methods:
Option A: Environment Variables (Recommended for Production)
export GOOGLE_OAUTH_CLIENT_ID="your-client-id.apps.googleusercontent.com"
export GOOGLE_OAUTH_CLIENT_SECRET="your-client-secret"
export GOOGLE_OAUTH_REDIRECT_URI="http://localhost:8000/oauth2callback" # Optional
Option B: File-based (Traditional)
client_secret.json
in project rootGOOGLE_CLIENT_SECRET_PATH
(or legacy GOOGLE_CLIENT_SECRETS
) environment variable with the file pathCredential Loading Priority:
GOOGLE_OAUTH_CLIENT_ID
, GOOGLE_OAUTH_CLIENT_SECRET
)GOOGLE_CLIENT_SECRET_PATH
or GOOGLE_CLIENT_SECRETS
environment variableclient_secret.json
in project root)Why Environment Variables?
Environment:
export OAUTHLIB_INSECURE_TRANSPORT=1 # Development only
export USER_GOOGLE_EMAIL=your.email@gmail.com # 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
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). This affects the server_url used for Gemini native function calling and the OAUTH_REDIRECT_URI.WORKSPACE_MCP_PORT
: Sets the port the server listens on (default: 8000). This affects the server_url, port, and OAUTH_REDIRECT_URI.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
.# Default (stdio mode for MCP clients)
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
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
, chat
The server supports two transport modes:
Easiest Setup (Recommended)
python install_claude.py
This script automatically:
After running the script, just restart Claude Desktop and you're ready to go.
Manual Claude Configuration (Alternative)
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"google_workspace": {
"command": "uvx",
"args": ["workspace-mcp"],
"env": {
"GOOGLE_OAUTH_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
"GOOGLE_OAUTH_CLIENT_SECRET": "your-client-secret",
"OAUTHLIB_INSECURE_TRANSPORT": "1"
}
}
}
}
Get Google OAuth Credentials (if you don't have them):
http://localhost:8000/oauth2callback
Development Installation (For Contributors):
{
"mcpServers": {
"google_workspace": {
"command": "uv",
"args": ["run", "main.py"],
"cwd": "/path/to/google_workspace_mcp",
"env": {
"GOOGLE_OAUTH_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
"GOOGLE_OAUTH_CLIENT_SECRET": "your-client-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 features transport-aware OAuth callback handling:
http://localhost:8000/oauth2callback
for consistencyWhen calling a tool:
Note: All tools support automatic authentication via
@require_google_service()
decorators with 30-minute service caching.
calendar_tools.py
)Tool | Description |
---|---|
list_calendars |
List accessible calendars |
get_events |
Retrieve events with time range filtering |
get_event |
Fetch detailed information of a single event by ID |
create_event |
Create events (all-day or timed) with optional Drive file attachments |
modify_event |
Update existing events |
delete_event |
Remove events |
drive_tools.py
)Tool | Description |
---|---|
search_drive_files |
Search files with query syntax |
get_drive_file_content |
Read file content (supports Office formats) |
list_drive_items |
List folder contents |
create_drive_file |
Create new files or fetch content from public URLs |
gmail_tools.py
)Tool | Description |
---|---|
search_gmail_messages |
Search with Gmail operators |
get_gmail_message_content |
Retrieve message content |
send_gmail_message |
Send emails |
draft_gmail_message |
Create drafts |
docs_tools.py
)Tool | Description |
---|---|
search_docs |
Find documents by name |
get_doc_content |
Extract document text |
list_docs_in_folder |
List docs in folder |
create_doc |
Create new documents |
read_doc_comments |
Read all comments and replies |
create_doc_comment |
Create new comments |
reply_to_comment |
Reply to existing comments |
resolve_comment |
Resolve comments |
sheets_tools.py
)Tool | Description |
---|---|
list_spreadsheets |
List accessible spreadsheets |
get_spreadsheet_info |
Get spreadsheet metadata |
read_sheet_values |
Read cell ranges |
modify_sheet_values |
Write/update/clear cells |
create_spreadsheet |
Create new spreadsheets |
create_sheet |
Add sheets to existing files |
read_sheet_comments |
Read all comments and replies |
create_sheet_comment |
Create new comments |
reply_to_sheet_comment |
Reply to existing comments |
resolve_sheet_comment |
Resolve comments |
slides_tools.py
)Tool | Description |
---|---|
create_presentation |
Create new presentations |
get_presentation |
Retrieve presentation details |
batch_update_presentation |
Apply multiple updates at once |
get_page |
Get specific slide information |
get_page_thumbnail |
Generate slide thumbnails |
read_presentation_comments |
Read all comments and replies |
create_presentation_comment |
Create new comments |
reply_to_presentation_comment |
Reply to existing comments |
resolve_presentation_comment |
Resolve comments |
forms_tools.py
)Tool | Description |
---|---|
create_form |
Create new forms with title and description |
get_form |
Retrieve form details, questions, and URLs |
set_publish_settings |
Configure form template and authentication settings |
get_form_response |
Get individual form response details |
list_form_responses |
List all responses to a form with pagination |
chat_tools.py
)Tool | Description |
---|---|
list_spaces |
List chat spaces/rooms |
get_messages |
Retrieve space messages |
send_message |
Send messages to spaces |
search_messages |
Search across chat history |
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 toolsclient_secret.json
or .credentials/
directoryhttp://localhost:8000/oauth2callback
for development (requires OAUTHLIB_INSECURE_TRANSPORT=1
)mcpo
over networksTo use this server as a tool provider within Open WebUI:
Create a file named config.json
with the following structure to have mcpo
make the streamable HTTP endpoint available as an OpenAPI spec tool:
{
"mcpServers": {
"google_workspace": {
"type": "streamablehttp",
"url": "http://localhost:8000/mcp"
}
}
}
mcpo --port 8001 --config config.json --api-key "your-optional-secret-key"
This command starts the mcpo
proxy, serving your active (assuming port 8000) Google Workspace MCP on port 8001.
http://localhost:8001/google_workspace
(matching the mcpo base URL and server name from config.json)--api-key
with mcpo, enter it as the API KeyThe Google Workspace tools should now be available when interacting with models in Open WebUI.
MIT License - see LICENSE
file for details.
Reviews feature coming soon
Stay tuned for community discussions and feedback