Skip to main content
Glama

Google Drive MCP

English | Русский

npm Glama CI License: MIT

A1 Google Drive MCP lets an AI app work with your Google Drive in plain language. Find a file, tidy up folders, upload and download content, export a Doc as Markdown, share it with the right people — and keep the trash between you and permanent deletion.

It uses the Google Drive API with your Google account. It sees My Drive and shared drives alike, treats “delete” as the reversible trash and makes the limits of the Drive API explicit instead of implying that every file task is possible.

  • 21 tools. Search and metadata, folders and moving, upload and download, export of Docs/Sheets/Slides, the trash, sharing and comments.

  • Connects from the conversation. Say "connect Google Drive": the server walks you through the OAuth client, catches Google's redirect on 127.0.0.1 with PKCE and keeps the tokens itself — no config files, no restart.

  • The trash comes first. “Delete” means the reversible trash; permanent deletion is a deliberately separate tool that cannot be picked by accident.

  • Documents stay intact. Docs, Sheets and Slides move, copy, export and convert as whole files — the server never edits the text inside them.

  • You choose the scope. drive.readonly covers every read and drive.file limits access to app-created files; the full tool surface needs drive.

Start with a read-only question:

Find the project roadmap doc in my Drive, export it to Markdown and summarize it.

Connect the server · Explore use cases · Open technical documentation


See it work in a minute

You: Show me what’s in the “Contracts 2025” folder, newest first.

Assistant: Lists the files with their types, owners and modification dates. Nothing changes.

You: Prepare an “Archive” subfolder and move everything older than a year into it.

Assistant: Shows the folder it would create and the files it would move, then asks for confirmation.

You: Confirm.

Assistant: Creates the folder and moves the files. Nothing is shared, trashed or deleted unless you ask separately.

Related MCP server: google-drive-mcp-server

Contents

Quick start

You need Node.js 20+ and a Google account. Credentials are not required at install time — the server connects from the conversation.

  1. Add the server to your AI app.

  2. Say "connect Google Drive": the assistant walks you through creating the OAuth client and approving access without editing config files.

  3. Ask the read-only question above.

In the desktop app: open Settings → MCP servers, select Add server, choose STDIO, and enter the command npx -y @a1-x-tech/mcp-google-drive@latest with GOOGLE_DRIVE_CLIENT_ID, GOOGLE_DRIVE_CLIENT_SECRET and GOOGLE_DRIVE_REFRESH_TOKEN. Select Save, then Restart.

In the IDE extension: open the gear menu → MCP servers, select Add server, choose STDIO, and enter the same command and environment variables. Select Save, then Restart extension.

From the command line:

codex mcp add google-drive \
  -- npx -y @a1-x-tech/mcp-google-drive@latest
codex mcp list

Codex MCP documentation

claude mcp add \
  --transport stdio --scope user google-drive \
  -- npx -y @a1-x-tech/mcp-google-drive@latest
claude mcp list

Claude Code MCP documentation

The current official path is Settings → Extensions. For a custom desktop extension, open Advanced settings → Extension Developer → Install Extension…, select a .mcpb file and follow the prompts.

This repository currently publishes an npm stdio package and does not contain a .mcpb bundle. For Claude Desktop builds that still support local configuration, use the following JSON stdio configuration as a fallback:

{
  "mcpServers": {
    "google-drive": {
      "command": "npx",
      "args": ["-y", "@a1-x-tech/mcp-google-drive@latest"]
    }
  }
}

In those builds, save it to ~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows.

Claude Desktop MCP documentation

Add this to ~/.cursor/mcp.json on macOS/Linux or %USERPROFILE%\.cursor\mcp.json on Windows:

{
  "mcpServers": {
    "google-drive": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@a1-x-tech/mcp-google-drive@latest"]
    }
  }
}

Cursor MCP documentation

Run MCP: Open User Configuration and add:

{
  "servers": {
    "google-drive": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@a1-x-tech/mcp-google-drive@latest"]
    }
  }
}

Check it with MCP: List Servers.

VS Code MCP documentation

What you can ask it to do

Find and read files

  • Find last quarter’s budget spreadsheet and show where it lives and who owns it.

  • Export the project brief to Markdown and summarize the open questions.

  • Download the signed contract PDF into my reports folder.

Organize and transfer content

  • Create a “2026 Reports” folder and move the monthly reports into it.

  • Upload these meeting notes and convert them into a Google Doc.

  • Copy the proposal template and rename the copy for the new client.

Share and discuss

  • Share the folder with a teammate as a commenter and add a note to the invitation.

  • List the open comments on the design doc and resolve the ones we’ve addressed.

  • Revoke the external contractor’s access to the archive.

Clean up deliberately

  • Trash the outdated drafts — and restore the one deleted by mistake.

  • Permanently delete the folder of test uploads once I confirm.

  • Show what’s in the trash before anything is purged.

How your Drive changes

  1. Everything in Drive — folders and shared-drive items included — is a file with an id. Names are not unique, so tools act on ids, and duplicate names are legal: it pays to search before creating.

  2. “Delete” means the trash: reversible, auto-purged by Google after about 30 days. Permanent deletion bypasses the trash, takes folder subtrees with it and lives in a deliberately separate tool.

  3. Google Docs, Sheets and Slides are moved, copied, shared, exported and converted as whole units. The server has no tool that edits text inside a Doc or cells inside a Sheet.

  4. A write is never replayed after an uncertain failure: retries after network and 5xx errors apply to reads only, so a copy, upload or new folder cannot be duplicated behind your back.

Built-in uploads are capped at 5 MB (larger files go through a resumable session via raw_request), exports at 10 MB per the Drive API. Comments created through the API cannot be anchored to a specific passage inside a Doc.

What can change

Operation

What happens

Confirmation boundary

Search, metadata, download, export

Reads files and folders

No change

Create a folder, copy or upload

Adds files or replaces content

Changes Drive

Move, rename, update metadata

Changes a file’s location or properties

Changes a file

Manage permissions

Grants, changes or revokes access

Changes who can open a file

Manage comments

Creates, resolves or deletes comment threads

Can destroy a discussion

Trash or restore a file

Moves it into or out of the trash

Reversible for ~30 days

Delete forever

Erases past the trash, subtrees included

Destructive

Raw API request

Can call API methods without a dedicated tool

Potentially destructive

The AI client controls confirmation prompts. The server marks reads, writes and destructive tools so the client can distinguish an inspection from a live change.

Getting access

Google Drive requires OAuth 2.0; an API key is not enough. There are two ways in, and the first one needs no configuration files.

Say "connect Google Drive" and the assistant runs the flow with you:

  1. setup_instructions prints the checklist: create or select a Google Cloud project, enable Google Drive API, configure the consent screen and create a Desktop app OAuth client.

  2. Download that client's JSON ("Download JSON") and give the assistant its path — set_client stores it owner-only. The secret never goes through the conversation.

  3. start_login returns a Google consent link. Open it on this machine and approve; the code comes back to a one-shot listener on 127.0.0.1 (PKCE), never through the chat.

  4. finish_login exchanges the code and saves the tokens to ~/.config/mcp-google-drive/credentials.json (mode 0600) and verifies them with a real Google Drive API call — so an API that is still switched off is caught right there.

The tokens are re-read on every call, so the connection works immediately — no restart of the AI app. auth_status shows what is connected, logout revokes and deletes it.

Environment variables (CI, unattended installs)

  1. Create or select a Google Cloud project and enable Google Drive API.

  2. Configure the OAuth consent screen and create a Desktop app OAuth client.

  3. Authorize the Google account whose files the server should work with. The OAuth 2.0 Playground can obtain the refresh token when Use your own OAuth credentials is enabled.

  4. Request the narrowest scope that covers your use:

    Scope

    Enables

    https://www.googleapis.com/auth/drive.readonly

    The read-only tools: search, metadata, download, export and shared-drive listing.

    https://www.googleapis.com/auth/drive.file

    Only files created or opened by this app — enough for upload-and-organize flows on app-owned files.

    https://www.googleapis.com/auth/drive

    The full tool surface: sharing, trash, deletion and comments on arbitrary files.

The server uses whatever scope the refresh token was minted with; a call outside it fails with an insufficientPermissions error.

Testing-mode OAuth refresh tokens can expire after seven days. Publish the OAuth app, or use an Internal app in a Workspace domain, when you need long-lived access. Treat the client secret and refresh token as passwords.

Configuration

Every variable is optional — with none of them the server connects from the chat.

Variable

Required

Description

GOOGLE_DRIVE_CLIENT_ID

No*

OAuth client ID.

GOOGLE_DRIVE_CLIENT_SECRET

No*

OAuth client secret.

GOOGLE_DRIVE_REFRESH_TOKEN

No*

OAuth refresh token.

GOOGLE_DRIVE_ACCESS_TOKEN

No*

Short-lived (~1 hour) alternative to the OAuth trio.

GOOGLE_DRIVE_OAUTH_PORT

No

Fixed loopback port for the in-chat login; useful over SSH port forwarding.

GOOGLE_DRIVE_API_BASE

No

Google APIs base URL override.

GOOGLE_DRIVE_TIMEOUT_MS

No

Per-request timeout; default 60000 ms.

GOOGLE_DRIVE_MAX_RETRIES

No

Temporary-error retries; default 3.

* Provide either the OAuth trio or an access token.

Without any credentials the server still starts and completes the MCP handshake; the first tool call replies with the exact variables to set instead of a dead server.

Data, limits and background work

  • Requests go to Google Drive. The local server refreshes Google OAuth tokens and calls the Drive API. Its anonymous telemetry contains an installation ID, package version, AI client and platform versions, and tool names — never OAuth tokens, file content, tool arguments or prompts. For each tool call it also sends the outcome and, on failure, an excerpt of the error text with e-mails, addresses, tokens, numbers of 4+ digits and quoted text replaced by #; a value from your request can appear in it if the error text contains it. Set ASKADS_TELEMETRY=0 to opt out.

  • Google applies quotas and size caps. Uploads through the built-in tool are limited to 5 MB and exports to 10 MB. On 429, the server uses backoff; reads also retry after network and 5xx errors, while writes are not replayed after an uncertain failure.

  • Local files are handled cautiously. Downloads save only to absolute paths and refuse to overwrite an existing file unless asked; inline returns cap at 100 KB of textual content.

  • There is no background polling. The server runs only when called; nothing watches your Drive between requests. If your AI app supports scheduled tasks, it can check for changes periodically.

Technical documentation

Support

Found a bug or need a scenario? Create an issue or write in Telegram.

Available Tools

21 tools
auth_statusGoogle connection statusA
Read-onlyIdempotent

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.

Inputs: no named parameters.

copy_fileCopy a fileA

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.

Inputs: file_id (required), name, parent_id.

create_folderCreate a folderA

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.

Inputs: name (required), parent_id.

delete_file_foreverPermanently delete a fileA
Destructive

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).

Inputs: file_id (required).

download_fileDownload file contentA
Read-onlyIdempotent

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).

Inputs: file_id (required), overwrite, save_path, acknowledge_abuse.

export_fileExport a Google Workspace fileA
Read-onlyIdempotent

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. With save_path the result is written to disk; without it small textual exports (≤100 KB) come back inline as content. Export is capped at 10 MB by the API — use the file's exportLinks (get_file) for bigger documents. Binary (non-Google) files are not exportable — use download_file.

Inputs: file_id (required), mime_type (required), overwrite, save_path.

finish_loginFinish the Google loginA
Idempotent

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 unnoticed.

Inputs: no named parameters.

get_fileGet file metadataA
Read-onlyIdempotent

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 syntax) when the default set is too much or too little.

Inputs: file_id (required), fields.

list_shared_drivesList shared drivesA
Read-onlyIdempotent

Lists the shared drives (formerly Team Drives) the authorized user is a member of: id, name, createdTime, plus nextPageToken. Use a drive's id as drive_id in search_files to browse its contents, or as parent_id to list its root. name_contains filters by name. My Drive is not a shared drive and never appears here.

Inputs: page_size, page_token, name_contains.

logoutDisconnect from GoogleA
Destructive

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.

Inputs: no named parameters.

manage_commentsManage file commentsA
Destructive

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 removes a comment and its replies permanently (needs comment_id; author only). Comments carry author, createdTime/modifiedTime, resolved and quotedFileContent. Not for Docs suggestions — those are a Docs feature this API cannot touch.

Inputs: action (required), file_id (required), anchor, content, +5 more.

manage_permissionsManage sharing & permissionsA
Destructive

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 permission_id from list); action=remove revokes it. Ownership transfer: role=owner with transfer_ownership=true — between personal accounts this only INVITES the new owner (pendingOwner until they accept). Changes are live immediately; removing your own access to someone else's file is irreversible from your side. role=owner/organizer grants full control including permanent deletion — prefer writer or less.

Inputs: action (required), file_id (required), role, type, +9 more.

move_fileMove a fileA
DestructiveIdempotent

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).

Inputs: file_id (required), new_parent_id (required), keep_existing_parents.

raw_requestRaw Google Drive API callA
Destructive

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//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 automatically; the method defaults to GET; the response must be JSON (binary media downloads belong to download_file/export_file).

Inputs: path (required), body, method.

search_filesSearch and list filesA
Read-onlyIdempotent

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). Shared drives: pass drive_id to search one drive, or include_all_drives=true to search everything at once. Paginate with page_token; order_by e.g. 'modifiedTime desc,name'. incompleteSearch=true in the result means some corpora were skipped — narrow the search.

Inputs: query, drive_id, order_by, mime_type, +8 more.

set_clientSave the OAuth clientA
Idempotent

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.

Inputs: path (required).

setup_instructionsSetup instructionsA
Read-onlyIdempotent

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; the checklist shortens to 'enable the API + log in' when an OAuth client is already configured (one client serves the whole mcp-google-* line). Never asks the user to paste secrets into the chat.

Inputs: no named parameters.

start_loginStart the Google loginA
Idempotent

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.

Inputs: no named parameters.

trash_fileTrash or restore a fileA
DestructiveIdempotent

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 explicitlyTrashed.

Inputs: action (required), file_id (required).

update_file_metadataRename / update file metadataA
DestructiveIdempotent

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.

Inputs: file_id (required), name, starred, description.

upload_fileUpload file contentA

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 .csv becomes native; export back with export_file). Cap: 5 MB per upload (multipart) — larger files need a resumable session via raw_request. A retry after an ambiguous failure without file_id would create a duplicate — search_files first.

Inputs: name, content, file_id, mime_type, +3 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 21 tools

    Disambiguation5/5

    Each tool targets a distinct resource+action, and the descriptions explicitly disambiguate the pairs that could collide: download_file vs export_file (binary vs Google-native), trash_file vs delete_file_forever (reversible vs permanent), and upload_file create-vs-replace by file_id. The auth cluster (setup_instructions, set_client, start_login, finish_login, auth_status, logout) is split by step with clear ordering cues, and raw_request is framed as an explicit escape hatch rather than a duplicate of the typed tools.

    Naming Consistency4/5

    The set is overwhelmingly snake_case verb_noun (search_files, get_file, create_folder, move_file, upload_file, download_file, export_file, trash_file, manage_permissions, manage_comments), which reads predictably. A few auth tools break the verb_noun pattern (auth_status, setup_instructions, logout), but the convention remains snake_case throughout with no camelCase mixing.

    Tool Count4/5

    21 tools is on the heavy side, but the footprint is wide (files, folders, shared drives, content transfer, permissions, comments, OAuth onboarding), so most tools earn their place rather than being redundant. Six of the 21 are auth/onboarding helpers, which is a sizeable slice of the surface but justified by the no-restart in-chat login flow.

    Completeness4/5

    Core Drive lifecycle is well covered: search/list, get metadata, create/copy/move, content upload/download/export, reversible and permanent deletion, plus permissions and comments management. Gaps are real but non-blocking: revisions, change tracking, and shortcut creation are only reachable through raw_request, and large-file resumable uploads and >10 MB exports have no typed path.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to automate Google Drive tasks such as provisioning workspaces, reusing templates, inspecting folder structures, updating reports, and sharing files through user-controlled OAuth.
      MIT