Google Workspace
Gmail, Calendar, Contacts, Drive, Sheets, Docs, Slides
Google Workspace MCP Extension for Claude
A Model Context Protocol server that gives Claude access to Google Workspace — Gmail, Calendar, Drive, Contacts, Sheets, Docs, Slides, and 100+ APIs via the gws CLI.
Tools
| Service | Tools | Operations |
|---|---|---|
| Gmail | 7 | send, reply, forward, triage, read, search, list |
| Calendar | 6 | list events, get event, create, update, delete, freebusy |
| Contacts | 7 | search, get, list, create, update, delete, directory search |
| Drive | 2 | search, read file |
| Sheets | 5 | read, update, append, create, delete |
| Docs | 5 | get, write, batch update, create, delete |
| Slides | 4 | get, create, batch update, delete |
| Generic | 1 | gws_run — fallback for any GWS API not covered above |
| Auth | 1 | OAuth login and status |
38 tools total. All tools support shared (team) Drives.
Key tool details
drive_search — Searches across both personal and shared Drives. Supports full Drive query syntax including folder parents, mimeType filters, and name matching.
drive_read_file — Reads the text content of any file in Drive by file ID. Routes by mimeType:
- Google Docs → plain text extraction
- Google Sheets → row/column data (A1:Z1000)
- Google Slides → slide structure with placeholder maps and text
- Office formats (.docx, .xlsx, .pptx) → server-side conversion to native Google format via
files.copywith explicit target mimeType, read converted copy, then delete temp copy (guaranteed cleanup via try/finally) - Plain text / CSV (
text/plain,text/csv) → raw content fetch - Unsupported types (PDF, images,
text/calendar,text/html, etc.) → returns{ error: "Unsupported file type: <mimeType>" }
docs_get — Three modes:
text(default): plain text, best for reading/summarizingindex: text with startIndex/endIndex character positions, use before positional editsfull: raw API response, for debugging or style operations
docs_create / sheets_create — Return stripped responses with only essential fields:
- docs_create →
{ documentId, title } - sheets_create →
{ spreadsheetId, title, spreadsheetUrl }
slides_get / slides_create — Return trimmed responses (no masters, layouts, geometry, styling). Each slide includes:
placeholder_map: maps standard types (TITLE, BODY, SUBTITLE) to objectIdselements: all shapes — both standard placeholders and custom text boxes- Empty placeholders are included (with objectId and placeholderType, no text field) so callers can insert text immediately after create without a redundant get call
sheets_read — Returns normalized data:
columnCountderived from the widest row (handles empty leading rows correctly)- All rows padded to uniform column count with empty strings
sheets_append — Uses direct Sheets API (spreadsheets.values.append) to preserve 2D array structure. Each inner array becomes a separate row.
docs_write — Uses batchUpdate API with insertText (not CLI helper), correctly handles newlines, em dashes, and unicode characters.
gws_run — Fallback tool for any Google Workspace API not covered by the dedicated tools. Accepts service, resource, method, params, and JSON body. Use only when no dedicated tool exists.
Setup (Extension — Claude Desktop)
1. Create a Google Cloud project
Go to Google Cloud Console and create a new project (or use an existing one).
2. Enable Google Workspace APIs
Enable each API you plan to use in your project. Click the links below and hit Enable on each page:
- Gmail API
- Google Calendar API
- Google Drive API
- Google Docs API
- Google Sheets API
- Google Slides API
- People API (for contacts)
3. Configure OAuth consent screen
Go to OAuth consent screen:
- Select External user type
- Fill in the app name (e.g. "Google Workspace CLI") and your email
- Save and continue through all screens
- Under Test users, click Add users and add your Google account email
4. Create OAuth credentials
Go to Credentials:
- Click Create Credentials → OAuth client ID
- Application type: Desktop app
- Click Create
- Copy the Client ID and Client Secret
5. Configure OAuth credentials
cp .env.example .env
Open .env and fill in your Client ID and Client Secret from the previous step.
6. Build the extension
pnpm install
pnpm run build
pnpm run build:extension
This produces google-workspace-mcp.mcpb.
7. Install in Claude Desktop
Open Claude Desktop → Settings → Extensions → Install from file → select google-workspace-mcp.mcpb.
When the extension loads for the first time, a browser window opens automatically for Google OAuth login. Sign in and authorize the app. After that, all tools are ready to use.
Note: If your app is in testing mode (unverified), you'll see a "Google hasn't verified this app" warning. Click Advanced → Go to <app name> (unsafe) to proceed. This is safe for personal use.
Setup (HTTP Server — Claude Code / standalone)
1. Complete steps 1–5 above
2. Install and build
pnpm install
pnpm run build
3. Authenticate
With the env vars from step 5 set, run:
./bin/gws-aarch64-apple-darwin/gws auth login -s drive,gmail,sheets,calendar,docs,slides,people
4. Start the server
node server/index.js
The MCP server starts on http://localhost:39147/mcp (override with PORT env var).
5. Connect Claude Code
claude mcp add google-workspace --transport http http://localhost:39147/mcp
Or add to Claude Desktop MCP config:
{
"mcpServers": {
"google-workspace": {
"type": "streamable-http",
"url": "http://localhost:39147/mcp"
}
}
}
Environment Variables
| Variable | Default | Description |
|---|---|---|
PORT |
39147 |
HTTP server port |
GWS_OAUTH_CLIENT_ID |
— | OAuth client ID |
GWS_OAUTH_CLIENT_SECRET |
— | OAuth client secret |
Architecture
src/
├── create-server.ts # Shared MCP server factory
├── extension.ts # Stdio entry point (.mcpb extension)
├── index.ts # HTTP entry point (standalone server)
├── gws-client.ts # Wrapper around the gws CLI binary
└── tools/
├── response.ts # Response helpers (JSON formatting, 900KB truncation)
├── auth.ts # OAuth login (browser-based, no gcloud needed)
├── gmail.ts # Gmail tools
├── calendar.ts # Calendar tools
├── contacts.ts # Contacts / People API tools
├── drive.ts # Drive tools (search, read file with auto-conversion)
├── sheets.ts # Sheets tools (normalized reads, direct API append)
├── docs.ts # Docs tools (text/index/full modes, batchUpdate writes)
├── slides.ts # Slides tools (trimmed responses, placeholder maps)
├── generic.ts # Generic gws_run fallback
└── index.ts # Tool registry (flat Map<name, handler>)
The server wraps the gws CLI binary, which handles OAuth token management and API discovery. Each tool either uses client.helper() for high-level CLI commands or client.api() for direct Google API calls.
The extension (extension.ts) runs via stdio for Claude Desktop .mcpb bundles. The HTTP server (index.ts) runs as a standalone process for Claude Code or other MCP clients. Both share the same createMcpServer() factory.
Key implementation details
- Shared Drive support: All Drive API calls include
supportsAllDrives: true(andincludeItemsFromAllDrives: truefor list operations) so files on team Drives are accessible - Sandbox compatibility: Sets
cwd: os.tmpdir()andGOOGLE_WORKSPACE_CLI_CONFIG_DIRfor Claude Desktop's read-only filesystem - OAuth credentials: Reads from env vars, falls back to bundled
oauth.json(injected at build time byscripts/build-extension.sh) - Auto-auth: Extension checks auth status on startup and opens browser for OAuth login if needed (non-blocking — MCP server starts immediately)
- Response truncation: All responses capped at 900KB to stay within context limits
- Slides trimming: Strips masters, layouts, geometry, and styling from API responses — returns only objectIds, placeholder types, and text content
- Office file reading:
drive_read_filecopies Office files with explicit target mimeType to trigger server-side conversion, reads the native copy, then deletes it (guaranteed cleanup via try/finally) - Unsupported type guard:
drive_read_fileonly fetches raw content fortext/plainandtext/csv— all other non-native types return a clean error instead of binary data
Development
pnpm run dev # Watch mode — recompiles on change
License
MIT
Capabilities
gws-mcp__gmail_update_draftUpdate an existing draft email in Gmail. This fully replaces the draft's message content (Gmail API does not support partial edits). If thread_id is omitted, the tool preserves the existing thread automatically.
Parameters
ccstring/ CC recipients, comma-separatedtostring/ Recipient email address(es), comma-separatedbccstring/ BCC recipients, comma-separatedbodystring/ Email body textsubjectstring/ Email subject linedraft_idstring/ The Gmail draft ID to updatethread_idstring/ Thread ID to preserve threading. If omitted, the existing draft's thread is preserved automatically.gws-mcp__docs_batch_updateApply batch updates to a Google Doc. Supports inserting text, replacing text, deleting content ranges, and other document modifications. Uses the Google Docs API batchUpdate format.
Parameters
requestsarray/ Array of update request objects. Each can be: insertText ({ insertText: { location: { index: 1 }, text: "Hello" } }), replaceAllText ({ replaceAllText: { containsText: { text: "old", matchCase: true }, replaceText: "new" } }), deleteContentRange ({ deleteContentRange: { range: { startIndex: 1, endIndex: 10 } } })document_idstring/ The Google Docs document IDgws-mcp__docs_createCreate a new Google Doc.
Parameters
titlestring/ Title for the new documentgws-mcp__docs_deleteDelete a Google Doc. This permanently removes the document from Drive.
Parameters
document_idstring/ The document ID to deletegws-mcp__slides_getGet the content of a Google Slides presentation. Returns slide objectIds, placeholder types (TITLE/BODY/SUBTITLE), and text content — stripped of layout/styling data to fit context windows. Use the returned objectIds with slides_batch_update for edits.
Parameters
presentation_idstring/ The Google Slides presentation ID (from the URL)gws-mcp__slides_createCreate a new Google Slides presentation. Returns the presentationId and a placeholder_map for each slide mapping placeholder types (TITLE, BODY, SUBTITLE) to their objectIds — use these with slides_batch_update insertText.
Parameters
titlestring/ Title for the new presentationgws-mcp__slides_batch_updateApply batch updates to a Google Slides presentation. Supports inserting text, replacing text, creating slides, deleting objects, and other modifications. Uses the Google Slides API batchUpdate format.
Parameters
requestsarray/ Array of update request objects. Examples: createSlide ({ createSlide: { slideLayoutReference: { predefinedLayout: "TITLE_AND_BODY" } } }), insertText ({ insertText: { objectId: "slideId", text: "Hello", insertionIndex: 0 } }), replaceAllText ({ replaceAllText: { containsText: { text: "old" }, replaceText: "new" } }), deleteObject ({ deleteObject: { objectId: "elementId" } })presentation_idstring/ The presentation IDgws-mcp__slides_deleteDelete a Google Slides presentation. This permanently removes the file from Drive.
Parameters
presentation_idstring/ The presentation ID to deletegws-mcp__tasks_listList all task lists for the authenticated user.
gws-mcp__tasks_list_tasksList tasks in a specific task list. Returns task titles, statuses, due dates, and notes.
Parameters
show_hiddenboolean/ Include hidden/deleted tasks (default: false)tasklist_idstring/ The task list ID (use tasks_list to find IDs, or '@default' for the default list)show_completedboolean/ Include completed tasks (default: true)gws-mcp__tasks_createCreate a new task in a task list.
Parameters
duestring/ Due date in RFC 3339 format (e.g., 2026-03-28T00:00:00Z)notesstring/ Notes/description for the tasktitlestring/ Title of the tasktasklist_idstring/ The task list ID (or '@default' for the default list)gws-mcp__tasks_updateUpdate an existing task's title, notes, or due date.
Parameters
duestring/ New due date in RFC 3339 formatnotesstring/ New notes for the tasktitlestring/ New title for the tasktask_idstring/ The task ID to updatetasklist_idstring/ The task list IDgws-mcp__tasks_completeMark a task as completed.
Parameters
task_idstring/ The task ID to mark as completetasklist_idstring/ The task list IDgws-mcp__tasks_deleteDelete a task from a task list.
Parameters
task_idstring/ The task ID to deletetasklist_idstring/ The task list IDgws-mcp__gws_runFALLBACK ONLY — use dedicated tools first (gmail_*, calendar_*, drive_*, sheets_*, docs_*, slides_*, contacts_*). Only use gws_run when no dedicated tool exists for the operation, e.g. Chat, Admin, Tasks, or advanced API calls not covered by other tools. Commands follow the pattern: gws <service> <resource> <method>.
Parameters
bodyobject/ Request body for create/update operations (alias for json_body)methodstring/ API method (e.g., list, get, create, update, delete)paramsobject/ Query parameters as key-value pairs (e.g., { pageSize: 10, q: "search query" })dry_runboolean/ Preview the request without executing itservicestring/ Google Workspace service (e.g., calendar, chat, admin, classroom, contacts, drive, gmail, sheets, docs, slides)page_allboolean/ Fetch all pages of results (default: false, max 10 pages)resourcestring/ API resource (e.g., events, spaces, users, files, messages)json_bodyobject/ Request body for create/update operations (alias: body)gws-mcp__gws_auth_setupCheck or manage Google Workspace authentication. In HTTP mode, auth is handled via the MCP OAuth flow. In extension/stdio mode (Claude Desktop), use action 'login' to authenticate or re-authenticate with updated scopes.
Parameters
actionstring/ Action to perform: 'status' (default) checks auth state, 'login' triggers browser-based OAuth login (extension/stdio mode only).servicesstring/ Comma-separated services to request scopes for (e.g. 'drive,gmail,tasks'). Only used with action 'login'. Defaults to all supported services.gws-mcp__gmail_sendSend a new email via Gmail. Composes and sends an email message to the specified recipients.
Parameters
ccstring/ CC recipients, comma-separatedtostring/ Recipient email address(es), comma-separatedbccstring/ BCC recipients, comma-separatedbodystring/ Email body textsubjectstring/ Email subject linegws-mcp__gmail_replyReply to an existing email thread in Gmail.
Parameters
bodystring/ Reply body textmessage_idstring/ The Gmail message ID to reply togws-mcp__gmail_forwardForward an existing email to another recipient.
Parameters
tostring/ Recipient email address to forward tomessage_idstring/ The Gmail message ID to forwardgws-mcp__gmail_triageGet an overview of recent unread emails in the Gmail inbox for triage.
gws-mcp__gmail_readRead a specific email message by its ID. Returns the full message including headers, body, and metadata.
Parameters
message_idstring/ The Gmail message ID to readgws-mcp__gmail_searchSearch Gmail messages using Gmail search syntax. Returns matching messages with snippets. Supports queries like "from:[email protected]", "subject:proposal", "after:2024/01/01", "has:attachment", "label:important".
Parameters
querystring/ Gmail search query (e.g., "from:[email protected] subject:Q4 proposal", "is:unread after:2024/06/01")max_resultsnumber/ Maximum number of messages to return (default: 10)gws-mcp__gmail_listList recent emails from the inbox. Optionally filter by label. Returns message IDs, subjects, senders, dates, and snippets.
Parameters
labelstring/ Label to filter by (e.g., "INBOX", "SENT", "STARRED", "IMPORTANT", or custom label). Defaults to INBOX.max_resultsnumber/ Maximum number of messages to return (default: 10)gws-mcp__gmail_create_draftCreate a draft email in Gmail without sending it. The draft can be reviewed and sent later from Gmail. Returns the draft ID and a link to open it in Gmail.
Parameters
ccstring/ CC recipients, comma-separatedtostring/ Recipient email address(es), comma-separatedbccstring/ BCC recipients, comma-separatedbodystring/ Email body textsubjectstring/ Email subject linegws-mcp__gmail_save_attachment_to_driveSave a Gmail attachment directly to Google Drive. Use gmail_read first to get attachment metadata (filename, mimeType, attachmentId) from the message parts. The file is fetched from Gmail and uploaded to Drive server-side — no base64 data flows through the conversation. Returns the Drive file metadata including a web link.
Parameters
filenamestring/ Filename to save as in Drive (e.g., 'report.xlsx')message_idstring/ The Gmail message ID that contains the attachmentattachment_idstring/ The attachment ID from the message part's body.attachmentId fieldparent_folder_idstring/ Optional Drive folder ID to save into. If omitted, saves to the root of My Drive.gws-mcp__calendar_list_eventsList upcoming events from a Google Calendar. Returns event titles, times, attendees, and meeting links.
Parameters
querystring/ Free-text search query to filter eventstime_maxstring/ End of time range (ISO 8601, e.g., "2024-06-30T23:59:59Z"). Defaults to 7 days from now.time_minstring/ Start of time range (ISO 8601, e.g., "2024-06-01T00:00:00Z"). Defaults to now.calendar_idstring/ Calendar ID (default: "primary" for the user's main calendar)max_resultsnumber/ Maximum number of events to return (default: 20)gws-mcp__calendar_get_eventGet details of a specific calendar event by its event ID.
Parameters
event_idstring/ The calendar event IDcalendar_idstring/ Calendar ID (default: "primary")gws-mcp__calendar_create_eventCreate a new calendar event. Supports setting title, time, attendees, description, location, and Google Meet links.
Parameters
endstring/ End time in ISO 8601 format (e.g., "2024-06-15T15:00:00-07:00")startstring/ Start time in ISO 8601 format (e.g., "2024-06-15T14:00:00-07:00")summarystring/ Event titleadd_meetboolean/ Attach a Google Meet video conference link to the event (default: false)locationstring/ Event location (physical address or room name)attendeesstring/ Comma-separated email addresses of attendeescalendar_idstring/ Calendar ID (default: "primary")descriptionstring/ Event description or agendasend_updatesstring/ Who to send invite notifications to (default: "all")gws-mcp__calendar_update_eventUpdate an existing calendar event. Only provided fields are changed.
Parameters
endstring/ New end time (ISO 8601)startstring/ New start time (ISO 8601)summarystring/ New event titleevent_idstring/ The calendar event ID to updatelocationstring/ New event locationattendeesstring/ Comma-separated email addresses (replaces existing attendees)calendar_idstring/ Calendar ID (default: "primary")descriptionstring/ New event descriptionsend_updatesstring/ Who to send update notifications to (default: "all")gws-mcp__calendar_delete_eventDelete a calendar event by its event ID.
Parameters
event_idstring/ The calendar event ID to deletecalendar_idstring/ Calendar ID (default: "primary")send_updatesstring/ Who to send cancellation notifications to (default: "all")gws-mcp__calendar_freebusyCheck availability (free/busy) for one or more people over a time range. Useful for finding open slots to schedule meetings.
Parameters
emailsstring/ Comma-separated email addresses to check availability fortime_maxstring/ End of the time range to check (ISO 8601)time_minstring/ Start of the time range to check (ISO 8601)gws-mcp__contacts_searchSearch Google Contacts by name, email, or phone number. Returns matching contacts with their details.
Parameters
querystring/ Search query (name, email, phone number, or company name)max_resultsnumber/ Maximum number of contacts to return (default: 10)gws-mcp__contacts_getGet full details of a specific contact by their resource name.
Parameters
resource_namestring/ Contact resource name (e.g., "people/c1234567890")gws-mcp__contacts_listList contacts from the user's Google Contacts. Returns names, emails, phone numbers, and organizations.
Parameters
max_resultsnumber/ Maximum number of contacts to return (default: 20)gws-mcp__contacts_createCreate a new contact in Google Contacts.
Parameters
namestring/ Full name of the contactemailstring/ Email addressnotesstring/ Notes about the contactphonestring/ Phone numbertitlestring/ Job titlecompanystring/ Company or organization namegws-mcp__contacts_updateUpdate an existing contact. Only provided fields are changed.
Parameters
namestring/ Updated full nameemailstring/ Updated email addressnotesstring/ Updated notesphonestring/ Updated phone numbertitlestring/ Updated job titlecompanystring/ Updated company nameresource_namestring/ Contact resource name (e.g., "people/c1234567890")gws-mcp__contacts_deleteDelete a contact from Google Contacts.
Parameters
resource_namestring/ Contact resource name (e.g., "people/c1234567890")gws-mcp__contacts_directory_searchSearch the company's Google Workspace directory (all users in the organization). Useful for finding colleagues' contact info.
Parameters
querystring/ Search query (name, email, or department)max_resultsnumber/ Maximum number of results (default: 10)gws-mcp__drive_create_folderCreate a new folder in Google Drive.
Parameters
namestring/ Name for the new folderparent_idstring/ Parent folder ID to create inside (optional, defaults to root)gws-mcp__drive_searchSearch for files in Google Drive. Returns file names, IDs, types, and modification dates.
Parameters
querystring/ Search query (Drive query syntax, e.g., "name contains 'report'" or "mimeType='application/vnd.google-apps.spreadsheet'")page_sizenumber/ Maximum number of results to return (default: 20)gws-mcp__drive_read_fileRead the text content of any file in Google Drive by file ID. Supports Google Docs, Sheets, Slides, Office formats (.docx/.xlsx/.pptx — auto-converted), and plain text files. Returns extracted text directly — no local filesystem needed.
Parameters
file_idstring/ The Google Drive file ID to readgws-mcp__sheets_readRead data from a Google Sheets spreadsheet. Returns cell values for the specified range.
Parameters
rangestring/ Cell range in A1 notation (e.g., "Sheet1!A1:D10", "A1:Z")spreadsheet_idstring/ The spreadsheet ID (from the URL)gws-mcp__sheets_updateUpdate specific cells in a Google Sheets spreadsheet. Overwrites existing values in the specified range.
Parameters
rangestring/ Cell range in A1 notation (e.g., "Sheet1!A1:B2")valuesarray/ 2D array of values to write (rows of columns), e.g., [["A1","B1"],["A2","B2"]]spreadsheet_idstring/ The spreadsheet IDgws-mcp__sheets_appendAppend rows to the end of a Google Sheets spreadsheet.
Parameters
rangestring/ Target range for appending (default: first sheet). e.g., "Sheet1!A1"valuesarray/ 2D array of rows to append, e.g., [["val1","val2"],["val3","val4"]]spreadsheet_idstring/ The spreadsheet IDgws-mcp__sheets_createCreate a new Google Sheets spreadsheet.
Parameters
titlestring/ Title for the new spreadsheetheadersarray/ Optional header row values, e.g., ["Name", "Email", "Date"]gws-mcp__sheets_deleteDelete a Google Sheets spreadsheet. This permanently removes the file from Drive.
Parameters
spreadsheet_idstring/ The spreadsheet ID to deletegws-mcp__docs_getGet the content of a Google Doc. Three modes: "text" (default) returns plain text — use for reading/summarizing. "index" returns text with startIndex/endIndex — use before positional edits (insertText at index, deleteContentRange). "full" returns the raw API response — use only for debugging or style operations.
Parameters
modestring/ "text" (default): plain text. "index": text with character positions for edits. "full": raw API response.document_idstring/ The Google Docs document ID (from the URL)gws-mcp__docs_writeWrite/append text content to a Google Doc.
Parameters
textstring/ Text content to write to the documentdocument_idstring/ The Google Docs document IDConnect
Add this to your MCP client config to access all integrations through the gateway.
{
"mcpServers": {
"datatorag": {
"url": "https://datatorag.com/mcp"
}
}
}