gdrive-mcp
gdrive-mcp lets you read and write Google Drive, Docs, Sheets, and Calendar with bounded reads, spill-to-disk, confirm-gated mutations, and dry-run previews.
Drive: resolve links/IDs, search files, list folders, get metadata.
Docs: read/paginate as markdown/text, extract images/comments, create and edit text with markdown, colors, locators, dry-run.
Sheets: preview sheets, save full tabs to CSV, write/append/format/clear/delete rows, create spreadsheets/tabs.
Calendar: list calendars/events/freebusy, create/update/delete events, RSVP, with previews, ETags, dry-run, notification controls.
Files: read text, download/upload, import Excel as Sheets, move/rename/export, all local I/O sandboxed.
Safety: confirm-gated destructive writes, dry-run previews, audit log, verification gate for selected models.
Provides tools for interacting with Google Drive, including reading and writing Google Docs and Google Sheets, searching files, managing folders, and more.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gdrive-mcp show me files named 'report' in my Drive"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gdrive-mcp
A read/write MCP for Google Drive, Docs, Sheets, Slides & Calendar that fixes what trips agents on naive Google Workspace servers — context floods, unguarded destructive writes, surprise attendee notifications, and inconsistent argument names — with bounded/paged reads, spill-to-disk for full data, and confirm-gated mutations.
Conventions: Drive/Docs/Sheets/Slides tools take their target as
item(a URL or ID); Calendar tools use explicitcalendar_id/event_idarguments. Unknown args are rejected; destructive tools (ᶜ) return an impact preview unless called withconfirm=true.Dry-run (edit-only): the edit tools for existing files —
append_text,insert_text,insert_table,delete_text,replace_text,write_sheet,append_rows,format_cells,clear_range,delete_rows, and the Slides edit tools (add_slide,duplicate_slide,move_slide,delete_slide,replace_slide_text,set_shape_text,set_speaker_notes,add_slide_comment) — plus all Calendar mutation tools acceptdry_run=true, returning a predicted before/after without writing (client-side;write_sheetshows formula cells literally, so Google's recalculation isn't simulated, and Docsinsert_textreports the insertion point rather than a merged string). Dry-runs are still subject to the verification gate.Editing a Doc by content, not by offset:
delete_text/replace_text(andinsert_text/insert_table'safter/before) locate their target with a locator —match(a literal, case-sensitive substring lying within one paragraph) orsection(a heading's exact text, covering that heading and everything under it up to the next heading of the same or higher level). Character offsets intoread_document's content are not valid Docs indexes: that content is rendered markdown (heading prefixes, synthesized table delimiter rows, escaped pipes) and does not align with the document's UTF-16 index space. The server resolves locators against the API's own element offsets instead, so anchors are always valid — and for block content they land on a paragraph boundary by construction. Eachread_documentoutlineentry also carries realstart/endoffsets, plus arevision_id; locator writes pin that revision, so a concurrent edit makes the write fail rather than land on shifted text.Colored text (opt-in):
append_text/insert_texttake an optionalcolor(hex, e.g.#3366CC) applied only when explicitly passed — unset = plain text.read_document(include_colors=true)returnscolored_runs(spans with an explicit foreground color).Formatted writes (opt-in):
append_text/insert_text/create_documentacceptmarkdown=true, rendering a small dialect —#…######headings,-/*bullets,1.numbered lists (nest with two spaces or a tab per level),**bold**,*italic*,<u>underline</u>, and GFM pipe tables (a header row immediately followed by a| --- | --- |delimiter row — a lone| a | b |line with no delimiter stays literal text). The only escape is\|for a literal pipe inside a table cell; otherwise text that looks like markup gets styled (leavemarkdownunset to store text verbatim). Table round-trip preserves structure and plain cell text — cell emphasis and multi-paragraph cells are not preserved on read. In Sheets,format_cellssets bold/italic/underline on a cell range without touching values.Local-file sandbox: all local file I/O is confined to
GDRIVE_MCP_FILES_DIR(default a private0700dir under the config dir) —download_file/export_file/read_full_sheetwrite there (relativedest_path; absolute paths and..rejected, files0600), andupload_file(source_path)/import_excel_as_sheet(source_path)read only from there. This stops a prompt-injected agent from writing to~/.sshor exfiltrating arbitrary local files to Drive. Fetched Doc images are pulled only from Google hosts (the OAuth token is never sent elsewhere).Spilled-file retention + audit: files spilled to the sandbox are swept on server start once older than
GDRIVE_MCP_FILES_TTL_HOURS(default 24;0disables) — for a long-lived server, restart to dispose, or lower the TTL. The sweep is ownership-gated: it only runs in a sandbox gdrive-mcp itself created (tracked by a.gdrive-mcp-sandboxmarker file), so pointingGDRIVE_MCP_FILES_DIRat a pre-existing directory never deletes the files already there — a startup warning notes the skipped sweep, and creating the marker file yourself opts the directory in. Every tool call is appended to an audit log (GDRIVE_MCP_AUDIT_LOG, defaultaudit.login the config dir) recording user, tool, target id, and outcome — never the content read or written.Verification gate: set
GDRIVE_MCP_VERIFICATION_MODEL_PATTERNSto comma-separated, case-insensitive model-name substrings when selected model families should require per-call user approval via MCP elicitation. A match from either the operator pinGDRIVE_MCP_CALLING_MODELor the request's self-reported_meta.modelturns the gate on; a nonmatching request model cannot turn off an operator-pin match. SetGDRIVE_MCP_REQUIRE_VERIFICATION=alwaysto gate every call regardless of model. Gated calls fail closed on decline or when the client cannot prompt. Because request metadata is advisory, enforce mandatory policy with deployment-controlled environment variables and credential boundaries.
Tools
Discovery
resolve_link— resolve any Drive/Docs/Sheets URL or ID into its id, kind, name, and link.search_files— find files by name, full-text content, MIME type, and/or parent folder.list_folder— list a folder's direct children.get_metadata— full metadata for a file: owner, timestamps, size, parents, sharing.
Docs
read_document— read a Doc as markdown/text in bounded ~8k-char chunks (paginated, with anoutlinecarrying each heading'sstart/endoffsets, plusrevision_id); reads all tabs by default or a specifictab.extract_images— pull embedded images (inline and positioned/floating) out as viewable images, in document order (tab-aware).create_document— create a new Doc, optionally with initial content (markdown=truefor formatted).append_text— append text to the end of a Doc, targeting a chosen tab (markdown=truefor headings/lists/bold/italic/underline).insert_text— insert textafter/beforea matched substring (or at a rawindex), targeting a chosen tab (markdown=trueas above).insert_table— insert a table filled from arowsgrid (append, orafter/beforea match, or at anindex;header=truebolds the first row).**
delete_text**ᶜ — delete a matched substring or a whole headingsection.**
replace_text**ᶜ — replace a matched substring or a wholesection(markdown=truefor formatted replacements; useinsert_tablefor tables).read_comments— list a doc/file's comments and replies.add_comment— add an (unanchored) comment.
Sheets
read_sheet— a bounded 5×5 preview of each tab (configurablemax_rows/max_cols; passa1_rangefor an exact range;values=FORMULAfor formulas).read_full_sheet— read a whole tab, save it to a local CSV, and return the path + exacttotal_rows/total_cols+ the 5×5 preview.**
write_sheet**ᶜ — write rows starting at a cell; gated when it would overwrite non-empty cells.append_rows— append rows after the last row (non-destructive).format_cells— set bold/italic/underline on a bounded A1 range (tri-state flags; values untouched).create_spreadsheet— create a new spreadsheet with optional named tabs.add_tab— add a tab to an existing spreadsheet.**
clear_range**ᶜ — clear the values in an A1 range.**
delete_rows**ᶜ — delete N rows from a tab.
Slides
read_presentation— read a deck as text in bounded chunks: each slide'sidand layout, every element'sid, type and text (tables cell by cell), speaker notes and comment threads (status, author, assignee, replies), plus anoutline, the deck'slayoutsandrevision_id;slidereads just one.create_presentation— create a new deck (in My Drive root).add_slide— add a slide from a predefined layout or one of the deck's own layouts (by id or name), at aposition, optionally filling its title and body placeholders.duplicate_slide— copy a slide, placed right after the original.move_slide— move a slide to a new 1-basedposition.**
delete_slide**ᶜ — delete a slide; the preview shows its title, element count and text.**
replace_slide_text**ᶜ — replace a literal phrase on every slide (or oneslide), in shapes and table cells; layouts, masters and speaker notes are never touched.**
set_shape_text**ᶜ — set the whole text of one shape, placeholder or table cell (row/column), by elementid; gated only when it overwrites existing text.**
set_speaker_notes**ᶜ — set a slide's speaker notes; gated only when it overwrites existing notes.**
add_slide_comment**ᶜ — comment on a slide (or pin it to one element), optionally assigned to someone (the editor's "Assign to") and/or @mentioning people. Assignees and mentions must be email addresses — a name like@Samcan't be resolved to an account. Assigning or mentioning emails the person, so it previews unless called withconfirm=true; a plain comment needs no confirmation. Uses the Slides API'sinsertComment, which the Drive comments API cannot substitute for: Drive-API comments are never assigned or anchored to a slide.
Slides are addressed by a 1-based number (as a string, e.g. "3") or by the stable object id from read_presentation — prefer ids, since numbers shift as slides are added, moved or deleted. Edits that resolve against a read pin that deck's revisionId, so a concurrent edit makes the write fail rather than land on the wrong content.
Calendar
list_calendars— list subscribed calendars with time zone, access role, and pagination.list_events— list expanded event instances in a bounded time window, with search and pagination.get_event— retrieve one event by calendar ID and API event ID.query_freebusy— retrieve availability-only busy intervals for up to 50 calendars.**
create_event**ᶜ — create timed/all-day or recurring events with optional attendees, reminders, and Google Meet; supports caller-supplied IDs for idempotent retries.**
update_event**ᶜ — partially update an event with a live before/after preview and preview-bound ETag concurrency protection.**
delete_event**ᶜ — delete one event, recurring instance, or recurring series with a live preview and preview-bound ETag protection.**
respond_to_event**ᶜ — accept, tentatively accept, or decline an invitation without changing other attendees' responses, with preview-bound ETag protection.
Calendar writes default to send_updates=none; callers must explicitly select externalOnly or all to email attendees. Every Calendar mutation previews unless called with confirm=true, and dry_run=true never writes even when confirmed. For update, delete, and RSVP, copy the previewed event etag into the confirmed call; if the event changed after preview, the write is refused. Timed values require RFC3339 offsets, recurring timed events also require an IANA time_zone, all-day end dates are exclusive, and Google permits at most five reminder overrides.
Files
read_file_as_text— a file's content as text in bounded chunks (Google-native exported; PDFs text-extracted).download_file— download a binary file (base64 if small, else written to disk).**
upload_file**ᶜ — create a new file, or replace an existing file's content (replace is gated).import_excel_as_sheet— upload an Excel file (.xlsx/.xls) from the sandbox and convert it to a native Google Sheet (always a new file).**
move_file**ᶜ — move a file into aparentfolder.**
rename_file**ᶜ — rename a file.export_file— export a Google-native file to pdf / docx / xlsx / pptx / csv / txt / md / html.
Related MCP server: google-mcp
Quick install
Requires uv, the Claude Code CLI (claude), and your own Google OAuth client (see Setup). Then:
git clone https://github.com/shivankj11/gdrive-mcp.git && cd gdrive-mcp && bash setup.shsetup.sh is idempotent — re-run it any time. It installs uv (if missing), runs the one-time Google browser consent, and registers the server with Claude Code. It looks for the Desktop-app OAuth client JSON in this order: an existing ~/.config/gdrive-mcp/oauth_client.json; a GDRIVE_MCP_OAUTH_CLIENT_CMD that prints the JSON; or a plaintext oauth_client.json at the repo root. If none is found it tells you how to create one.
Setup (one-time, per Google account)
Required prerequisite: Google Desktop-app OAuth client JSON. Neither the binary
nor auth creates this file. Senders and recipients of a binary/zip should follow
Binary handoff: packaging, credentials, and installation.
The packager can include the app configuration in a private archive; every recipient
still signs in as themselves to create their own token.
In a Google Cloud project you control, create an OAuth client (Application type Desktop app) and configure its consent screen. The
drivescope is restricted, so follow Google's verification requirements (for personal use, add yourself as a test user).Enable the Drive, Docs, Sheets, Slides, and Calendar APIs. Drive/Docs/Sheets/Slides use the
drivescope (Slides needs no new consent, but its API must be enabled); Calendar uses separate narrow calendar-list, event, and free/busy scopes.Save the client JSON to
~/.config/gdrive-mcp/oauth_client.json(or setGDRIVE_MCP_OAUTH_CLIENT), then:
uv run gdrive-mcp auth # one-time loopback-OAuth browser consent; caches a token
uv run gdrive-mcp whoami # verifyAn older cached token that predates Calendar support is rejected with a directed re-consent
message. Run uv run gdrive-mcp auth again to grant the added narrow Calendar scopes; existing
Drive access is retained through incremental authorization.
You authenticate as yourself, so the server can only reach what your own Google account already can.
Register with an MCP client
claude mcp add gdrive -- uv run --directory /path/to/gdrive-mcp gdrive-mcp serveRust implementation (rust/)
rust/ holds a second, self-contained implementation of the same server — same 48 tools, same
argument names, same result shapes, same confirm/dry-run/locator/gate semantics — as a single
static binary with no Python runtime. The two are interchangeable: they read the same
~/.config/gdrive-mcp/oauth_client.json and write the same token.json (byte-compatible with
google-auth's format), so authenticating with one authenticates the other, and every
GDRIVE_MCP_* variable in Configuration means the same thing to both.
cargo install --path rust # or: cargo build --release --manifest-path rust/Cargo.toml
# First install Desktop-app OAuth JSON; see Setup above and docs/BINARY_HANDOFF.md.
gdrive-mcp auth # one-time browser consent (skip if the Python side already ran it)
gdrive-mcp whoami # verify
claude mcp add gdrive -- gdrive-mcp serveNotable differences, all internal:
Google APIs are called directly over REST (
reqwest) instead of through a discovery document, behind aGoogleApitrait so the tool tests run against a recording fake.MCP is served by
rmcp, the official Rust SDK; the verification gate prompts through its elicitation support, andtests/server_integration.rsdrives the registered path with a real in-memory MCP client (annotations, strict schemas, and every accept/decline/no-prompt branch).Argument handling reproduces both of FastMCP's layers, not just the strict one: unknown arguments are rejected (
extra="forbid"), and a list sent as a JSON string or a boolean sent as"true"is coerced the way pydantic's lax mode did, because MCP clients really send those.PDF text extraction uses
pdf-extractrather thanpypdf, so extracted text may differ in whitespace for unusual PDFs.The markdown dialect's inline rules need lookaround, which Rust's default
regexengine does not support, somd.rsusesfancy-regexfor exactly those two patterns — with\wand\sspelled out, since the two engines define them differently.
Known behavioural divergences, both confined to how a spilled filename is spelled: A1 cells accept
only ASCII digits (Python's \d also matched other Unicode digits), and localfs's filename
sanitiser keeps Unicode combining marks where Python replaced them with _. Neither affects
containment or content.
cargo test --manifest-path rust/Cargo.toml # unit + integration tests, no credentials needed
python3 scripts/diff_tool_surface.py # both servers advertise an identical tool surfaceSee VERIFICATION.md for what each implementation's tests actually pin, and for
the live credentialed runs.
Configuration
Env var | Default | Purpose |
|
| Desktop-app OAuth client JSON |
|
| Cached per-user token |
|
| Sandbox for local file I/O — download/export/CSV writes and upload sources are confined here (absolute/ |
|
| Age (hours) after which spilled sandbox files are swept on server start; |
|
| Base config dir |
| (unset) | Operator-controlled caller-model pin; used when the client does not send |
| (unset) | Comma-separated model-name substrings that require per-call verification |
| (unset) | Set to |
Credential files are git-ignored and must never be committed.
Development
uv sync # install deps (incl. dev group)
uv run pytest # run the test suiteLicense
MIT — see LICENSE.
Available Tools
14 toolsappend_rowsA
Append rows after the last row of a tab of a spreadsheet (item). Non-destructive.
value_input RAW (default) stores cell text literally; 'USER_ENTERED' interprets formulas/typed
values. dry_run=true returns where the rows would land (predicted) without appending.
Inputs: tab (required), item (required), rows (required), dry_run, +1 more.
clear_rangeADestructive
Clear all values in an A1 range of a spreadsheet (item), e.g. 'Data!A2:C10'. Requires confirm=true.
dry_run=true returns the values that would be cleared (before) without clearing.
Inputs: item (required), a1_range (required), confirm, dry_run.
create_documentA
Create a new Google Doc (in My Drive root), optionally with initial text content.
markdown=true renders `text` with the same dialect as append_text: headings, bullets,
numbered lists, **bold**, *italic*, <u>underline</u>. (For spreadsheets use
create_spreadsheet.)
Inputs: title (required), text, markdown.
create_spreadsheetB
Create a new spreadsheet with optional named tabs.
Inputs: title (required), tabs.
format_cellsA
Set text formatting (bold/italic/underline) on a bounded A1 range of a spreadsheet (item).
a1_range like 'Data!A1:C10' or a single cell 'Data!B2' (no tab prefix targets the first
tab; open-ended ranges like 'A:C' are rejected). Each flag is tri-state: true applies it,
false removes it, unset leaves that property as-is. Formatting only — cell values are
untouched. dry_run=true returns the resolved target without writing. (Headings, bullets,
and rich text are Docs concepts: see append_text/create_document with markdown=true.)
Inputs: item (required), a1_range (required), bold, italic, +2 more.
list_folderARead-only
List the direct children of a folder (item = folder URL or ID).
Returns one page; when `has_more` is true, pass the returned `next_page_token` to continue.
Inputs: item (required), page_size, page_token.
read_commentsARead-only
List comments on a Doc or file (item = URL or ID).
Returns one page; when `has_more` is true, pass the returned `next_page_token` to continue.
Inputs: item (required), page_size, page_token.
read_documentARead-only
Read a Google Doc (item = URL or ID) as 'markdown' (default) or 'text', one bounded chunk at a time.
Multi-tab docs: by default every tab is read (each prefixed with its title as a heading);
pass a `tab` id, or an `item` URL containing `tab=t.xxxx`, to read only that tab. Returns the
requested chunk (0-based) plus title, the doc's `tabs`, the outline, and paging metadata
(total_chunks, total_chars, has_more). Set max_chars<=0 to get the whole document. Set
include_colors=true to also return `colored_runs` (text spans with an explicit foreground color).
Inputs: item (required), tab, chunk, max_chars, +2 more.
read_file_as_textARead-only
Read a file's content as text, one bounded chunk at a time.
Google-native files are exported; PDFs are text-extracted. Returns the requested chunk
(0-based) in `content` plus name, mime_type, and paging metadata (total_chunks,
total_chars, has_more) — page through by incrementing chunk. Set max_chars<=0 for the
whole document.
Inputs: item (required), chunk, max_chars.
read_full_sheetA
Read an entire sheet tab, save it to a local CSV, and return the path + a 5x5 preview.
Reads the full tab (item = URL or ID; default first tab) via the Sheets API, writes it to
dest_path (resolved inside the sandbox files dir; a sanitized default name otherwise), and
returns total_rows/total_cols plus the same first-5-rows/cols preview as read_sheet. Use this
instead of read_sheet when you need the complete data without flooding the context.
Inputs: item (required), tab, values, dest_path.
rename_fileCDestructive
Rename a file. Requires confirm=true.
Inputs: item (required), new_name (required), confirm.
resolve_linkARead-only
Resolve a Google Drive/Docs/Sheets URL or bare ID (item) to its id, kind, name and link.
Inputs: item (required).
search_filesARead-only
Search Drive by name, full-text content, mime type, and/or parent folder.
Returns one page; when `has_more` is true, pass the returned `next_page_token` to continue.
`incomplete_search` true means Drive couldn't search every corpus (results may be partial).
Inputs: full_text, in_folder, mime_type, page_size, +2 more.
write_sheetADestructive
Write rows to a tab of a spreadsheet (item), starting at start_cell (default A1).
value_input RAW (default) stores cell text literally; pass 'USER_ENTERED' to interpret typed
values/formulas (a leading '=' becomes a live formula). Overwriting existing non-empty cells
requires confirm=true. dry_run=true returns a predicted before/after (client-side) without
writing; formula cells are shown literally (Google's recalculation is not simulated).
Inputs: tab (required), item (required), rows (required), confirm, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Each tool targets a distinct action on a specific resource (e.g., append_rows vs write_sheet, read_document vs read_file_as_text) with clear scoping, eliminating ambiguity.
All tools follow a consistent verb_noun snake_case pattern (e.g., create_document, search_files, rename_file) with no deviations.
14 tools cover the essential operations for Google Drive, Docs, and Sheets without being overwhelming or sparse.
Solid for Sheets (CRUD + format/append/clear) but missing create_folder, delete/organize files, and update document content beyond creation, leaving notable gaps.
Maintenance
Related MCP Connectors
Hosted Google Ads MCP with OAuth, bounded reads, and prepare/confirm writes.
Streamable HTTP MCP server for Google Calendar and Sheets with OAuth login.
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Google Ads MCP server — manage campaigns, keywords, and metrics.
Related MCP Servers
- AlicenseAqualityDmaintenanceMCP server for Google Workspace APIs - Docs, Sheets, Drive, Gmail, and Calendar. Enables reading, creating, and editing Google Docs and Sheets, managing comments, reading emails, and viewing calendar events.3417MIT
- FlicenseNot gradedqualityCmaintenanceMCP server for Google Drive, Docs, and Sheets — built for Claude Code. Gives Claude Code direct read/write access to Google Sheets (cell-level edits, formatting, structure), Google Docs (insert, replace, append), and Drive (search).1-
- FlicenseNot gradedqualityDmaintenanceA read-only Google Drive MCP server that allows searching files, reading file content (with auto-export for Google Docs, Sheets, Slides), and retrieving file metadata via OAuth authentication.10 npm4-
- AlicenseBqualityDmaintenanceProduction-ready MCP server for Google Workspace providing broad coverage across Gmail, Drive, Calendar, Docs, Sheets, and more, with safe-by-default write operations and markdown-to-Google-Docs support.10039 PyPIMIT