Google Drive文件管理服务

一个通过Model Context Protocol提供Google Drive文件搜索、读取、创建、共享和管理的服务。

  • by node2flow-th
  • TypeScript
  • 本地部署
  • 1 星标
  • 更新于
在 GitHub 查看 node2flow-th/google-drive-mcp-community

使用说明

@node2flow/google硬盘mcp

MCP服务器 Google 云端硬盘 --通过模型上下文协议,使用23个工具搜索、读取、创建、共享、注释和管理文件。

快速开始

克劳德桌面/光标

添加到MCP配置中:

{
  "mcpServers": {
    "google-drive": {
      "command": "npx",
      "args": ["-y", "@node2flow/google-drive-mcp"],
      "env": {
        "GOOGLE_CLIENT_ID": "your-client-id",
        "GOOGLE_CLIENT_SECRET": "your-client-secret",
        "GOOGLE_REFRESH_TOKEN": "your-refresh-token"
      }
    }
  }
}

HTTP模式

GOOGLE_CLIENT_ID=xxx GOOGLE_CLIENT_SECRET=xxx GOOGLE_REFRESH_TOKEN=xxx npx @node2flow/google-drive-mcp --http

MCP端点: http://localhost:3000/mcp

Cloudflare工作人员

可用网址: https://google-drive-mcp-community.node2flow.net/mcp

POST https://google-drive-mcp-community.node2flow.net/mcp?GOOGLE_CLIENT_ID=xxx&GOOGLE_CLIENT_SECRET=xxx&GOOGLE_REFRESH_TOKEN=xxx

工具(23)

文件(10)

工具 说明
gd_search_files 使用强大的查询语法(名称、类型、文件夹、日期)搜索/列出文件
gd_get_file 获取文件或文件夹的详细元数据
gd_read_file 读取/下载文件内容(文本文件)
gd_create_file 创建新文件或Google Workspace文档
gd_update_file 更新元数据--重命名、移动、星号、垃圾/取消跟踪
gd_copy_file 将文件复制到新位置
gd_delete_file 永久删除文件(不可逆)
gd_export_file 导出Google工作区文件(文档→文本、图纸→csv等)
gd_create_folder 创建新文件夹
gd_empty_trash 永久删除所有被丢弃的文件

权限(3)

工具 说明
gd_list_permissions 列出有权访问文件的人
gd_share_file 与用户、组、域或任何人共享
gd_unshare_file 删除用户或组的访问权限

评论(3)

工具 说明
gd_list_comments 列出文件的评论
gd_create_comment 向文件添加注释
gd_delete_comment 删除评论

回复(2)

工具 说明
gd_list_replies 列出对评论的回复
gd_create_reply 回复评论(可选解析线程)

共享驱动器(3)

工具 说明
gd_list_drives 列出共享驱动器
gd_create_drive 创建共享驱动器(仅限工作区)
gd_delete_drive 删除空的共享驱动器

修订(1)

工具 说明
gd_list_revisions 列出文件的修订历史记录

关于(1)

工具 说明
gd_about 获取用户信息、存储配额和驱动器功能

搜索查询语法

这 q 参数在 gd_search_files 支持强大的查询:

# By name
name = 'exact-name.txt'
name contains 'report'

# By type
mimeType = 'application/vnd.google-apps.folder'
mimeType = 'application/vnd.google-apps.document'
mimeType = 'application/pdf'

# By location
'folderId' in parents

# By status
trashed = false
starred = true

# By date
modifiedTime > '2024-01-01'
createdTime > '2024-06-01T00:00:00'

# Full-text search
fullText contains 'quarterly report'

# Combine with and/or
name contains 'report' and mimeType = 'application/pdf'
trashed = false and modifiedTime > '2024-01-01'

导出格式

使用 gd_export_file 要转换Google工作区文件,请执行以下操作:

来源 导出到
谷歌文档 text/plain, text/html, application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document (docx)
谷歌表格 text/csv, application/pdf, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (xlsx)
谷歌幻灯片 application/pdf, text/plain, application/vnd.openxmlformats-officedocument.presentationml.presentation (pptx)
谷歌绘图 image/png, image/svg+xml, application/pdf

配置

参数 必填 说明
GOOGLE_CLIENT_ID 是 来自谷歌云控制台的OAuth 2.0客户端ID
GOOGLE_CLIENT_SECRET 是 OAuth 2.0客户端密码
GOOGLE_REFRESH_TOKEN 是 刷新令牌(通过OAuth同意流获得)

获取您的凭据

  1. 首选 谷歌云控制台
  2. 创建项目→ 启用 Google Drive API
  3. 创建 OAuth 2.0客户端ID (桌面应用程序类型)
  4. 使用 OAuth游乐场 或者您的应用程序获取具有作用域的刷新令牌 https://www.googleapis.com/auth/drive

OAuth范围

范围 访问
drive 完全访问(读/写/删除)
drive.readonly 只读访问
drive.file 只有由应用程序创建或明确授予应用程序的文件

许可证

MIT许可证-请参阅 许可证

版权所有(c)2026 Node2Flow

链接