Token导航 LogoToken导航TokenDH.com
Clojure Google Drive MCP logo
文档知识未说明官方级别未说明来源级核验

Clojure Google Drive MCP

MCP Server

一个Clojure库,提供与Google Drive API的集成,支持文件搜索、文档读写、表格操作等功能。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
Cursor文档处理知识管理Cursor

安装说明

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

作者 / 组织

grain6pbc

提供方

grain6pbc

最后核验

2026/5/17 20:20

快速接入

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

详细介绍

Clojure-Google Drive MCP(或可译为“Clojure与Google Drive的MCP集成”,具体翻译可能根据上下文调整)

Clojure语言与Google Drive模型上下文协议(MCP)服务器的绑定

Neovedic时间戳12025-10-22--1600--CDT--moon-vishakha--09thhouse16--kae3g

______________________________________________________________________

🌾 代表稻田或谷物的符号,可翻译为“🌾(稻田/谷物)”或根据上下文简化为“🌾(农作物)”等,具体翻译需结合语境。若仅作为表情符号使用,可直接保留原样或译为“🌾(表情符号:稻田/谷物)”。 概述

一个全面的Clojure库,提供符合惯用法的绑定到(某种API或框架,原文未指明) @modelcontextprotocol/server-gdrive MCP服务器,实现在Clojure应用程序中无缝集成Google Drive。

是粮食网络生态系统的一部分。

______________________________________________________________________

📦 表示“包裹”或“箱子”。 安装

\deps.edn\ 是 Clojure 项目中用于管理依赖项的文件,其中文含义可以理解为“依赖项配置文件”或“依赖配置文件”。这个文件通常位于项目的根目录下,用于指定项目所需的各种库和版本信息

{:deps {grainpbc/clojure-google-drive-mcp {:git/url "https://github.com/grainpbc/clojure-google-drive-mcp"
                                           :git/sha "..."}}}

莱宁根

[grainpbc/clojure-google-drive-mcp "0.1.0"]

“Babashka”在中文中可以翻译为“老奶奶”或“奶奶”。这是一个对年长女性的亲切称呼,带有一定的敬意和亲切感

{:deps {grainpbc/clojure-google-drive-mcp {:local/root "../clojure-google-drive-mcp"}}}

______________________________________________________________________

🚀 表情符号“🚀”通常表示火箭、快速进展或激动人心的事情。在中文中,可以简单地翻译为“🚀(火箭/快速进展/激动人心)”。不过,由于表情符号本身具有直观性和象形性,直接使用“🚀”在中文语境中也能被广泛理解。 快速入门

(ns my-app.core
  (:require [clojure-google-drive-mcp.core :as gdrive]))

;; Initialize with credentials
(gdrive/init! {:credentials-path "~/.config/cursor/gdrive-credentials.json"})

;; Search for files
(gdrive/search "Grain Network")
;; => [{:id "1a2b3c4d..." :name "PSEUDO.md" :mimeType "application/vnd.google-apps.document"}]

;; Read a document
(gdrive/read-doc "1a2b3c4d5e6f7g8h9i0j")
;; => "# PSEUDO.md\n\nThis is the content..."

;; Write to a document
(gdrive/write-doc "1a2b3c4d5e6f7g8h9i0j" "Updated content")
;; => {:revision "v2" :modifiedTime "2025-10-22T16:00:00Z"}

;; List recent files
(gdrive/list-files {:page-size 10 :order-by "modifiedTime desc"})
;; => [{:id "..." :name "..." :modifiedTime "..."}]

______________________________________________________________________

🏗️ 翻译为中文是“建筑工地”或“正在建造中”。这个表情符号通常用来表示建筑、施工或建造的场景。 建筑学

┌─────────────────────────────────────────────────────┐
│      clojure-google-drive-mcp Library               │
├─────────────────────────────────────────────────────┤
│                                                     │
│  ┌──────────────────────────────────────┐          │
│  │   Clojure API (core.clj)             │          │
│  │  - search, read-doc, write-doc       │          │
│  │  - list-files, watch-doc             │          │
│  └──────────────────────────────────────┘          │
│                    ↓                                │
│  ┌──────────────────────────────────────┐          │
│  │   MCP Client (mcp.clj)               │          │
│  │  - JSON-RPC over stdio               │          │
│  │  - Process management                │          │
│  └──────────────────────────────────────┘          │
│                    ↓                                │
│  ┌──────────────────────────────────────┐          │
│  │   NPX Process                        │          │
│  │   @modelcontextprotocol/server-gdrive│          │
│  └──────────────────────────────────────┘          │
│                    ↓                                │
│  ┌──────────────────────────────────────┐          │
│  │   Google Drive API                   │          │
│  └──────────────────────────────────────┘          │
│                                                     │
└─────────────────────────────────────────────────────┘

______________________________________________________________________

📚 书籍 API 参考文档

初始化

init!

初始化MCP服务器连接。

(gdrive/init! {:credentials-path "path/to/credentials.json"
               :mcp-server-command "npx"
               :mcp-server-args ["-y" "@modelcontextprotocol/server-gdrive"]})

选项:

  • :credentials-path - OAuth凭证JSON文件的路径
  • :mcp-server-command - 运行MCP服务器的命令(默认:“npx”)
  • :mcp-server-args - MCP服务器的参数
  • :auto-authenticate - 自动打开浏览器进行OAuth认证(默认:true)

返回: 连接状态原子

______________________________________________________________________

文件操作

search

在Google云端硬盘中搜索文件。

(gdrive/search "query string")
(gdrive/search "query string" {:max-results 50})

参数:

  • query - 搜索查询字符串
  • opts - 可选地图,包含:

- :max-results - 最大结果数量(默认:100) - :mime-type - 按MIME类型过滤 - :order-by - 排序顺序

返回值: 文件映射的向量

list-files

列出Google云端硬盘中的文件。

(gdrive/list-files)
(gdrive/list-files {:page-size 20 :order-by "modifiedTime desc"})

参数:

  • opts - 可选地图,包含:

- :page-size - 每页文件数量 - :order-by - 排序字段和方向 - :page-token - 分页标记/分页令牌

返回值: 带有(某物/某信息的)地图 :files 向量和可选(项) :next-page-token

get-file

通过ID获取文件元数据。

(gdrive/get-file "1a2b3c4d5e6f7g8h9i0j")

返回值: 文件元数据映射

______________________________________________________________________

文档操作

read-doc

读取Google文档内容。

(gdrive/read-doc doc-id)
(gdrive/read-doc doc-id {:format :markdown})

参数:

  • doc-id - Google 文档 ID
  • opts - 可选地图,包含:

- :format - 输出格式(:plain-text:markdown:html)

返回值: 文档内容(作为字符串)

write-doc

在Google文档中撰写内容。

(gdrive/write-doc doc-id "New content")
(gdrive/write-doc doc-id "New content" {:append true})

参数:

  • doc-id - Google 文档ID
  • content - 想要写的内容
  • opts - 可选地图,包含:

- :append - 追加而非替换(默认:false) - :format - 输入格式(:plain-text:markdown:html)

返回: 更新结果并附上修订信息

append-to-doc

向Google文档追加内容。

(gdrive/append-to-doc doc-id "Additional content")

返回值: 更新结果

______________________________________________________________________

“Sheets Operations”可以翻译为“表格操作”或“工作表操作”,具体取决于上下文中的具体含义,但通常指的是在电子表格软件(如Excel)中对表格或工作表进行的各种操作,包括编辑、格式化、计算、排序、筛选等

read-sheet

读取Google Sheets中的数据。

(gdrive/read-sheet sheet-id)
(gdrive/read-sheet sheet-id {:range "A1:D10"})

参数:

  • sheet-id - Google 表格 ID
  • opts - 可选地图,包含:

- :range - A1记谱范围 - :sheet-name - 特定的表格名称

返回值: 行向量(每一行都是一个向量)

write-sheet

将数据写入Google表格。

(gdrive/write-sheet sheet-id [["A1" "B1"] ["A2" "B2"]])
(gdrive/write-sheet sheet-id data {:range "A1" :sheet-name "Sheet1"})

返回值: 更新结果

______________________________________________________________________

实时操作

watch-doc

监视文档以查看更改。

(gdrive/watch-doc doc-id
  (fn [change]
    (println "Document changed:" change)))

参数:

  • doc-id - 需关注的文档ID
  • callback - 每次更改时调用函数

返回值: 表把(与……一起使用) unwatch-doc)

unwatch-doc

停止观看文档。

(gdrive/unwatch-doc watch-handle)

______________________________________________________________________

共享与权限

share-file

与用户共享一个文件。

(gdrive/share-file file-id "user@example.com" :writer)
(gdrive/share-file file-id "user@example.com" :reader {:notify true})

角色: :owner:writer:commenter:reader

返回值: 权限对象

get-permissions

获取文件权限。

(gdrive/get-permissions file-id)

返回值: 权限映射向量

______________________________________________________________________

🔧 修理工具或扳手的符号,常用于表示需要修理或维护的场合。 配置

环境变量

# Set credentials path
export GDRIVE_CREDENTIALS_PATH="$HOME/.config/cursor/gdrive-credentials.json"

# Set MCP server command (optional)
export GDRIVE_MCP_COMMAND="npx"

# Enable debug logging
export GDRIVE_DEBUG=true

配置文件

创建 ~/.graindrive/config.edn

{:credentials-path "~/.config/cursor/gdrive-credentials.json"
 :mcp-server {:command "npx"
              :args ["-y" "@modelcontextprotocol/server-gdrive"]}
 :cache {:enabled true
         :ttl 300} ;; 5 minutes
 :logging {:level :info}}

______________________________________________________________________

🛠️(工具/修理的象征) 示例

示例1:珍娜的学习指南

(ns jenna.study-guide
  (:require [clojure-google-drive-mcp.core :as gdrive]))

;; Initialize
(gdrive/init! {:credentials-path "~/.config/cursor/gdrive-credentials.json"})

;; Create a new document
(def doc (gdrive/create-doc "Jenna Fluid Dynamics Midterm Guide"))

;; Share with Jenna
(gdrive/share-file (:id doc) "jenna@illinois.edu" :writer)

;; Add content
(gdrive/write-doc (:id doc)
  "# Fluid Dynamics Midterm Study Guide
  
  ## 1. Fundamental Concepts
  - Density, viscosity, pressure
  
  ## 2. Bernoulli's Equation
  ...")

;; Read current content
(def content (gdrive/read-doc (:id doc)))

;; Append new section
(gdrive/append-to-doc (:id doc)
  "
  ## 3. Practice Problems
  1. Calculate the pressure drop in a pipe...
  ")

;; Watch for Jenna's edits
(gdrive/watch-doc (:id doc)
  (fn [change]
    (println "Jenna updated the doc!")
    (println "New content:" (:content change))))

示例2:自动同步

(ns grain.sync
  (:require [clojure-google-drive-mcp.core :as gdrive]
            [clojure.java.io :as io]))

(defn sync-local-to-drive
  "Sync local markdown file to Google Doc"
  [local-path doc-id]
  (let [content (slurp local-path)]
    (gdrive/write-doc doc-id content)
    (println "Synced to Drive:" local-path)))

(defn sync-drive-to-local
  "Sync Google Doc to local markdown file"
  [doc-id local-path]
  (let [content (gdrive/read-doc doc-id {:format :markdown})]
    (spit local-path content)
    (println "Synced from Drive:" local-path)))

(defn bidirectional-sync
  "Perform bidirectional sync with conflict detection"
  [doc-id local-path]
  (let [local-content (slurp local-path)
        remote-content (gdrive/read-doc doc-id {:format :markdown})]
    (if (= local-content remote-content)
      (println "Already in sync")
      (do
        (println "Conflict detected - merging...")
        ;; Smart merge logic here
        ))))

示例3:批处理操作

(ns grain.batch
  (:require [clojure-google-drive-mcp.core :as gdrive]))

;; Find all Grain Network docs
(def grain-docs
  (gdrive/search "name contains 'Grain' and mimeType = 'application/vnd.google-apps.document'"))

;; Read all docs
(def all-content
  (mapv (fn [doc]
          {:name (:name doc)
           :content (gdrive/read-doc (:id doc))})
        grain-docs))

;; Backup all docs
(doseq [doc grain-docs]
  (let [content (gdrive/read-doc (:id doc))
        backup-path (str "backup/" (:name doc) ".md")]
    (io/make-parents backup-path)
    (spit backup-path content)
    (println "Backed up:" (:name doc))))

______________________________________________________________________

🔒 表示“锁定”或“安全”的符号。 安全

OAuth 范围(或权限)

此库请求以下范围:

  • https://www.googleapis.com/auth/drive.file - 访问此应用程序创建的文件
  • https://www.googleapis.com/auth/drive.readonly - 读取访问权限(可选)

凭证存储

# Secure your credentials
chmod 600 ~/.config/cursor/gdrive-credentials.json

# Never commit credentials
echo "gdrive-credentials.json" >> .gitignore
echo "token.json" >> .gitignore

令牌刷新

令牌由MCP服务器自动刷新,无需人工干预。

______________________________________________________________________

🧪(表示化学实验或科学实验的符号) 测试

# Run tests
bb test

# Run with coverage
bb test:coverage

# Integration tests (requires credentials)
bb test:integration

______________________________________________________________________

📊 表格/数据图表 表现/性能

缓存

;; Enable caching for better performance
(gdrive/init! {:credentials-path "..."
               :cache {:enabled true
                       :ttl 300}}) ;; 5 minutes

;; Cache is automatically invalidated on writes

批量请求

;; Read multiple docs efficiently
(gdrive/batch-read ["doc-id-1" "doc-id-2" "doc-id-3"])
;; => [{:id "doc-id-1" :content "..."} ...]

______________________________________________________________________

🌾 稻谷或田野的符号,常用来表示农业、丰收或乡村生活等意象。 谷物网络集成

依赖项

  • clojure-s6 - 同步服务的守护进程管理
  • clojure-sixos - 文件系统监控
  • grainclay - 不可变的版本历史
  • grainneovedic - 时间意识

在Graindrive中的使用

(ns graindrive.core
  (:require [clojure-google-drive-mcp.core :as gdrive]
            [clojure-s6.core :as s6]
            [grainclay.core :as clay]
            [grainneovedic.core :as neovedic]))

(defn start-sync-daemon
  [doc-id local-path]
  (s6/define-service
    :name "gdrive-sync"
    :run (fn []
           (loop []
             (let [content (gdrive/read-doc doc-id)
                   timestamp (neovedic/now)
                   clay-path (str "sync/" doc-id "--" timestamp ".md")]
               (spit local-path content)
               (clay/write clay-path content)
               (Thread/sleep 5000)
               (recur))))))

______________________________________________________________________

🐛 表示“虫子”或“bug(软件错误)”。在中文里,这个表情通常用来表示发现了一个问题或者错误,类似于“我发现了个bug”这样的意思。 故障排除

问题:“未找到 NPX”

# Install Node.js
nvm install node

问题:“身份验证失败”

# Remove cached token
rm ~/.cache/@modelcontextprotocol/server-gdrive/token.json

# Re-authenticate
bb gdrive:auth

问题:“权限被拒绝”

  • 在 Google Cloud Console 中检查 OAuth 同意屏幕设置
  • 确保您的电子邮件已被添加为测试用户
  • 验证作用域是否正确配置

______________________________________________________________________

📚 书籍 资源

______________________________________________________________________

📄(文件/纸张) 许可证

麻省理工学院许可证

版权所有 (c) 2025 国家粮食和物资储备局(注:PBC在此处根据上下文推测为“Public Bureau of Grain and Materials Reserve”的缩写,实际翻译可能需根据具体组织名称调整,但通常PBC在金融领域指中国人民银行,此处显然不符,故采用上述推测翻译)

特此免费授予任何获得本副本的人员以下许可: 对于此软件及其相关文档文件(以下简称“软件”),进行处理 在软件中不受限制地使用,包括但不限于以下权利 使用、复制、修改、合并、发布、分发、再许可和/或销售 软件的副本,并允许软件的使用者 经授权可执行此操作,但需遵守以下条件:

上述版权通知及本许可通知应包含在所有(作品/文件/材料等)中 软件的副本或其大部分内容。

该软件按“现状”提供,不附带任何形式的明示或暗示保证 暗示的,包括但不限于商品适销性保证, “特定用途的适用性和无侵权性。在任何情况下,均不得……” 作者或版权所有者对任何索赔、损害或其他(情况)不承担责任 责任,无论是因合同、侵权行为还是其他原因而产生, 因软件或与软件相关,或因使用软件或其他与软件相关的交易而产生的 软件。

______________________________________________________________________

作为粮食网络生态系统的一部分 🌾 表示稻田或农作物生长的符号,可翻译为“🌾(稻田/农作物生长)”。在中文语境中,这个符号常用来象征农业、丰收或自然生长的意象。\ 创建12025-10-22--16:00--CDT--月亮位于室女座--第9宫16分--kae3g\ 由……维护谷物PBC(注:PBC在此处可能是一个特定上下文中的缩写或术语,但根据常规理解,它并不直接对应一个广为人知的中文词汇,因此保留原样。如果PBC在特定领域有明确含义,请根据具体语境翻译)\ 组织https://github.com/grainpbc(直接翻译为中文网址形式,但通常网址不翻译,保持原样)

目录标签

目录标签

Cursor文档处理知识管理GoogleDrive集成本地部署Clojure库文件管理文档操作表格处理

支持客户端

Cursor

接入字段

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

未说明

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

oauth

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

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

0

权限和风险

未说明oauth部署方式未说明

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

安装前确认

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

仍需确认:installCommand

来源信息

继续浏览同类 MCP