Skip to main content
Glama

gworkspace-mcp

gworkspace-mcp is a local MCP server that lets Claude, or any other MCP client, work in Google Drive, Docs, Sheets, Slides, Gmail and Calendar for several Google accounts at once. You sign in each account once, give it a short label such as work or personal, and every tool takes that label as its account argument.

Google's hosted connectors sign in to one Google account each. This server runs on your own machine and keeps one token per account. A single conversation can read a doc from one account and email it from another.

What you need

  • uv, which installs the right Python (3.12 or newer) for you.

  • A Google Cloud project where you can create an OAuth client. A free project is enough.

Related MCP server: mcp-google-multi

Setup

1. Create your own OAuth client

Each person who runs this server creates their own OAuth client. The project ships no shared client. Google classes full Drive and Gmail access as "restricted" scopes. A shared client with those scopes would need Google's app verification and a paid security audit before anyone else could sign in.

  1. Create a project in the Google Cloud console, or pick an existing one.

  2. Turn on the APIs the server calls. With the gcloud CLI:

    gcloud services enable drive.googleapis.com docs.googleapis.com \
      sheets.googleapis.com slides.googleapis.com gmail.googleapis.com \
      calendar-json.googleapis.com

    You can also turn each one on from APIs & Services > Library in the console. You only need the APIs for the services you plan to use.

  3. Open Google Auth Platform in the console. Under Branding, enter an app name and your email. Google needs a home page and a privacy policy link before it will publish the app. You can use https://github.com/gborges0727/gworkspace-mcp and https://github.com/gborges0727/gworkspace-mcp/blob/main/PRIVACY.md, with github.com as the authorized domain. Under Audience, choose External, then click Publish app. An app left in "Testing" status gets tokens that Google expires after 7 days, so you would sign in again every week. A published app that Google has not verified works for up to 100 users. Each account you sign in sees an "unverified app" warning once.

  4. Under Clients, create a client of type Desktop app and download its JSON file.

  5. Save that file as ~/.config/gworkspace-mcp/client_secret.json:

    mkdir -p ~/.config/gworkspace-mcp
    mv ~/Downloads/client_secret_*.json ~/.config/gworkspace-mcp/client_secret.json

A Google Workspace account may block apps that Google has not verified. Sign-in then fails with a message that your administrator blocked the app. The Workspace admin can mark the app as trusted in the Admin console, under Security > Access and data control > API controls.

2. Add your accounts

Run accounts add once for each Google account, with a label of your choice:

uvx gworkspace-accounts-mcp accounts add work
uvx gworkspace-accounts-mcp accounts add personal --no-send --services drive,docs,gmail

The command prints a Google sign-in URL. Open it in a browser on any device and approve access. Google then sends the browser to a localhost address, and the page fails to load. That failure is expected. Copy the full URL from the address bar and paste it into the terminal. The command checks the URL, saves the account's token, and prints the email it signed in as.

This works over SSH and on machines with no browser, because nothing has to listen on localhost.

These options limit what an account can do:

  • --services picks which of drive, docs, sheets, slides, gmail and calendar the account grants. Google asks only for those permissions, and the server refuses the other services' tools for that account. Leaving it out grants all six. Choosing docs, sheets or slides adds drive too, because those tools use Drive for links and folder moves.

  • --no-send keeps the account from sending email. The server refuses gmail_send, and gmail_reply and gmail_forward work only with as_draft=true, which saves a draft you send yourself. Calendar changes that would email guests are refused too, unless the call passes send_updates="none". So is a Drive share that would email the person you share with, unless the call passes send_notification=false. Google has no permission that allows drafts without sending, so the server enforces this itself.

  • --read-only asks Google only for read access. The server refuses every tool that would change something in that account, before it contacts Google. A read-only account cannot send email or save drafts.

3. Connect it to your MCP client

For Claude Code:

claude mcp add gworkspace --scope user -- uvx gworkspace-accounts-mcp serve

For Claude Desktop and other clients that use a JSON config, add:

{
  "mcpServers": {
    "gworkspace": {
      "command": "uvx",
      "args": ["gworkspace-accounts-mcp", "serve"]
    }
  }
}

The server reads the account files on every call. An account you add while the server runs works on the next tool call, without a restart.

If Google's hosted Drive or Gmail connectors are also turned on in your client, Claude sees two sets of similar tools. Turn the hosted ones off, or tell Claude which to use.

Managing accounts

Command

What it does

accounts add <label> [--services a,b] [--no-send] [--read-only] [--force]

Signs in a Google account under <label>. --force replaces an existing account with the same label, for example to add a service or lift --no-send.

accounts list

Shows each label, its email, its services, whether it can write and send, and which one is the default.

accounts default <label>

Picks the account the tools use when a call names none.

accounts remove <label>

Deletes the account's token file and asks Google to revoke the token.

Labels use lowercase letters, digits, - and _, up to 32 characters.

A tool call can name an account by its label or by its email. When a call names no account, the server uses the default account. With no default set, it uses the only account if there is one, and otherwise returns an error that lists the labels.

Google revokes a token with Gmail access when you change that account's password. The next tool call then fails with the exact accounts add command that signs it in again.

Tools

Every tool name starts with its service, and every tool that touches Google takes an optional account argument. Tools that take a file accept either its ID or its full Google URL.

Service

Read

Write

Accounts

accounts_list

Drive

drive_search, drive_list_recent, drive_get_metadata, drive_read_content, drive_download, drive_get_permissions, drive_list_revisions, drive_list_shared_drives, drive_get_shared_drive, drive_list_comments

drive_create, drive_copy, drive_update, drive_trash, drive_share, drive_create_comment, drive_reply_to_comment

Docs

docs_read, docs_outline

docs_batch_update, docs_append_text, docs_replace_text

Sheets

sheets_get, sheets_get_values, sheets_a1_to_grid_range

sheets_update_values, sheets_update_formulas, sheets_batch_update_values, sheets_append_values, sheets_clear_values, sheets_batch_update, sheets_insert_dimension, sheets_create

Slides

slides_read, slides_outline, slides_read_page, slides_page_thumbnail

slides_batch_update, slides_replace_text, slides_create

Gmail

gmail_search, gmail_get_thread, gmail_get_message, gmail_list_drafts, gmail_get_draft, gmail_list_labels, gmail_read_attachment

gmail_create_draft, gmail_update_draft, gmail_delete_draft, gmail_send, gmail_reply, gmail_forward, gmail_update_labels, gmail_trash, gmail_mark_spam, gmail_create_label, gmail_update_label, gmail_delete_label

Calendar

calendar_list_calendars, calendar_list_events, calendar_get_event, calendar_free_busy, calendar_find_meeting_times

calendar_create_event, calendar_update_event, calendar_delete_event, calendar_respond, calendar_quick_add, calendar_move_event

Some tools do more than pass one request through to Google:

  • drive_read_content returns a file as readable text. Docs come back as Markdown and Sheets as CSV, one section per tab. PDF, Word, Excel and PowerPoint files are converted on your machine, and images come back as images the model can see.

  • drive_create uploads text or a file from a local path. A Markdown upload becomes a formatted Google Doc, and a CSV or .xlsx becomes a Google Sheet.

  • drive_download and gmail_read_attachment can save straight to a local path, so a large file never passes through the conversation. The rules under Safety settings decide which paths they accept. gmail_read_attachment can also return a PDF or Office attachment as text.

  • docs_outline and slides_outline list each paragraph or slide element with its position. The model can find where to edit without reading the full document structure, which runs to hundreds of KB for a long doc.

  • sheets_a1_to_grid_range turns a range like 'Q3 Budget'!B4:D10 into the numeric sheet ID and 0-based indexes that Sheets edit requests need.

  • slides_page_thumbnail returns a slide as an image the model can look at.

  • gmail_reply and gmail_forward build the threading headers, quote the original, and carry its attachments over on a forward. Attachments on any outgoing email can come from a local path.

  • calendar_find_meeting_times checks everyone's free and busy times and returns the open slots inside working hours.

docs_batch_update, sheets_batch_update and slides_batch_update send raw batch update requests to Google's APIs. The Docs and Slides tools take the document's revisionId from a recent read. Google then rejects the edit if someone changed the document after that read.

Calendar tools that change an event email its guests by default when it has any. Pass send_updates="none" to change the event without emailing anyone.

Differences from Google's hosted connectors

The tool set follows Google's hosted Drive, Docs, Sheets, Slides and Gmail connectors. Those connectors can do some things that Google's public APIs cannot:

  • Requesting access to a file you cannot open.

  • Reading the transcript of a video file.

  • Writing Docs edits as tracked suggestions. The public Docs API makes direct edits only.

  • Sharing with Google Chat spaces or Workspace target audiences. drive_share shares with people, groups, a whole domain, or anyone with the link.

Safety settings

Claude may follow instructions it reads in an email or a shared doc. The server limits what one tool call can do with your local files, your tokens and your sharing settings, so such an instruction does less harm.

Tools that read or write files on your machine (drive_create, drive_download, gmail_read_attachment, slides_page_thumbnail, and attachments on outgoing email) follow these rules:

  • They refuse the server's own config folder, which holds your tokens.

  • They refuse hidden files and anything inside a hidden folder in your home folder, such as ~/.ssh, ~/.aws or ~/.zshrc.

  • They never replace an existing file unless the call passes overwrite=true. They never follow a symlink when writing, and they never create folders.

  • When GWORKSPACE_MCP_FILE_ROOTS is set, they use only files inside the folders it lists. Separate the folders with : on macOS and Linux, or ; on Windows, for example GWORKSPACE_MCP_FILE_ROOTS=~/Downloads:~/Documents/shared.

Without GWORKSPACE_MCP_FILE_ROOTS, a tool call can still attach any other file in your home folder to an email or upload it to Drive. Set it to the folders you actually use.

drive_share refuses link sharing ("anyone with the link") and sharing with a whole domain. Set GWORKSPACE_MCP_ALLOW_PUBLIC_SHARE=1 to allow both. A tool argument cannot turn either setting on, so text in an email or doc cannot change them.

Set these variables where your MCP client starts the server. For Claude Code:

claude mcp add gworkspace --scope user -e GWORKSPACE_MCP_FILE_ROOTS=~/Downloads \
  -- uvx gworkspace-accounts-mcp serve

For a JSON config, add an "env" object next to "args".

Where your data lives

The server keeps everything under ~/.config/gworkspace-mcp/. It uses $XDG_CONFIG_HOME/gworkspace-mcp when that variable is set, and $GWORKSPACE_MCP_HOME overrides both. Set GWORKSPACE_MCP_CLIENT_SECRET to read the OAuth client from somewhere else.

  • client_secret.json holds your OAuth client.

  • accounts/<label>.json holds one account's email, services, send and read-only settings, and its token. The server writes these files with mode 600 and the folders with mode 700.

  • config.json records the default account.

The server talks only to Google. It never prints or returns a token. When it refreshes a token, it writes the new one back into the same account file.

Development

git clone https://github.com/gborges0727/gworkspace-mcp
cd gworkspace-mcp
uv sync
uv run pytest -q

The tests mock every Google call, so they need no account and no network.

Each service's tools live in their own module under src/gworkspace_mcp/tools/. The docstring at the top of src/gworkspace_mcp/context.py explains how to write a tool. It covers how a tool resolves its account, how it refuses writes and sends the account does not allow, and how it turns Google errors into short messages.

License

The project uses the MIT license, in LICENSE.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers