New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

mcp-google-gdrive

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

mcp-google-gdrive

MCP server for Google Drive, Docs, Sheets, and Slides with multi-account support, permissions, labels, and full CRUD

latest
Source
npmnpm
Version
2.2.0
Version published
Maintainers
1
Created
Source

mcp-google-gdrive

An MCP server for Google Drive, Docs, Sheets, and Slides. Lets AI assistants manage files, folders, permissions, labels, and trash with full read/write access across multiple Google accounts. Includes automatic Workspace format conversion (Docs to Markdown, Sheets to CSV/JSON, Slides to text).

Tools

Account Management

ToolDescription
gdrive_list_accountsList all configured Google accounts with labels and emails
gdrive_switch_accountSet the active account for subsequent calls
gdrive_add_accountGenerate an authorization URL to add a new Google account

Files

ToolDescription
gdrive_list_filesList files with optional search query and folder filtering
gdrive_get_metadataGet detailed metadata for a file by ID
gdrive_read_fileRead file content with automatic Workspace format conversion
gdrive_download_fileDownload a file to local disk (supports Workspace export)
gdrive_create_fileCreate a new file with optional OCR on image/PDF uploads
gdrive_update_fileUpdate a file's content, name, or description
gdrive_copy_fileCopy a file, optionally to a different folder
gdrive_move_fileMove a file to a different folder
gdrive_search_filesFull-text search across file names and content

Folders

ToolDescription
gdrive_create_folderCreate a new folder
gdrive_list_folderList contents of a specific folder
gdrive_delete_folderDelete a folder (trash or permanent)

Trash

ToolDescription
gdrive_trash_fileMove a file or folder to trash
gdrive_untrash_fileRestore a file or folder from trash
gdrive_empty_trashPermanently delete all trashed files (irreversible)
gdrive_list_trashList files currently in trash

Permissions

ToolDescription
gdrive_share_fileShare a file with a user, group, domain, or anyone
gdrive_list_permissionsList all permissions on a file or folder
gdrive_update_permissionUpdate a permission's role
gdrive_remove_permissionRemove a permission (unshare)
gdrive_transfer_ownershipTransfer file ownership to another user

Labels

ToolDescription
gdrive_list_labelsList available Drive labels
gdrive_list_file_labelsList labels applied to a file
gdrive_set_file_labelsAdd, update, or remove labels on a file

Google Docs

ToolDescription
gdrive_export_docExport a Google Doc (markdown, html, text, docx, pdf). Use savePath to save binary formats to disk
gdrive_create_docCreate a Google Doc from Markdown content
gdrive_update_docReplace a Google Doc's content with Markdown

Google Sheets

ToolDescription
gdrive_create_sheetCreate a new spreadsheet with named tabs
gdrive_export_sheetExport a sheet to CSV, JSON, or XLSX. Use savePath to save XLSX to disk
gdrive_list_sheetsList all sheets/tabs in a spreadsheet
gdrive_read_sheet_rangeRead a specific range from any tab (A1 notation)
gdrive_write_sheet_rangeWrite data to a specific range

Google Slides

ToolDescription
gdrive_create_slidesCreate a new presentation
gdrive_export_slidesExport slides to text, PDF, or PPTX. Use savePath to save binary formats to disk
gdrive_get_slide_thumbnailGet a thumbnail image URL for a specific slide

What's New in v2.2

  • outputFormat parameter — 12 read/list tools now accept outputFormat: "json" | "yaml" | "text". Default is json (backwards compatible). Use yaml for structured output or text for compact human-readable tables. Supported on: list_accounts, list_files, list_folder, list_trash, list_permissions, list_labels, list_file_labels, list_sheets, get_metadata, read_sheet_range, get_slide_thumbnail, search_files.

v2.1

  • gdrive_download_file — Download any file from Drive to a local disk path. Workspace files (Docs, Sheets, Slides) are automatically exported to the specified format (pdf, docx, xlsx, pptx, csv, txt, html, or markdown).
  • savePath on export toolsgdrive_export_doc, gdrive_export_sheet, and gdrive_export_slides now accept an optional savePath parameter. When provided, binary exports (docx, pdf, xlsx, pptx) are saved to disk instead of returned as base64. Omitting savePath preserves the v2.0 behavior.
  • gdrive_list_accounts email resolution — Accounts migrated from v0.x that showed "migrated" instead of an email address now auto-resolve via the Google userinfo API on first call.
  • Documentation fixesgdrive_empty_trash notes eventual consistency; gdrive_transfer_ownership notes cross-org limitation.

Output Formats

All read and list tools support an outputFormat parameter:

FormatDescriptionUse Case
jsonPretty-printed JSON (default)Machine consumption, API pipelines
yamlYAML serializationHuman-readable structured data, config files
textCompact aligned tables and key-value pairsQuick scanning, terminal output, token-efficient LLM context

Example: gdrive_list_files({ query: "name contains 'report'", outputFormat: "text" }) returns:

files:
  id             name              mimeType         modifiedTime  size
  -------------  ----------------  ---------------  ------------  ----
  abc123def456   Q1 Report.pdf     application/pdf  2026-04-01    1024
  ghi789jkl012   Q2 Report.docx    application/pdf  2026-03-15    2048
resultCount: 2

Prerequisites

  • Node.js 18+
  • A Google Cloud project with these APIs enabled:
    • Google Drive API
    • Google Docs API
    • Google Sheets API
    • Google Slides API
  • OAuth2 desktop application credentials

Setup

  • Create a project in the Google Cloud Console and enable the Drive, Docs, Sheets, and Slides APIs
  • Create OAuth2 credentials (Application type: Desktop app) and download the JSON file
  • Save the credentials file:
mkdir -p ~/.config/mcp-google-gdrive
cp ~/Downloads/client_secret_*.json ~/.config/mcp-google-gdrive/credentials.json
chmod 600 ~/.config/mcp-google-gdrive/credentials.json
  • Run the one-time authorization flow:
npx mcp-google-gdrive --auth primary

This prints a URL for Google consent. After granting access, paste the authorization code back into the terminal.

Multi-Account Setup

Add additional accounts with unique labels:

npx mcp-google-gdrive --auth work
npx mcp-google-gdrive --auth personal

Each account gets its own token file at ~/.config/mcp-google-gdrive/tokens/{label}.json. Use the account parameter on any tool to specify which account to use, or call gdrive_switch_account to change the default.

Configuration

Gemini CLI

Add to ~/.gemini/settings.json:

{
  "mcpServers": {
    "google-gdrive": {
      "command": "npx",
      "args": ["-y", "mcp-google-gdrive"]
    }
  }
}

watsonx Orchestrate

orchestrate toolkits import --kind mcp \
  --name google-gdrive \
  --description "Google Drive, Docs, Sheets, Slides" \
  --command "npx -y mcp-google-gdrive" \
  --tools "*"

Claude Code

claude mcp add -s user google-gdrive -- npx -y mcp-google-gdrive

VS Code / Cursor

Add to .vscode/mcp.json in your workspace:

{
  "mcpServers": {
    "google-gdrive": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "mcp-google-gdrive"]
    }
  }
}

Authentication

The server uses OAuth2 for Google Drive access. Credentials are stored locally:

  • ~/.config/mcp-google-gdrive/credentials.json — OAuth2 client (shared across accounts)
  • ~/.config/mcp-google-gdrive/tokens/{label}.json — Per-account tokens (chmod 600)
  • ~/.config/mcp-google-gdrive/config.json — Active account and account registry

Access tokens expire after one hour and are refreshed automatically using stored refresh tokens. Token refresh is transparent and requires no user interaction.

Migrating from v0.x

If upgrading from a single-account v0.x installation, the server automatically migrates your existing token.json to tokens/primary.json on first start.

License

MIT

Keywords

mcp

FAQs

Package last updated on 04 Apr 2026

Related posts