Skip to main content
Glama

drive-mcp

A minimal Model Context Protocol server for one Google Drive account, served over stdio. It gives an MCP client such as Claude Code the ability to search, read, download, create, edit, organize and share files using your own Google OAuth client.

Why

Google's hosted Drive MCP endpoint requires the Cloud project to be enrolled in the Google Workspace Developer Preview Program, which asks for a Workspace account. A personal Google account cannot use it. This server sidesteps that by talking to the Drive API itself with a Desktop-app OAuth client that you create in your own Google Cloud project. No third party sits between the client and your files.

Related MCP server: Google Docs MCP Proxy

Scope and safety

The server requests the full drive scope. That is deliberate: the narrower drive.file scope only reaches files the app itself created, which would rule out reading, editing or organizing anything already in the account.

Because the scope is broad, the tool surface is the safety boundary:

  • Nothing permanently deletes. trash_file moves to the trash, where Drive keeps things for 30 days and untrash_file brings them back. There is no tool to empty the trash.

  • Sharing never emails anyone unless sendNotificationEmail is set to true.

  • Link sharing is created with allowFileDiscovery off, so shared links are never searchable.

  • download_file refuses to overwrite a local file unless told to.

Pin every write tool to an "ask" rule in your MCP client so it prompts on every call regardless of the session's permission mode. In Claude Code that is a block in .claude/settings.local.json of the project where the server is registered:

{
  "permissions": {
    "ask": [
      "mcp__drive__create_file",
      "mcp__drive__create_folder",
      "mcp__drive__upload_file",
      "mcp__drive__update_file_content",
      "mcp__drive__update_file_metadata",
      "mcp__drive__copy_file",
      "mcp__drive__trash_file",
      "mcp__drive__untrash_file",
      "mcp__drive__share_file",
      "mcp__drive__unshare_file"
    ]
  }
}

The tool name prefix is mcp__<server name>__, so adjust it to whatever name you register the server under.

Tools

Read

Tool

Effect

search_files

Structured search: name, full text, type, folder, modified after, owned by me. Paginated

list_recent_files

Most recently modified files, default 10

list_folder

Direct children of a folder, folders first. root is My Drive

get_file_metadata

One file with its folder path and web link

read_file_content

Content as text. Docs export as Markdown, Sheets as CSV, Slides as plain text; text-like files as-is

get_file_permissions

Who has access and with what role

download_file

Save to a local absolute path. Docs, Sheets, Slides and Drawings export to docx, xlsx, pptx and png by default

Write

Tool

Effect

create_file

Writes. New file from text. convertTo imports Markdown, HTML or plain text as a Doc, CSV as a Sheet

create_folder

Writes. New folder

upload_file

Writes. Upload a local file, optionally importing it as a Google-native file

update_file_content

Writes. Replace a file's content. For a Doc, Markdown replaces the whole document

update_file_metadata

Writes. Rename, move, describe or star

copy_file

Writes. Copy, optionally renamed and into another folder

trash_file / untrash_file

Writes. Reversible trash

share_file

Writes, reaches other people. Grant reader, commenter or writer to a user, group, domain or anyone with the link

unshare_file

Writes. Remove a permission by id or by email; anyone removes link sharing

Files

File

Purpose

server.js

The MCP server

auth.js

One-time OAuth consent flow; writes the token file

config.js

File locations and scope, overridable through environment variables

credentials.json

OAuth client from Google Cloud Console. Gitignored, never commit it

token.json

Refresh token, written with mode 600. Gitignored, never commit it

Setup

Requires Node.js 20 or newer.

  1. In Google Cloud Console, signed in as the Google account you want to expose: create a project and enable the Google Drive API.

  2. Configure the OAuth consent screen as External and add that same account as a test user.

  3. Create an OAuth client ID of type Desktop app and download its JSON to credentials.json in this directory. If you already have a Desktop client from another tool in the same project, the same file works here; each server keeps its own token.

  4. Install dependencies and run the consent flow:

    npm install
    npm run auth

    A browser opens on the Google consent screen. When it finishes, the script prints which account the token belongs to. Set DRIVE_MCP_ACCOUNT to the expected address if you want a warning when the wrong account was used.

  5. Register the server with your MCP client. For Claude Code, from the project where you want it available:

    claude mcp add drive -- node /absolute/path/to/drive-mcp/server.js

Configuration

Everything defaults to files next to the code. Override with environment variables when the server runs from elsewhere or when several accounts share one checkout.

Variable

Default

Meaning

DRIVE_MCP_CREDENTIALS

./credentials.json

Path to the OAuth client JSON

DRIVE_MCP_TOKEN

./token.json

Path where the refresh token is stored

DRIVE_MCP_ACCOUNT

unset

Expected address; auth.js warns if the token belongs to another account

To change the scope, edit SCOPES in config.js and re-run npm run auth. An existing token keeps its old scope, and API calls fail with insufficient authentication scopes until it is reissued.

Notes

  • Staying in OAuth "Testing" status is fine for personal use; no Google verification is needed. Refresh tokens for an app in Testing status expire 7 days after they are issued, whether or not the app is used. This is not an idle timeout: a token used every single day still stops working on day 7. Re-run npm run auth when calls start failing with invalid_grant.

  • credentials.json and token.json are secrets. They are gitignored here, but treat any copy of them like a password.

  • Sibling projects: gmail-mcp and calendar-mcp.

License

MIT. See LICENSE.

Available Tools

17 tools
copy_fileB

WRITES. Copy a file, optionally with a new name and into another folder. Folders cannot be copied.

Inputs: fileId (required), name, folderId.

create_fileA

WRITES. Create a file from text. With convertTo, the text is imported as a Google Doc (from Markdown, HTML or plain text), Sheet (from CSV) or Slides. Without it a plain file of the given mimeType is created. Omit content to create an empty Google file.

Inputs: name (required), content, folderId, mimeType, +2 more.

create_folderC

WRITES. Create a folder.

Inputs: name (required), parentId.

download_fileA

Save a file to a local absolute path. Google-native files are exported (Docs to docx, Sheets to xlsx, Slides to pptx, Drawings to png by default; pass format to change). Refuses to overwrite unless overwrite is true.

Inputs: fileId (required), destinationPath (required), format, overwrite.

get_file_metadataC

Full metadata for one file, including its folder path and web link.

Inputs: fileId (required).

get_file_permissionsC

Who can access a file and with what role.

Inputs: fileId (required).

list_folderA

List the direct children of a folder, folders first then by name. Use "root" for My Drive.

Inputs: folderId, pageToken, maxResults.

list_recent_filesB

The most recently modified files that are not in the trash. Default 10.

Inputs: orderBy, maxResults.

read_file_contentA

Return a file's content as text. Google Docs export as Markdown, Sheets as CSV (first sheet), Slides as plain text; text, Markdown, CSV, JSON and similar files are returned as-is. Binary files such as PDFs and images cannot be read this way; use download_file.

Inputs: fileId (required), format, maxChars.

search_filesA

Search Drive by name, full text, type, folder and modification date. All constraints are ANDed. Returns metadata only; use read_file_content or download_file for contents. Trashed files are excluded unless includeTrashed is true.

Inputs: name, type, orderBy, folderId, +7 more.

share_fileB

WRITES and reaches other people. Grant access to a user, group, domain, or anyone with the link. No email is sent unless sendNotificationEmail is true.

Inputs: role (required), type (required), fileId (required), domain, +4 more.

trash_fileA

WRITES. Move a file or folder to the trash. Reversible with untrash_file for 30 days; nothing is permanently deleted.

Inputs: fileId (required).

unshare_fileA

WRITES. Remove one permission, by permission id (from get_file_permissions) or by the email address it was granted to. Pass emailAddress "anyone" to remove link sharing.

Inputs: fileId (required), emailAddress, permissionId.

untrash_fileB

WRITES. Restore a file or folder from the trash.

Inputs: fileId (required).

update_file_contentA

WRITES. Replace a file's content with new text. For a Google Doc the text is re-imported (Markdown, HTML or plain text), replacing the whole document; for a Sheet pass CSV. The file id, name, sharing and location are unchanged.

Inputs: fileId (required), content (required), mimeType.

update_file_metadataA

WRITES. Rename, move, describe or star a file. Only the fields passed are changed. Moving replaces the current parent folder.

Inputs: fileId (required), name, starred, description, +1 more.

upload_fileB

WRITES. Upload a local file. With convertTo the upload is imported as a Google-native file (e.g. a .docx or .md into a Google Doc, a .csv or .xlsx into a Sheet).

Inputs: localPath (required), name, folderId, mimeType, +1 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 17 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action: separate tools for creating folders vs files, reading content vs downloading, updating content vs metadata, and sharing vs unsharing. Overlaps like list_folder/search_files/list_recent_files are clearly distinguished by scope and filters.

    Naming Consistency5/5

    All tools use snake_case with a consistent verb_noun pattern (e.g., create_folder, update_file_content, share_file). Variations like list_recent_files and get_file_metadata are still predictable and readable.

    Tool Count4/5

    17 tools is slightly above the typical 3-15 range but justified by Google Drive's breadth (files, folders, permissions, sharing, trash, content I/O). No tool appears redundant, though a few could theoretically be merged.

    Completeness4/5

    Core lifecycle is covered: create, read, update, copy, trash/untrash, share/unshare. Minor gaps include no permanent delete (trash is reversible) and no dedicated move operation (handled via update_file_metadata), but no critical dead ends.

    Maintenance

    ActivitySlowing
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      C
      maintenance
      A 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.
      13 npm
      2
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Local stdio MCP server that handles Google OAuth2 locally and proxies authenticated requests to Google Docs and Google Drive REST APIs, enabling document and file operations from Cursor or other MCP clients.
      61 npm
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      A local, read-only MCP server for searching your Google Drive.
      23 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables an MCP client to search, read, label, draft, and send Gmail messages for a single Google account over stdio using your own OAuth client.
      280 npm
      MIT