# Google Drive MCP [Health: Active]

**Category:** 📂 File Systems  
**Repository:** https://github.com/A1-x-Tech/mcp-google-drive  
**GitHub Stars:** 0  
**npm Downloads (last month):** 742  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/google-drive-mcp

## Description
MCP server for the Google Drive API: search, upload, download, organize and share files.

## Tools
Capabilities this server exposes over MCP:

- **auth_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** — 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.
- **set_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.
- **start_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** — Second step: confirms the browser consent finished, 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.
- **logout** — 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** — 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.
- **list_shared_drives** — 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.
- **get_file** — 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.
- **create_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.
- **copy_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.
- **move_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).
- **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.
- **upload_file** — 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.
- **download_file** — 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).
- **export_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. 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.
- **trash_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 explicitlyTrashed.
- **delete_file_forever** — 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).
- **manage_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 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.
- **manage_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 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.
- **raw_request** — 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 automatically; the method defaults to GET; the response must be JSON (binary media downloads belong to download_file/export_file).

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "google-drive-mcp": {
    "command": "npx",
    "args": ["-y","@a1-x-tech/mcp-google-drive@latest"],
    "env": {
      "GOOGLE_DRIVE_CLIENT_ID": "",
      "GOOGLE_DRIVE_CLIENT_SECRET": "",
      "GOOGLE_DRIVE_REFRESH_TOKEN": ""
    }
  }
}
```

**Requires environment variables:** `GOOGLE_DRIVE_CLIENT_ID`, `GOOGLE_DRIVE_CLIENT_SECRET`, `GOOGLE_DRIVE_REFRESH_TOKEN` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What Google Drive MCP does

Google Drive MCP MCP server gives an AI client access to Google Drive through the Google Drive API. It covers both My Drive and shared-drive content, where each item is addressed by its Drive file ID rather than by name alone. The server supports read operations as well as changes to files, folders, permissions, comments, and trash status.

The available surface contains 21 tools spanning search and metadata, folder creation and movement, upload and download, copying, renaming, export, sharing, comments, trash, restoration, and permanent deletion. Google Docs, Sheets, and Slides are handled as complete files: the server can move, copy, share, export, or convert them, but it does not edit document text or spreadsheet cells.

## How it works

Google Drive MCP MCP server authenticates against the Google Drive API using a Google account. During an interactive connection, the assistant guides the user through OAuth client setup and approval, receives Google’s redirect on `127.0.0.1`, and uses PKCE. The server stores the resulting tokens, so the interactive flow does not require a configuration file or a restart.

Two access scopes are described. `drive.readonly` supports read access across Drive, while `drive.file` restricts access to files created by the application. The complete tool set requires the broader `drive` scope. An existing refresh-token setup can also be supplied through environment variables.

Reads may be retried after network or HTTP 5xx failures, but writes are not replayed after an uncertain failure. This avoids silently duplicating a folder, upload, or copy. Uploads through the built-in path are limited to 5 MB; larger uploads can use a resumable session through `raw_request`. Drive API exports are limited to 10 MB.

## Setup and configuration

The package runs through Node.js 20 or newer and is available from npm as `@a1-x-tech/mcp-google-drive`. Add it to an MCP client with the stdio command `npx -y @a1-x-tech/mcp-google-drive@latest`.

For clients using preconfigured credentials, the documented variables are `GOOGLE_DRIVE_CLIENT_ID`, `GOOGLE_DRIVE_CLIENT_SECRET`, and `GOOGLE_DRIVE_REFRESH_TOKEN`. Alternatively, start the server and ask the assistant to connect Google Drive so the OAuth flow can be completed interactively.

The README provides setup examples for Codex, Claude Code, Claude Desktop local configurations, Cursor, and VS Code. Claude Desktop’s current extension path expects an `.mcpb` bundle, which this repository does not provide; local stdio configuration is documented as a fallback for builds that still support it.

## Tools and capabilities

With Google Drive MCP MCP server, an agent can:

- Search for files and inspect names, types, owners, locations, and modification dates.
- Create folders, move items, copy files, rename them, and update metadata.
- Upload and download content, including converting uploaded content into a Google Doc.
- Export Google Docs, Sheets, and Slides, including exporting a Doc to Markdown.
- Grant, modify, or revoke access and add invitation messages.
- List, create, resolve, or delete comment threads.
- List trashed items, restore them, move files to trash, or permanently delete them.

The server treats ordinary deletion as moving an item to the reversible trash. Google normally purges trashed items after about 30 days. Permanent deletion is exposed separately and can remove a folder subtree, so it is not bundled with the ordinary trash operation.

## Limitations and notes

File names are not unique, and duplicate names are valid in Drive. Workflows should search first and use returned IDs for later operations. The server does not provide tools for editing text inside Docs or cells inside Sheets. API-created comments cannot target a precise passage in a document.

Operations that change Drive, file metadata, permissions, comments, or trash status require care. The README’s examples show confirmation before creating a folder and moving files, but the exact confirmation behavior depends on the connected AI client. Permanent deletion bypasses the trash and should be treated separately from cleanup workflows.

_Full upstream README: https://allmcps.com/mcp/google-drive-mcp/readme_

