google-workspace-mcp
A single-tool MCP server for Google Calendar, Gmail, and Drive, designed for LLM context efficiency with compact output and multi-account support.
README
<p align="center"> <h1 align="center">google-workspace-mcp</h1> <p align="center"> One MCP tool for Google Calendar, Gmail & Drive — built for LLM context efficiency. <br /> <a href="#-quick-start">Quick Start</a> · <a href="#-commands">Commands</a> · <a href="#-output-format">Output</a> · <a href="#-security">Security</a> </p> </p>
<p align="center"> <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="MIT License" /></a> <a href="https://bun.sh"><img src="https://img.shields.io/badge/runtime-Bun_1.3-f9f1e1?logo=bun" alt="Bun" /></a> <a href="https://modelcontextprotocol.io"><img src="https://img.shields.io/badge/protocol-MCP-7c3aed" alt="MCP" /></a> <a href="https://github.com/Remenby31/google-workspace-mcp/actions"><img src="https://img.shields.io/badge/build-passing-brightgreen" alt="Build" /></a> <a href="https://github.com/Remenby31/google-workspace-mcp"><img src="https://img.shields.io/badge/version-0.1.0-orange" alt="Version" /></a> </p>
Why?
Most Google Workspace MCP servers register 30–120 separate tools, each with verbose parameter descriptions that eat thousands of tokens from your LLM context window.
This server takes a different approach:
| Typical MCP server | google-workspace-mcp | |
|---|---|---|
| Tools registered | 30–120 | 1 |
| Tool descriptions | ~3,000 tokens | ~150 tokens |
| Context overhead | High | Minimal |
| Output format | Verbose JSON-like | Compact, scannable |
| Multi-account | Limited | Built-in (--as) |
One tool. One parameter. Full Google Workspace access.
⚡ Quick Start
git clone https://github.com/Remenby31/google-workspace-mcp.git
cd google-workspace-mcp
bun install
bun run setup
The interactive wizard handles everything:
- Asks for your Google Cloud OAuth credentials
- Writes
~/.mcp.jsonconfig automatically - Opens your browser for authorization (OAuth 2.1 + PKCE)
- Verifies the connection by fetching your calendar
Prerequisites: Bun ≥ 1.0 (
curl -fsSL https://bun.sh/install | bash) and a Google Cloud project with OAuth credentials.
<details> <summary><strong>Manual configuration</strong></summary>
Add to ~/.mcp.json (or your MCP client's config):
{
"mcpServers": {
"google": {
"command": "bun",
"args": ["run", "/path/to/google-workspace-mcp/src/index.ts"],
"env": {
"GOOGLE_OAUTH_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
"GOOGLE_OAUTH_CLIENT_SECRET": "your-client-secret",
"GOOGLE_DEFAULT_EMAIL": "you@gmail.com"
}
}
}
}
| Variable | Description |
|---|---|
GOOGLE_OAUTH_CLIENT_ID |
OAuth 2.0 client ID from Google Cloud Console |
GOOGLE_OAUTH_CLIENT_SECRET |
OAuth 2.0 client secret |
GOOGLE_DEFAULT_EMAIL |
Default Google account (optional, auto-detected from stored credentials) |
</details>
<details> <summary><strong>Client-specific setup: Claude Code / VS Code / Cursor</strong></summary>
Claude Code CLI — uses ~/.mcp.json (configured by bun run setup)
VS Code / Cursor — add to .vscode/mcp.json:
{
"servers": {
"google": {
"command": "bun",
"args": ["run", "/path/to/google-workspace-mcp/src/index.ts"],
"env": {
"GOOGLE_OAUTH_CLIENT_ID": "...",
"GOOGLE_OAUTH_CLIENT_SECRET": "...",
"GOOGLE_DEFAULT_EMAIL": "..."
}
}
}
}
Claude Desktop — add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows), same structure as above inside "mcpServers".
</details>
🧰 Commands
📅 Calendar
| Command | Description |
|---|---|
cal |
Events for today + 3 days |
cal <date|range> |
Events for a date (tomorrow, next week, jun 25, jun 25-28) |
cal search <query> |
Search events by keyword |
cal detail <id> |
Full details — attendees, Meet link, description |
cal create <title> <start> <end> |
Create event. Options: --meet --invite a@b.com |
cal update <id> [flags] |
Update: --title --start --end --location |
cal delete <id> |
Delete event |
cal rsvp <id> <yes|no|maybe> |
RSVP to invitation |
cal busy <date|range> |
Free/busy slots |
cal calendars |
List all calendars |
📧 Gmail
| Command | Description |
|---|---|
mail |
Last 10 unread emails |
mail search <query> |
Search with Gmail operators (from:, is:, has:, after:) |
mail read <id> |
Read full message content |
mail thread <id> |
Read entire conversation thread |
mail send <to> <subject> --body "..." |
Send email |
mail reply <id> --body "..." |
Reply to message |
mail draft <to> <subject> --body "..." |
Create draft |
mail labels |
List all labels |
mail tag <id> +/-LABEL |
Add/remove label (+STARRED, -UNREAD, +TRASH) |
mail attach <msg_id> <attachment_id> |
Download attachment |
📁 Drive
| Command | Description |
|---|---|
drive search <query> |
Search files by name or content |
drive ls [folder_id] |
List folder contents (default: root) |
drive read <id> |
Read file content (Docs, Sheets → text/CSV, PDFs, text files) |
drive info <id> |
Metadata, permissions, sharing status |
drive share <id> <email> [role] |
Share file (reader | commenter | writer) |
drive link <id> |
Get shareable link |
drive mkdir <name> |
Create folder |
drive cp <id> [name] |
Copy file |
🌐 Options
| Option | Description |
|---|---|
--as <email> |
Use a specific Google account instead of default |
help |
Show all commands |
📋 Output Format
Compact, scannable, token-efficient:
Calendar:
Jun 22 (Mon) — user@company.com
[a3f2c1] 09:30-10:00 Weekly Standup 📹 meet.google.com/abc-defg-hij
[b7e4d9] 10:00-10:30 Engineering Sync 📹 meet.google.com/xyz-uvwx-rst
[——————] all-day Office
Gmail:
Inbox — user@company.com (3 unread)
[f8c2a1] Jun 20 14:32 alice@company.com Re: Deploy pipeline ★
[d4e7b3] Jun 19 09:15 bob@company.com PR Review #432 📎
[a1b2c3] Jun 18 22:01 noreply@github.com [proj] CI failed
Drive:
My Drive — user@gmail.com
📁 [d1e2f3] Projects/ modified Jun 20
📄 [a4b5c6] Budget 2026.xlsx 12.3 KB modified Jun 18
📝 [g7h8i9] Meeting Notes Google Doc modified Jun 15
<details> <summary><strong>Design principles</strong></summary>
- Short IDs — 6-character codes like
[a3f2c1]mapped to full Google IDs within each session. Use them in follow-up commands:cal detail a3f2c1 - Relative dates —
today,tomorrow,Mon,Jun 25instead of ISO timestamps - Dense layout — one line per item, key info front-loaded, icons for quick scanning
- Truncation — long content truncated with
...to avoid flooding the context - No boilerplate — no "Successfully retrieved 4 events from calendar 'primary' for user@..." wrappers
</details>
🔄 Multi-Account
Connect multiple Google accounts and switch freely:
google cal → default account (GOOGLE_DEFAULT_EMAIL)
google cal --as work@company.com → work calendar
google mail --as personal@gmail.com → personal inbox
Each account authenticates independently on first use. Tokens are stored per-email in ~/.google-workspace-mcp/credentials/.
🛡️ Error Handling
Errors always include correct syntax and an example — LLMs can self-correct:
> cal create "Meeting" tomorrow
Missing end time. Usage: cal create <title> <start> <end>
Example: cal create "Meeting" "tomorrow 14:00" "tomorrow 15:00"
> mail read
Missing message ID. Run 'mail' or 'mail search <query>' first to get IDs.
> blabla
Unknown command "blabla". Available: cal, mail, drive, help
<details> <summary><strong>LLM tolerance features</strong></summary>
- Aliases —
calendar/agenda/rdv→cal,gmail/email/inbox→mail - French support —
demain,chercher,envoyer,supprimer,lundi - Flexible dates —
tomorrow,next monday,jun 25,25/06,2026-06-25 - RSVP tolerance —
yes/oui/ok/acceptedall work - Fuzzy actions —
read/get/show/view/openall resolve to the same action
</details>
🔒 Security
| Feature | Implementation |
|---|---|
| OAuth 2.1 + PKCE S256 | Authorization code flow with proof key (RFC 7636) |
| Ephemeral ports | Callback server binds to OS-assigned free port |
| Loopback only | 127.0.0.1 binding, no external access (RFC 8252) |
| Auto-shutdown | Callback server stops after auth or 2-minute timeout |
| Local storage | Tokens in ~/.google-workspace-mcp/credentials/, never transmitted |
| No telemetry | Zero tracking, fully auditable source |
🏗️ Architecture
src/
├── index.ts MCP server — single tool definition (~50 lines)
├── commands.ts Command parser, aliases, dispatch
├── auth.ts OAuth 2.1 + PKCE, token storage, multi-account
├── calendar.ts Google Calendar API (10 commands)
├── gmail.ts Gmail API (10 commands)
├── drive.ts Google Drive API (8 commands)
├── format.ts Short IDs, relative dates, output formatting
└── setup.ts Interactive setup wizard
2 runtime dependencies: @modelcontextprotocol/sdk + googleapis
☁️ Google Cloud Setup
<details> <summary><strong>Step-by-step guide</strong></summary>
- Go to Google Cloud Console and create a new project
- Navigate to APIs & Services → Library and enable:
- Google Calendar API
- Gmail API
- Google Drive API
- Go to APIs & Services → OAuth consent screen:
- Select External user type
- Fill in app name and email
- Publish the app (avoids 7-day token expiry in test mode)
- Go to APIs & Services → Credentials:
- Click Create Credentials → OAuth client ID
- Select Desktop application
- Copy the Client ID and Client Secret
- Run
bun run setupand paste your credentials
</details>
🤝 Contributing
Contributions welcome! The codebase is small (~1,200 lines) and straightforward.
git clone https://github.com/Remenby31/google-workspace-mcp.git
cd google-workspace-mcp
bun install
bun run typecheck # type checking
bun run test # run test suite
📄 License
MIT — use it however you want.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。