MCP server for Google Workspace integration
Project description
arclio-mcp-gsuite
Google Workspace integration for AI assistants via Model Context Protocol (MCP)
Developed and maintained by Arclio - Secure MCP service management for AI applications
๐ Overview
arclio-mcp-gsuite is a robust Python package that enables AI models to interact with Google Workspace services via the Model Context Protocol (MCP). It serves as an intelligent middleware between AI assistants and Google APIs, allowing models to execute complex operations without direct API access.
What is MCP?
The Model Context Protocol (MCP) provides a standardized interface for AI models to access external tools and services. arclio-mcp-gsuite implements an MCP server that exposes Google Workspace capabilities as tools that can be discovered and called by AI models.
Key Benefits
- AI-Ready Integration: Purpose-built for AI assistants to interact with Google Workspace
- Standardized Protocol: Clean integration with MCP-compatible AI systems
- Enterprise Security: Credentials remain isolated from AI models
- Comprehensive APIs: Support for Drive, Gmail, Calendar, and Slides
- Robust Error Handling: Consistent error patterns and graceful failure modes
- Extensive Testing: 125+ tests ensuring reliability and correctness
๐ ๏ธ Capabilities
arclio-mcp-gsuite provides tools across four major Google Workspace services:
๐ Google Drive
- gdrive_search: Find files in Google Drive using query syntax
- gdrive_read_file: Read file content with automatic format handling
- gdrive_upload_file: Upload local files to Google Drive
- gdrive_delete_file: Remove files from Google Drive
๐ง Gmail
- query_gmail_emails: Search emails with Gmail query syntax
- get_gmail_email: Retrieve complete message content and metadata
- create_gmail_draft: Create draft emails
- get_gmail_attachment: Download email attachments
- reply_gmail_email: Reply to existing email threads
- delete_gmail_draft: Remove draft emails
- bulk_delete_gmail_emails: Delete multiple emails in one operation
๐ Google Calendar
- list_calendars: View all accessible calendars
- get_calendar_events: Retrieve calendar events
- create_calendar_event: Create new calendar events
- delete_calendar_event: Remove calendar events
๐ผ๏ธ Google Slides
- get_presentation: Retrieve presentation details
- create_presentation: Create new presentations
- get_slides: List all slides in a presentation
- create_slide: Add new slides to a presentation
- add_text_to_slide: Insert text content into slides
- delete_slide: Remove slides from a presentation
- create_presentation_from_markdown: Generate entire presentations from Markdown
๐ AI-Powered Workflows
The tools above enable AI assistants to handle complex workflows such as:
- Email Analysis โ Presentation Creation: Parse emails and convert insights into slides
- Drive Document Processing: Read, analyze, and create summaries of documents
- Calendar Management: Schedule meetings based on email communications
- Document Generation: Create structured documents from AI-generated content
- Multi-stage Operations: Combine tools for complex operations like creating a presentation based on data from a spreadsheet
๐๏ธ Architecture
The project is designed with a clean, layered architecture:
arclio-mcp-gsuite/
โโโ server.py # MCP server implementation
โโโ auth/ # Authentication components
โ โโโ __init__.py
โ โโโ gauth.py # Google OAuth handling
โโโ services/ # API service implementations
โ โโโ __init__.py
โ โโโ base.py # Base service class
โ โโโ drive.py # Google Drive implementation
โ โโโ gmail.py # Gmail implementation
โ โโโ calendar.py # Calendar implementation
โ โโโ slides.py # Slides implementation
โโโ tools/ # MCP tool handlers
โโโ __init__.py
โโโ base.py # Base tool handler
โโโ drive.py # Drive tools
โโโ gmail.py # Gmail tools
โโโ calendar.py # Calendar tools
โโโ slides.py # Slides tools
How It Works
- MCP Hub initiates the server process
- The server dynamically discovers all available tool handlers
- When queried by an AI model, the server returns accessible tools based on enabled capabilities
- When a tool is called, the server:
- Validates arguments
- Routes the request to the appropriate tool handler
- The tool handler uses a service implementation to interact with Google APIs
- Results are formatted and returned to the model through the MCP Hub
๐ฆ Installation & Setup
Prerequisites
- Python 3.9 or higher
- Google Cloud project with API access
- OAuth credentials with appropriate scopes
Installation
# Install from source
git clone https://github.com/arclio/arclio-mcp-gsuite.git
cd arclio-mcp-gsuite
pip install -e .
# Or via pip (when available)
pip install arclio-mcp-gsuite
# For development with CLI tools
pip install "arclio-mcp-gsuite[dev]"
OAuth Setup
- Create a project in Google Cloud Console
- Enable the APIs you need (Drive, Gmail, Calendar, Slides)
- Create OAuth credentials (web application type)
- Use the OAuth 2.0 Playground or your own app to get a refresh token
- Set environment variables with your credentials
Environment Variables
# Required variables
export GSUITE_CLIENT_ID="your-client-id.apps.googleusercontent.com"
export GSUITE_CLIENT_SECRET="your-client-secret"
export GSUITE_REFRESH_TOKEN="your-refresh-token"
export GSUITE_ENABLED_CAPABILITIES="drive,gmail,calendar,slides"
# Optional variables
export RUN_INTEGRATION_TESTS="0" # Set to "1" to enable integration tests
๐ Usage
Running the Server
# Directly
python -m arclio_mcp_gsuite
# As a module
python -c "from arclio_mcp_gsuite import main; main()"
Integrating with MCP Hub
- Ensure your MCP Hub is configured to connect to this server
- Provide the required environment variables
- The MCP Hub will handle communication with this server, allowing AI models to:
- Discover available tools
- Call tools with appropriate arguments
- Receive structured responses
Tool Call Format
Each tool call must include a __user_id__ parameter representing the Google account email:
{
"name": "gdrive_search",
"arguments": {
"__user_id__": "user@example.com",
"query": "name contains 'Project Proposal'",
"page_size": 5
}
}
๐ API Reference
Response Formats
Tools return different formats based on their function:
- Gmail tools: Structured JSON with email metadata and content
- Drive tools: File metadata and content (text or base64-encoded for binary files)
- Calendar tools: Event details and metadata
- Slides tools: Presentation and slide objects
Google Drive Tools
gdrive_search
Searches for files in Google Drive.
Arguments:
__user_id__(string, required): Google account emailquery(string, required): Drive query syntax (e.g.,"mimeType='image/jpeg'")page_size(integer, optional): Maximum number of files to return (default: 10)
Returns:
- List of file metadata objects with ID, name, MIME type, and webViewLink
gdrive_read_file
Reads file content from Google Drive.
Arguments:
__user_id__(string, required): Google account emailfile_id(string, required): Drive file ID
Returns:
- For text files: mimeType, content as text, encoding
- For binary files: mimeType, base64-encoded content, encoding
- For Google Docs: Converts to Markdown
- For Google Sheets: Converts to CSV
Gmail Tools
query_gmail_emails
Searches for emails using Gmail query syntax.
Arguments:
__user_id__(string, required): Google account emailquery(string, optional): Gmail search query (e.g.,"is:unread from:example.com")max_results(integer, optional): Maximum emails to return (default: 100)
Returns:
- List of email metadata objects (subject, from, to, date, snippet, id)
get_gmail_email
Retrieves a complete email message by ID.
Arguments:
__user_id__(string, required): Google account emailemail_id(string, required): Gmail message ID
Returns:
- Complete email object with headers, body content, and attachment information
Calendar Tools
list_calendars
Lists all accessible calendars.
Arguments:
__user_id__(string, required): Google account email
Returns:
- List of calendar objects with id, summary, timeZone, and access information
create_calendar_event
Creates a new calendar event.
Arguments:
__user_id__(string, required): Google account email__calendar_id__(string, optional): Calendar ID (default: primary)summary(string, required): Event titlestart_time(string, required): RFC3339 format (e.g., "2024-05-01T14:00:00Z")end_time(string, required): RFC3339 formatlocation(string, optional): Event locationdescription(string, optional): Event descriptionattendees(array, optional): List of attendee email addressessend_notifications(boolean, optional): Whether to notify attendeestimezone(string, optional): Timezone (e.g., "America/New_York")
Returns:
- Created event object with ID, details, and web link
Slides Tools
create_presentation_from_markdown
Creates a Google Slides presentation from Markdown content.
Arguments:
-
__user_id__(string, required): Google account email -
title(string, required): Presentation title -
markdown_content(string, required): Markdown formatted as:# Slide Title Content for first slide - Bullet point 1 - Bullet point 2 --- # Second Slide Title ## Subtitle More content here
Returns:
- Created presentation object with ID, title, and slide count
๐งฉ Development
Setup Development Environment
# Clone the repository
git clone https://github.com/arclio/arclio-mcp-gsuite.git
cd arclio-mcp-gsuite
# Create virtual environment and install dependencies
make install-dev
# Set up environment variables
cp .env.example .env
# Edit .env with your credentials
source .env
Development Commands
# Lint code
make lint
# Format code
make format
# Run all tests
make test
# Run unit tests only
make test-unit
# Run integration tests
export RUN_INTEGRATION_TESTS=1
make test-integration
# Build package
make build
# Run server
make run
Testing Structure
The project features a comprehensive testing suite with 125+ tests organized by service and functionality:
tests/
โโโ unit/ # Unit tests
โ โโโ services/ # Service tests
โ โ โโโ drive/ # Drive service tests
โ โ โโโ gmail/ # Gmail service tests
โ โ โโโ calendar/ # Calendar service tests
โ โ โโโ slides/ # Slides service tests
โ โโโ tools/ # Tool handler tests
โ โโโ drive/ # Drive tool tests
โ โโโ gmail/ # Gmail tool tests
โ โโโ calendar/ # Calendar tool tests
โ โโโ slides/ # Slides tool tests
โโโ integration/ # Integration tests (requires API credentials)
โโโ test_drive_api.py
โโโ test_gmail_api.py
โโโ test_calendar_api.py
โโโ test_slides_api.py
Unit tests mock the Google API calls, while integration tests make actual API calls (only when explicitly enabled).
๐ง Adding New Tools
Adding support for a new Google service or tool is straightforward:
- Create a Service Class:
# services/new_service.py
from .base import BaseGoogleService
class NewService(BaseGoogleService):
def __init__(self):
super().__init__("service_name", "version")
def some_operation(self, arg1, arg2):
try:
# Implement the operation using self.service
return result
except Exception as e:
return self.handle_api_error("some_operation", e)
- Create Tool Handlers:
# tools/new_service.py
from ..services.new_service import NewService
from .base import BaseToolHandler
class NewOperationToolHandler(BaseToolHandler):
name = "new_operation"
capability = "new_service"
description = "Description of what this tool does"
input_schema = {
"type": "object",
"properties": {
"__user_id__": {
"type": "string",
"description": "The email address of the Google account"
},
"arg1": {
"type": "string",
"description": "Description of arg1"
}
},
"required": ["__user_id__", "arg1"]
}
def execute_tool(self, args):
service = NewService()
return service.some_operation(args["arg1"], args.get("arg2"))
-
Update Imports:
- Add the new service to
services/__init__.py - Import handlers in
tools/__init__.py
- Add the new service to
-
Update Scopes:
- Add any necessary OAuth scopes to
auth/gauth.py
- Add any necessary OAuth scopes to
The server's dynamic discovery mechanism will automatically find and register new tool handlers.
๐ Troubleshooting
- Authentication Errors: Verify OAuth credentials and scopes
- Missing Dependencies: Run
make install-devto install all dependencies - Tool Not Found: Ensure the capability is enabled in
GSUITE_ENABLED_CAPABILITIES - API Limits: Be aware of Google API quotas and rate limits
- Permission Issues: Check that the authenticated user has appropriate permissions
๐ Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure your code passes tests and follows the project's style guidelines.
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ข About Arclio
Arclio is a leading provider of secure MCP service management for AI applications. We specialize in creating robust, enterprise-grade tools that enable AI models to interact with external services safely and effectively.
Built with โค๏ธ by the Arclio team
Project details
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 arclio_mcp_gsuite-0.1.1.tar.gz.
File metadata
- Download URL: arclio_mcp_gsuite-0.1.1.tar.gz
- Upload date:
- Size: 39.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3a44e6a11971ec8cfd04b2b38fd5ec05d578e11d7d4807b61a604162c0c64fad
|
|
| MD5 |
391d1b7039b6d43a497806084887b3c6
|
|
| BLAKE2b-256 |
3c6475c619ec4226685be7880cbb62fda9662f7455a6fcf5148704d1ab6e9ed3
|
File details
Details for the file arclio_mcp_gsuite-0.1.1-py3-none-any.whl.
File metadata
- Download URL: arclio_mcp_gsuite-0.1.1-py3-none-any.whl
- Upload date:
- Size: 50.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d20ae4781200a5558a478f6b4deeee138fa9476d0c696f8aa35a3f66e1100207
|
|
| MD5 |
f0f6971639d52b8179c9c541195d12e1
|
|
| BLAKE2b-256 |
aa80612bce22c66549256b17b8dcfca2b866799736bff9942d76d7941d863e6c
|