mcp-google-workspace
Search, read, send, and manage Gmail messages, drafts, filters, and forwarding, including HTML/CC/BCC, threads, attachments, and multiple OAuth profiles.
Provides access to Google Workspace and Google accounts, including admin tools for Google Groups and Drive audit logs, plus Apps Script project source.
List, create, and delete calendar events for users or OAuth profiles, including attendees and descriptions.
Manage Google Cloud DNS records, including listing, creating, and deleting records.
Search, read, upload, create folders, share, and delete Drive files, with support for Shared Drives and file metadata/content.
Read, write, append, and inspect spreadsheet metadata with formula-safe writes.
Manage Tag Manager accounts, containers, workspaces, tags, versions, and publishing.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
mcp-google-workspace
A Model Context Protocol server that gives AI assistants (Claude Desktop, Claude Code, Antigravity, Cursor, …) access to Google Workspace and Google accounts:
Gmail: search, read, send (HTML, CC/BCC, threads, attachments), drafts, filters, forwarding
Calendar: list, create and delete events
Drive: search, read, upload, create folders, share, delete, Shared Drives
Sheets: read, write (formula-safe, verified), append, metadata
Workspace admin: Google Groups, Drive audit logs
Apps Script: read project source
Google Cloud DNS: list, create and delete records
Google Tag Manager: accounts, containers, workspaces, tags, versions, publish
Two authentication modes can be used at the same time:
Mode | Used by | Typical use |
Service account + domain-wide delegation | Workspace tools ( | Act as any user of your Workspace domain |
OAuth2 user profiles |
| Consumer Gmail or any single Google account; multiple accounts supported |
If no service account is configured, Workspace tools fall back to the default OAuth profile.
Requirements
Node.js 20.12+
A Google Cloud project with the APIs you need enabled: Gmail, Google Calendar, Google Drive, Google Sheets, Admin SDK, Apps Script, Cloud DNS, Tag Manager
Related MCP server: Google Tools MCP Server
Install
git clone <this-repo-url> mcp-google-workspace
cd mcp-google-workspace
npm install
cp .env.example .env # optional; you can also pass env vars from the MCP clientSetup
Option A — OAuth2 (user accounts)
Google Cloud Console → APIs & Services → OAuth consent screen: configure it (add yourself as a test user while the app is in Testing).
Credentials → Create credentials → OAuth client ID → Desktop app. Download the JSON and save it as
credentials.json(or pointGOOGLE_CREDENTIALS_PATHto it).Authorize the default profile:
npm run authOpen the printed URL, grant access, and tokens are written to
tokens.json(GOOGLE_TOKENS_PATH).Optional extra accounts:
# .env GOOGLE_PERSONAL_TOKENS_PATH=./tokens_personal.json GOOGLE_PERSONAL_EMAIL=you@gmail.comnpm run auth -- --profile personalFor more than two accounts use
GOOGLE_PROFILES_JSON:GOOGLE_PROFILES_JSON={"work":{"tokensPath":"./tokens_work.json","email":"me@example.com"}} npm run auth -- --profile workTools accept the profile name or its email in the
accountargument.
npm run auth requests Drive, Sheets, Gmail (incl. settings), Calendar and Apps Script scopes. Add --all-scopes to also request Admin SDK, Tag Manager and Cloud DNS scopes (needed only if you use those tools via OAuth).
Option B — Service account with domain-wide delegation (Workspace)
Google Cloud Console → IAM & Admin → Service accounts → Create. Create a JSON key and save it as
service_account.json(or setGOOGLE_SERVICE_ACCOUNT_PATH).Copy the service account's Client ID (numeric).
Workspace Admin console → Security → Access and data control → API controls → Manage domain-wide delegation → Add new, paste the Client ID and these scopes:
https://www.googleapis.com/auth/drive,https://www.googleapis.com/auth/spreadsheets,https://www.googleapis.com/auth/script.projects.readonly,https://www.googleapis.com/auth/script.processes,https://www.googleapis.com/auth/gmail.readonly,https://www.googleapis.com/auth/gmail.send,https://www.googleapis.com/auth/gmail.compose,https://www.googleapis.com/auth/gmail.modify,https://www.googleapis.com/auth/gmail.settings.basic,https://www.googleapis.com/auth/gmail.settings.sharing,https://www.googleapis.com/auth/admin.directory.group.readonly,https://www.googleapis.com/auth/calendar,https://www.googleapis.com/auth/admin.reports.audit.readonlySet the mailbox to act as by default:
GOOGLE_IMPERSONATED_USER=assistant@example.comEvery Workspace tool also accepts
impersonateUser(calendar tools:userEmail). Groups and audit-log tools need an admin user.Google Groups cannot be impersonated. To read or send as a group address, map it to a real member mailbox:
GOOGLE_GROUP_SUBJECT_MAP={"sales@example.com":"assistant@example.com"}
Tag Manager: the service account is used directly (no impersonation); add its email as a user in GTM.
Cloud DNS: uses GCP_DNS_KEY_FILE, else the service account, else the default OAuth tokens, else Application Default Credentials. The identity needs the DNS Administrator role.
Configuration reference
All variables are optional. Relative paths resolve against the package directory. A .env file next to package.json is loaded automatically; variables set by the MCP client take precedence.
Variable | Default | Description |
|
| OAuth client JSON (Desktop app) |
|
| Tokens of the |
| — | Email of the |
| — | Enables the |
| — | Email of the |
|
| OAuth client for the |
| — | Extra profiles: |
|
| Profile used when |
|
| Local port for the |
|
| Service account key (enables domain-wide delegation) |
| — | Default impersonated mailbox |
| — | JSON map of group address → member mailbox to impersonate |
| — | Comma list. If set, impersonation and Drive sharing are limited to these domains |
| — | Comma list. New Drive items outside Shared Drives are shared (writer) with these domains; also the default for |
| — | Key file for Cloud DNS |
| — | Defaults for the |
MCP client configuration
Claude Desktop
~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"google-workspace": {
"command": "node",
"args": ["/absolute/path/to/mcp-google-workspace/index.mjs"],
"env": {
"GOOGLE_IMPERSONATED_USER": "assistant@example.com",
"GOOGLE_ALLOWED_INTERNAL_DOMAINS": "example.com"
}
}
}
}Claude Code
claude mcp add google-workspace \
--env GOOGLE_IMPERSONATED_USER=assistant@example.com \
-- node /absolute/path/to/mcp-google-workspace/index.mjsAntigravity
Agent panel → ⋯ → MCP Servers → Manage MCP Servers → View raw config, then add to mcp_config.json:
{
"mcpServers": {
"google-workspace": {
"command": "node",
"args": ["/absolute/path/to/mcp-google-workspace/index.mjs"],
"env": {
"GOOGLE_PERSONAL_TOKENS_PATH": "/absolute/path/to/tokens_personal.json",
"GOOGLE_PERSONAL_EMAIL": "you@gmail.com"
}
}
}
}Any other MCP client that launches stdio servers works the same way (node index.mjs).
Tools
Calendar
Tool | Description |
| Upcoming events of a user's primary calendar ( |
| Create an event ( |
| Delete an event by |
Calendar tools impersonate userEmail; pass account instead to use an OAuth profile.
Workspace admin
Tool | Description |
| List the domain's Google Groups |
| Drive audit events (view/edit/download/…) filtered by |
Gmail (Workspace, service account)
Tool | Description |
| Gmail query search with headers + snippet, paginated |
| Full message by ID |
| Send (text/HTML, CC, BCC, Reply-To, |
| Draft management |
Gmail (OAuth profiles)
Tool | Description |
| Search a profile's mailbox |
| Full message by ID |
| Send from a profile |
| Draft management |
| Address, message/thread totals, historyId |
|
|
|
|
Drive (Workspace, service account)
Tool | Description |
| Recently modified files ( |
| Full metadata |
| Docs → text, Sheets → CSV, other files raw |
| Create a folder (auto-share, |
| Upload from |
| Share with |
| Trash or permanently delete |
| List Shared Drives |
| Read Apps Script project source |
Drive (OAuth profiles)
gdrive_personal_search_files, gdrive_personal_get_file_metadata, gdrive_personal_read_file_content, gdrive_personal_create_folder, gdrive_personal_upload_file, gdrive_personal_delete_file — same behavior, scoped to the chosen account.
OAuth-profile tools are hidden from the tool list until at least one OAuth tokens file exists.
Sheets
Tool | Description |
| Read a range |
| Write a range. Blocks overwriting formulas or ARRAYFORMULA spill rows unless |
| Append rows and verify them |
| Title, locale, time zone and sheet list |
Sheets tools use the service account (impersonateUser) or an OAuth profile (account).
Google Cloud DNS
gcp_dns_list_records, gcp_dns_create_record, gcp_dns_delete_record — project / managedZone per call or via GCP_DNS_PROJECT / GCP_DNS_MANAGED_ZONE.
Google Tag Manager
gtm_list_accounts, gtm_list_containers, gtm_list_workspaces, gtm_list_tags, gtm_get_tag, gtm_update_tag, gtm_create_version, gtm_publish_version.
Security notes
credentials*.json,token*.json,service_account*.json,client_secret*.jsonand.envare git-ignored. Never commit them.Domain-wide delegation lets the service account act as any user in your domain. Grant only the scopes you need and set
GOOGLE_ALLOWED_INTERNAL_DOMAINSto limit impersonation and Drive sharing.Tools that accept
filePath(attachments, uploads) read local files with the server's permissions. Run the server under an account with appropriate file access.Sending email, sharing files, deleting files, changing DNS and publishing GTM versions are real, outward-facing actions. Configure your MCP client to require confirmation for them.
Development
npm run check # syntax-check every module
npm start # run over stdioLayout:
index.mjs MCP server entry: tool registry + dispatch
auth.mjs OAuth2 consent CLI (npm run auth)
src/config.mjs env vars, profiles, domain guard
src/google-auth.mjs OAuth / service-account / DNS / GTM clients
src/tools/ tool schemas
src/handlers/ tool implementations
src/*-helpers.mjs Gmail, Drive and MIME helpers; sheets-guard.mjsLicense
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Gmail, Outlook, Drive, OneDrive and calendars for AI agents. Many accounts, one endpoint, audit log.
Multiple Gmail accounts, editable Google Sheets & Docs for AI agents. Deny-by-default access rules.
Permissioned access to Gmail, Drive and Calendar via the user's own Google account
Email, calendar and contacts for AI agents: Gmail, Microsoft 365 and IMAP accounts behind one API.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides comprehensive natural language control over Google Workspace services including Gmail, Drive, Calendar, Docs, Sheets, Slides, Forms, Tasks, and Chat. Features multi-user OAuth 2.1 support, flexible tool tiers, and seamless integration with AI assistants.843MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with Google Workspace services (Gmail, Drive, Docs, Tasks, Calendar) through OAuth 2.0 authentication, providing 25+ operations for business automation and productivity.1-
- FlicenseNot gradedqualityDmaintenanceEnables AI assistants to manage Gmail (list, search, send, label emails) and Google Calendar (list, create, update, delete events) via OAuth 2.0.-
- FlicenseNot gradedqualityBmaintenanceEnables AI agents to access multiple Gmail/Google Workspace accounts for searching and reading mail, calendars, and attachments.-