Google Drive 扩展
🎥Plug & Play
Watch the demo
服务器已归档
本教程介绍如何将 Google Drive MCP 服务器 添加为 goose 扩展,以便列出、读取和搜索 Google Drive 中的文件。
快速安装
- goose Desktop
- goose CLI
命令
GDRIVE_OAUTH_PATH=$USER_HOME/.config/gcp-oauth.keys.json \
GDRIVE_CREDENTIALS_PATH=$USER_HOME/.config/.gdrive-server-credentials.json \
npx -y @modelcontextprotocol/server-gdrive auth \
npx -y @modelcontextprotocol/server-gdrive
环境变量
GDRIVE_CREDENTIALS_PATH: $USER_HOME/.config/.gdrive-server-credentials.json
GDRIVE_OAUTH_PATH: $USER_HOME/.config/gcp-oauth.keys.json
信息
环境变量中必须使用绝对路径。请务必将 $USER_HOME 替换为你的主目录。
配置
信息
运行此命令需要在系统上安装 Node.js,因为它使用 npx。
要获取 Google Drive 服务器凭据和 OAuth 密钥,请按以下步骤操作:
-
设置 Google Cloud 凭据,以启用 API 访问:
- 创建 Google Cloud 项目
- 前往 Google Cloud Console 并创建新项目
location可以保持为No organization
- 启用 Google Drive API
- 在项目中前往 API 产品库
- 查看左上角,确认你在正确的项目中
- 搜索
Google Drive API并启用它
- 创建 Google Cloud 项目
-
配置 OAuth 同意屏幕
- 前往 OAuth 同意屏幕
- 填写必填信息:
project name、user support email Audience选择Internal,然后按create- 如果无法选择
Internal,请选择External并执行以下额外步骤:- 前往 Audience 页面
- 在
Test users下点击Add Users
-
创建 OAuth 凭据
- 前往 OAuth Clients
- 点击
Create Client - 选择 Application Type: Desktop App
- 下载 JSON 密钥文件
- 将其重命名为
gcp-oauth.keys.json - 把它移到扩展可以访问的安全位置:
mv ~/Downloads/gcp-oauth.keys.json ~/.config/gcp-oauth.keys.json
-
连接 Google 账号
要连接 Google 账号,在终端中运行以下身份验证命令:
GDRIVE_OAUTH_PATH=$USER_HOME/.config/gcp-oauth.keys.json \
GDRIVE_CREDENTIALS_PATH=$USER_HOME/.config/.gdrive-server-credentials.json \
npx -y @modelcontextprotocol/server-gdrive auth信息将
$USER_HOME替换为你的主目录。浏览器窗口会打开以进行身份验证。按照提示连接 Google 账号并完成 OAuth 流程。此时,环境变量
GDRIVE_CREDENTIALS_PATH会被设为已保存的凭据。
提示
使用 Google Drive 扩展时,你需要每天重新身份验证一次。要重新验证,只需在终端中再次运行身份验证命令。
- goose Desktop
- goose CLI
- Launch the installer
- Click
Yesto confirm the installation - Obtain your GDRIVE_CREDENTIALS_PATH, GDRIVE_OAUTH_PATH and paste them as environment variables
- Click
Add Extension - Click the button in the top-left to open the sidebar
- Navigate to the chat
信息
- 对于
GDRIVE_CREDENTIALS_PATH,输入$USER_HOME/.config/.gdrive-server-credentials.json - 对于
GDRIVE_OAUTH_PATH,输入$USER_HOME/.config/gcp-oauth.keys.json
将 $USER_HOME 替换为你的主目录。必须指定绝对路径,此扩展才能工作。
- 运行
configure命令:
goose configure
- 选择添加
Command-line Extension
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension (Connect to a new extension)
│
◆ What type of extension would you like to add?
│ ○ Built-in Extension
│ ● Command-line Extension (Run a local command or script)
│ ○ Remote Extension (Streamable HTTP)
└
- 为扩展命名
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension (Connect to a new extension)
│
◇ What type of extension would you like to add?
│ Command-line Extension
│
◆ What would you like to call this extension?
│ google drive
└
- 输入命令
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension (Connect to a new extension)
│
◇ What type of extension would you like to add?
│ Command-line Extension
│
◇ What would you like to call this extension?
│ google drive
│
◆ What command should be run?
│ npx -y @modelcontextprotocol/server-gdrive
└
- 输入 goose 在操作完成前应等待的秒数,超时后会中止。默认是 300 秒
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension (Connect to a new extension)
│
◇ What type of extension would you like to add?
│ Command-line Extension
│
◇ What would you like to call this extension?
│ google drive
│
◇ What command should be run?
│ npx -y @modelcontextprotocol/server-gdrive
│
◆ Please set the timeout for this tool (in secs):
│ 300
└
- 选择是否添加描述。如果这里选择 “Yes”,系统会提示你输入扩展描述。
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension (Connect to a new extension)
│
◇ What type of extension would you like to add?
│ Command-line Extension
│
◇ What would you like to call this extension?
│ google drive
│
◇ What command should be run?
│ npx -y @modelcontextprotocol/server-gdrive
│
◇ Please set the timeout for this tool (in secs):
│ 300
│
◇ Would you like to add a description?
│ No
└
- 添加环境变量
┌ goose-configure
│
◇ What would you like to configure?
│ Add Extension (Connect to a new extension)
│
◇ What type of extension would you like to add?
│ Command-line Extension
│
◇ What would you like to call this extension?
│ google drive
│
◇ What command should be run?
│ npx -y @modelcontextprotocol/server-gdrive
│
◇ Please set the timeout for this tool (in secs):
│ 300
│
◇ Would you like to add a description?
│ No
│
◆ Would you like to add environment variables?
│ Yes
│
◇ Environment variable name:
│ GDRIVE_CREDENTIALS_PATH
│
◇ Environment variable value:
│ ~/.config/.gdrive-server-credentials.json
│
◇ Add another environment variable?
│ yes
|
◇ Environment variable name:
│ GDRIVE_OAUTH_PATH
│
◇ Environment variable value:
│ ~/.config/gcp-oauth.keys.json
│
└ Added google drive extension
使用示例
在这个示例中,我将用 goose 快速收集并总结 30 分钟后市场营销预算评审会议所需的重要信息。我会让 goose 从 Google Drive 找出相关文档,总结第一季度表现,突出市场营销自动化和视频制作方面的关键决策,并找出上次会议遗留的待办事项。
goose 提示词
30 分钟后我有一场重要的市场营销预算评审会议,需要你帮我准备。Google Drive 里有我们先前会议和规划环节的几份文档。你能帮我:
1. 找出所有与市场营销预算和表现相关的文档
2. 快速总结我们的第一季度表现
3. 突出我们需要就市场营销自动化工具和视频制作做出的关键决策
4. 找出上次会议遗留的待办事项
我需要一份快速但全面的概览,以便有准备地走进这场会议。
goose 输出
我来帮你准备会议。先列出 Google Drive 中的可用资源,确保我们访问的是正确的文件。
[... 列出资源 ...]
很好!我看到几份相关文档。我逐一访问它们,收集你需要的信息。
[... 读取资源 ...]
根据这些文档,这是你的会议全面概览:
第一季度表现摘要:
- 总体比预算低 5%(花费 $104,200,预算 $107,000)
- 数字营销表现良好,ROI 最高:
- 邮件营销:ROI 3.2
- Google Ads:ROI 2.4
- 内容营销:ROI 2.1
- 社交媒体互动比上一季度上升 23%
- 内容营销博客文章带来的线索是预期的 2 倍
需要做出的关键决策:
1. 市场营销自动化工具(许可证即将续期):
- 当前工具(BasicAutomation Pro):每年 $12,000
- 选项:
- GrowthStack(每年 $15,000)- 推荐选项,功能与价格平衡
- MarketingHub Enterprise(每年 $18,000)- 带 AI 功能的高端选项
- 需要决定是升级还是维持当前方案
- 如果更换供应商,实施需要 6 周
2. 视频制作投入:
- 三家供应商:
- CreativeForce Media($16,200)- 最全面,无限次修改
- VisualCraft Studios($14,500)- 稳妥的中间选项
- Digital Narrative Pro($12,800)- 基础套餐
- 尽管成本更高,仍推荐 CreativeForce Media,因为交付物全面
- 时间线视供应商而定,为 3 到 5 周
上次会议遗留的待办事项:
1. Sarah 需要展示视频内容投入的 ROI 分析
2. John 需要完成软件许可证审查
3. Lisa 将展示新的 PPC 策略
4. Mike 已完成视频制作机构的报价
第二季度规划考虑:
- 建议第二季度预算增加 12%(合计 $120,000)
- 可能需要根据新工具和视频制作的决策重新分配
- PPC 策略审查仍待进行
需要我更详细地聚焦这份概览的某个方面吗?