FastMCP2 server for Google Drive uploads with Qdrant-powered semantic search

๐Ÿš€ GoogleUnlimited Google Workspace Platform

docspypilicense

GoogleUnlimited is a comprehensive MCP framework that provides seamless Google Workspace integration through an advanced middleware architecture. It enables AI assistants and MCP clients to interact with Gmail, Google Drive, Docs, Sheets, Slides, Calendar, Forms, Chat, and Photos services using a unified, secure API.

๐Ÿ“‹ Table of Contents

  • Quick Installation Instructions
  • Service Capabilities
  • Middleware Architecture
  • Template System
  • Resource Discovery
  • Testing Framework
  • Security & Authentication

โšก Quick Installation Instructions

What is GoogleUnlimited?

GoogleUnlimited provides AI assistants with access to Google Workspace services through the Model Context Protocol (MCP). It supports 90+ tools across 9 Google services, enabling seamless integration between AI workflows and Google Workspace applications with revolutionary performance improvements.

Architecture Overview

๐Ÿ› ๏ธ Installation Methods

Method 1: Quick Install via uvx (Recommended)

The fastest way to get started - install directly from PyPI:

{
  "mcpServers": {
    "google-workspace-unlimited": {
      "command": "uvx",
      "args": ["google-workspace-unlimited"],
      "disabled": false,
      "timeout": 300
    }
  }
}

โšก That's it! The server runs in stdio mode by default, perfect for MCP clients like Claude Desktop, Cursor, Roo, etc.

Method 2: Clone and Development Setup

For development or customization:

  1. Clone and setup:

    git clone https://github.com/dipseth/google_workspace_fastmcp2.git
    cd google_workspace_fastmcp2
    uv sync
    
  2. Configure Google OAuth:

    a. Go to Google Cloud Console

    b. Create a new project (or select existing)

    c. Enable the APIs you need: Gmail, Drive, Docs, Sheets, Slides, Calendar, Forms, Chat, Photos

    d. Go to APIs & Services > Credentials > Create Credentials > OAuth client ID

    e. Select Web application as the application type

    f. Under Authorized redirect URIs, add:

    http://localhost:8002/oauth2callback
    

    g. Click Create and copy your Client ID and Client Secret

  3. Setup environment:

    cp .env.example .env
    

    Edit .env with your credentials:

    # Your OAuth credentials from Google Cloud Console
    GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
    GOOGLE_CLIENT_SECRET=your-client-secret
    
    # Must match EXACTLY what you set in Google Cloud Console
    OAUTH_REDIRECT_URI=http://localhost:8002/oauth2callback
    

    Alternative: Instead of GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET, you can download the JSON file from Google and set GOOGLE_CLIENT_SECRETS_FILE=credentials.json

  4. Start the server:

    uv run python server.py
    

๐Ÿ“š Configuration Resources:

  • ๐Ÿ”ง Complete Configuration Guide - Comprehensive environment variables and settings reference
  • ๐Ÿค– Claude.ai Integration Guide - Setup for Claude.ai remote MCP server usage
  • ๐Ÿ”’ HTTPS Setup Guide - SSL certificate configuration for secure connections
  • โš™๏ธ MCP JSON Configuration Guide - Standard MCP configuration for any compatible client

๐Ÿ“‹ Environment Variables Reference

Variable Required Default Description
GOOGLE_CLIENT_ID Yes* - OAuth 2.0 client ID from Google Cloud Console
GOOGLE_CLIENT_SECRET Yes* - OAuth 2.0 client secret from Google Cloud Console
GOOGLE_CLIENT_SECRETS_FILE Yes* - Alternative: path to OAuth JSON file
OAUTH_REDIRECT_URI Yes http://localhost:8002/oauth2callback Must match Google Console exactly
SERVER_HOST No localhost Server bind address
SERVER_PORT No 8002 Server port
ENABLE_HTTPS No false Enable HTTPS/SSL
SSL_CERT_FILE If HTTPS - Path to SSL certificate
SSL_KEY_FILE If HTTPS - Path to SSL private key
CREDENTIAL_STORAGE_MODE No FILE_ENCRYPTED FILE_ENCRYPTED, FILE_PLAINTEXT, MEMORY_ONLY
CREDENTIALS_DIR No ./credentials Directory for stored credentials
LOG_LEVEL No INFO DEBUG, INFO, WARNING, ERROR
SESSION_TIMEOUT_MINUTES No 60 Session idle timeout
GMAIL_ALLOW_LIST No - Comma-separated allowed email addresses
QDRANT_URL No http://localhost:6333 Qdrant vector database URL
QDRANT_KEY No NONE Qdrant API key (use NONE for no auth)
FASTMCP_CLOUD No false Enable cloud deployment mode

*Either GOOGLE_CLIENT_ID + GOOGLE_CLIENT_SECRET OR GOOGLE_CLIENT_SECRETS_FILE is required.

๐Ÿ”— Client Connections

GoogleUnlimited supports multiple connection methods. Here are the two most popular ways to get started:

๐ŸŽฏ Quick Setup Options

Option 1: Cursor IDE (STDIO - Community Verified โœ…):

{
  "mcpServers": {
    "google-workspace": {
      "command": "uv",
      "args": [
        "--directory", "/path/to/google_workspace_fastmcp2",
        "run", "python", "server.py"
      ],
      "env": {
        "GOOGLE_CLIENT_SECRETS_FILE": "/path/to/client_secrets.json",
        "MCP_TRANSPORT": "stdio"
      }
    }
  }
}

Option 2: HTTP Streamable (VS Code Roo, Claude Desktop, etc.):

# 1. Start server in HTTP mode
uv run python server.py --transport http --port 8002

# 2. Configure your client with:
{
  "google-workspace": {
    "type": "streamable-http",
    "url": "https://localhost:8002/mcp",
    "disabled": false
  }
}

๐Ÿ“š Complete Connection Guide

For detailed setup instructions, troubleshooting, and configurations for all supported clients including:

  • Claude Code CLI (HTTP & STDIO)
  • Claude Desktop
  • VS Code/GitHub Copilot
  • Claude.ai with Cloudflare Tunnel
  • And more...

๐Ÿ”— Complete Client Connection Guide - Comprehensive setup instructions, troubleshooting, and advanced configurations for all supported AI clients and development environments

๐ŸŽฏ Service Capabilities

GoogleUnlimited supports 9 Google Workspace services with 90+ specialized tools:

Service Icon Tools Key Features Documentation
Gmail ๐Ÿ“ง 14 Send, reply, labels, filters, search, allowlist api-reference/gmail/
Drive ๐Ÿ“ 9 Upload, download, sharing, Office docs, file management api-reference/drive/
Docs ๐Ÿ“„ 4 Create, edit, format, batch operations api-reference/docs/
Sheets ๐Ÿ“Š 7 Read, write, formulas, formatting api-reference/sheets/
Slides ๐ŸŽฏ 5 Presentations, templates, export api-reference/slides/
Calendar ๐Ÿ“… 9 Events, scheduling, attendees, timezones api-reference/calendar/
Forms ๐Ÿ“ 8 Creation, responses, validation, publishing api-reference/forms/
Chat ๐Ÿ’ฌ 24 Messaging, cards, spaces, webhooks, unified cards api-reference/chat/
Photos ๐Ÿ“ท 12 Albums, upload, search, metadata, smart search api-reference/photos/

๐Ÿ“š API Documentation Resources:

  • ๐Ÿ”— Complete API Reference - Comprehensive documentation for all 90+ tools across 9 services
  • ๐Ÿ“ง Gmail API Guide - Email management, labels, filters, and search operations
  • ๐Ÿ“ Drive API Guide - File operations, sharing, and Office document handling
  • ๐Ÿ“Š Sheets API Guide - Spreadsheet data manipulation and formatting
  • ๐Ÿ“… Calendar API Guide - Event scheduling and timezone management

๐Ÿง  Middleware Architecture

GoogleUnlimited uses a middleware architecture that provides seamless service integration, intelligent resource management, and powerful templating capabilities.

Middleware Architecture

๐Ÿ”ง Core Middleware Components

  • ๐Ÿท๏ธ TagBasedResourceMiddleware: Intelligent resource discovery using URI patterns (service://gmail/messages, user://current/email)
  • ๐Ÿง  QdrantUnifiedMiddleware: AI-powered semantic search across all tool responses with vector embeddings
  • ๐ŸŽจ TemplateMiddleware: Advanced Jinja2 template system for beautiful, structured output formatting

โœจ Architecture Benefits

  • ๐Ÿ”„ Unified Resource Access: URI-based access to service data without API calls
  • ๐Ÿง  Semantic Intelligence: Natural language search across all stored responses
  • ๐ŸŽจ Visual Excellence: Consistent, beautiful output formatting for optimal AI consumption
  • ๐Ÿ’ฐ Token Efficiency: Template macros reduce token usage by 60-80% through structured data rendering
  • โšก Performance: 30x faster than traditional approaches through intelligent caching

๐Ÿ“š Middleware Documentation Resources:

  • ๐Ÿ“– Middleware Architecture Guide - Complete middleware system documentation and implementation details
  • ๐Ÿท๏ธ TagBasedResourceMiddleware - URI pattern resource discovery and management
  • ๐Ÿง  QdrantUnifiedMiddleware - AI-powered semantic search and vector embeddings
  • ๐ŸŽจ TemplateMiddleware - Advanced Jinja2 template system for output formatting

๐ŸŽจ Template System

GoogleUnlimited features powerful Jinja2 template macros that transform raw Google Workspace data into visually stunning, AI-optimized formats.

๐ŸŽฏ Available Template Macros

Template File Macro Purpose Key Features
email_card.j2 render_gmail_labels_chips() Gmail label visualization Interactive chips, unread counts, direct Gmail links
calendar_dashboard.j2 render_calendar_dashboard() Calendar & events dashboard Primary/shared calendars, upcoming events, dark theme
dynamic_macro.j2 render_calendar_events_dashboard() Calendar events dashboard Event cards, time/location details, clickable links, dark theme
document_templates.j2 generate_report_doc() Professional reports Metrics, tables, charts, company branding
colorfuL_email.j2 render_beautiful_email3() Rich HTML emails Multiple signatures, gradients, responsive design

๐Ÿ’ก Template Macro Examples

Gmail Labels Visualization - Transform label lists into beautiful interactive chips:

{{ render_gmail_labels_chips( service://gmail/labels , 'Label summary for: ' + user://current/email ) }}

Calendar Dashboard - Create comprehensive calendar overviews:

{{ render_calendar_dashboard( service://calendar/calendars, service://calendar/events, 'My Calendar Overview' ) }}

Calendar Events Dashboard - Transform calendar events into beautiful, interactive event cards:

{{ render_calendar_events_dashboard( service://calendar/events , 'Upcoming Events for: ' + user://current/email.email ) }}

Calendar Events Dashboard Example

This macro creates a stunning dark-themed dashboard featuring:

  • ๐Ÿ“… Interactive Event Cards: Each event is rendered as a clickable card that opens in Google Calendar
  • ๐Ÿ• Smart Time Display: Automatically formats all-day events vs. timed events with timezone support
  • ๐Ÿ“ Location Integration: Displays meeting locations and virtual meeting links
  • ๐Ÿ‘ฅ Attendee Information: Shows attendee counts and participant details
  • โœ… Status Indicators: Color-coded status (confirmed, tentative, cancelled) with visual feedback
  • ๐Ÿ“ฑ Responsive Design: Mobile-optimized layout with touch-friendly interactions
  • ๐ŸŽจ Dark Theme Styling: Professional appearance with gradient backgrounds and hover effects

Professional Documents - Generate reports with metrics and charts:

{{ generate_report_doc(
    report_title='Q4 Performance Report',
    metrics=[{'value': '$1.2M', 'label': 'Revenue', 'change': 15}],
    company_name='Your Company'
) }}

๐Ÿ” Macro Discovery & Dynamic Creation

Explore all available macros using the template resource system:

# Access the template://macros resource to discover all available macros
macros = await access_resource("template://macros")
# Returns comprehensive macro information with usage examples

# Access specific macro details
macro_details = await access_resource("template://macros/render_gmail_labels_chips")

๐ŸŽฏ Dynamic Macro Creation

Create custom macros at runtime using the create_template_macro tool:

# Create a new macro dynamically
await create_template_macro(
    macro_name="render_task_status_badge",
    macro_content='''
    {% macro render_task_status_badge(status, size='small') %}
    {% if status == 'completed' %}
    <span class="status-badge status-completed {{ size }}">โœ… Complete</span>
    {% elif status == 'in_progress' %}
    <span class="status-badge status-in-progress {{ size }}">๐Ÿ”„ In Progress</span>
    {% else %}
    <span class="status-badge status-pending {{ size }}">โณ {{ status|title }}</span>
    {% endif %}
    {% endmacro %}
    ''',
    description="Renders visual status badges for task states with appropriate icons",
    usage_example="{{ render_task_status_badge('completed', 'large') }}",
    persist_to_file=True
)

# Immediately use the newly created macro
await send_gmail_message(
    html_body="Task Status: {{ render_task_status_badge('completed', 'large') }}"
)

Key Features:

  • โšก Immediate Availability: Macros are instantly available after creation
  • ๐ŸŽฏ Resource Integration: Automatically available via template://macros/macro_name
  • ๐Ÿ’พ Optional Persistence: Save macros to disk for permanent availability
  • ๐Ÿ”„ Template Processing: Full Jinja2 syntax validation and error handling

๐Ÿš€ Real-World Usage

Templates can be directly used in tool calls for beautiful, structured output:

# Send a beautiful email with calendar dashboard
await send_gmail_message(
    to="[email protected]",
    subject="Weekly Schedule Update",
    html_body="{{ render_calendar_events_dashboard( service://calendar/events, 'My upcoming events') }}",
    content_type="mixed"
)

# Generate and send a professional report
await create_doc(
    title="Q4 Performance Report",
    content="{{ generate_report_doc( report_title='Quarterly Results', company_name='GoogleUnlimited' ) }}"
)

๐Ÿ“š Template System Resources:

  • ๐ŸŽจ Template Directory - Complete collection of Jinja2 templates and macros
  • ๐Ÿ’Œ Beautiful Email Templates - Rich HTML email styling and themes
  • ๐Ÿท๏ธ Gmail Label Cards - Interactive label visualization with chips
  • ๐Ÿ“… Calendar Dashboard - Event timeline and scheduling views
  • ๐Ÿ“„ Document Templates - Structured document formatting

๐Ÿ—‚๏ธ Resource Discovery

GoogleUnlimited provides a powerful MCP resource system that enables lightning-fast data access without API calls through intelligent URI patterns.

Resource Discovery

๐ŸŽฏ Resource URI Patterns

Pattern Purpose Example Returns
user://profile/{email} User authentication status user://profile/[email protected] Profile + auth state
service://{service}/lists Available service lists service://gmail/lists [filters, labels]
service://{service}/{list_type} All items in list service://gmail/labels All Gmail labels
service://{service}/{list_type}/{id} Specific item details service://gmail/labels/INBOX INBOX label details
recent://{service} Recent items recent://drive Recent Drive files
qdrant://search/{query} Semantic search qdrant://search/gmail errors Relevant responses

๐Ÿ—๏ธ Key Resource Files

  • resources/user_resources.py: Authentication, profiles, session management (1,812 lines)
  • resources/service_list_resources.py: Service discovery through TagBasedResourceMiddleware (446 lines)
  • middleware/qdrant_core/resources.py: AI-powered search and analytics (319 lines)

โšก Lightning-Fast Access

# Instant Gmail labels (no API call needed)
labels = await access_resource("service://gmail/labels")

# Current user info from session
user = await access_resource("user://current/email")

# Semantic search across all tool responses
results = await access_resource("qdrant://search/gmail errors today")

# Recent calendar events
events = await access_resource("recent://calendar")

๐Ÿ“š Resource System Documentation:

  • ๐Ÿ—‚๏ธ User Resources - Authentication, profiles, and session management (1,812 lines)
  • ๐Ÿท๏ธ Service List Resources - Service discovery through TagBasedResourceMiddleware (446 lines)
  • ๐Ÿง  Qdrant Core Resources - AI-powered search and analytics (319 lines)
  • ๐Ÿ“‹ Resource Patterns Guide - Complete URI pattern reference and usage examples

๐Ÿงช Testing Framework

GoogleUnlimited includes comprehensive testing with client tests that validate MCP usage exactly as an LLM would experience it, plus additional testing suites. 559 tests passing with 100% pass rate.

๐ŸŽฏ Client Testing Focus

Testing Framework

The client tests are the most important component - they provide deterministic testing of MCP operations using real resource integration and standardized patterns across all 90+ tools and 9 Google services. These tests validate both explicit email authentication and middleware injection patterns.

๐Ÿš€ Quick Test Commands

# ๐Ÿงช Run all client tests (primary test suite)
uv run pytest tests/client/ -v

# ๐Ÿ“ง Test specific service
uv run pytest tests/client/ -k "gmail" -v

# ๐Ÿ” Authentication required tests
uv run pytest tests/client/ -m "auth_required" -v

๐Ÿ”ฌ Real Resource ID Integration

The testing framework fetches real IDs from service resources for realistic testing:

# Available fixtures for real resource testing
real_gmail_message_id      # From service://gmail/messages
real_drive_document_id     # From service://drive/items
real_calendar_event_id     # From service://calendar/events
real_photos_album_id       # From service://photos/albums
real_forms_form_id         # From service://forms/forms
real_chat_space_id         # From service://chat/spaces

๐Ÿ”„ CI/CD Pipeline

Automated testing and publishing via GitHub Actions:

  • CI Workflow: Runs on every PR and push to main
    • Python 3.11 & 3.12 matrix testing
    • Linting with ruff and formatting with black
    • Full test suite execution
  • TestPyPI Publishing: Automated package publishing for testing

๐Ÿ“š Testing Resources:

  • ๐Ÿ“‹ Client Testing Framework Guide - Complete client testing documentation and patterns
  • ๐Ÿงช Client Tests Directory - Real resource integration tests for deterministic MCP validation
  • ๐Ÿค– MCP Client Integration - Learn more about MCP client patterns and usage
  • ๐Ÿ” Authentication Patterns - Email vs middleware injection validation testing

๐Ÿ”’ Security & Authentication

GoogleUnlimited implements enterprise-grade security with OAuth 2.1 + PKCE, advanced session management, and comprehensive audit capabilities.

Security Architecture

๐Ÿ›ก๏ธ Authentication Flows

  1. ๐ŸŒ MCP Inspector OAuth: MCP Spec compliant with Dynamic Client Registration
  2. ๐Ÿ–ฅ๏ธ Direct Server OAuth: Web-based authentication for direct access
  3. ๐Ÿ”ง Development JWT: Testing mode with generated tokens
  4. ๐Ÿ“ Enhanced File Credentials: Persistent storage with encryption options
  5. ๐Ÿ”‘ Custom OAuth Clients: Bring your own OAuth credentials with automatic fallback

โœจ Security Features

  • ๐Ÿ” OAuth 2.1 + PKCE: Modern authentication with proof-of-key exchange (supports public clients)
  • ๐Ÿ”’ Session Isolation: Multi-tenant support preventing data leaks
  • ๐Ÿท๏ธ 27+ API Scopes: Granular permission management across all services
  • ๐Ÿ“Š Audit Logging: Complete security event tracking
  • ๐Ÿ” AES-256 Encryption: Machine-specific keys for credential storage
  • ๐Ÿ”„ Three-Tier Fallback: Robust credential persistence across server restarts (State Map โ†’ UnifiedSession โ†’ Context Storage)

โš™๏ธ Security Configuration

# ๐Ÿ”’ Security settings in .env
CREDENTIAL_STORAGE_MODE=FILE_ENCRYPTED
SESSION_SECRET_KEY=your-secret-key
SESSION_TIMEOUT_MINUTES=30
ENABLE_AUDIT_LOGGING=true
[email protected]

๐Ÿ“š Security Documentation Resources:

  • ๐Ÿ›ก๏ธ Unified OAuth Architecture - Complete security architecture and authentication design
  • ๐Ÿ” OAuth 2.1 + PKCE Implementation - Modern authentication with proof-of-key exchange
  • ๐Ÿ  Session Management Guide - Multi-tenant support and session isolation
  • ๐Ÿ”’ Encryption & Storage - AES-256 credential encryption and machine-specific keys
  • ๐Ÿ“Š Audit Logging System - Complete security event tracking and monitoring

๐Ÿš€ Ready to revolutionize your Google Workspace integration?

๐Ÿ“š Documentation โ€ข ๐Ÿ”ง Configuration โ€ข ๐ŸŽฏ API Reference โ€ข ๐Ÿงช Testing

MCP Server ยท Populars

MCP Server ยท New