TypeScript
py-mcp-google-工具箱
MCP 服务器为 AI 助手提供了与 Google 服务交互的强大工具,包括 Gmail、Google 日历、Google Drive 和 Google 搜索。
概述
py-mcp-google-toolbox 提供以下与 Google 相关的功能:
- Gmail操作(阅读、搜索、发送、修改)
- Google 日历管理(事件创建、列出、更新、删除)
- Google Drive 交互(搜索、读取文件)
- Google 搜索集成(搜索网页)
目录
先决条件
- Python :安装 Python 3.12 或更高版本
- Google Cloud 控制台设置:
- 前往Google Cloud Console
- 创建新项目或选择现有项目
- 启用服务 API:
- 前往“API 和服务”>“库”
- 搜索并启用“Gmail API”
- 搜索并启用“Google 日历 API”
- 搜索并启用“Google Drive API”
- 搜索表单并启用“自定义搜索 API”
- 从 GCP 设置 OAuth 2.0 凭据:
- 前往“API 和服务”>“凭证”
- 点击“创建凭证”>“OAuth 客户端 ID”
- 选择“Web应用程序”
- 记下客户端 ID 和客户端密钥
- 客户端 ID
- 客户端机密
- 下载 secret json 并重命名为 credentials.json
- 生成 API 密钥
- 转到自定义搜索引擎并获取其 ID
安装
Git 克隆
配置
- 安装 UV 包管理器:
- 创建并激活虚拟环境:
- 安装依赖项:
- 获取刷新令牌(如果令牌已过期,则可以运行此操作)
这将:
- 打开浏览器进行 Google OAuth 身份验证
- 请求以下权限:
https://www.googleapis.com/auth/gmail.modify
https://www.googleapis.com/auth/calendar
https://www.googleapis.com/auth/gmail.send
https://www.googleapis.com/auth/gmail.readonly
https://www.googleapis.com/auth/drive
https://www.googleapis.com/auth/drive.file
https://www.googleapis.com/auth/drive.readonly
- 将凭证保存到
token.json
- 在控制台中显示刷新令牌
- 环境变量:
- 将 credentials.json 复制到项目根文件夹 (py-mcp-google-toolbox)
使用 Docker
- 构建 Docker 镜像:
- 运行容器:
使用本地
- 运行服务器:
配置 MCP 设置
将服务器配置添加到您的 MCP 设置文件:
克劳德桌面应用程序
- 要通过Smithery自动安装:
- 要手动安装,请打开
~/Library/Application Support/Claude/claude_desktop_config.json
将其添加到mcpServers
对象:
游标 IDE
打开~/.cursor/mcp.json
将其添加到mcpServers
对象:
对于 Docker
工具文档
Gmail 工具
list_emails
:列出 Gmail 收件箱中的最近电子邮件,并提供过滤选项search_emails
:执行高级 Gmail 搜索并检索详细的电子邮件内容send_email
:撰写并发送电子邮件,支持抄送、密送收件人modify_email
:通过修改标签来更改电子邮件状态(已读/未读、已存档、已删除)
日历工具
list_events
:检索指定时间范围内即将发生的日历事件create_event
:创建带有参与者、地点和描述的新日历事件update_event
:通过灵活的参数更新修改现有日历事件delete_event
:根据事件 ID 删除日历事件
驱动工具
read_gdrive_file
:从 Google Drive 文件中读取和检索内容search_gdrive
:使用可自定义的查询在 Google Drive 中搜索文件
搜索工具
search_google
:执行 Google 搜索并返回格式化的结果
发展
对于本地测试,您可以使用附带的客户端脚本:
执照
MIT 许可证
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
Google 工具箱
Related MCP Servers
- GoMIT License
- AsecurityAlicenseAqualityGoogle Workspace MCP ServerLast updated -36392PythonMIT License
- Go
Appeared in Searches
- Tools for finding trending keywords, ad costs, and storing data in Google Sheets
- How to Create Looker Dashboards
- Automating Workflow for File Processing and Communication
- A server for finding information using Google Search
- An analytics platform for tracking and understanding website and app performance