google-workspace-mcp-server
MCP server for Google Workspace APIs - Docs, Sheets, Drive, Gmail, and Calendar. Enables reading, creating, and editing Google Docs and Sheets, managing comments, reading emails, and viewing calendar events.
README
Google Workspace MCP Server
MCP server for Google Workspace APIs - Docs, Sheets, Drive, Gmail, and Calendar. Use it with Claude Code to read, create, and edit Google Docs and Sheets, manage comments, read emails, and view calendar events.
Quick Start
- Get your Google credentials (see Setup below)
- Add to your Claude Code config (
~/.claude.json):
{
"mcpServers": {
"google-workspace": {
"type": "stdio",
"command": "npx",
"args": ["google-workspace-mcp-server"],
"env": {
"GOOGLE_CLIENT_ID": "your-client-id",
"GOOGLE_CLIENT_SECRET": "your-client-secret",
"GOOGLE_REFRESH_TOKEN": "your-refresh-token"
}
}
}
}
- Restart Claude Code
Setup
Step 1: Create a Google Cloud Project
- Go to Google Cloud Console
- Click the project dropdown (top left) → New Project
- Name it something like "MCP Server" → Create
- Wait for the project to be created, then select it
Step 2: Enable the APIs
- Go to APIs & Services → Library (or click here)
- Search for and enable each of these APIs:
- Google Docs API → Click → Enable
- Google Sheets API → Click → Enable
- Google Drive API → Click → Enable
- Gmail API → Click → Enable
- Google Calendar API → Click → Enable
Step 3: Configure OAuth Consent Screen
- Go to APIs & Services → OAuth consent screen
- Select user type:
- Internal (only if you have Google Workspace) - simpler, no test user setup needed
- External (for personal Gmail accounts) - requires adding yourself as a test user
- Click Create
- Fill in the required fields:
- App name: "MCP Server" (or anything)
- User support email: your email
- Developer contact email: your email
- Click Save and Continue
- On Scopes page, click Save and Continue (no changes needed)
- On Test users page (External only): click Add Users → add your Google email → Save and Continue
- Click Back to Dashboard
Step 4: Create OAuth Credentials
- Go to APIs & Services → Credentials
- Click Create Credentials → OAuth client ID
- Application type: Web application
- Name: "MCP Server" (or anything)
- Under Authorized redirect URIs, click Add URI and enter:
https://developers.google.com/oauthplayground - Click Create
- Copy and save your Client ID and Client Secret - you'll need these!
Step 5: Get Your Refresh Token
-
Go to OAuth 2.0 Playground
-
Click the gear icon (⚙️) in the top right corner
-
Check "Use your own OAuth credentials"
-
Enter your Client ID and Client Secret from Step 4
-
Close the settings
-
In the left panel, find and select these scopes:
- Google Docs API v1 →
https://www.googleapis.com/auth/documents - Google Sheets API v4 →
https://www.googleapis.com/auth/spreadsheets - Google Drive API v3 →
https://www.googleapis.com/auth/drive - Gmail API v1 →
https://www.googleapis.com/auth/gmail.readonly - Gmail API v1 →
https://www.googleapis.com/auth/gmail.compose(for creating drafts) - Google Calendar API v3 →
https://www.googleapis.com/auth/calendar.readonly
- Google Docs API v1 →
-
Click Authorize APIs
-
Sign in with your Google account and grant permissions
- If you see "Google hasn't verified this app", click Advanced → Go to MCP Server (unsafe)
- Click Continue to grant permissions
-
Click Exchange authorization code for tokens
-
Copy the Refresh Token (not the Access Token!) - this is what you need!
Step 6: Configure Claude Code
Add the MCP server to your Claude Code settings. Edit ~/.claude.json:
{
"mcpServers": {
"google-workspace": {
"type": "stdio",
"command": "npx",
"args": ["google-workspace-mcp-server"],
"env": {
"GOOGLE_CLIENT_ID": "123456789-abcdefg.apps.googleusercontent.com",
"GOOGLE_CLIENT_SECRET": "GOCSPX-xxxxxxxxxxxxx",
"GOOGLE_REFRESH_TOKEN": "1//04xxxxxxxxxxxxx"
}
}
}
}
Replace the values with your actual credentials from Steps 4 and 5.
Step 7: Restart Claude Code
Restart Claude Code to load the new MCP server. You should now be able to use Google Workspace tools!
Tools
Google Docs API
| Tool | Description |
|---|---|
docs_get_document |
Get document content by ID |
docs_create_document |
Create a new document |
docs_batch_update |
Insert/update/delete text, formatting, images, tables |
Google Sheets API
| Tool | Description |
|---|---|
sheets_get_spreadsheet |
Get spreadsheet metadata |
sheets_get_values |
Read cell values from a range |
sheets_batch_get_values |
Read from multiple ranges |
sheets_update_values |
Write values to a range |
sheets_append_values |
Append rows to a table |
sheets_create_spreadsheet |
Create a new spreadsheet |
sheets_batch_update |
Apply formatting, charts, filters |
sheets_clear_values |
Clear cell values from a range |
sheets_duplicate_sheet |
Duplicate a sheet within a spreadsheet |
Google Drive API
| Tool | Description |
|---|---|
drive_get_file |
Download file content (PDFs, images, etc.) |
drive_list_files |
List files in your Drive |
drive_search_files |
Search for files by name or content |
drive_copy_file |
Create a copy of a file |
drive_list_comments |
List comments on a document |
drive_create_comment |
Add a comment (anchored or unanchored) |
drive_reply_to_comment |
Reply to an existing comment |
drive_resolve_comment |
Mark comment as resolved |
drive_delete_comment |
Delete a comment |
Gmail API
| Tool | Description |
|---|---|
gmail_list_messages |
List messages with optional search filters |
gmail_get_message |
Get full content of a specific message |
gmail_list_threads |
List conversation threads |
gmail_get_thread |
Get all messages in a thread |
gmail_list_labels |
List all Gmail labels (folders) |
gmail_create_draft |
Create an email draft (not sent automatically) |
gmail_list_attachments |
List attachments in a message |
gmail_get_attachment |
Download an attachment |
Google Calendar API (Read-Only)
| Tool | Description |
|---|---|
calendar_list_calendars |
List all accessible calendars |
calendar_list_events |
List events with time range and search filters |
calendar_get_event |
Get detailed event information |
calendar_freebusy_query |
Check free/busy availability for calendars |
Usage Examples
Once configured, you can ask Claude Code things like:
- "Read my Google Doc at https://docs.google.com/document/d/abc123/edit"
- "Read this PDF from my Drive: https://drive.google.com/file/d/xyz789/view"
- "Create a new Google Doc with meeting notes from today"
- "Add a row to my spreadsheet with today's data"
- "Search my Drive for files about project planning"
- "Show me the comments on this document"
- "Reply to John's comment saying I'll fix it tomorrow"
- "Show me my unread emails"
- "Find emails from notifications@github.com"
- "What's on my calendar today?"
- "Show me my meetings for this week"
- "Get the details of that standup meeting"
Troubleshooting
"Access token expired" errors
The MCP server automatically refreshes tokens using your refresh token. If you see this error, your refresh token may have been revoked. Go through Step 5 again to get a new one.
"App not verified" warning
This is normal for personal projects. Click Advanced → Go to [App Name] (unsafe) to proceed.
"Insufficient permissions" errors
Make sure you enabled all five APIs (Docs, Sheets, Drive, Gmail, Calendar) in Step 2, and selected all five scopes in Step 5.
Environment Variables
| Variable | Description |
|---|---|
GOOGLE_CLIENT_ID |
OAuth 2.0 Client ID from Google Cloud Console |
GOOGLE_CLIENT_SECRET |
OAuth 2.0 Client Secret |
GOOGLE_REFRESH_TOKEN |
Refresh token from OAuth Playground |
Development
# Clone the repo
git clone https://github.com/nityeshaga/google-workspace-mcp-server.git
cd google-workspace-mcp-server
# Install dependencies
npm install
# Build
npm run build
# Run locally
npm start
License
MIT
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。