
Google Drive Files Mcp
io.github.zayansalman由 GitHub 帳號 zayansalman 發布v0.3.0更新於 Oct 24, 2026
Minimal MCP server for Google Drive file management and Google Sheets editing.
概覽
讓助理移動、上傳與整理 Google Drive 檔案,並就地編輯 Google 試算表與文件內容。
- 可以做什麼
- 這是一個本機 MCP 伺服器兼命令列工具,提供 23 個單一用途工具,涵蓋 Google Drive、試算表與文件。Drive 工具可搜尋、建立資料夾、真正移動檔案,並以可續傳上傳本機檔案(含大型二進位檔)。試算表工具可讀取、寫入、附加、清除、批次寫入、管理分頁、凍結窗格,並設定格式、欄寬與列高。文件工具可讀取附字元索引的文字,並進行範圍限定的取代、插入、刪除與附加編輯,不影響其他格式。
- 適用情境
- 當託管版 Google Drive 連接器不夠用時適合使用:需要真正的移動而非複製、需要上傳本機二進位檔,或需要就地編輯試算表儲存格與文件文字。它適合從 MCP 用戶端整理 Drive 資料夾,並對試算表與文件做精確、可稽核的編輯。
- 執行需求
- 以 Python 套件形式(pip 或 uv 安裝)透過 stdio 在本機執行,僅限桌面端。需要一個啟用 Drive API 的 Google Cloud 專案(試算表與文件工具還需啟用對應 API)、OAuth 桌面用戶端密鑰 JSON,以及一次瀏覽器授權。透過 GDRIVE_FILES_MCP_CREDENTIALS、GDRIVE_FILES_MCP_TOKEN 與 GDRIVE_FILES_MCP_SCOPES 設定;不附帶任何 API 金鑰。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Google Drive Files Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
google-drive-files-mcp
A focused Model Context Protocol server (and standalone CLI) for Google Drive file management (move, upload, organize), Google Sheets editing (cells, rows, tabs, format), and surgical Google Docs editing (replace a phrase, insert at an anchor, delete a range — leaving all other formatting untouched). Twenty-three granular, single-purpose tools — each an explicit operation, with writes returning before/after or precise indices so nothing changes silently.
Built because the hosted Google Drive connectors can search, read, and copy files, but cannot move them (copy duplicates a file with a new ID rather than relocating it), cannot reliably upload a real binary (their inline-content API needs the bytes embedded as base64, which breaks for large/binary files), and cannot edit spreadsheet or document contents in place. This server adds a true move, a resumable upload from a local path, folder creation, a full set of Google Sheets edits, and range-scoped Google Docs edits — for any MCP client (Claude Code, Claude Desktop, Cursor, Cline, etc.).
Tools
Drive — files & folders
drive_search(query, only_folders=False, max_results=20)— find files/folders (and their IDs).drive_create_folder(name, parent=None)— create a folder (parentaccepts an ID, URL,root, or an unambiguous folder name).drive_move(file, dest_folder, keep_existing_parents=False)— true move (removed from its current folder);keep_existing_parents=Trueadds without removing.drive_upload_file(local_path, parent=None, name=None, mime_type=None)— upload a local file (any type, incl. large binaries) via a resumable media upload. Stored as-is (no Google-format conversion).
Google Sheets — read, edit, structure, format
sheets_get_info(spreadsheet)— list tabs + sizes (call first to learn tab names).sheets_read(spreadsheet, range_a1, render_option="FORMATTED_VALUE")— read a range (FORMULA/UNFORMATTED_VALUEavailable).sheets_write(spreadsheet, range_a1, values, value_input_option="USER_ENTERED")— overwrite a range; returnsbefore.USER_ENTEREDparses numbers and makes=SUM(..)a formula;RAWwrites literally.sheets_append(spreadsheet, range_a1, values, ...)— append rows after a table.sheets_clear(spreadsheet, range_a1)— clear values (keeps formatting); returnsbefore.sheets_batch_write(spreadsheet, updates, ...)— write many ranges atomically.sheets_add_tab/sheets_rename_tab/sheets_delete_tab— manage tabs (delete is destructive).sheets_freeze_panes(spreadsheet, tab, rows=None, cols=None)— freeze/unfreeze header rows/cols (0 = explicitly unfreeze; omit = untouched).sheets_format(spreadsheet, range_a1, number_format=None, bold=None, background=None, wrap=None)— number pattern / bold /#RRGGBBbackground / text wrap.sheets_set_column_width(spreadsheet, range_a1, pixel_size)— set column width in pixels for a whole-column range (e.g.'A:C').sheets_set_row_height(spreadsheet, range_a1, pixel_size)— set row height in pixels for a whole-row range (e.g.'2:5').
Google Docs — surgical in-place editing
Every Docs edit is range-scoped (documents.batchUpdate), so it changes exactly what you target and leaves every other run's native formatting byte-for-byte intact.
docs_get_info(document)— title + structure (paragraph/table counts, end index).docs_read(document)— full text with per-segment character indices (table cells include row/col). Read this first to target edits.docs_replace_text(document, find, replace, match_case=False)— replace a phrase everywhere; surrounding content/formatting untouched.docs_insert_text(document, text, index=None, after_text=None, before_text=None)— insert at an index or right after/before an anchor phrase.docs_delete_range(document, start_index, end_index)— delete one precise range.docs_append_text(document, text)— append at the end.
No rename/copy/trash/delete of files (copy already exists in the hosted Drive connector); destructive ops (sheets_clear, sheets_delete_tab, docs_delete_range) are their own explicit tools so you control exactly when they run.
Scope warning (read this)
Moving an existing arbitrary file requires the full drive scope — read/write/delete on all your Drive files. There is no narrower scope that can change a file's parents (drive.file only covers files the app itself created). This tool is therefore far more powerful than a read-only connector. Treat its cached token like a password (stored 0600), and prefer an isolated OAuth client/token rather than sharing one with read-only tools.
Install
One-time setup (~10 min)
- Google Cloud Console → create/pick a project.
- Enable the Drive API (link); for the Sheets tools also enable the Sheets API (link); for the Docs tools also enable the Docs API (link). (The full
drivescope already authorizes the Sheets and Docs APIs — no extra consent, just enable each API you want.) - OAuth consent screen → Internal (Workspace; no verification needed even for the restricted full-drive scope) or External + add yourself as a test user (personal Gmail).
- Credentials → OAuth client ID → Desktop app → download JSON.
google-drive-files-mcp setup --import-credentials ~/Downloads/client_secret_*.json→ consent in the browser.
Verify:
Claude Code
Find my "Q2 Report" doc and move it into the "2026 Reports" folder.
Claude Desktop
CLI
drive_move returns the before/after parents so the move is auditable:
Configuration
Safety notes
- True move removes the file from its current folder. Drive items can have multiple parents;
keep_existing_parents=Trueadds without removing. - Folder-name destinations must be unambiguous. If two folders share a name,
drive_moverefuses and lists the candidates so you can pass an explicit ID. - The before/after parents are returned on every move so an agent (or you) can verify the result.
Troubleshooting
HttpError 403: Google Drive API has not been used in project … or it is disabled
Enable the Drive API on the project that owns your OAuth client: console.cloud.google.com/apis/library/drive.googleapis.com → Enable, then wait ~1 min and retry. (This is the single most common first-run error.)
multiple folders named '…'; pass the folder ID/URL instead
Two or more of your folders share that name, so a name is ambiguous. Run google-drive-files-mcp search "<name>" --folders to get the IDs and pass the exact one.
no folder named '…' found
Create it first (google-drive-files-mcp mkdir "<name>") or pass a folder ID/URL/root.
HttpError 403: insufficientFilePermissions when moving
Either the token lacks the full drive scope — re-authorize with google-drive-files-mcp setup --reauth — or you don't have edit rights on the file/destination (you can't move a file someone else owns unless they've granted you edit access).
No valid Google token from Claude Desktop / cron
The first consent needs a browser. Run google-drive-files-mcp setup once in a terminal; later headless runs reuse and auto-refresh the cached token.
A move "removed" a file from a shared folder unexpectedly
A true move removes the item from its current parent(s). If you meant to also keep it where it was, use keep_existing_parents=true (CLI --keep).
Use it from other clients (Cursor, Cline, Continue, …)
Any stdio MCP client works — see docs/other-clients.md.
Authentication — bring your own Google OAuth client
There are no API keys and no shipped secrets. The server authenticates to your Google account with an OAuth client you create, and caches a refresh token locally. The author has zero access to your data.
- Why your own client? Google's restricted scopes (here, the full
drivescope) can't be redistributed in a shared app, and an unverified shared app is capped at 100 users. "Bring your own OAuth client" is the standard pattern for personal-data MCP servers. - What you need: a free Google Cloud project, the Drive API enabled, an OAuth consent screen, and a Desktop OAuth client. Full walkthrough → docs/setup-google-oauth.md.
- Where your token lives:
~/.config/google-drive-files-mcp/token.json(mode0600). Delete it to revoke locally; revoke fully at myaccount.google.com/permissions. - No hosted/SaaS option — everything runs locally; your Drive data never touches a third-party server.
More guides
- docs/setup-google-oauth.md — full OAuth walkthrough (full-
drivescope) + common errors - docs/claude-code.md · docs/claude-desktop.md · docs/other-clients.md
- examples/ — e.g. file a document into a
YYYY-MMfolder
Related tools
Part of a small family of focused, local MCP servers for Google Workspace data the hosted connectors don't expose:
- gmail-attachments-mcp — download Gmail attachment bytes to disk
- google-drive-comments-mcp — read comment threads on Docs/Sheets/Slides
- google-drive-files-mcp — move/organize Drive files (this repo)
They can share one OAuth login or stay isolated — see each repo's setup.
License
MIT. See LICENSE.
來源:README.md,提交 3f99054
工具
0版本歷史
1- v0.3.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分