Token导航 LogoToken导航TokenDH.com
Py MCP Google Toolbox logo
搜索检索stdio官方级别未说明来源级核验

Py MCP Google Toolbox

MCP Server

一个MCP服务器,提供与Google服务(如Gmail、Google日历、Google Drive和Google搜索)交互的强大工具。

工具数

0

提示词数

0

GitHub Stars

10

资源数

0
日程管理PythonClaude搜索ClaudeCursor

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

jikime

提供方

jikime

最后核验

2026/5/17 20:20

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

uv run get_refresh_token.py

详细介绍

py-mcp谷歌工具箱

](https://smithery.ai/server/@jikime/py-mcp-google-toolbox) ![](https://badge.mcpx.dev?type=server "MCP Server") License

一个MCP服务器,为人工智能助手提供与谷歌服务交互的强大工具,包括Gmail、谷歌日历、谷歌云端硬盘和谷歌搜索。

概述

py-mcp谷歌工具箱提供以下与谷歌相关的功能:

  • Gmail操作(读取、搜索、发送、修改)
  • 谷歌日历管理(事件创建、列出、更新、删除)
  • Google Drive交互(搜索、读取文件)
  • 谷歌搜索集成(搜索网络)

目录

- Gmail工具 - 日历工具 - 驱动工具 - 搜索工具

先决条件

  1. python:安装Python 3.12或更高版本
  2. 谷歌云控制台设置:

- 首选 谷歌云控制台 - 创建新项目或选择现有项目 - 启用服务API: 1. 转到“API和服务”>“库” 1. 搜索并启用“Gmail API” 1. 搜索并启用“Google日历API” 1. 搜索并启用“Google Drive API” 1. 搜索格式并启用“自定义搜索API” - 从GCP设置OAuth 2.0凭据: 1. 转到“API和服务”>“凭据” 1. 点击“创建凭据”>“OAuth客户端ID” 1. 选择“Web应用程序” 1. 记下客户端ID和客户端密码 - 客户端ID - 客户端密钥 1. 下载secret json并重命名为credentials.json - 生成API密钥

  1. 首选 自定义搜索引擎 并获取其ID

安装

克隆

git clone https://github.com/jikime/py-mcp-google-toolbox.git
cd py-mcp-google-toolbox

配置

  1. 安装UV包管理器:
curl -LsSf https://astral.sh/uv/install.sh | sh
  1. 创建并激活虚拟环境:
uv venv -p 3.12
source .venv/bin/activate  # On MacOS/Linux
# or
.venv\Scripts\activate  # On Windows
  1. 安装依赖项:
uv pip install -r requirements.txt
  1. 获取刷新令牌(如果令牌已过期,则可以运行此令牌)
uv run get_refresh_token.py

这将:

  • 打开浏览器进行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
  • 在控制台中显示刷新令牌
  1. 环境变量:
cp env.example .env
vi .env
# change with your key
GOOGLE_API_KEY=your_google_api_key
GOOGLE_CSE_ID=your_custom_search_engine_id
GOOGLE_CLIENT_ID=your_google_client_id
GOOGLE_CLIENT_SECRET=your_google_client_secret
GOOGLE_REFRESH_TOKEN=your_google_refresh_token
  1. 将credentials.json复制到项目根文件夹(py-mcp-google工具箱)

使用Docker

  1. 构建Docker镜像:
docker build -t py-mcp-google-toolbox .
  1. 运行容器:
docker run py-mcp-google-toolbox

使用本地

  1. 运行服务器:
mcp run server.py
  1. 运行MCP检查器
mcp dev server.py

配置MCP设置

将服务器配置添加到MCP设置文件中:

Claude桌面应用程序

  1. 通过自动安装 史密瑟里:
npx -y @smithery/cli install @jikime/py-mcp-google-toolbox --client claude
  1. 手动安装

打开 ~/Library/Application Support/Claude/claude_desktop_config.json

将此添加到 mcpServers 对象:

{
  "mcpServers": {
    "Google Toolbox": {
      "command": "/path/to/bin/uv",
      "args": [
        "--directory",
        "/path/to/py-mcp-google-toolbox",
        "run",
        "server.py"
      ]
    }
  }
}

光标IDE

打开 ~/.cursor/mcp.json

将此添加到 mcpServers 对象:

{
  "mcpServers": {
    "Google Toolbox": {
      "command": "/path/to/bin/uv",
      "args": [
        "--directory",
        "/path/to/py-mcp-google-toolbox",
        "run",
        "server.py"
      ]
    }
  }
}

Docker

{
  "mcpServers": {
    "Google Toolbox": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "py-mcp-google-toolbox"
      ]
    }
  }
}

工具文档

Gmail工具

  • list_emails:列出Gmail收件箱中最近的电子邮件,并提供过滤选项
  • search_emails:通过详细的电子邮件内容检索执行高级Gmail搜索
  • send_email:撰写和发送支持CC、BCC收件人的电子邮件
  • modify_email:通过修改标签更改电子邮件状态(已读/未读、已存档、已丢弃)

日历工具

  • list_events:检索指定时间范围内即将发生的日历事件
  • create_event:创建包含与会者、位置和描述的新日历事件
  • update_event:通过灵活的参数更新修改现有日历事件
  • delete_event:按事件ID删除日历事件

驱动工具

  • read_gdrive_file:从Google Drive文件读取和检索内容
  • search_gdrive:使用可自定义的查询在Google Drive中搜索文件

搜索工具

  • search_google:执行谷歌搜索并返回格式化结果

发展

对于本地测试,您可以使用附带的客户端脚本:

# Example: List emails
uv run client.py list_emails max_results=5 query="is:unread"

# Example: Search emails
uv run client.py search_emails query="from:test@example.com"

# Example: Send email
uv run client.py send_email to="test@example.com" subject="test mail" body="Hello"

# Example: Modify email
uv run client.py modify_email id=MESSAGE_ID remove_labels=INBOX add_labels=ARCHIVED

# Example: List events
uv run client.py list_events time_min=2025-05-01T00:00:00+09:00 time_max=2025-05-02T23:59:59+09:00 max_results=5

# Example: Create event
uv run client.py create_event summary="new event" start=2025-05-02T10:00:00+09:00 end=2025-05-02T11:00:00+09:00 attendees="user1@example.com,user2@example.com"

# Example: Update event
uv run client.py update_event event_id=EVENT_ID summary="update event" start=2025-05-02T10:00:00+09:00 end=2025-05-02T11:00:00+09:00 attendees="user1@example.com,user2@example.com"

# Example Delete event
uv run client.py delete_event event_id=EVENT_ID

# Example: Search Google
uv run client.py search_google query="what is the MCP?"

# Example: Search Google Drive
uv run client.py search_gdrive query=mcp

# Example: Read file
uv run client.py read_gdrive_file file_id=1234567890

许可证

MIT许可证

目录标签

目录标签

日程管理PythonClaude搜索Google服务集成本地部署邮件管理日历管理文件管理网页搜索

支持客户端

ClaudeCursor

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

oauth

运行时(runtime,运行环境)

Python

部署方式(deploymentType,部署类型)

local-only

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiooauthlocal-only

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP