gws-mcp
Provides tools for reading and searching Gmail messages and threads, listing and downloading attachments, managing labels, and optionally creating/updating drafts when write access is enabled.
Provides tools for listing calendars and events, searching events, retrieving event details, and optionally creating/updating events without sending invitation emails when write access is enabled.
Provides tools for searching Drive files, listing recent files, retrieving metadata, reading/exporting file contents (Google Docs/Slides as text, Sheets as CSV, other files saved to downloads), and optionally creating files/folders when write access is enabled.
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., "@gws-mcpwhat's on my work calendar 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.
gws-mcp: Google Workspace MCP server (multi-account)
A local MCP server that gives Claude Desktop access to
Gmail, Google Calendar and Google Drive on one or more Google Workspace accounts.
Each account gets an alias (e.g. work) and every tool takes an optional account argument.
Read-only by default. Write access is opt-in per account.
No sending, no deleting. Even with write enabled, there are no tools to send email, send drafts, delete, trash or cancel anything. You send your own emails.
Tokens in the macOS Keychain (or an encrypted file on servers), never in plain text.
Nothing sensitive is logged. Logs go to stderr and token-shaped strings are redacted.
Contents
Google Cloud setup (one time per Workspace organization)
Related MCP server: Mariana Google MCP
Tools
Area | Read (always) | Write (only with |
General |
| |
Gmail |
|
|
Calendar |
|
|
Drive |
|
|
Notes:
drive_read_fileexports Google Docs and Slides as plain text and Sheets as CSV (first sheet only). Other files (PDF, images, Office files) are saved to the downloads folder.Attachments and Drive files are saved to
~/Downloads/gws-mcpby default. Existing files are never overwritten; a numbered copy is created instead.Reply drafts are attached to the original conversation (
threadId,In-Reply-To,References,Re:subject).
Security model
Two layers protect write access. A write tool only works when both are true for the account:
write = trueis set for the account in the config file, andGoogle actually granted the write permissions (scopes) to the stored token.
If no account has write = true, write tools are not registered at all and Claude does not
see them. If one account has write on and another off, the tools are visible but refuse to
act on the read-only account.
Scopes requested from Google:
Mode | Scopes |
Read-only |
|
Write (added) |
|
Google has no "drafts only" scope: gmail.modify would technically allow sending and
trashing, and calendar.events would allow deleting. This server blocks those actions in its
own code. The tools simply do not exist, adding the TRASH/SPAM labels is refused, and
event status (cancellation) cannot be changed. drive.file lets the server write only files
it created itself, so your existing Drive files can never be changed.
Drafts. Drafts created by Claude carry a hidden X-GWS-MCP header.
gmail_update_draft only changes those. To change a draft you wrote, Claude must use
gmail_update_user_draft, which requires the draft's exact current subject and refuses drafts
with attachments. Set that tool to "Always ask" in Claude Desktop (see below) so you
approve every change.
Calendar. Creating or updating events never sends invitation or update emails
(sendUpdates = none).
Untrusted content. Emails, events and files can contain text that tries to instruct an AI. The server tells Claude to treat such content as data only. Keep write access off unless you need it.
Google Cloud setup
Do this once for each Google Workspace organization (you need to be its admin, or have permission to create Cloud projects). Google renames console menus from time to time; the names below match the console as of 2026.
1. Create a project
Open https://console.cloud.google.com/ and sign in with an account in the Workspace organization you want to connect.
Click the project picker at the top, then New project.
Name it e.g.
gws-mcp. Make sure Organization is your Workspace organization, then click Create and select the new project.
2. Enable the APIs
Go to APIs & Services → Library.
Search for and Enable each of these:
Gmail API
Google Calendar API
Google Drive API
3. Configure the consent screen (Internal)
Go to APIs & Services → OAuth consent screen (shown as Google Auth Platform). Click Get started if prompted.
App information: app name
gws-mcp, user support email = your address. Click Next.Audience: choose Internal. This limits the app to users in your organization, needs no Google verification, and keeps refresh tokens from expiring after 7 days. (If Internal is greyed out, the project is not inside a Workspace organization; go back to step 1.)
Contact information: your email. Agree to the policy and click Create.
Optional: under Data access, click Add or remove scopes and add the scopes from the Security model table. The server requests them itself, so this step only documents them.
4. Create a Desktop OAuth client
Go to Clients (or APIs & Services → Credentials → Create credentials → OAuth client ID).
Application type: Desktop app. Name:
gws-mcp desktop. Click Create.Click Download JSON. Keep this file private: it identifies your app.
Repeat steps 1-4 in each additional Workspace organization. An Internal app only works for accounts in its own organization.
Install
Requirements: macOS (Windows and Linux also work) and uv. uv downloads Python 3.12 for this project automatically; your system Python is not changed.
cd ~/google-workspace-mcp
uv sync # creates .venv and uv.lock, installs dependencies
uv run gws-mcp --versionAdd an account
Create the config folder and put the client JSON in it:
mkdir -p ~/.config/gws-mcp/clients mv ~/Downloads/client_secret_*.json ~/.config/gws-mcp/clients/your-company.json chmod 600 ~/.config/gws-mcp/clients/your-company.json cp ~/google-workspace-mcp/config.example.toml ~/.config/gws-mcp/config.tomlEdit
~/.config/gws-mcp/config.toml:default_account = "work" [accounts.work] email = "you@your-company.com" client_secrets = "~/.config/gws-mcp/clients/your-company.json" write = falseAliases are 1-32 characters: lowercase letters, digits,
-and_.Authorize it. A browser window opens; sign in with that account and click Allow:
uv run gws-mcp auth workThe token is saved only if the account you signed in with matches
email. On macOS you may be asked to allow access to the Keychain: choose Always Allow.Check it:
uv run gws-mcp accounts # * work you@your-company.com write=off authorized
Add to Claude Desktop
Find the full path of
uv(Claude Desktop does not use your shell'sPATH):which uv # e.g. /opt/homebrew/bin/uvIn Claude Desktop open Settings → Developer → Edit Config. This opens
~/Library/Application Support/Claude/claude_desktop_config.json. Add the server undermcpServers(keep any servers already there):{ "mcpServers": { "google-workspace": { "command": "/opt/homebrew/bin/uv", "args": [ "--directory", "/Users/YOUR_USER/google-workspace-mcp", "run", "gws-mcp", "serve" ] } } }To use a config file elsewhere, add
"env": {"GWS_MCP_CONFIG": "/path/to/config.toml"}.Quit Claude Desktop completely (Cmd+Q) and open it again. The tools appear under the tools/connectors menu in the chat box.
Recommended: in the tool permissions, set
gmail_update_user_draft(and any other write tool you want to approve one by one) to Always ask.
Turn write access on or off
Turn on:
Set
write = truefor the account inconfig.toml.Re-authorize so Google grants the extra permissions:
uv run gws-mcp auth workRestart Claude Desktop.
Until step 2 is done, write tools refuse with a message telling you to re-authorize.
Turn off:
Set
write = falseand restart Claude Desktop. Write tools disappear (if no other account has write on) and are refused for this account in any case.Optional, to also drop the permissions at Google: run
uv run gws-mcp auth workagain (read-only scopes only), and/or remove the app's access at https://myaccount.google.com/connections.
More accounts
Add another [accounts.<alias>] block and run uv run gws-mcp auth <alias>. Accounts from a
different Workspace organization need their own Cloud project and client JSON (see
Google Cloud setup).
With several accounts, set default_account or tell Claude which account to use (e.g.
"search my home account"). Claude can call list_accounts to see the aliases.
Token storage options
Backend | When | Setup |
| Desktop: macOS Keychain, Windows Credential Manager | nothing |
| Headless servers without a keyring | see below |
uv run gws-mcp gen-key # prints a key; store it like a password
export GWS_MCP_TOKEN_KEY="<key>"[storage]
backend = "encrypted_file"
encrypted_file_path = "~/.config/gws-mcp/tokens.enc"The file is Fernet-encrypted (AES-128 + HMAC) and written with 0600 permissions. Without
the key it cannot be read.
Access tokens are refreshed automatically with the refresh token and the new token is saved. If a refresh token is revoked (password change, access removed, admin policy), tools return "Authorize it with: gws-mcp auth ".
Troubleshooting
Symptom | Fix |
| Create |
| Check |
| You signed in with an account outside the project's organization. Use the right account, or create a project in that organization. |
| Sign in with the account in |
| The consent screen is not Internal. |
| Enable the Gmail, Calendar and Drive APIs (step 2). |
| Run |
Server not showing in Claude Desktop | Use the absolute path of |
Creating a file in an existing Drive folder fails | With |
Run with more logging: add "--log-level", "DEBUG" before "serve" in the Claude Desktop
args. Logs never contain tokens or message content.
Development
uv sync
uv run pytest # all Google API calls are mocked; no credentials needed
uv run ruff check . && uv run ruff format --check .Layout:
src/gws_mcp/
__main__.py CLI: serve | auth <alias> | accounts | gen-key
config.py TOML config and account resolution
scopes.py read/write scope sets and the scope check
logging_setup.py stderr logging with redaction
auth/ OAuth loopback flow, token storage, refresh
google_clients.py per-account API clients
services/ Google API logic (no MCP dependency)
tools/ MCP tool wrappers and the write guard
server.py builds the transport-agnostic MCP server
entrypoints/ stdio runner (an HTTP + OAuth runner can be added here)Moving to a server later only needs a new file in entrypoints/ (Streamable HTTP with MCP
OAuth) plus backend = "encrypted_file"; tools and services stay unchanged.
Related MCP Connectors
Multiple Google accounts (Gmail, Calendar, Drive, Contacts, Tasks) in one Claude connector.
Multiple Google accounts (Gmail, Calendar, Drive, Contacts, Tasks) in one Claude connector.
Multiple Gmail accounts, editable Google Sheets & Docs for AI agents. Deny-by-default access rules.
Give Claude only the Google Drive files you choose. Every action logged.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables Claude to interact with Google Workspace services including Gmail, Drive, Sheets, Docs, and Calendar. Provides comprehensive tools for reading, creating, and managing emails, files, spreadsheets, documents, and calendar events with built-in safety controls and audit logging.-
- AlicenseAqualityBmaintenanceEnables Claude to manage Gmail, Google Calendar, and Google Contacts through a safety-first interface with soft-delete protections and draft-only email capabilities. Supports multiple Google accounts with comprehensive mutation logging and mandatory manual confirmation for destructive actions.16MIT
- AlicenseNot gradedqualityDmaintenanceEnables Claude to manage Gmail, Google Calendar, and Google Drive, including sending emails, scheduling meetings, and organizing files, with integrated workflows.5MIT
- AlicenseNot gradedqualityBmaintenanceEnables read/write access to Google Docs, Sheets, Drive, and Calendar through Claude Desktop, with 24 tools for creating, editing, searching, and managing files and events.1,258 npmMIT