Google Workspace MCP 服务器
一个模型上下文协议 (MCP) 服务器,提供与 Gmail 和日历 API 交互的工具。此服务器可让您通过 MCP 界面以编程方式管理电子邮件和日历活动。
特征
Gmail 工具
list_emails
:列出收件箱中最近的电子邮件,并可选择过滤search_emails
:使用 Gmail 查询语法进行高级电子邮件搜索send_email
:发送新邮件,支持抄送和密送modify_email
:修改电子邮件标签(存档、垃圾箱、标记为已读/未读)
日历工具
list_events
:列出即将发生的日历事件,并按日期范围进行过滤create_event
:创建有参与者的新日历事件由于 Google Cloud Calendar API 不具有允许创建但阻止删除或更新的范围,因此出于安全措施,以下事件已从此服务器中删除。
update_event
:更新现有日历事件delete_event
:删除日历事件
先决条件
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 安装 Google Workspace Server - No Calendar Deletion:
手动安装
克隆并安装:
创建 OAuth 凭证:在根目录中创建一个
credentials.json
文件:获取刷新令牌:
这将:
打开浏览器进行 Google OAuth 身份验证
请求以下权限:
https://www.googleapis.com/auth/gmail.modify
https://www.googleapis.com/auth/calendar
https://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
对象:构建并运行:
使用示例
Gmail操作
列出最近的电子邮件:
搜索电子邮件:
发送电子邮件:
修改邮箱:
日历操作
列出事件:
创建事件:
3.更新事件:
4.删除事件:
故障排除
身份验证问题:
确保所有必需的 OAuth 范围都已授予
验证客户端ID和密钥是否正确
检查刷新令牌是否有效
API 错误:
检查 Google Cloud Console 的 API 配额和限制
确保您的项目已启用 API
验证请求参数是否符合所需格式
执照
该项目已获得 MIT 许可。
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
从https://github.com/epaproditus/google-workspace-mcp-server分叉 Google 日历上的删除和更新已被删除,因为没有范围可以防止删除,同时保持创建功能。
Related Resources
Related MCP Servers
- -securityAlicense-qualityLets LLMs read and manage Google Calendar events.Last updated -995622MIT License
- AsecurityAlicenseAqualityProvides tools for interacting with Gmail and Calendar APIs. This server enables you to manage your emails and calendar events programmatically through the MCP interface.Last updated -25MIT License
- -securityAlicense-qualityEnables comprehensive calendar management with capabilities to create, list, update, and delete events through a Model Context Protocol server integrated with Google Calendar.Last updated -153MIT License
- -securityAlicense-qualityEnables interaction with Gmail and Google Calendar using the MCP protocol, supporting multiple Google accounts, email management, and calendar operations through natural language.Last updated -13MIT License