Google Workspace MCP Server
An MCP (Model Context Protocol) server that exposes 28 Google Workspace tools (Drive, Calendar, Sheets, Docs, Gmail, Chat, Admin) by wrapping the gws CLI as a subprocess. No direct API integration โ all operations go through the gws binary.
Table of contents
- How it works
- Tools (28)
- Prerequisites
- Quick start
- What
--installdoes - Configuration
- Security
- Building from source
- Project structure
- License
How it works
Claude Code <-> (stdio) <-> google-workspace-mcp.jar
|
GwsClient (ProcessBuilder)
|
gws CLI binary (@googleworkspace/cli)
|
Google Workspace APIs
Each MCP tool call translates arguments into a gws command-line invocation, executes it as a subprocess, and returns the JSON response. Auth is delegated entirely to gws auth. Untrusted content (email bodies, document text, file names) is wrapped with random boundary markers to mitigate prompt injection.
Tools (28)
Drive (6)
Calendar (4)
Sheets (4)
Docs (3)
Gmail (5)
Chat (3)
Admin (3)
Prerequisites
- Java 21 or later
- gws CLI โ
npm install -g @googleworkspace/cli - Claude Code โ install instructions
Quick start
1. Download
Download the latest JAR from Releases:
curl -L -o google-workspace-mcp-1.0.0.jar \
https://github.com/wrxck/google-workspace-mcp/releases/download/v1.0.0/google-workspace-mcp-1.0.0.jar
2. Install
java -jar google-workspace-mcp-1.0.0.jar --install
This walks you through Google Cloud setup, OAuth login, and registers the MCP server with Claude Code โ all in one command.
3. Use
Restart Claude Code, then:
> List my upcoming calendar events for this week
> Download the Q4 report from Drive
> Send an email to [email protected] about the status update
> What spreadsheets do I have?
What --install does
The --install flag automates the full setup:
- Checks for
gwsCLI โ prints install instructions if missing - Runs
gws auth setupโ creates a Google Cloud project and enables Workspace APIs (opens browser) - Runs
gws auth loginโ authenticates via OAuth with Drive, Gmail, Calendar, and Chat scopes (opens browser) - Registers with Claude Code โ runs
claude mcp addto register the server for stdio transport - Installs Claude Code skill โ copies a tool reference guide to
~/.claude/skills/gws/SKILL.mdso Claude knows how to use the tools effectively
Configuration
Manual registration
If automatic registration fails:
claude mcp add --scope user --transport stdio google-workspace -- \
java -jar /path/to/google-workspace-mcp-1.0.0.jar
Security
- Response sanitization โ All API responses containing untrusted content (email bodies, document text, file names, chat messages) are wrapped in unique cryptographic boundary markers. This defends against prompt injection via API responses.
- Tool annotations โ
readOnlyHintanddestructiveHintare set accurately per tool, so Claude treats delete operations with appropriate caution. - Command injection prevention โ Arguments are passed as a list to
ProcessBuilder, never shell-interpolated. - Input validation โ Required parameters are validated before subprocess execution.
Building from source
git clone https://github.com/wrxck/google-workspace-mcp.git
cd google-workspace-mcp
mvn clean package
This compiles, runs all tests, and produces the shaded JAR at target/google-workspace-mcp-1.0.0.jar.
Then install:
java -jar target/google-workspace-mcp-1.0.0.jar --install
Project structure
src/main/java/com/google/workspace/mcp/
โโโ GoogleWorkspaceMcpServer.java # Entry point, CLI flags, server bootstrap
โโโ GwsClient.java # Subprocess execution, JSON parsing, timeouts
โโโ GwsAuth.java # Auth delegation (gws auth setup/login)
โโโ ContentSanitizer.java # Prompt injection defense (boundary markers)
โโโ tools/
โโโ DriveTools.java # 6 Drive tools
โโโ CalendarTools.java # 4 Calendar tools
โโโ SheetsTools.java # 4 Sheets tools
โโโ DocsTools.java # 3 Docs tools
โโโ GmailTools.java # 5 Gmail tools
โโโ ChatTools.java # 3 Chat tools
โโโ AdminTools.java # 3 Admin tools (People API)