RiversUnlimited 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.
- Quick Installation Instructions
- Service Capabilities
- Middleware Architecture
- Template System
- Resource Discovery
- Testing Framework
- Security & Authentication
RiversUnlimited provides AI assistants with access to Google Workspace services through the Model Context Protocol (MCP). It supports 72+ tools across 9 Google services, enabling seamless integration between AI workflows and Google Workspace applications with revolutionary performance improvements.
graph TB
subgraph "π€ AI Assistant"
A[Claude/GPT/Other]
end
subgraph "π RiversUnlimited MCP Framework"
B[MCP Protocol]
C[Unified Middleware]
D[OAuth 2.1 + PKCE]
end
subgraph "βοΈ Google Workspace"
E[π§ Gmail]
F[π Drive]
G[π Sheets]
H[π Docs]
I[π― Slides]
J[π
Calendar]
K[π Forms]
L[π¬ Chat]
M[π· Photos]
end
A --> B
B --> C
C --> D
D --> E
D --> F
D --> G
D --> H
D --> I
D --> J
D --> K
D --> L
D --> M
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
-
Clone and setup:
git clone https://github.com/dipseth/google_workspace_fastmcp2.git cd google_workspace_fastmcp2 uv sync -
Configure Google OAuth:
- Visit Google Cloud Console π
- Enable APIs: Gmail, Drive, Docs, Sheets, Slides, Calendar, Forms, Chat, Photos
- Create OAuth 2.0 credentials (Web application type)
- Download client secrets JSON file
-
Setup environment:
cp .env.example .env # Edit .env with your Google OAuth credentials path -
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
RiversUnlimited supports multiple connection methods. Here are the two most popular ways to get started:
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:{
"rivers_unlimited": {
"type": "streamable-http",
"url": "https://localhost:8002/mcp",
"disabled": false
}
}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
RiversUnlimited supports 9 Google Workspace services with 71+ specialized tools:
| Service | Icon | Tools | Key Features | Documentation |
|---|---|---|---|---|
| Gmail | π§ | 11 | Send, reply, labels, filters, search | api-reference/gmail/ |
| Drive | π | 7 | Upload, download, sharing, Office docs | api-reference/drive/ |
| Docs | π | 4 | Create, edit, format, batch operations | api-reference/docs/ |
| Sheets | π | 6 | Read, write, formulas, formatting | api-reference/sheets/ |
| Slides | π― | 5 | Presentations, templates, export | api-reference/slides/ |
| Calendar | π | 6 | Events, scheduling, attendees, timezones | api-reference/calendar/ |
| Forms | π | 8 | Creation, responses, validation, publishing | api-reference/forms/ |
| Chat | π¬ | 12 | Messaging, cards, spaces, webhooks | api-reference/chat/ |
| Photos | π· | 12 | Albums, upload, search, metadata | api-reference/photos/ |
π API Documentation Resources:
- π Complete API Reference - Comprehensive documentation for all 71+ 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
RiversUnlimited uses a middleware architecture that provides seamless service integration, intelligent resource management, and powerful templating capabilities.
graph TD
A[π MCP Request] --> B[π·οΈ TagBasedResourceMiddleware]
B --> C[π§ QdrantUnifiedMiddleware]
C --> D[π¨ TemplateMiddleware]
D --> E[β‘ Tool Execution]
E --> F[π Response Processing]
F --> G[β¨ Formatted Output]
B --> H[π Resource Discovery<br/>service://gmail/labels<br/>user://current/profile]
C --> I[π Semantic Search<br/>Vector Embeddings<br/>Natural Language Queries]
D --> J[π― Template Rendering<br/>Gmail Chips<br/>Dashboard Cards]
style B fill:#e3f2fd
style C fill:#f3e5f5
style D fill:#e8f5e8
style E fill:#fff3e0
- π·οΈ 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
- π 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
RiversUnlimited features powerful Jinja2 template macros that transform raw Google Workspace data into visually stunning, AI-optimized formats.
| 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 |
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 ) }}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'
) }}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")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
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='RiversUnlimited' ) }}"
)π 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
RiversUnlimited provides a powerful MCP resource system that enables lightning-fast data access without API calls through intelligent URI patterns.
graph LR
subgraph "π Resource Types"
A[π€ user://current/email]
B[π·οΈ service://gmail/labels]
C[π
recent://calendar]
D[π§ qdrant://search/query]
end
subgraph "π Resource Engine"
E[TagBasedResourceMiddleware]
F[QdrantUnifiedMiddleware]
G[UserResourceManager]
end
subgraph "π Data Sources"
H[Google APIs]
I[Vector Database]
J[Session Cache]
end
A --> E --> J
B --> E --> H
C --> E --> H
D --> F --> I
style E fill:#e1f5fe
style F fill:#f3e5f5
style G fill:#e8f5e8
| 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 |
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)
# 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
RiversUnlimited includes comprehensive testing with client tests that validate MCP usage exactly as an LLM would experience it, plus additional testing suites.
flowchart LR
A[π€ LLM Client] --> B[π§ Gmail Tests]
A --> C[π Drive Tests]
A --> D[π Sheets Tests]
A --> E[π
Calendar Tests]
B --> F[β
Real Resource Integration]
C --> F
D --> F
E --> F
F --> G[π Authentication Patterns]
F --> H[π Service Validation]
style A fill:#e1f5fe
style F fill:#e8f5e8
style G fill:#f3e5f5
The client tests are the most important component - they provide deterministic testing of MCP operations using real resource integration and standardized patterns across all 71+ tools and 9 Google services. These tests validate both explicit email authentication and middleware injection patterns.
# π§ͺ 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π 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
RiversUnlimited implements enterprise-grade security with OAuth 2.1 + PKCE, advanced session management, and comprehensive audit capabilities.
flowchart TD
A[π OAuth 2.1 + PKCE] --> B[π Dynamic Client Registration]
B --> C[π Session Management]
C --> D[π Encrypted Storage]
D --> E[π Audit Logging]
B --> F[π MCP Inspector OAuth]
B --> G[π₯οΈ Direct Server OAuth]
B --> H[π§ Development JWT]
B --> I[π File Credentials]
style A fill:#e8f5e8
style C fill:#e1f5fe
style D fill:#f3e5f5
- π MCP Inspector OAuth: MCP Spec compliant with Dynamic Client Registration
- π₯οΈ Direct Server OAuth: Web-based authentication for direct access
- π§ Development JWT: Testing mode with generated tokens
- π Enhanced File Credentials: Persistent storage with encryption options
- π Custom OAuth Clients: Bring your own OAuth credentials with automatic fallback
- π 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 settings in .env
CREDENTIAL_STORAGE_MODE=FILE_ENCRYPTED
SESSION_SECRET_KEY=your-secret-key
SESSION_TIMEOUT_MINUTES=30
ENABLE_AUDIT_LOGGING=true
GMAIL_ALLOW_LIST=[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
