Google Workspace MCP Server
Provides Gmail integration for searching messages with Gmail query syntax, reading messages and threads, creating drafts, sending existing drafts with confirmation, modifying labels, and listing labels.
Provides Google Calendar integration for listing and reading calendar events, enabling questions about schedules and availability.
Provides Google Docs integration for reading and exporting document content and building docs from notes or Drive files.
Provides Google Drive integration for searching files, retrieving file metadata and sharing details, exporting Google Docs/Sheets/Slides content as text, and creating Drive files.
Provides Google Forms integration for accessing form responses and exporting them into sheets or other Workspace tools.
Provides Google Sheets integration for reading, creating, and updating spreadsheets, including pulling form responses and tracking changes.
Provides Google Slides integration for exporting slide content as text and working with presentations in Google Workspace.
Provides Google Tasks integration for managing tasks as part of the Google Workspace toolset.
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., "@Google Workspace MCP Server summarize this week's unread emails and flag ones needing a reply"
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.
Google Workspace MCP Server & CLI
Google Workspace MCP server and CLI for Claude Code, Codex and AI agents. 38 tools for Gmail, Drive, Sheets, Docs, Slides, Calendar, Tasks, Forms and Contacts through Google's official Workspace CLI, so your credential never leaves your machine.
One install gives you both surfaces, the same 38 tools under the same names, from the same server, so they cannot drift apart.
It wraps Google's own Workspace CLI, so your credential is created by you and stays on your machine. That also sidesteps the security assessment a third-party OAuth app needs for mailbox and Drive access.
Two ways to use it
Command line
google-workspace-cli runs every tool as a command. Agents that run commands, like
Claude Code, Codex and OpenCode, use it on their own, and you can type the same
commands in a terminal, a script or a cron job:
google-workspace-cli # every command, one line each
google-workspace-cli gmail-search --q "from:sarah newer_than:30d" --max 5
google-workspace-cli calendar-list-events --json
google-workspace-cli drive-search --q "name contains 'invoice'" --agent
google-workspace-cli gmail-create-draft --to a@example.com --subject Hi --body "See you Friday"
google-workspace-cli gmail-send-draft --draftId r-123 --confirm
google-workspace-cli <command> --help # what any command takes--confirm is the shell spelling of the confirmation sending a draft needs. --json gives JSON, --compact puts it on one line, --select keeps only the fields you name, and --agent turns on all of it for a script. Exit codes are 0 ok, 2 usage or a refused write, 3 not found, 4 auth, 5 API, 7 rate limited and 10 nothing configured, so a script branches on the number.
google-workspace-cli schema <command> prints the exact JSON Schema an MCP client
receives for that tool.
MCP server, for AI agents
google-workspace-mcp is what Claude Code, Claude Desktop, Cursor and the rest launch.
You never run it by hand:
claude mcp add google-workspace -- npx -y @apexlogicfocus/google-workspace-mcp-cliIn Claude Desktop, the .mcpb extension
installs on a double click. Section 4 has every other client.
What each costs
Both surfaces are the same program with the same 38 tools. The difference is when the model pays for them. Measured in Claude Code:
MCP server | CLI | |
Every message, with every tool loaded | 6,700 tokens | nothing |
Every message, Claude Code's default | 810 tokens | nothing |
When Google Workspace comes up | nothing more, or the tools it picks | 1,800 tokens for |
20 messages with Google Workspace in 1, every tool loaded | 134,000 tokens | 1,800 tokens |
Claude Code's tool search is on by default: it sends only the tool names and the server instructions, and loads a tool's full definition when the model reaches for it. An app that loads every tool up front pays the first line on every message, whether Google Workspace comes up or not. With the skill added, Claude Code also lists its one-line description, about 140 tokens.
To spend less, turn the server off when you are not using it, which in Claude
Code is the /mcp panel. GWS_SERVICES=gmail,calendar registers only the services you name, and the rest cost nothing.
Or install the CLI and add the server on the days it earns its place.
Measured on 2026-09-27 with Claude Code 2.1.257 on Claude Opus 5: one
short prompt with and without the server connected, once with
ENABLE_TOOL_SEARCH=false and once with the default, the difference read
from the API's own usage figures. SKILL.md was measured the same way. Other
apps and models count tokens a little differently.
Related MCP server: worksuite-mcp
Contents
Section | ||
1 | Real prompts, not features | |
2 | Node, one command | |
3 | Sign in once | |
4 | Every client, copy and paste | |
5 |
| |
6 | All 38 | |
7 | For claude.ai | |
8 | What it will not do | |
9 | When something breaks | |
10 | Start here if you are new |
1. What you can ask it ๐ฌ
What did I agree to with the agency, and is it in the calendar?
Summarise every unread email from this week and tell me which need a reply.
Draft replies to the three that matter. Do not send them.
Find the pricing spreadsheet and tell me what changed since March.
Pull every response to the onboarding form into a new sheet.
Who did I email about the launch, and did they reply?
Build a doc from the notes in that folder.
What is on my calendar next week that I could move?
The first one is the point. It reads mail and calendar together, which no single Google product does for you.
2. Quick install โก
Node 20 or newer. Nothing else.
npx -y @apexlogicfocus/google-workspace-mcp-cli --versionThat is the whole install. npx fetches it on demand, so there is nothing to update later.
For the CLI as a command you or your agent can run anywhere, install it once:
npm install -g @apexlogicfocus/google-workspace-mcp-cli
google-workspace-cliYou also need Google's Workspace CLI, which is what actually talks to Google:
# macOS
brew install googleworkspace/tap/gws
# or download a binary
# https://github.com/googleworkspace/cli/releases3. Setup ๐
One command, once.
gws auth loginA browser opens, you approve, and you are done. The credential belongs to the CLI, not to this server.
Limit what it can touch while you are there:
gws auth login --services drive,gmail,calendar
gws auth login --readonlyYou will see an "unverified app" warning
That is expected and it is not a problem. Google shows it for any OAuth app it has not reviewed, and reviewing an app that only you use is not worth the process. Click Advanced, then Go to (your app).
If you would rather not see it, gws auth setup walks you through creating your own Google Cloud project, and then the app is yours.
Revoking
gws auth logoutOr remove access at myaccount.google.com/permissions.
4. Connect your client ๐
Claude Code
claude mcp add google-workspace -- npx -y @apexlogicfocus/google-workspace-mcp-cli@latest--scope user makes it available in every project rather than the current one.
Claude Desktop
The short way: download the .mcpb extension
from the latest release and double-click it. It carries its own dependencies,
so there is no config file to edit and nothing to install first. Install and sign in to gws first (section 3), because the extension talks to Google through it.
The long way, if you would rather edit the config yourself:
Platform | Config path |
macOS |
|
Windows |
|
{
"mcpServers": {
"google-workspace": {
"command": "npx",
"args": ["-y", "@apexlogicfocus/google-workspace-mcp-cli@latest"]
}
}
}Tip Claude Desktop does not inherit your shell PATH, so it may not find
npxorgws. If it fails, use absolute paths fromwhich npxandwhich gws, and setGWS_BINto the second one.
Quit Claude Desktop completely and reopen it.
claude.ai on the web
claude.ai runs connectors from Anthropic's cloud, not from your machine, so it cannot launch a local command. It needs this server running somewhere with a public HTTPS address. See section 7.
Cursor
.cursor/mcp.json
{
"mcpServers": {
"google-workspace": {
"command": "npx",
"args": ["-y", "@apexlogicfocus/google-workspace-mcp-cli@latest"]
}
}
}Windsurf
~/.codeium/windsurf/mcp_config.json, same shape as Cursor.
VS Code
.vscode/mcp.json. The key is servers, not mcpServers.
{
"servers": {
"google-workspace": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@apexlogicfocus/google-workspace-mcp-cli@latest"]
}
}
}Codex CLI
~/.codex/config.toml
[mcp_servers.google-workspace]
command = "npx"
args = ["-y", "@apexlogicfocus/google-workspace-mcp-cli@latest"]Everything else
Any stdio MCP client takes the same two things: the command npx and those arguments.
5. Check it worked ๐ฉบ
npx -y @apexlogicfocus/google-workspace-mcp-cli doctorIt checks the CLI is present, that you are authenticated, and makes one live API call. If every line is fine, restart your client and ask it what is on my calendar today.
6. Tools ๐ ๏ธ
38 tools. The named ones cover what an assistant reaches for; workspace_raw covers the rest.
Gmail
Tool | Does |
| search with Gmail's own query syntax |
| one message in full |
| a whole conversation in order |
| write a draft, never sends |
| send an existing draft, needs |
| archive, mark read, triage |
| label ids, which differ from their names |
Drive
Tool | Does |
| find files with Drive query syntax |
| metadata, sharing, link |
| the content of a Doc, Sheet or Slide as text |
| |
| grant someone access |
| to the trash, recoverable, needs |
Sheets, Docs, Slides
sheets_read ยท sheets_write ยท sheets_append ยท sheets_get ยท sheets_create
docs_get ยท docs_create ยท docs_append
slides_get ยท slides_create
Calendar and Tasks
calendar_list_events ยท calendar_create_event ยท calendar_update_event ยท calendar_delete_event ยท calendar_list_calendars
tasks_lists ยท tasks_list ยท tasks_create ยท tasks_complete
Forms and Contacts
forms_get ยท forms_responses ยท contacts_search ยท contacts_list
Everything else
Tool | Does |
| the exact shape a method expects, from Google's discovery service |
| call any of the ~400 methods the tools above do not cover |
Read the schema before using workspace_raw, rather than guessing field names.
7. Running it on a server ๐ฅ๏ธ
Needed for claude.ai, and useful if you want it always on.
curl -fsSL https://raw.githubusercontent.com/apexlogicfocus/google-workspace-mcp-cli/main/deploy/install.sh | sudo bashThat creates a dedicated user, installs the gws binary with its checksum verified, generates a bearer token, and runs a systemd service bound to 127.0.0.1:8787. Nothing is exposed to the internet by the script: put it behind your existing reverse proxy, which is where TLS belongs.
Then authenticate as the service user. The script prints the exact command.
Docker instead:
docker build -t google-workspace-mcp .
docker run -d --name gws-mcp -p 127.0.0.1:8787:8787 \
-e GWS_MCP_TOKEN="$(openssl rand -hex 32)" \
-v ~/.config/gws:/home/node/.config/gws \
google-workspace-mcpThe config mount must be read-write: gws stores its encryption key and cached discovery documents there, not just a token.
Note On macOS the credential lives in the OS keyring, so copying
~/.config/gwsto a Linux box does not work. SetGOOGLE_WORKSPACE_CLI_KEYRING_BACKEND=fileand authenticate on the server itself.
8. Safety ๐ก๏ธ
Email is drafted, never sent silently. gmail_create_draft writes to Drafts and stops. Sending is a separate tool needing confirm: true, because a sent email cannot be recalled.
Nothing is deleted permanently. drive_trash is recoverable for 30 days. There is no hard-delete tool.
Turn writes off, or narrow the surface:
GWS_READ_ONLY=1 # refuse every write
GWS_SERVICES=drive,calendar # nothing else is even registeredGWS_SERVICES removes the other tools from the list rather than failing when called. A model cannot reach for a tool it cannot see.
Prompt injection. Anything read from a mailbox or a shared document was written by someone else and can contain text shaped like an instruction. The server tells the model to treat it as data. That helps and is not a guarantee: for an agent working unattended on other people's content, GWS_READ_ONLY=1 is the real defence.
Full detail in SECURITY.md.
9. Troubleshooting ๐ง
Run doctor first. It answers most of it.
Symptom | Cause |
"The | not installed, or not on the PATH your client uses. Set |
"Not authenticated" | run |
Works in the terminal, not in Claude Desktop | Desktop does not inherit your shell PATH. Use absolute paths |
"unverified app" warning | expected. Advanced, then Go to. See section 3 |
A tool says the service is disabled |
|
|
|
claude.ai cannot see it | it needs a public HTTPS URL, see section 7 |
10. FAQ โ
An MCP server is a standard way to give an AI assistant real access to a tool, so it can act rather than guess. You install it once, your assistant gains a set of tools, and the same server works in Claude, Cursor, ChatGPT and anything else that speaks MCP.
Without one, an assistant can only talk about your email. With one, it can read it.
google-workspace-cli is the same program as the MCP server, run as commands. AI agents that run commands, like Claude Code, Codex and OpenCode, use it on their own, and you can type the same commands in a terminal, a script or a cron job. Every tool is a command with dashes, so gmail_search runs as google-workspace-cli gmail-search.
Use the MCP server in an app with no terminal, like Claude Desktop's chat. Use the CLI anywhere commands run: an agent like Claude Code, Codex or OpenCode, a script or a cron job. The MCP server's tools take up context on every message, and the CLI costs nothing until it runs.
Google's suite of work apps: Gmail, Drive, Docs, Sheets, Slides, Calendar, Tasks, Forms and Contacts. If you use a Gmail address, you already have it.
You need to be comfortable running two commands in a terminal: one to install, one to sign in. After that it is all conversation with your assistant.
If a terminal is unfamiliar, the Claude Desktop path in section 4 is the shortest route.
Your Google data goes from Google to the machine running this server, and from there to whichever AI client you connected. It does not pass through any server of ours, because there isn't one.
The exception is deliberate and worth understanding: whatever your assistant reads, it sends to its own model provider, the same as anything else you paste into a chat.
Work across apps in one step. Gmail cannot search your Drive, and Calendar cannot read your mail. An assistant with this server does both in a single question, and it can act on the answer: draft the reply, create the event, update the sheet.
It can trash a Drive file and delete a calendar event, and both need confirm: true set deliberately. Trashed files are recoverable for 30 days. There is no permanent-delete tool.
It cannot send an email by accident: drafting and sending are separate tools, and sending needs confirmation.
If you want none of that, run it with GWS_READ_ONLY=1.
It costs nothing. The server is free and open source, Google's CLI is free, and the Workspace APIs are free at any volume a person generates.
It works with any MCP client. Claude Code, Claude Desktop, Cursor, Windsurf, VS Code, Codex CLI and Gemini CLI all run it locally.
claude.ai is the exception: it connects from Anthropic's cloud rather than your machine, so it needs the server running somewhere with a public HTTPS address. See section 7.
One account per server. The gws CLI holds a single login.
For a second account, run a second copy with GOOGLE_WORKSPACE_CLI_CONFIG_DIR pointing somewhere else, and add it to your client under a different name.
It refreshes itself. The CLI holds a refresh token and renews access silently, so you sign in once.
If you ever do need to sign in again, doctor says so plainly rather than failing with a permissions error.
Questions
Run into a problem or have a question? Open an issue and I will help.
Dependencies
Library | License | What it does |
Apache-2.0 | Talks to Google, and owns the credential | |
MIT | The MCP server, stdio and streamable HTTP | |
MIT | The HTTP transport | |
MIT | Tool argument schemas |
License
MIT. Free to use, modify, and share.
Not affiliated with, endorsed by, or sponsored by Google LLC. Google Workspace, Gmail, Google Drive, Google Docs, Google Sheets, Google Slides, Google Calendar, Google Tasks, Google Forms and Google Contacts are trademarks of Google LLC. This project wraps the official Google Workspace CLI and holds no credentials of its own.
Available Tools
38 toolscalendar_create_eventA
Create an event. Adding attendees emails them immediately, so confirm the list before calling with any.
Inputs: end (required), start (required), summary (required), location, +3 more.
calendar_delete_eventADestructive
Delete an event. Attendees are notified that it was cancelled, and it cannot be undone.
Inputs: eventId (required), confirm, calendarId.
calendar_list_calendarsARead-only
Every calendar this account can see, with its id. Needed before working on anything other than primary.
Inputs: no named parameters.
calendar_list_eventsARead-only
Events in a window. Times are RFC3339, e.g. 2026-09-01T00:00:00Z. Defaults to the primary calendar.
Inputs: timeMax (required), timeMin (required), q, max, +1 more.
calendar_update_eventA
Change an existing event. Only the fields you pass are altered.
Inputs: eventId (required), end, start, summary, +3 more.
contacts_listBRead-only
All your contacts, paged.
Inputs: max.
contacts_searchBRead-only
Search your own contacts by name, email or company.
Inputs: query (required), max.
docs_appendA
Add text to the end of a Doc without touching what is already there.
Inputs: text (required), documentId (required).
docs_createA
Create a new Google Doc with a title, and optionally an opening body of text.
Inputs: title (required), text.
docs_getARead-only
Read a Google Doc's full structured content. For plain prose, drive_export with text/markdown is usually easier to work with.
Inputs: documentId (required).
drive_create_folderA
Create a folder, optionally inside another.
Inputs: name (required), parentId.
drive_exportARead-only
Read the CONTENT of a Google Doc, Sheet or Slide as text. drive_get_file returns metadata only, so this is the one to use when you need what is inside.
Inputs: fileId (required), mimeType.
drive_get_fileBRead-only
Metadata for one file: name, type, size, owners, sharing and link.
Inputs: fileId (required).
drive_searchARead-only
Find files with Drive query syntax (name contains 'x', mimeType='application/pdf', modifiedTime > '2026-01-01'). Returns id, name, type and link.
Inputs: q, max, orderBy.
drive_trashADestructive
Move a file to the trash. Recoverable for 30 days, unlike a permanent delete, which this tool deliberately does not do.
Inputs: fileId (required), confirm.
forms_getCRead-only
A form's questions and settings.
Inputs: formId (required).
forms_responsesCRead-only
Every response to a form.
Inputs: formId (required).
gmail_create_draftA
Write a draft. It is NOT sent: it appears in Drafts for a person to review. This is the safe way to have an agent write email.
Inputs: to (required), body (required), subject (required), cc, +1 more.
gmail_get_messageCRead-only
One message in full, including the body and headers.
Inputs: id (required), format.
gmail_get_threadBRead-only
A whole conversation in order. Prefer this over fetching messages one by one when you need context.
Inputs: id (required).
gmail_list_labelsARead-only
Every label with its id. Label ids are needed by gmail_modify_labels and are not the same as their display names.
Inputs: no named parameters.
gmail_modify_labelsA
Add or remove labels on a message. Use this to archive (remove INBOX), mark read (remove UNREAD) or triage.
Inputs: id (required), add, remove.
gmail_searchARead-only
Search the mailbox with Gmail's own query syntax (from:, to:, subject:, has:attachment, newer_than:7d, is:unread). Returns message ids and snippets; use gmail_get_message for a full body.
Inputs: q (required), max.
gmail_send_draftADestructive
Send a draft that already exists. Separate from creating one on purpose: an agent drafts, a person sends. Cannot be undone.
Inputs: draftId (required), confirm.
sheets_appendA
Add rows to the end of a sheet without touching what is there. Prefer this over sheets_write when adding data.
Inputs: range (required), values (required), spreadsheetId (required).
sheets_createA
Create a new spreadsheet and return its id.
Inputs: title (required).
sheets_getARead-only
Spreadsheet structure: every sheet name, id, and dimensions. Read this before a range query so the sheet name is right.
Inputs: spreadsheetId (required).
sheets_readBRead-only
Read a cell range, e.g. 'Sheet1!A1:D50'. Returns rows as arrays.
Inputs: range (required), spreadsheetId (required).
sheets_writeB
Overwrite a range with new values. Existing cells in that range are replaced.
Inputs: range (required), values (required), spreadsheetId (required).
slides_createA
Create an empty presentation and return its id.
Inputs: title (required).
slides_getBRead-only
A presentation's structure and the text on every slide.
Inputs: presentationId (required).
tasks_completeC
Mark a task done.
Inputs: task (required), tasklist (required).
tasks_createA
Add a task. due is RFC3339 and Google ignores the time part, only the date.
Inputs: title (required), tasklist (required), due, notes.
tasks_listARead-only
Tasks in a list. Completed ones are hidden unless you ask for them.
Inputs: tasklist (required), max, showCompleted.
tasks_listsBRead-only
Every task list with its id.
Inputs: no named parameters.
workspace_rawADestructive
Call any Google Workspace API method the curated tools do not cover. The CLI is generated from Google's discovery service, so this reaches roughly 400 methods across drive, gmail, sheets, docs, slides, calendar, tasks, people, chat, forms, keep, meet, script and admin-reports. Use workspace_schema first to learn the exact shape.
Inputs: path (required), service (required), body, params, +2 more.
workspace_schemaARead-only
The exact parameters and request body a method expects, straight from Google's discovery service. Read this before workspace_raw rather than guessing field names.
Inputs: method (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 38 tools
Tools are cleanly separated by service prefix (gmail_, drive_, sheets_, docs_, calendar_, tasks_, slides_, forms_, contacts_) and each has a distinct action. Overlapping-looking pairs like drive_get_file vs drive_export and gmail_create_draft vs gmail_send_draft are explicitly disambiguated in their descriptions. An agent can reliably pick the right tool.
A consistent service_action snake_case pattern dominates (gmail_search, drive_search, sheets_read, calendar_create_event, workspace_raw). Minor deviations exist: tasks_lists vs tasks_list use confusing plural/singular forms, and gmail_modify_labels uses a different verb style, but overall it stays readable.
38 tools is heavy in absolute terms but spread across ~10 distinct Google products, averaging only ~4 per service, so each tool earns its place. The breadth of Workspace justifies the count, though it sits above the ideal range and could be trimmed.
Broad lifecycle coverage across Gmail, Drive, Sheets, Docs, Calendar, Tasks, Slides, Forms and Contacts, plus workspace_raw/workspace_schema as an escape hatch. Gaps remain (e.g. no docs content edit, no tasks update/delete, no gmail message delete, Drive only trashes), but the raw API tool lets agents work around them.
Maintenance
Related MCP Connectors
Gmail, Outlook, Drive, OneDrive and calendars for AI agents. Many accounts, one endpoint, audit log.
Permissioned access to Gmail, Drive and Calendar via the user's own Google account
Multiple Gmail accounts, editable Google Sheets & Docs for AI agents. Deny-by-default access rules.
Use your apps from your AI: Gmail, Slack, Google Sheets, HubSpot and 2,300+ more on your accounts.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to control Google Workspace services (Slides, Docs, Sheets, Drive) with granular tools and provides a universal CLI escape hatch for all Workspace APIs.MIT
- AlicenseBqualityDmaintenanceConnects AI assistants to Google Workspace (Gmail, Drive, Docs, Sheets, Slides, Calendar, Tasks, Forms, Chat, Contacts) through your own OAuth app, providing around 120 tools for managing email, files, calendar, and more.100MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to securely interact with Google Workspace services, including sending emails via Gmail and appending content to Google Docs.525 npmMIT
- AlicenseBqualityBmaintenanceEnables AI agents to search, read, and compose Gmail, manage Drive files and Google Docs/Sheets/Slides, handle Calendar events and Tasks, and access Forms and Contacts using the official Workspace CLI, with credentials staying on the user's machine.38632 npmMIT