Back

Google Workspace

Gmail, Calendar, Contacts, Drive, Sheets, Docs, Slides

48 capabilitiesView Source ↗

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.copy with 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/summarizing
  • index: text with startIndex/endIndex character positions, use before positional edits
  • full: 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 objectIds
  • elements: 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:

  • columnCount derived 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:

3. Configure OAuth consent screen

Go to OAuth consent screen:

  1. Select External user type
  2. Fill in the app name (e.g. "Google Workspace CLI") and your email
  3. Save and continue through all screens
  4. Under Test users, click Add users and add your Google account email

4. Create OAuth credentials

Go to Credentials:

  1. Click Create CredentialsOAuth client ID
  2. Application type: Desktop app
  3. Click Create
  4. 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 AdvancedGo 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 (and includeItemsFromAllDrives: true for list operations) so files on team Drives are accessible
  • Sandbox compatibility: Sets cwd: os.tmpdir() and GOOGLE_WORKSPACE_CLI_CONFIG_DIR for Claude Desktop's read-only filesystem
  • OAuth credentials: Reads from env vars, falls back to bundled oauth.json (injected at build time by scripts/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_file copies 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_file only fetches raw content for text/plain and text/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_draft

Update 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-separated
tostring/ Recipient email address(es), comma-separated
bccstring/ BCC recipients, comma-separated
bodystring/ Email body text
subjectstring/ Email subject line
draft_idstring/ The Gmail draft ID to update
thread_idstring/ Thread ID to preserve threading. If omitted, the existing draft's thread is preserved automatically.
gws-mcp__docs_batch_update

Apply 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 ID
gws-mcp__docs_create

Create a new Google Doc.

Parameters

titlestring/ Title for the new document
gws-mcp__docs_delete

Delete a Google Doc. This permanently removes the document from Drive.

Parameters

document_idstring/ The document ID to delete
gws-mcp__slides_get

Get 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_create

Create 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 presentation
gws-mcp__slides_batch_update

Apply 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 ID
gws-mcp__slides_delete

Delete a Google Slides presentation. This permanently removes the file from Drive.

Parameters

presentation_idstring/ The presentation ID to delete
gws-mcp__tasks_list

List all task lists for the authenticated user.

gws-mcp__tasks_list_tasks

List 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_create

Create 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 task
titlestring/ Title of the task
tasklist_idstring/ The task list ID (or '@default' for the default list)
gws-mcp__tasks_update

Update an existing task's title, notes, or due date.

Parameters

duestring/ New due date in RFC 3339 format
notesstring/ New notes for the task
titlestring/ New title for the task
task_idstring/ The task ID to update
tasklist_idstring/ The task list ID
gws-mcp__tasks_complete

Mark a task as completed.

Parameters

task_idstring/ The task ID to mark as complete
tasklist_idstring/ The task list ID
gws-mcp__tasks_delete

Delete a task from a task list.

Parameters

task_idstring/ The task ID to delete
tasklist_idstring/ The task list ID
gws-mcp__gws_run

FALLBACK 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 it
servicestring/ 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_setup

Check 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_send

Send a new email via Gmail. Composes and sends an email message to the specified recipients.

Parameters

ccstring/ CC recipients, comma-separated
tostring/ Recipient email address(es), comma-separated
bccstring/ BCC recipients, comma-separated
bodystring/ Email body text
subjectstring/ Email subject line
gws-mcp__gmail_reply

Reply to an existing email thread in Gmail.

Parameters

bodystring/ Reply body text
message_idstring/ The Gmail message ID to reply to
gws-mcp__gmail_forward

Forward an existing email to another recipient.

Parameters

tostring/ Recipient email address to forward to
message_idstring/ The Gmail message ID to forward
gws-mcp__gmail_triage

Get an overview of recent unread emails in the Gmail inbox for triage.

gws-mcp__gmail_read

Read a specific email message by its ID. Returns the full message including headers, body, and metadata.

Parameters

message_idstring/ The Gmail message ID to read
gws-mcp__gmail_search

Search 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_list

List 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_draft

Create 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-separated
tostring/ Recipient email address(es), comma-separated
bccstring/ BCC recipients, comma-separated
bodystring/ Email body text
subjectstring/ Email subject line
gws-mcp__gmail_save_attachment_to_drive

Save 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 attachment
attachment_idstring/ The attachment ID from the message part's body.attachmentId field
parent_folder_idstring/ Optional Drive folder ID to save into. If omitted, saves to the root of My Drive.
gws-mcp__calendar_list_events

List upcoming events from a Google Calendar. Returns event titles, times, attendees, and meeting links.

Parameters

querystring/ Free-text search query to filter events
time_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_event

Get details of a specific calendar event by its event ID.

Parameters

event_idstring/ The calendar event ID
calendar_idstring/ Calendar ID (default: "primary")
gws-mcp__calendar_create_event

Create 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 title
add_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 attendees
calendar_idstring/ Calendar ID (default: "primary")
descriptionstring/ Event description or agenda
send_updatesstring/ Who to send invite notifications to (default: "all")
gws-mcp__calendar_update_event

Update 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 title
event_idstring/ The calendar event ID to update
locationstring/ New event location
attendeesstring/ Comma-separated email addresses (replaces existing attendees)
calendar_idstring/ Calendar ID (default: "primary")
descriptionstring/ New event description
send_updatesstring/ Who to send update notifications to (default: "all")
gws-mcp__calendar_delete_event

Delete a calendar event by its event ID.

Parameters

event_idstring/ The calendar event ID to delete
calendar_idstring/ Calendar ID (default: "primary")
send_updatesstring/ Who to send cancellation notifications to (default: "all")
gws-mcp__calendar_freebusy

Check 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 for
time_maxstring/ End of the time range to check (ISO 8601)
time_minstring/ Start of the time range to check (ISO 8601)
gws-mcp__contacts_search

Search 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_get

Get full details of a specific contact by their resource name.

Parameters

resource_namestring/ Contact resource name (e.g., "people/c1234567890")
gws-mcp__contacts_list

List 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_create

Create a new contact in Google Contacts.

Parameters

namestring/ Full name of the contact
emailstring/ Email address
notesstring/ Notes about the contact
phonestring/ Phone number
titlestring/ Job title
companystring/ Company or organization name
gws-mcp__contacts_update

Update an existing contact. Only provided fields are changed.

Parameters

namestring/ Updated full name
emailstring/ Updated email address
notesstring/ Updated notes
phonestring/ Updated phone number
titlestring/ Updated job title
companystring/ Updated company name
resource_namestring/ Contact resource name (e.g., "people/c1234567890")
gws-mcp__contacts_delete

Delete a contact from Google Contacts.

Parameters

resource_namestring/ Contact resource name (e.g., "people/c1234567890")
gws-mcp__contacts_directory_search

Search 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_folder

Create a new folder in Google Drive.

Parameters

namestring/ Name for the new folder
parent_idstring/ Parent folder ID to create inside (optional, defaults to root)
gws-mcp__drive_search

Search 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_file

Read 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 read
gws-mcp__sheets_read

Read 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_update

Update 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 ID
gws-mcp__sheets_append

Append 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 ID
gws-mcp__sheets_create

Create a new Google Sheets spreadsheet.

Parameters

titlestring/ Title for the new spreadsheet
headersarray/ Optional header row values, e.g., ["Name", "Email", "Date"]
gws-mcp__sheets_delete

Delete a Google Sheets spreadsheet. This permanently removes the file from Drive.

Parameters

spreadsheet_idstring/ The spreadsheet ID to delete
gws-mcp__docs_get

Get 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_write

Write/append text content to a Google Doc.

Parameters

textstring/ Text content to write to the document
document_idstring/ The Google Docs document ID

Connect

Add this to your MCP client config to access all integrations through the gateway.

{
  "mcpServers": {
    "datatorag": {
      "url": "https://datatorag.com/mcp"
    }
  }
}