A powerful Model Context Protocol (MCP) server enabling AI-native, secure, and extensible access to Google Workspace services

In the evolving landscape of AI-powered assistants, streamlined access to productivity tools is essential. The Google Workspace MCP Server, developed by Taylor Wilsdon, is a high-performance open-source server that bridges Google Workspace APIs (Calendar, Drive, Docs, Gmail) with Large Language Models (LLMs) via the Model Context Protocol (MCP).

This Python-based server is designed to empower AI assistants, autonomous agents, and chat-based tools to natively query, manipulate, and generate content using real-time, secure user data—without compromising on modularity, privacy, or developer control.


🔧 Key Features at a Glance

  • OAuth 2.0 Authentication: Seamlessly manages user auth flows with secure token storage and refresh
  • Google Calendar: Full CRUD operations for events with all-day/time-based support
  • Google Drive: Search, read, and write files including native .docx/.xlsx extraction
  • Gmail: Search inbox, retrieve messages, compose drafts, and send emails
  • Google Docs: Create, read, and list documents—all accessible via LLMs
  • Streamable HTTP + SSE: Dual transport support for compatibility with agents and chat UIs
  • mcpo integration: Serve via OpenAPI and connect directly to tools like Open WebUI
  • Extensible Design: Easily add support for more APIs or services
  • Secure OAuth Callback Server: Built-in /oauth2callback handling on localhost:8000
  • Thread-safe session management for reliable multi-client concurrency

🔄 AI & LLM Integration Use Cases

This project is ideal for:

  • LLM tools and copilots needing access to a user’s email, calendar, or documents
  • Research agents generating reports from Google Docs and Drive files
  • AI personal assistants managing schedule, writing emails, or summarizing documents
  • Enterprise chatbots integrated into workflows with calendar or task visibility

It supports Open WebUI integration and is fully compatible with Claude Desktop, OpenRouter, or any MCP-compatible front-end.


⚙️ Quick Start for Sysadmins & Developers

Prerequisites

  • Python 3.11+ and uv
  • Google Cloud Project with OAuth 2.0 credentials
  • Enabled APIs: Google Calendar, Drive, Gmail, Docs

Installation

git clone https://github.com/taylorwilsdon/google_workspace_mcp.git
cd google_workspace_mcp
uv venv
source .venv/bin/activate
uv pip install -e .

Place your client_secret.json in the root directory and never commit it.

Start the Server

export OAUTHLIB_INSECURE_TRANSPORT=1  # For local testing
uv run main.py

The server listens by default on http://localhost:8000.


🔌 mcpo + OpenAPI Integration

To expose the server as an OpenAPI tool:

{
  "mcpServers": {
    "google_workspace": {
      "type": "streamablehttp",
      "url": "http://localhost:8000/mcp"
    }
  }
}

Run mcpo:

mcpo --port 8001 --config config.json --api-key "secret"

Then connect via Swagger UI: http://localhost:8001/docs
Or as a tool in Open WebUI, using http://localhost:8001/google_workspace


📑 Available Tools (Sample)

Google Calendar

ToolDescription
list_calendarsFetch all calendars
get_eventsRetrieve upcoming events
create_eventAdd new calendar events
modify_eventUpdate existing events
delete_eventRemove calendar entries

Gmail

ToolDescription
search_gmail_messagesUse standard Gmail search syntax
get_gmail_message_contentRetrieve full email content
send_gmail_messageSend email
draft_gmail_messageCompose a draft message

Google Drive

ToolDescription
search_drive_filesSearch by name, type, or content
get_drive_file_contentRead specific file
create_drive_fileUpload new document
list_drive_itemsBrowse folders/files

Google Docs

ToolDescription
search_docsFind Docs by name
get_doc_contentRead document text
create_docGenerate a new Doc

All tools support session-based or email-based authentication. If no credentials exist, the assistant will prompt the user to complete OAuth via a secure redirect.


🔒 Security Notes

  • client_secret.json and user token files must be excluded from version control
  • Supports scoped OAuth requests—each tool only requests necessary access
  • Consider reverse proxy (Nginx, Caddy) + API key for external production usage

🧩 Extendability

Want to add more Google Workspace tools?

  • Define async tool in gdrive/, gmail/, etc.
  • Use @server.tool("your_tool_name")
  • Access credentials via get_credentials()
  • Register the tool in main.py

GitHub Repo: github.com/taylorwilsdon/google_workspace_mcp
License: MIT

Whether you’re building an AI assistant, LLM-based workflow, or autonomous agent, Google Workspace MCP Server offers a ready-to-deploy, developer-friendly bridge to integrate AI with real-world productivity tools.

Scroll to Top