Google Workspace MCP Server
Google Workspace MCP 服务器
一个模型上下文协议 (MCP) 服务器,提供与 Gmail 和日历 API 交互的工具。此服务器可让您通过 MCP 界面以编程方式管理电子邮件和日历活动。
特征
Gmail 工具
list_emails:列出收件箱中最近的电子邮件,并可选择过滤search_emails:使用 Gmail 查询语法进行高级电子邮件搜索send_email:发送新邮件,支持抄送和密送modify_email:修改电子邮件标签(存档、垃圾箱、标记为已读/未读)
日历工具
list_events:列出即将发生的日历事件,并按日期范围进行过滤create_event:创建有参与者的新日历事件update_event:更新现有日历事件delete_event:删除日历事件
Related MCP server: Gmail AutoAuth MCP Server
先决条件
Node.js :安装 Node.js 版本 14 或更高版本
Google Cloud 控制台设置:
创建新项目或选择现有项目
启用 Gmail API 和 Google 日历 API:
前往“API 和服务”>“库”
搜索并启用“Gmail API”
搜索并启用“Google 日历 API”
设置 OAuth 2.0 凭据:
前往“API 和服务”>“凭证”
点击“创建凭证”>“OAuth 客户端 ID”
选择“Web应用程序”
将“授权重定向 URI”设置为包含:
http://localhost:4100/code记下客户端 ID 和客户端密钥
设置说明
通过 Smithery 安装
要通过Smithery自动为 Claude Desktop 安装 gsuite-mcp:
npx -y @smithery/cli install @rishipradeep-think41/gsuite-mcp --client claude手动安装
克隆并安装:
git clone https://github.com/epaproditus/google-workspace-mcp-server.git cd google-workspace-mcp-server npm install创建 OAuth 凭证:在根目录中创建一个
credentials.json文件:{ "web": { "client_id": "YOUR_CLIENT_ID", "client_secret": "YOUR_CLIENT_SECRET", "redirect_uris": ["http://localhost:4100/code"], "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://oauth2.googleapis.com/token" } }获取刷新令牌:
node get-refresh-token.js这将:
打开浏览器进行 Google OAuth 身份验证
请求以下权限:
https://www.googleapis.com/auth/gmail.modifyhttps://www.googleapis.com/auth/calendarhttps://www.googleapis.com/auth/gmail.send
将凭证保存到
token.json在控制台中显示刷新令牌
配置 MCP 设置:将服务器配置添加到您的 MCP 设置文件:
对于 VSCode Claude 扩展:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json对于 Claude 桌面应用程序:
~/Library/Application Support/Claude/claude_desktop_config.json
将其添加到
mcpServers对象:{ "mcpServers": { "google-workspace": { "command": "node", "args": ["/path/to/google-workspace-server/build/index.js"], "env": { "GOOGLE_CLIENT_ID": "your_client_id", "GOOGLE_CLIENT_SECRET": "your_client_secret", "GOOGLE_REFRESH_TOKEN": "your_refresh_token" } } } }构建并运行:
npm run build
使用示例
Gmail操作
列出最近的电子邮件:
{ "maxResults": 5, "query": "is:unread" }搜索电子邮件:
{ "query": "from:example@gmail.com has:attachment", "maxResults": 10 }发送电子邮件:
{ "to": "recipient@example.com", "subject": "Hello", "body": "Message content", "cc": "cc@example.com", "bcc": "bcc@example.com" }修改邮箱:
{ "id": "message_id", "addLabels": ["UNREAD"], "removeLabels": ["INBOX"] }
日历操作
列出事件:
{ "maxResults": 10, "timeMin": "2024-01-01T00:00:00Z", "timeMax": "2024-12-31T23:59:59Z" }创建事件:
{ "summary": "Team Meeting", "location": "Conference Room", "description": "Weekly sync-up", "start": "2024-01-24T10:00:00Z", "end": "2024-01-24T11:00:00Z", "attendees": ["colleague@example.com"] }更新事件:
{ "eventId": "event_id", "summary": "Updated Meeting Title", "location": "Virtual", "start": "2024-01-24T11:00:00Z", "end": "2024-01-24T12:00:00Z" }删除事件:
{ "eventId": "event_id" }
故障排除
身份验证问题:
确保所有必需的 OAuth 范围都已授予
验证客户端ID和密钥是否正确
检查刷新令牌是否有效
API 错误:
检查 Google Cloud Console 的 API 配额和限制
确保您的项目已启用 API
验证请求参数是否符合所需格式
执照
该项目已获得 MIT 许可。
Available Tools
8 toolscreate_eventC
Create a new calendar event
Inputs: end (required), start (required), summary (required), attendees, +2 more.
delete_eventB
Delete a calendar event
Inputs: eventId (required).
list_emailsB
List recent emails from Gmail inbox
Inputs: maxResults, query.
list_eventsC
List upcoming calendar events
Inputs: maxResults, timeMax, timeMin.
modify_emailA
Modify email labels (archive, trash, mark read/unread)
Inputs: id (required), addLabels, removeLabels.
search_emailsB
Search emails with advanced query
Inputs: query (required), maxResults.
send_emailC
Send a new email
Inputs: body (required), subject (required), to (required), bcc, +1 more.
update_eventB
Update an existing calendar event
Inputs: eventId (required), attendees, description, end, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Every tool has a clearly distinct purpose with no ambiguity. Calendar tools (create_event, delete_event, list_events, update_event) and email tools (list_emails, modify_email, search_emails, send_email) are cleanly separated by resource type and action, making misselection unlikely.
All tools follow a consistent verb_noun pattern with snake_case throughout. The naming is predictable and readable, with clear action verbs (create, delete, list, modify, search, send, update) paired with appropriate nouns (event, emails).
With 8 tools, this server is well-scoped for Google Workspace functionality. The count is appropriate, covering core calendar and email operations without being overwhelming or too sparse, with each tool earning its place.
The tool surface provides good coverage for calendar and email workflows, with CRUD operations for events and key email actions. Minor gaps exist, such as no direct email deletion tool (though modify_email handles archiving/trashing) and no calendar search, but agents can work around these.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Hosted Google Calendar MCP server for AI agents. No self-hosting or Google Cloud setup.
Hosted MCP server for Gmail, Outlook, iCloud, Fastmail & Yahoo Mail with per-workspace controls.
Email inboxes and calendars for AI agents: send, receive, search, draft and schedule.
Related MCP Servers
- FlicenseNot gradedqualityFmaintenanceA Model Context Protocol server that enables AI assistants to interact with Gmail services, supporting email operations, draft management, and calendar functionality through Google API integration.2-
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI assistants to manage Gmail through natural language interactions with features like sending emails, searching, and label management.MIT
- AlicenseNot gradedqualityNot gradedmaintenanceA Model Context Protocol server that enables applications to interact with Gmail through a clean API, supporting email searching, sending, reading, and label management.MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI assistants to search, read, and send emails with attachment support through the Gmail API. It also provides tools for comprehensive label management and uses secure OAuth2 authentication for mailbox access.MIT