fastmcp-gsuite
Provides tools for managing Gmail, including querying emails, creating drafts, replying to emails, and retrieving attachments.
Provides tools for managing Google Calendar, including viewing events, creating events with attendees and notifications, and deleting events.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@fastmcp-gsuite What do I have on my agenda tomorrow?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
fastmcp-gsuite MCP server (using fastmcp)
MCP server to interact with Google products, rewritten using the fastmcp library.
This project is a fork of mcp-gsuite.
Example prompts
Right now, this MCP server supports Gmail and Calendar integration with the following capabilities:
General
Multiple google accounts
Gmail
Get your Gmail user information
Query emails with flexible search (e.g., unread, from specific senders, date ranges, with attachments)
Retrieve complete email content by ID
Create new draft emails with recipients, subject, body and CC options
Delete draft emails
Reply to existing emails (can either send immediately or save as draft)
Retrieve multiple emails at once by their IDs.
Save multiple attachments from emails to your local system.
Calendar
Manage multiple calendars
Get calendar events within specified time ranges
Create calendar events with:
Title, start/end times
Optional location and description
Optional attendees
Custom timezone support
Notification preferences
Delete calendar events
Example prompts you can try:
Retrieve my latest unread messages
Search my emails from the Scrum Master
Retrieve all emails from accounting
Take the email about ABC and summarize it
Write a nice response to Alice's last email and upload a draft.
Reply to Bob's email with a Thank you note. Store it as draft
What do I have on my agenda tomorrow?
Check my private account's Family agenda for next week
I need to plan an event with Tim for 2hrs next week. Suggest some time slots.
Related MCP server: Google-Workspace-MCP-Server
Quickstart
Install
Quick Setup (Recommended)
The easiest way to set up authentication is using the interactive setup command:
# Install the package
pip install fastmcp-gsuite
# or with uv
uv pip install fastmcp-gsuite
# Run interactive setup
uv run fastmcp-gsuite-setupPrerequisites:
Create OAuth2 credentials in Google Cloud Console
Select "Desktop app" as application type
Enable Gmail API, Google Calendar API, and Google Drive API
The setup wizard will guide you through:
Entering your Google OAuth2 Client ID and Client Secret
Authorizing your Google account(s) in browser
Copying the authorization code from browser back to terminal
Automatically creating all necessary configuration files
Additional Commands:
# Add another Google account
uv run fastmcp-gsuite-setup --add-account
# List configured accounts
uv run fastmcp-gsuite-setup --list
# Remove an account
uv run fastmcp-gsuite-setup --remove-account user@example.comManual Setup (Advanced)
Google Workspace (G Suite) APIs require OAuth2 authorization. Follow these steps to set up authentication manually:
Create OAuth2 Credentials:
Go to the Google Cloud Console
Create a new project or select an existing one
Enable the Gmail API, Google Calendar API, and Google Drive API for your project
Go to "Credentials" → "Create Credentials" → "OAuth client ID"
Select "Desktop app" as the application type
Configure the OAuth consent screen with required information
Note: For desktop/CLI applications, the redirect URI
urn:ietf:wg:oauth:2.0:oobwill be used automatically
Required OAuth2 Scopes:
[
"openid",
"https://mail.google.com/",
"https://www.googleapis.com/auth/calendar",
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/userinfo.email"
]Create a
.gauth.jsonin your working directory:
{
"installed": {
"client_id": "$your_client_id",
"client_secret": "$your_client_secret",
"redirect_uris": ["urn:ietf:wg:oauth:2.0:oob", "http://localhost"],
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token"
}
}Note:
Use
"installed"for Desktop app credentials (recommended)Alternatively,
"web"format also works with this libraryurn:ietf:wg:oauth:2.0:oobis the Out-of-Band (OOB) redirect URIGoogle will display the authorization code in the browser for you to copy and paste
Create a
.accounts.jsonfile with account information:
{
"accounts": [
{
"email": "alice@bob.com",
"account_type": "personal",
"extra_info": "Additional info that you want to tell Claude: E.g. 'Contains Family Calendar'"
}
]
}You can specify multiple accounts. Make sure they have access in your Google Auth app. The extra_info field is especially interesting as you can add info here that you want to tell the AI about the account (e.g. whether it has a specific agenda).
Run the authentication script to generate credentials:
# Set environment variables
export GOOGLE_ACCOUNT_EMAIL="your-email@example.com"
export GOOGLE_CLIENT_ID="your-client-id"
export GOOGLE_CLIENT_SECRET="your-client-secret"
# Run the script
uv run python scripts/get_refresh_token.pyThis will open a browser for authorization and create .oauth2.{email}.json credential files.
Claude Desktop
On MacOS: ~/Library/Application\ Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"gsuite": {
"command": "uv",
"args": [
"--directory",
"<dir_to>/fastmcp-gsuite",
"run",
"fastmcp-gsuite"
]
}
}
}Note: Configuration is now primarily handled via environment variables or a .env file in the working directory, using pydantic-settings . See the Configuration Options section below.
{
"mcpServers": {
"fastmcp-gsuite": {
"command": "uv",
"args": [
"--directory",
"<dir_to>/fastmcp-gsuite",
"run",
"fastmcp-gsuite" # Use the new entry point
# Configuration via .env or environment variables is preferred now
]
}
}
}{
"mcpServers": {
"fastmcp-gsuite": {
"command": "uvx",
"args": [
"fastmcp-gsuite" # Use the new entry point
# Configuration via .env or environment variables is preferred now
]
}
}
}Configuration Options (via .env file or Environment Variables)
Configuration is now managed using pydantic-settings . Create a .env file in the directory where you run the server, or set environment variables:
GAUTH_FILE: Path to the.gauth.jsonfile containing OAuth2 client configuration. Default:./.gauth.jsonACCOUNTS_FILE: Path to the.accounts.jsonfile containing Google account information. Default:./.accounts.jsonCREDENTIALS_DIR: Directory to store the generated.oauth2.{email}.jsoncredential files. Default:.(current directory)
Example .env file:
GAUTH_FILE=/path/to/your/.gauth.json
ACCOUNTS_FILE=/path/to/your/.accounts.json
CREDENTIALS_DIR=/path/to/your/credentialsThis allows for flexible configuration without command-line arguments when running the server.
Troubleshooting Setup
Problem: "No refresh token received"
Cause: You may have already authorized the app previously
Solution: Go to https://myaccount.google.com/permissions and revoke access, then try setup again
Problem: "Browser doesn't open automatically"
Solution: Copy the authorization URL displayed in the terminal and open it manually in your browser
Problem: "Redirect URI mismatch" error
Cause: Google Cloud Console has wrong redirect URI configured
Solution: In Google Cloud Console, ensure your OAuth client is configured as "Desktop app" type. Desktop apps automatically use
urn:ietf:wg:oauth:2.0:oobas the redirect URI
Problem: "Permission denied when creating .gauth.json"
Cause: Insufficient write permissions in current directory
Solution: Run setup in a directory where you have write permissions, or use
GAUTH_FILEenvironment variable to specify a different location
Problem: "Account already exists" when adding account
Solution: Use
--remove-accountto remove the old account first, or choose to overwrite when prompted
Problem: Setup works but MCP server can't find credentials
Solution: Ensure you're running the MCP server from the same directory where you ran setup, or set
GAUTH_FILE,ACCOUNTS_FILE, andCREDENTIALS_DIRenvironment variables to point to the correct locations
For more help, see the GitHub Issues.
Development
Building and Publishing
To prepare the package for distribution:
Sync dependencies and update lockfile:
uv syncBuild package distributions:
uv buildThis will create source and wheel distributions in the dist/ directory.
Publish to PyPI:
uv publishNote: You'll need to set PyPI credentials via environment variables or command flags:
Token:
--tokenorUV_PUBLISH_TOKENOr username/password:
--username/UV_PUBLISH_USERNAMEand--password/UV_PUBLISH_PASSWORD
Automatic PyPI Publishing with Tag Push
This project is configured to automatically publish to PyPI when a tag is pushed to the repository. The publishing process is handled by a GitHub Actions workflow.
To publish a new version:
Update the version in
pyproject.tomlCommit the changes
Tag the commit with a version tag (e.g.,
v0.4.2)Push the tag to GitHub
# Example workflow to release a new version
git add pyproject.toml
git commit -m "Bump version to 0.4.2"
git tag -a v0.4.2 -m "Version 0.4.2"
git push && git push --tagsThe GitHub Actions workflow will automatically build and publish the package to PyPI. Make sure to set the following secrets in your GitHub repository:
PYPI_API_TOKEN: Your PyPI API token
You can also use the version bumping commands in the Makefile:
# Bump patch version (0.4.1 -> 0.4.2)
make bump-patch
# Bump minor version (0.4.1 -> 0.5.0)
make bump-minor
# Bump major version (0.4.1 -> 1.0.0)
make bump-majorDebugging
Since MCP servers run over stdio, debugging can be challenging. For the best debugging experience, we strongly recommend using the MCP Inspector.
You can launch the MCP Inspector via npm with this command:
npx @modelcontextprotocol/inspector uv --directory /path/to/fastmcp-gsuite run fastmcp-gsuiteUpon launching, the Inspector will display a URL that you can access in your browser to begin debugging.
You can also watch the server logs with this command:
tail -n 20 -f ~/Library/Logs/Claude/mcp-server-fastmcp-gsuite.log # Log filename might change based on the server nameE2E Testing
Standard E2E Tests
To run the standard E2E tests, you need to set up the necessary environment variables with valid Google credentials:
# Make sure valid Google credentials are set in your environment variables
dotenvx run -f .env.local -- uv run make e2e-testsThese tests use the Google API libraries directly to authenticate and test the functionality.
MCP-Based E2E Tests
There are also MCP-based E2E tests that test the functionality through the MCP protocol, simulating how Claude or other clients would interact with the MCP server:
# Specify the environment file containing your Google credentials
make mcp-e2e-tests ENV_FILE=.env.localThis will run tests that:
Start the MCP G-Suite server
Connect to it using the chuk-mcp client
Test various tools like Gmail message listing and Calendar event retrieval
The environment file should contain the following variables:
GSUITE_CREDENTIALS_JSON- Base64 encoded JSON credentialsGOOGLE_ACCOUNT_EMAIL- Your Google account emailGOOGLE_PROJECT_ID- Your Google Cloud project IDGOOGLE_CLIENT_ID- Your OAuth client IDGOOGLE_CLIENT_SECRET- Your OAuth client secret
Both types of E2E tests are excluded from CI pipelines and should only be run locally with valid credentials.
E2E Test Execution Guide
This project implements end-to-end (E2E) tests using real Google accounts. You can run the E2E tests using the following steps.
Prerequisites
To run E2E tests, you need:
A
.env.localfile with the following environment variables:GSUITE_CREDENTIALS_JSON: Base64 encoded Google credentialsGOOGLE_ACCOUNT_EMAIL: Google account email for testingGOOGLE_PROJECT_ID: Google project IDGOOGLE_CLIENT_ID: Google client IDGOOGLE_CLIENT_SECRET: Google client secret
E2E test dependencies installed:
uv pip install -e ".[e2e]"Test Execution Commands
Run all E2E tests:
dotenvx run -f .env.local -- uv run make mcp-all-e2e-testsRun tests for individual services:
# Gmail tests
dotenvx run -f .env.local -- uv run make mcp-e2e-tests
# Google Calendar tests
dotenvx run -f .env.local -- uv run make mcp-google-e2e-tests
# Google Drive tests
dotenvx run -f .env.local -- uv run make mcp-gdrive-e2e-tests
# Google Tasks tests
dotenvx run -f .env.local -- uv run make mcp-tasks-e2e-tests
# Google Contacts tests
dotenvx run -f .env.local -- uv run make mcp-contacts-e2e-testsImportant Notes
E2E tests access real Google accounts, so be careful not to affect production environments
E2E tests are automatically skipped in CI environments
Temporary authentication files are created during test execution but are automatically deleted afterward
Available Tools
35 toolsarchive_gmail_messageA
Archive a Gmail message (remove from inbox).
Inputs: user_id (required), message_id (required).
batch_modify_gmail_messagesA
Modify labels on multiple Gmail messages in a single batch request (max 1000).
Inputs: user_id (required), message_ids (required), add_label_ids, remove_label_ids.
bulk_get_gmail_emailsA
Retrieves multiple Gmail email messages by their IDs in a single request, including bodies and attachment metadata.
Inputs: user_id (required), email_ids (required).
bulk_save_gmail_attachmentsB
Save multiple Gmail attachments to disk by their message IDs and attachment IDs in a single request.
Inputs: user_id (required), attachments (required).
bulk_save_gmail_attachments_to_driveB
Save multiple Gmail attachments to Google Drive in a single request.
Inputs: user_id (required), attachments (required), folder_id.
copy_drive_fileB
Create a copy of a file in Google Drive.
Inputs: user_id (required), file_id (required), new_name, parent_folder_id.
create_calendar_eventB
Create a new event in a specified calendar.
Inputs: user_id (required), calendar_id (required), summary (required), start_datetime (required), +9 more.
create_drive_folderB
Create a new folder in Google Drive.
Inputs: user_id (required), folder_name (required), parent_folder_id.
create_gmail_draftC
Create a draft email in Gmail.
Inputs: user_id (required), to (required), subject (required), body (required), +1 more.
create_gmail_replyC
Create a reply to an existing Gmail email message.
Inputs: user_id (required), original_message_id (required), reply_body (required), send, +1 more.
delete_calendar_eventC
Delete an event from a calendar.
Inputs: user_id (required), calendar_id (required), event_id (required).
delete_drive_fileC
Delete a file from Google Drive.
Inputs: user_id (required), file_id (required).
delete_drive_folderB
Delete a folder from Google Drive.
Inputs: user_id (required), folder_id (required).
delete_gmail_draftB
Delete a draft email from Gmail.
Inputs: user_id (required), draft_id (required).
download_drive_fileA
Download the content of a Google Drive file by its ID.
Inputs: user_id (required), file_id (required).
get_drive_fileB
Get metadata for a specific Google Drive file by its ID.
Inputs: user_id (required), file_id (required).
get_email_detailsB
Get the full details of a specific Gmail email by its ID, including body and attachment metadata.
Inputs: user_id (required), email_id (required), body_offset, body_limit.
get_gmail_labelsA
List all available Gmail labels for the user.
Inputs: user_id (required).
list_calendar_eventsB
List events from a specific calendar within a given time range.
Inputs: user_id (required), calendar_id (required), start_time (required), end_time (required), +2 more.
list_calendarsB
List all calendars the user has access to.
Inputs: user_id (required).
list_drive_filesB
List files in the user's Google Drive with optional filtering by search query.
Inputs: user_id (required), query, limit, order_by.
list_drive_foldersB
List folders in the user's Google Drive with optional filtering.
Inputs: user_id (required), query, limit.
mark_gmail_message_readB
Mark a Gmail message as read.
Inputs: user_id (required), message_id (required).
modify_gmail_messageB
Modify labels on a Gmail message (add or remove labels).
Inputs: user_id (required), message_id (required), add_label_ids, remove_label_ids.
move_drive_fileB
Move a file to a different folder in Google Drive.
Inputs: user_id (required), file_id (required), new_parent_id (required), remove_previous_parents.
move_drive_folderB
Move a folder to a different location in Google Drive.
Inputs: user_id (required), folder_id (required), new_parent_id (required), remove_previous_parents.
query_gmail_emailsB
Query Gmail emails based on an optional search query. Returns emails in reverse chronological order (newest first).
Inputs: user_id (required), query, max_results.
rename_drive_fileC
Rename a file in Google Drive.
Inputs: user_id (required), file_id (required), new_name (required).
rename_drive_folderB
Rename a folder in Google Drive.
Inputs: user_id (required), folder_id (required), new_name (required).
save_gmail_attachment_to_driveB
Save a Gmail attachment to Google Drive.
Inputs: user_id (required), message_id (required), part_id (required), folder_id, +1 more.
trash_drive_fileA
Move a file to Google Drive trash (soft delete).
Inputs: user_id (required), file_id (required).
trash_drive_folderB
Move a folder to Google Drive trash (soft delete).
Inputs: user_id (required), folder_id (required).
untrash_drive_fileB
Restore a file from Google Drive trash.
Inputs: user_id (required), file_id (required).
update_calendar_eventA
Update an existing event in a calendar. Only provided fields will be updated.
Inputs: user_id (required), calendar_id (required), event_id (required), summary, +10 more.
upload_drive_fileC
Upload a file to Google Drive.
Inputs: user_id (required), file_path (required), parent_folder_id, mime_type.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 35 tools
Each tool targets a specific action and resource, with clear differentiation between single/batch operations and across services (Gmail, Drive, Calendar).
Tools follow a consistent 'verb_service_noun' pattern, with occasional prefixes like 'batch_' or 'bulk_' that are uniformly applied.
With 35 tools covering three major Google services, the count is well-scoped; each tool serves a distinct purpose without unnecessary duplication.
While Drive and Calendar coverage is thorough, Gmail lacks a send email tool, and there is no tool to manage labels beyond modifying messages, leaving notable gaps for core email workflows.
Related MCP Connectors
A MCP server for Gmail that lets you search, read, and draft emails and replies.
MCP server for Nylas — read email, calendars, events and contacts, and send email or create events.
A MCP server that works with Google Calendar to manage event listing, reading, and updates.
Hosted email MCP for your own Gmail, Outlook.com, Microsoft 365, iCloud or IMAP inbox: read, search, draft, reply in thread, forward and file mail. It moves or flags up to 500 messages in one call, and a send leaves exactly one copy in Sent. A calendar is a separate connection, and connecting one adds diary and scheduling tools.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Gmail and Google Calendar using the MCP protocol, supporting multiple Google accounts, email management, and calendar operations through natural language.28 npm32MIT
- AlicenseNot gradedqualityDmaintenanceMCP server that seamlessly interacts with your Google Calendar, Gmail, Drive and so on.30MIT
- AlicenseNot gradedqualityDmaintenanceMCP server to interact with Google Gmail and Calendar APIs. Supports multiple accounts, email search and drafting, and calendar event management.MIT
- AlicenseNot gradedqualityCmaintenanceLocal MCP server for reading/sending email via Gmail and managing Google Calendar events, enabling an AI agent to handle email and calendar operations through natural language.MIT