Skip to main content

Google Workspace MCP Server - Connect Claude to Google Workspace APIs

Project description

Google Workspace MCP Server

Connect Claude to Google Workspace APIs through the Model Context Protocol (MCP).

PyPI version Python 3.10+ License: MIT Tests

Features

115 MCP tools across 7 Google Workspace APIs:

Service Tools Capabilities
Gmail 27 Search, send, reply, drafts, labels, filters, formatting, batch operations, attachments
Calendar 8 List calendars, create/update/delete events, manage attendees, free/busy
Drive 17 Search, upload/download binary files, folders, permissions, sync (rclone integration)
Docs 17 Create, edit, format text/paragraphs, tables, lists, tabs, comments
Sheets 12 Create, read, write, format cells, charts, merge, conditional formatting
Slides 21 Create presentations, slides, format text, backgrounds, layouts
Tasks 13 Task lists, create/update/complete tasks, subtasks, search

Highlights

  • Full Gmail Management: Search with advanced queries, send/reply with file attachments, organize with labels, filters, rich HTML formatting, batch operations
  • Binary File Transfer: Upload any file type to Drive via local path; download Drive files and Gmail attachments to disk
  • Calendar Integration: Create events with attendees, manage multiple calendars, handle timezones, check availability
  • Drive Operations: Search files, manage folders, permissions, upload/download with optional rclone sync
  • Google Docs: Create and edit documents, rich text formatting, tables, lists, tabs, comments, Mermaid diagrams
  • Google Sheets: Create spreadsheets, format cells, charts, conditional formatting, merge cells, number formats
  • Google Slides: Create presentations, format text, add images/text boxes, backgrounds, layouts, bullet lists
  • Tasks API: Full task management with lists, subtasks, due dates, and cross-list search

Binary File Transfer (v0.3.0)

Work with any file type — not just text:

# Upload a JPEG to Drive
upload_drive_file(local_path="/path/to/photo.jpg", parent_id="<folder-id>")

# Download a Drive file to disk (PDF, image, etc.)
get_drive_file_content(file_id="<id>", save_path="/tmp/report.pdf")

# Send an email with attachments
send_email(to="...", subject="...", body="...", attachments=["/path/to/file.pdf"])

# List attachments in a received email
get_gmail_message_content(message_id="<id>")
# → response includes: attachments: [{filename, mimeType, size, attachmentId}, ...]

# Download a Gmail attachment
download_gmail_attachment(message_id="<id>", attachment_id="<att-id>", save_path="/tmp/file.pdf")

Formatting Capabilities

  • Rich Text Formatting: Apply bold, italic, underline, colors, fonts across Docs, Slides, and Gmail
  • Advanced Cell Formatting: Background colors, borders, number formats, conditional formatting in Sheets
  • Professional Presentations: Custom layouts, formatted text boxes, backgrounds, and bullet lists in Slides
  • HTML Email Creation: Rich formatting for professional email communications

Installation

pip install gworkspace-mcp

Or with uv:

uv pip install gworkspace-mcp

For development:

git clone https://github.com/masapasa/google-workspace-mcp.git
cd google-workspace-mcp
pip install -e ".[dev]"

Quick Start

1. Set Up Google Cloud Credentials

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the following APIs:
    • Gmail API
    • Google Calendar API
    • Google Drive API
    • Google Docs API
    • Google Sheets API
    • Google Slides API
    • Google Tasks API
  4. Create OAuth 2.0 credentials (Desktop application)
  5. Download and note your Client ID and Client Secret

2. Authenticate

# Set your credentials
export GOOGLE_OAUTH_CLIENT_ID='your-client-id'
export GOOGLE_OAUTH_CLIENT_SECRET='your-client-secret'  # pragma: allowlist secret

# Run OAuth flow (opens browser)
workspace setup

# Verify authentication
workspace doctor

3. Start MCP Server

workspace mcp

4. Connect to Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "google-workspace": {
      "command": "workspace",
      "args": ["mcp"],
      "env": {
        "GOOGLE_OAUTH_CLIENT_ID": "your-client-id",
        "GOOGLE_OAUTH_CLIENT_SECRET": "your-client-secret"  // pragma: allowlist secret
      }
    }
  }
}

Restart Claude Desktop to activate.

Authentication

OAuth 2.0 Flow

This server uses OAuth 2.0 for secure authentication with Google APIs. The authentication flow:

  1. workspace setup opens your browser for Google consent
  2. You authorize access to Gmail, Calendar, Drive, Docs, Sheets, Slides, and Tasks
  3. Tokens are securely stored locally
  4. Tokens auto-refresh when expired

Required Scopes

The server requests the following OAuth scopes:

Scope Purpose
https://www.googleapis.com/auth/gmail.modify Read, send, and organize Gmail
https://www.googleapis.com/auth/calendar Full calendar access
https://www.googleapis.com/auth/drive Full Drive access
https://www.googleapis.com/auth/documents Read and write Google Docs
https://www.googleapis.com/auth/spreadsheets Read and write Google Sheets
https://www.googleapis.com/auth/presentations Read and write Google Slides
https://www.googleapis.com/auth/tasks Full Tasks access

Token Storage

Tokens are stored at: ~/.gworkspace-mcp/tokens.json

This file contains your OAuth tokens. Keep it secure and do not share it.

Available Tools

Gmail (26 tools)

Tool Description
search_gmail_messages Search messages with Gmail query syntax
get_gmail_message_content Get full message content by ID
send_email Send a new email
reply_to_email Reply to an existing thread
create_draft Save email as draft
list_gmail_labels List all labels (system and custom)
create_gmail_label Create a custom label
delete_gmail_label Delete a custom label
modify_gmail_message Add/remove labels from a message
archive_gmail_message Archive a message (remove from inbox)
trash_gmail_message Move message to trash
untrash_gmail_message Restore message from trash
mark_gmail_as_read Mark message as read
mark_gmail_as_unread Mark message as unread
star_gmail_message Add star to message
unstar_gmail_message Remove star from message
batch_modify_gmail_messages Bulk add/remove labels
batch_archive_gmail_messages Bulk archive messages
batch_trash_gmail_messages Bulk trash messages
batch_mark_gmail_as_read Bulk mark as read
batch_delete_gmail_messages Permanently delete messages (caution!)
format_email_content Format email content with HTML styling
set_email_signature Set Gmail signature with formatting
create_formatted_email Create rich HTML emails with formatting
list_gmail_filters List all Gmail filters
create_gmail_filter Create new Gmail filter
delete_gmail_filter Delete Gmail filter
get_vacation_settings Get vacation auto-responder settings
set_vacation_settings Configure vacation auto-responder

Calendar (8 tools)

Tool Description
list_calendars List all accessible calendars
create_calendar Create a new calendar
update_calendar Update calendar properties
delete_calendar Delete a calendar
get_events Get events within a time range
create_event Create a new event
update_event Update an existing event
delete_event Delete an event
query_free_busy Check availability for attendees

Drive (17 tools)

Tool Description
search_drive_files Search files with Drive query syntax
get_drive_file_content Get file content (text files)
create_drive_folder Create a new folder
upload_drive_file Upload a text file
delete_drive_file Delete a file or folder
move_drive_file Move file to different folder
list_drive_contents* List folder contents
download_drive_folder* Download folder to local filesystem
upload_to_drive* Upload local folder to Drive
sync_drive_folder* Sync between local and Drive

*Requires rclone to be installed

Sheets (12 tools)

Tool Description
create_spreadsheet Create a new Google Spreadsheet
get_spreadsheet_data Get spreadsheet metadata and structure
list_spreadsheet_sheets List all sheets in a spreadsheet
get_sheet_values Get values from a specific sheet/range
update_sheet_values Update specific cells with new values
append_sheet_values Append rows to end of sheet data
clear_sheet_values Clear values from a range
format_cells Apply formatting (colors, fonts, borders)
set_number_format Set number formats (currency, percentage, date)
merge_cells Merge cells across ranges
set_column_width Adjust column widths
create_chart Create charts (bar, line, pie) from data

Slides (21 tools)

Tool Description
create_presentation Create a new Google Slides presentation
get_presentation Get presentation metadata and structure
list_presentations List accessible presentations
get_presentation_text Extract all text from presentation
get_slide Get specific slide content
add_slide Add new slide with layout
delete_slide Delete a slide
update_slide_text Update text in slide shapes
format_text_in_slide Apply text formatting to slide content
add_formatted_text_box Add text box with custom formatting
add_text_box Add basic text box to slide
set_slide_background Set slide background color or image
create_bulleted_list_slide Create slide with bulleted list
apply_slide_layout Apply predefined layout to slide
add_image Add image from URL to slide

Docs (17 tools)

Tool Description
create_document Create a new Google Doc
get_document Get document content and structure
append_to_document Append text to a document
upload_markdown_as_doc Convert Markdown to Google Doc
list_document_comments List all comments on a document
add_document_comment Add a comment to a document
reply_to_comment Reply to an existing comment
list_document_tabs List all tabs in a document
get_tab_content Get content from a specific tab
create_document_tab Create a new tab
update_tab_properties Update tab title or icon
move_tab Move tab to new position
render_mermaid_to_doc Render Mermaid diagram and insert into doc
format_text_in_document Apply text formatting (bold, italic, colors, fonts)
format_paragraph_in_document Apply paragraph formatting (alignment, spacing)
create_list_in_document Create bulleted or numbered lists
insert_table_in_document Insert tables with custom dimensions
apply_heading_style Apply heading styles (H1, H2, etc.)
set_document_margins Configure document margins
publish_markdown_to_doc Publish markdown content as Google Doc

Tasks (13 tools)

Tool Description
list_task_lists List all task lists
get_task_list Get a specific task list
create_task_list Create a new task list
update_task_list Update task list title
delete_task_list Delete a task list
list_tasks List tasks in a list
get_task Get a specific task
search_tasks Search tasks across all lists
create_task Create a new task
update_task Update task details
complete_task Mark task as completed
delete_task Delete a task
move_task Move task or make it a subtask

CLI Commands

# Authenticate with Google
workspace setup

# Check authentication status and dependencies
workspace doctor

# Start the MCP server (for Claude Desktop)
workspace mcp

# Show version
workspace --version

# Show help
workspace --help

Documentation

For detailed documentation, see the docs/ directory:

Development

# Clone and install
git clone https://github.com/masapasa/google-workspace-mcp.git
cd google-workspace-mcp
pip install -e ".[dev]"

# Run tests
pytest

# Code quality
ruff format src tests && ruff check src tests && mypy src

See Contributing Guide for full development setup.

Requirements

  • Python: 3.10 or higher
  • Google Cloud Project: With Workspace APIs enabled
  • OAuth 2.0 Credentials: Desktop application type
  • Optional: rclone for Drive sync features (4 tools)
  • Optional: pandoc for Markdown to Docs conversion
  • Optional: @mermaid-js/mermaid-cli for Mermaid diagrams

Troubleshooting

"Not authenticated" error

Run workspace setup to authenticate, or check status with workspace doctor.

Token refresh failing

Delete ~/.gworkspace-mcp/tokens.json and run workspace setup again.

Missing rclone tools

The 4 rclone-based tools (list_drive_contents, download_drive_folder, upload_to_drive, sync_drive_folder) require rclone to be installed. Install from rclone.org.

Claude Desktop not seeing tools

  1. Ensure the config file path is correct for your OS
  2. Restart Claude Desktop after config changes
  3. Check that workspace mcp runs without errors

License

MIT License - See LICENSE file for details.

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and linting
  5. Submit a pull request

Links

Acknowledgments

Extracted from claude-mpm - Multi-agent project manager with MCP server integrations.

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

gworkspace_mcp-0.3.7.tar.gz (80.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gworkspace_mcp-0.3.7-py3-none-any.whl (107.3 kB view details)

Uploaded Python 3

File details

Details for the file gworkspace_mcp-0.3.7.tar.gz.

File metadata

  • Download URL: gworkspace_mcp-0.3.7.tar.gz
  • Upload date:
  • Size: 80.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for gworkspace_mcp-0.3.7.tar.gz
Algorithm Hash digest
SHA256 ca9e8d0617833a434c8cdd5ad7e5e75327ffbfb4e27efb7770f56153c59e8825
MD5 93203544cc67bf6e4fa8ba2d871ab58e
BLAKE2b-256 d82ec481aff546b32381e55da99715e3099aac17416a59f6c5175c511bfcb184

See more details on using hashes here.

File details

Details for the file gworkspace_mcp-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: gworkspace_mcp-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 107.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for gworkspace_mcp-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 09e6d2b6a0305e83a71dbeb081483436647bbdae36f205503ea8e3139f58f36b
MD5 2dc5cbc9d12448dcb2d0b1275d7e5e48
BLAKE2b-256 3267b5232ae1773c9a72844d3624c4118b509d955cff5bc6ef378b5bf45d1b3c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page