Google Drive MCP
v1.1.2MCP server for the Google Drive API: search, upload, download, organize and share files.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
auth_status Google connection status
Shows whether this server is connected to Google: token presence and source (env variables or a stored in-chat login), expiry, the Google account email, granted vs missing OAuth scopes, where the credentials file lives and where the OAuth client comes from. Makes no network calls and never returns the token itself. Call it first when other tools report the server is not connected.
setup_instructions Setup instructions
Step-by-step checklist for connecting this server to Google: creating a Google Cloud project and a Desktop-app OAuth client, publishing the consent screen (mandatory — Testing-mode refresh tokens die after 7 days), downloading the client JSON and handing its PATH to set_client. Works without any credentials; with your own client already configured it shortens to 'enable the API + log in' (one client serves the whole mcp-google-* line). Never asks the user to paste secrets into the chat.
set_client Save the OAuth client
Saves the OAuth client credentials from the JSON file downloaded from Google Cloud Console ('Download JSON' on a Desktop-app client). Pass the file PATH — the secret must never be pasted into the chat. The client is stored once in the shared ~/.config/mcp-google-auth/client.json (owner-only) and reused by every mcp-google-* server; tokens stay per-server. After this, call start_login.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path to the client_secret_*.json file downloaded from Google Cloud Console. |
start_login Start the Google login
First step of connecting from the chat, without editing config files or restarting the client. Returns authorizeUrl — show it to the user as a clickable link and ask them to open it in the browser ON THIS MACHINE, pick the Google account and approve access. A one-shot listener on 127.0.0.1 catches Google's redirect; the code is exchanged locally and never passes through the chat. Does not open the browser itself. The attempt lives 10 minutes; when the browser shows the success page, call finish_login.
finish_login Finish the Google login
Second step: waits up to 20 s for the browser consent to finish, saves the tokens to an owner-only file and verifies the login with a read-only identity call, returning the account email and the granted scopes. After success every tool works immediately — no client restart. If the user granted only part of the requested permissions, the login is still saved and missingScopes lists what will not work. Logging in under a different Google account replaces the previous login (its refresh token is revoked best-effort) and the response carries previousAccountEmail so the change never goes unnotice…
logout Disconnect from Google
Revokes the stored token at Google (oauth2.googleapis.com/revoke) and deletes the local credentials file. Tokens supplied via env variables are NOT touched — remove them from the MCP client config manually; envTokenStillSet in the response says whether any are still in effect.
search_files Search and list files
Searches and lists files and folders: id, name, mimeType, size, parents, driveId, modifiedTime, trashed, starred, webViewLink and shortcutDetails per file, plus nextPageToken. The convenience filters (name_contains, full_text_contains, mime_type, parent_id, only_folders) are AND-ed together and with the raw Drive `query` expression (q syntax, e.g. "modifiedTime > '2026-01-01T00:00:00'"). Trashed files are hidden unless include_trashed=true. Names are NOT unique in Drive — expect several hits and pick by id. parent_id lists a folder's direct children (use 'root' for My Drive's top level). Sha…
| Parameter | Type | Description |
|---|---|---|
drive_id | string | Search only this shared drive. |
full_text_contains | string | Full-text match over the file's content and description. |
include_all_drives | boolean | Search My Drive and every shared drive together (slower; ignored when drive_id is set). |
include_trashed | boolean | Include trashed files (default false — the trash is a separate view, as in the Drive UI). |
mime_type | string | Exact mimeType, e.g. application/pdf, application/vnd.google-apps.document (Google Doc), application/vnd.google-apps.spreadsheet (Google Sheet). |
name_contains | string | Substring match on the file name (case-insensitive prefix matching per word). |
only_folders | boolean | Only folders (mimeType application/vnd.google-apps.folder). |
order_by | string | Sort keys: createdTime, folder, modifiedTime, name, quotaBytesUsed, recency, starred; add ' desc' to reverse, e.g. 'modifiedTime desc,name'. |
page_size | integer | Files per page (1..1000; API default 100). |
page_token | string | nextPageToken from the previous page. |
parent_id | string | Only direct children of this folder ('root' = My Drive top level). |
query | string | Raw Drive search expression (q syntax), AND-ed with the other filters, e.g. "modifiedTime > '2026-01-01T00:00:00' and not name contains 'draft'". |
get_file Get file metadata
Returns a file's metadata (never its content — that is download_file/export_file): id, name, mimeType, size, parents, driveId, createdTime/modifiedTime, trashed, starred, description, md5Checksum, webViewLink, webContentLink, exportLinks (for Google-native files), owners, lastModifyingUser, shortcutDetails (a shortcut's real target id/mimeType) and capabilities (canEdit/canShare/canTrash/canDelete/canDownload — check before mutating). Google-native files (mimeType application/vnd.google-apps.*) report no size and no md5Checksum. Pass fields to select a custom projection (Drive fields synta…
| Parameter | Type | Description |
|---|---|---|
file_id * | string | The file id — the long id from the Drive URL (drive.google.com/file/d/<fileId> or docs.google.com/.../d/<fileId>/edit) or from search_files/get_file output. Folders and shared-drive items are files… |
fields | string | Custom Drive fields projection, e.g. "id,name,permissions(id,role,emailAddress)". Defaults to a rich metadata set. |
create_folder Create a folder
Creates a folder (a Drive file with mimeType application/vnd.google-apps.folder) and returns its id, name, parents and webViewLink. parent_id places it inside a folder or a shared drive ('root' or omitted = My Drive top level). Drive allows several folders with the same name in the same parent — search_files first if the folder might already exist, and reuse its id instead of creating a duplicate.
| Parameter | Type | Description |
|---|---|---|
name * | string | The folder name (not required to be unique, even within one parent). |
parent_id | string | Parent folder or shared-drive id; omitted = My Drive root. |
copy_file Copy a file
Copies a file and returns the new copy's metadata (a fresh fileId — the original is untouched). name renames the copy (default: same name as the original, NOT 'Copy of ...'); parent_id places it in a folder (default: same parent as the original for My Drive files). Works on Google-native files (Docs/Sheets/Slides) and binaries alike, but folders cannot be copied — recreate the tree with create_folder + copy_file per file. Comments and permissions are not copied. Each retry would create another copy, so after an ambiguous failure check with search_files before calling again.
| Parameter | Type | Description |
|---|---|---|
file_id * | string | The file id — the long id from the Drive URL (drive.google.com/file/d/<fileId> or docs.google.com/.../d/<fileId>/edit) or from search_files/get_file output. Folders and shared-drive items are files… |
name | string | Name for the copy (defaults to the original's name). |
parent_id | string | Folder for the copy (defaults to the original's parent). |
move_file Move a file
Moves a file or folder into another folder (or shared drive) and returns id, name and the new parents. By default the file leaves all its current parents (a plain move); keep_existing_parents=true only adds the new parent — note that files in shared drives always have exactly one parent, so keeping old parents fails there. Moving between My Drive and a shared drive changes ownership rules and may be rejected by the drive's settings. The move costs one extra read (the current parents are fetched first).
| Parameter | Type | Description |
|---|---|---|
file_id * | string | The file id — the long id from the Drive URL (drive.google.com/file/d/<fileId> or docs.google.com/.../d/<fileId>/edit) or from search_files/get_file output. Folders and shared-drive items are files… |
new_parent_id * | string | Destination folder or shared-drive id ('root' = My Drive top level). |
keep_existing_parents | boolean | Add the new parent without removing the old ones (My Drive only; default false = a real move). |
update_file_metadata Rename / update file metadata
Renames a file and/or updates its description and starred flag — metadata only, the content is untouched (that is upload_file with file_id). Only the provided fields change; at least one is required. Works on folders too (folders are files). Returns id, name, description, starred and the new modifiedTime. Moving lives in move_file, trashing in trash_file.
| Parameter | Type | Description |
|---|---|---|
file_id * | string | The file id — the long id from the Drive URL (drive.google.com/file/d/<fileId> or docs.google.com/.../d/<fileId>/edit) or from search_files/get_file output. Folders and shared-drive items are files… |
description | string | New description (shown in the Drive details pane; searchable via full text). |
name | string | New file name (the extension is part of the name — keep it unless you mean to change it). |
starred | boolean | Star or unstar the file. |
upload_file Upload file content
Uploads content to Drive and returns the file's metadata. Without file_id it CREATES a new file (name required; parent_id places it); with file_id it REPLACES that file's content in place (same id, new bytes) — name/parent_id are ignored then. The bytes come from exactly one of `content` (inline UTF-8 text) or `local_path` (absolute path to a local file). mime_type describes the uploaded bytes (default: text/plain for content, guessed from the extension for local_path). convert_to=document|spreadsheet|presentation imports the bytes into an editable Google Doc/Sheet/Slides (e.g. a .docx or .c…
| Parameter | Type | Description |
|---|---|---|
content | string | Inline UTF-8 text content — for small text files. Exactly one of content/local_path. |
convert_to | string | Import into a Google-native editable file: document (Doc), spreadsheet (Sheet), presentation (Slides). |
file_id | string | Existing file whose CONTENT to replace (omit to create a new file). |
local_path | string | Absolute local path to read the bytes from. Exactly one of content/local_path. |
mime_type | string | mimeType of the uploaded bytes (default: text/plain for content, extension-based for local_path). |
name | string | File name in Drive — required when creating (no file_id). |
parent_id | string | Folder for the new file (create only; omitted = My Drive root). |
download_file Download file content
Downloads a binary file's bytes. With save_path (absolute local path) the file is written to disk (refuses to overwrite unless overwrite=true) and the result reports saved_to/bytes; without save_path small textual files (≤100 KB, text/JSON/XML) are returned inline as `content`. Google-native files (Docs/Sheets/Slides — mimeType application/vnd.google-apps.*) have no bytes: this tool rejects them, use export_file; for a shortcut it names the real target to download instead. acknowledge_abuse=true downloads a file Drive flagged as malware/abuse (owner only).
| Parameter | Type | Description |
|---|---|---|
file_id * | string | The file id — the long id from the Drive URL (drive.google.com/file/d/<fileId> or docs.google.com/.../d/<fileId>/edit) or from search_files/get_file output. Folders and shared-drive items are files… |
acknowledge_abuse | boolean | Download even though Drive flagged the file as abusive (owner only). |
overwrite | boolean | Replace save_path if it already exists (default false). |
save_path | string | Absolute local path to write the file to (required for binary or >100 KB content). |
export_file Export a Google Workspace file
Exports (converts) a Google-native file — Doc, Sheet, Slides, Drawing — to a regular format. mime_type picks the target: Docs → text/markdown, text/plain, text/html, application/pdf, application/vnd.openxmlformats-officedocument.wordprocessingml.document (.docx), application/rtf; Sheets → text/csv (FIRST sheet only), application/pdf, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet (.xlsx); Slides → application/pdf, text/plain, application/vnd.openxmlformats-officedocument.presentationml.presentation (.pptx); Drawings → image/png, image/svg+xml, application/pdf. Wi…
| Parameter | Type | Description |
|---|---|---|
file_id * | string | The file id — the long id from the Drive URL (drive.google.com/file/d/<fileId> or docs.google.com/.../d/<fileId>/edit) or from search_files/get_file output. Folders and shared-drive items are files… |
mime_type * | string | Target format, e.g. text/markdown, text/csv, application/pdf (see the description for what each Google type supports). |
overwrite | boolean | Replace save_path if it already exists (default false). |
save_path | string | Absolute local path to write the export to (required for binary or >100 KB output). |
trash_file Trash or restore a file
action=trash moves a file (or folder, with everything inside) to the Drive trash; action=restore brings it back. Trashing is REVERSIBLE — the file stays recoverable until the trash auto-purges it after ~30 days — and is the safe default whenever a user asks to 'delete' something: only use delete_file_forever when they explicitly want it gone beyond recovery. Trashed files disappear from search_files unless include_trashed=true. Only the owner (or a shared-drive member with the right role) can trash; restore puts the file back at its old parent. Returns id, name, trashed and explicitlyTrash…
| Parameter | Type | Description |
|---|---|---|
action * | string | trash = move to the trash (reversible); restore = take it back out. |
file_id * | string | The file id — the long id from the Drive URL (drive.google.com/file/d/<fileId> or docs.google.com/.../d/<fileId>/edit) or from search_files/get_file output. Folders and shared-drive items are files… |
delete_file_forever Permanently delete a file
PERMANENTLY deletes a file, BYPASSING the trash — there is no undo, no 30-day grace period, and a folder takes every descendant with it. This is NOT the same as trash_file: when a user says 'delete', they almost always mean the reversible trash — use trash_file unless they explicitly confirmed permanent, unrecoverable deletion. Requires ownership (or organizer on a shared drive). Returns {ok:true} on success (the API responds with an empty 204).
| Parameter | Type | Description |
|---|---|---|
file_id * | string | The file id — the long id from the Drive URL (drive.google.com/file/d/<fileId> or docs.google.com/.../d/<fileId>/edit) or from search_files/get_file output. Folders and shared-drive items are files… |
manage_permissions Manage sharing & permissions
Manages who can access a file. action=list shows the grants (id, type, role, emailAddress/domain, expirationTime, pendingOwner). action=share grants access: type=user/group (needs email_address), domain (needs domain), or anyone (link sharing; allow_file_discovery=true also makes it searchable); role=reader, commenter, writer, fileOrganizer/organizer (shared drives only) or owner. Sharing with a user emails them by default — send_notification_email=false suppresses it (not allowed for ownership transfers); email_message adds a note. action=update changes an existing grant's role (needs permi…
| Parameter | Type | Description |
|---|---|---|
action * | string | What to do with the file's permissions. |
file_id * | string | The file id — the long id from the Drive URL (drive.google.com/file/d/<fileId> or docs.google.com/.../d/<fileId>/edit) or from search_files/get_file output. Folders and shared-drive items are files… |
allow_file_discovery | boolean | share with type=domain/anyone: whether the file can be FOUND by search (default false = link only). |
domain | string | share with type=domain: the Workspace domain, e.g. example.com. |
email_address | string | share with type=user/group: the grantee's email address. |
email_message | string | share: a custom note for the notification email. |
expiration_time | string | update: RFC3339 expiry for the grant, e.g. 2026-12-31T00:00:00Z (not available for owners). |
page_token | string | list: nextPageToken from the previous page. |
permission_id | string | update/remove: the permission id from action=list. |
role | string | share/update: the access level. fileOrganizer/organizer exist only on shared drives; owner transfers ownership. |
send_notification_email | boolean | share with type=user/group: send the notification email (API default true; must stay true for ownership transfer). |
transfer_ownership | boolean | share with role=owner: confirm the ownership transfer (required by the API for role=owner). |
type | string | share only: who the grant is for. user/group need email_address; domain needs domain; anyone = link sharing. |
manage_comments Manage file comments
Manages Drive comments on a file (Docs, Sheets, Slides, PDFs, images...). action=list pages through comments with their replies and resolved state (page_token; include_deleted shows tombstones); get fetches one (needs comment_id). create adds a comment (needs content; quoted_text attaches the passage it refers to — display only; positional anchoring inside a Doc's text is not possible through this API, such comments appear file-level). reply answers a thread (needs comment_id + content). resolve / reopen close or reopen a thread (need comment_id; optional content adds a closing note). delete…
| Parameter | Type | Description |
|---|---|---|
action * | string | What to do with the file's comments. |
file_id * | string | The file id — the long id from the Drive URL (drive.google.com/file/d/<fileId> or docs.google.com/.../d/<fileId>/edit) or from search_files/get_file output. Folders and shared-drive items are files… |
anchor | string | create only: a Drive anchor JSON string for region-anchorable media (rarely needed). |
comment_id | string | get/reply/resolve/reopen/delete: the comment id (from action=list). |
content | string | create/reply: the comment text (plain text). Optional closing note for resolve/reopen. |
include_deleted | boolean | list: include deleted comments as tombstones (default false). |
page_size | integer | list: comments per page (1..100; API default 20). |
page_token | string | list: nextPageToken from the previous page. |
quoted_text | string | create only: the file passage the comment refers to (shown as a quote; does not position the comment). |
raw_request Raw Google Drive API call
Escape hatch to call any Google Drive API v3 path directly, for requests the typed tools don't cover — e.g. revisions ("drive/v3/files/<fileId>/revisions"), changes ("drive/v3/changes?pageToken=..."), shortcut creation (POST "drive/v3/files" with shortcutDetails), emptying the trash (DELETE "drive/v3/files/trash"), generateIds, or starting a resumable upload session (POST "upload/drive/v3/files?uploadType=resumable"). The path is relative to https://www.googleapis.com and may carry a query string (remember supportsAllDrives=true for shared-drive items). The Bearer token is added automaticall…
| Parameter | Type | Description |
|---|---|---|
path * | string | API path relative to https://www.googleapis.com, e.g. "drive/v3/files/<fileId>/revisions?fields=*". |
body | object | JSON request body (POST/PATCH only). |
method | string | HTTP method (the Drive API uses these four). Defaults to GET. |