Skip to main content
Glama
Google Drive CRUD MCP Server

Google Drive CRUD MCP Server

Google Drive CRUD MCP Server

Give Claude full read-write access to your Google Drive, Docs, Sheets, and Slides, running on a server you own with Google credentials you control.

Deploy on Railway

CRUD stands for create, read, update, delete - the four things this server lets Claude do to your files, as opposed to read-only access.

Start here if you are not a developer

The Railway button above deploys the server, but it still needs a Google Cloud project and an OAuth client before it will connect to Claude. The guided setup walks through every step, including a copy-paste prompt that has Claude do the Google Cloud and Railway configuration with you:

atlanticlabs.ai/mcp-google-drive

That is the recommended path. The manual instructions further down are for people who would rather run the commands themselves.

Once it is deployed, the connector URL to paste into claude.ai is:

https://<your-railway-domain>/mcp

The /mcp path matters. A request to the bare domain returns an error.

Related MCP server: google-mcp

What it does

The server exposes Google Drive, Docs, Sheets, and Slides to Claude as MCP tools. MCP is the Model Context Protocol, the open standard Claude uses to talk to outside systems.

Drive files

Tool

What it does

search_files

Query-based search across every drive the account can reach

list_recent_files

Most recently modified files, excluding trashed ones

get_file_metadata

Metadata for a single file by ID

read_file_content

Extract text from Docs, Sheets, PDF, and Office files

download_file_content

Raw bytes, returned inline as base64, capped at 25 MB by default

create_file

Create a file or folder, converting to a native Google type unless told not to

create_resumable_upload_session

Return an upload URL so large files go straight to Google instead of through Claude

import_to_google_doc

Import Markdown, DOCX, TXT, HTML, RTF, or ODT and convert to a native Doc

list_drive_items

List the children of a folder

create_drive_folder

Create a folder

copy_drive_file

Copy a file

update_drive_file

Rename, move, or trash a file (metadata only, not content)

get_drive_shareable_link

Get a shareable link

get_drive_file_permissions, check_drive_file_public_access

Inspect who has access

manage_drive_access, set_drive_file_permissions

Grant or revoke access

Google Docs

Tool

What it does

docs_get

Read a document's content and structure, including the character indexes needed to edit it

docs_batch_update

Apply a batch of structural edits: insert text, style, tables, images, and so on

docs_replace_all_text

Replace every occurrence of a string, which is how template filling works

Google Sheets

Tool

What it does

spreadsheets_get

Read a spreadsheet's structure and values

spreadsheets_batch_update

Apply batch changes, including native charts, formatting, and sheet operations

Google Slides

Tool

What it does

presentations_get

Read a presentation's slides and elements

presentations_batch_update

Apply batch changes: create slides, insert text and shapes, place native charts

The Docs, Sheets, and Slides tools expose the underlying batch update APIs rather than a simplified wrapper, so Claude can build a formatted document, a real spreadsheet chart, or a slide layout rather than only writing plain text into a file.

How it works

The server runs on your own hosting account and authenticates with your own Google OAuth client. Nothing routes through infrastructure belonging to me or to anyone else.

  • Your Google Cloud project. You create the OAuth client, so the consent screen names your project and the access tokens are issued to it.

  • Your server. Railway is the one-click option, but the server is a normal Python application with a Dockerfile and runs anywhere that can run a container.

  • OAuth 2.1, multi-user. Each person who connects authorizes with their own Google account and sees only their own files. The server validates bearer tokens against Google on every call.

  • No stored copies of your files. Downloads and inline uploads are held in memory only. When create_file is given a URL to fetch from, the bytes are buffered while they transfer: in stateless mode that buffer stays in memory up to 5 MB and spills to a temporary file beyond it, and otherwise it is a temporary file regardless of size. Either way the buffer is deleted when the call ends.

  • Scopes. Drive read and write, Sheets read and write, Slides read and write, plus basic profile and email for identifying the signed-in user. Read-only mode is available and drops the write scopes entirely.

Manual self-host

Prerequisites

  • Python 3.10 or newer (.python-version pins the exact version)

  • The uv package manager: curl -LsSf https://astral.sh/uv/install.sh | sh

  • A Google account and a Google Cloud project (the free tier is enough)

1. Configure Google Cloud

In console.cloud.google.com, select or create a project.

Enable the APIs. Under APIs and Services, then Library, enable each of: Google Drive API, Google Docs API, Google Sheets API, Google Slides API.

Configure the OAuth consent screen. Under APIs and Services, then OAuth consent screen:

  • User type: External, or Internal if you have a Google Workspace organization.

  • Add yourself under Test users so you can authorize while the consent screen is still in testing mode.

  • Add these scopes:

    • openid

    • https://www.googleapis.com/auth/userinfo.email

    • https://www.googleapis.com/auth/userinfo.profile

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

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

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

    • https://www.googleapis.com/auth/spreadsheets

    • https://www.googleapis.com/auth/spreadsheets.readonly

    • https://www.googleapis.com/auth/presentations

    • https://www.googleapis.com/auth/presentations.readonly

Create an OAuth 2.0 client ID. Under APIs and Services, then Credentials, choose Create credentials, then OAuth client ID.

  • Application type: Web application, not Desktop app.

  • Authorized redirect URI: http://localhost:8000/oauth2callback for local work, or https://<your-domain>/oauth2callback for a deployed server.

  • Save the client ID and client secret.

2. Configure the environment

cp env.example .env

Fill in the client ID and secret. The recommended local configuration matches production:

GOOGLE_OAUTH_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_OAUTH_CLIENT_SECRET=your-client-secret
GOOGLE_OAUTH_REDIRECT_URI=http://localhost:8000/oauth2callback

WORKSPACE_MCP_TRANSPORT=streamable-http
WORKSPACE_MCP_PORT=8000
WORKSPACE_MCP_HOST=0.0.0.0
WORKSPACE_EXTERNAL_URL=http://localhost:8000

MCP_ENABLE_OAUTH21=true
WORKSPACE_MCP_STATELESS_MODE=true

Always set WORKSPACE_EXTERNAL_URL explicitly on a deployed server. It is the base URL the OAuth endpoints are built from. If it is unset, that base falls back to WORKSPACE_MCP_BASE_URI and the port, which defaults to http://localhost:8000 - correct locally, wrong anywhere else, and the usual cause of a redirect_uri_mismatch error. Setting GOOGLE_OAUTH_REDIRECT_URI explicitly, as above, pins the callback itself.

3. Install and run

uv sync
uv run main.py --transport streamable-http

The server listens on http://localhost:8000/mcp. To check it before wiring up a client:

npx @modelcontextprotocol/inspector
# Transport: streamable-http
# URL: http://localhost:8000/mcp
# Connect, complete the OAuth handshake, then list tools

Docker works too and reads the same .env:

docker compose up --build

4. Deploy

The Dockerfile is ready for Railway as it stands:

railway up --service gdrive-mcp

Set GOOGLE_OAUTH_CLIENT_ID, GOOGLE_OAUTH_CLIENT_SECRET, WORKSPACE_EXTERNAL_URL=https://<your-domain>, MCP_ENABLE_OAUTH21=true, WORKSPACE_MCP_STATELESS_MODE=true, and WORKSPACE_MCP_TRANSPORT=streamable-http in the Railway service variables, then add https://<your-domain>/oauth2callback to the authorized redirect URIs on the Google OAuth client.

5. Connect claude.ai

claude.ai fetches the server from Anthropic's servers, not from your browser, so it needs a public HTTPS URL. A deployed Railway service gives you one. For local testing, a tunnel works: run ngrok http 8000, then set WORKSPACE_EXTERNAL_URL and GOOGLE_OAUTH_REDIRECT_URI to the tunnel URL and add that callback to the Google OAuth client. Free ngrok URLs change on every restart, which means editing both places again each time.

In claude.ai, go to Settings, then Connectors, then Add custom connector, and enter https://<your-domain>/mcp. Authorize with a Google account that is listed under Test users on the consent screen.

One extra step if you want Claude to upload files it generates in code: in claude.ai, under Settings, then Capabilities, enable network egress and add *.googleapis.com and googleapis.com to the allowed domains. Without that, the connector itself still works, but a code execution step that pushes bytes out to Google is blocked by the sandbox firewall.

Claude egress allowlist with googleapis.com added

Local use with Claude Desktop

Claude Desktop speaks stdio rather than HTTP. Comment out WORKSPACE_MCP_TRANSPORT, MCP_ENABLE_OAUTH21, and WORKSPACE_MCP_STATELESS_MODE, then set:

USER_GOOGLE_EMAIL=you@example.com
MCP_SINGLE_USER_MODE=1
WORKSPACE_MCP_CREDENTIALS_DIR=./store_creds

In this mode the server also exposes a start_google_auth tool for kicking off the browser authorization flow. It is hidden when OAuth 2.1 is enabled, because the client handles authorization there instead.

Run uv run main.py --single-user, and add this to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "gdrive": {
      "command": "uv",
      "args": ["run", "/absolute/path/to/this/repo/main.py", "--single-user"]
    }
  }
}

Environment variables

These are the variables a normal deployment needs. The code reads a number of others for reverse proxy, service account, and alternate credential store setups, which env.example and the source cover.

Variable

Required

Default

What it does

GOOGLE_OAUTH_CLIENT_ID

Yes

none

OAuth client ID from Google Cloud

GOOGLE_OAUTH_CLIENT_SECRET

Yes

none

OAuth client secret from Google Cloud

GOOGLE_OAUTH_REDIRECT_URI

No

<base URL>/oauth2callback

Callback URI, and it must match one registered on the OAuth client

WORKSPACE_EXTERNAL_URL

Yes when deployed

none

Public URL the server is reachable at, used as the base for the OAuth endpoints

WORKSPACE_MCP_BASE_URI

No

http://localhost

Base used with the port when WORKSPACE_EXTERNAL_URL is unset

WORKSPACE_MCP_TRANSPORT

No

stdio

stdio or streamable-http. Deployed servers need streamable-http

WORKSPACE_MCP_PORT

No

8000

Port to bind. Railway sets PORT, which takes precedence

WORKSPACE_MCP_HOST

No

0.0.0.0

Bind address

MCP_ENABLE_OAUTH21

No

false

Multi-user mode where each caller sends their own bearer token

WORKSPACE_MCP_STATELESS_MODE

No

off

Keep no per-session state on disk, needed behind a stateless proxy

WORKSPACE_MCP_CREDENTIALS_DIR

No

~/.google_workspace_mcp/credentials

Where credentials persist when not stateless, for local use

WORKSPACE_MCP_READ_ONLY

No

off

Drop the write scopes and disable every mutating tool

USER_GOOGLE_EMAIL

No

none

Pin the server to one Google account in single-user mode

MCP_SINGLE_USER_MODE

No

off

Single-user mode, an alternative to OAuth 2.1

DOWNLOAD_FILE_CONTENT_MAX_MB

No

25

Largest file download_file_content will return inline

Troubleshooting

Symptom

Cause and fix

redirect_uri_mismatch

The redirect URI does not exactly match the one registered in Google Cloud. Check protocol, port, and path.

Access blocked: This app's request is invalid

The consent screen is unpublished and your account is not in the test-users list.

Drive API has not been used in project ... before or it is disabled

An API was not enabled. The error message includes a direct link to enable it.

A deployed server sends users to a localhost URL during authorization

WORKSPACE_EXTERNAL_URL is not set, so the OAuth base fell back to http://localhost:8000. Point it at the public URL.

A POST to the server returns 405

The connector URL is missing the /mcp path.

--single-user is incompatible with OAuth 2.1 mode

Both MCP_ENABLE_OAUTH21=true and --single-user are set. Pick one.

Claude can call tools but uploading a generated file fails

Claude's sandbox is blocking outbound traffic to Google. Add *.googleapis.com to the egress allowlist in claude.ai settings.

Attribution

This is a fork of the google_workspace_mcp project, taken at commit 5495c83cd3ac503d00cd8015de944c9949cd6443. The OAuth machinery, server scaffold, tool registry, and Drive helpers are that project's work, and this fork would not exist without it.

What changed here: the Google services this fork does not need were removed (Gmail, Calendar, Forms, Chat, Tasks, Contacts, Search, and Apps Script), which keeps the consent screen and the authorization blast radius down to Drive, Docs, Sheets, and Slides; the overlapping Drive tools were renamed and reshaped to match the tool surface of Claude's built-in Drive connector, so skills written against the built-in tools work unchanged; binary uploads were fixed, since upstream encoded content as UTF-8 regardless of the file type and turned an uploaded xlsx or pptx into a file containing the literal base64 text; and the Docs, Sheets, and Slides batch update tools were added for native-chart and template-filling workflows.

License

MIT, inherited from upstream. See LICENSE.

Maintained by Adam Walker at Atlantic Labs AI. Questions: adam@atlanticlabs.ai

Available Tools

25 tools
check_drive_file_public_accessCheck Drive File Public AccessA
Read-onlyIdempotent

Searches for a file by name and checks if it has public link sharing enabled.

Inputs: file_name (required), user_google_email (required), drive_id. Returns: result

copy_drive_fileCopy Drive FileB

Creates a copy of an existing Google Drive file.

This tool copies the template document to a new location with an optional new name. The copy maintains all formatting and content from the original file.

Inputs: file_id (required), user_google_email (required), new_name, parent_folder_id. Returns: result

create_drive_folderCreate Drive FolderA

Creates a new folder in Google Drive, supporting creation within shared drives.

Inputs: folder_name (required), user_google_email (required), parent_folder_id. Returns: result

create_fileCreate FileA

Creates a new file in Google Drive, supporting creation within shared drives. Accepts either direct content or a fileUrl to fetch the content from.

Inputs: title (required), user_google_email (required), content, fileUrl, +3 more. Returns: object

create_resumable_upload_sessionCreate Resumable Upload SessionA

Creates a Google Drive resumable upload session and returns the upload URL.

The caller (e.g. a skill running in claude.ai's sandbox) uses the returned upload_url to PUT raw file bytes directly to Google — bypassing MCP transport limits on large content arguments. Only the short URL travels through MCP; the bytes go straight from the sandbox to Google.

Inputs: title (required), mimeType (required), user_google_email (required), parentId, +1 more. Returns: object

docs_batch_updateBatch Update Google DocA

Apply a batch of edit requests to a Google Doc (documents.batchUpdate).

Accepts any Docs API request type (insertText, deleteContentRange, updateTextStyle, insertTable, insertInlineImage, ...). Indexes shift as earlier requests in the batch insert or delete content, so order edits from the END of the document toward the start, or send one request per call. Get current indexes from docs_get first. Pass writeControl with the revision id from docs_get to fail fast if the document changed since — otherwise stale indexes edit the wrong ranges silently.

Inputs: requests (required), documentId (required), user_google_email (required), writeControl. Returns: object

docs_getGet Google DocA
Read-onlyIdempotent

Read a Google Doc's content and structure (documents.get).

The returned resource's body.content elements carry startIndex/endIndex for every paragraph and text run — use them to compute the index arguments that docs_batch_update requests need, and to verify an edit landed.

Inputs: documentId (required), user_google_email (required), fields, includeTabsContent. Returns: object

docs_replace_all_textReplace All Text in Google DocA

Find-and-replace text across a Google Doc (documents.batchUpdate with one replaceAllText request per item). Preserves surrounding formatting, so it is the safest way to fill placeholders in a template document.

Inputs: documentId (required), replacements (required), user_google_email (required), matchCase. Returns: object

download_file_contentDownload File ContentA
Read-onlyIdempotent

Downloads a Google Drive file and returns its raw bytes as a base64-encoded blob.

For Google native files (Docs, Sheets, Slides), exports to a useful format:

  • Google Docs -> PDF (default) or DOCX if export_format='docx'

  • Google Sheets -> XLSX (default), PDF if export_format='pdf', or CSV if export_format='csv'

  • Google Slides -> PDF (default) or PPTX if export_format='pptx'

For other files, downloads the original file format.

Size limit: DOWNLOAD_FILE_CONTENT_MAX_MB env var (default 25 MB). Files larger than the limit return an error pointing to read_file_content for text extraction, or a Drive shareable link as a fallback.

Inputs: fileId (required), user_google_email (required), export_format.

get_drive_file_permissionsGet Drive File PermissionsB
Read-onlyIdempotent

Gets detailed metadata about a Google Drive file including sharing permissions.

Inputs: file_id (required), user_google_email (required). Returns: result

get_file_metadataGet File MetadataA
Read-onlyIdempotent

Returns metadata for a single Google Drive file by ID.

Inputs: fileId (required), user_google_email (required). Returns: object

import_to_google_docImport to Google DocA

Imports a file (Markdown, DOCX, TXT, HTML, RTF, ODT) into Google Docs format with automatic conversion.

Google Drive automatically converts the source file to native Google Docs format, preserving formatting like headings, lists, bold, italic, etc. For batch operations, prefer file_path for files on disk so callers do not need to load full file contents into their context.

Inputs: file_name (required), user_google_email (required), content, file_url, +3 more. Returns: result

list_drive_itemsList Drive ItemsA
Read-onlyIdempotent

Lists files/folders or shared drive containers, supporting shared drives. If drive_id is specified, lists items within that shared drive. folder_id is then relative to that drive (or use drive_id as folder_id for root). If drive_id is not specified, lists items from user's "My Drive" and accessible shared drives (if include_items_from_all_drives is True). Set resource_type to "shared_drives" to list shared drive containers instead of folder contents.

Inputs: user_google_email (required), query, corpora, detailed, +9 more. Returns: result

list_recent_filesList Recent FilesA
Read-onlyIdempotent

Lists the user's most recently modified files in Google Drive (across all drives the user has access to). Excludes trashed items.

Inputs: user_google_email (required), page_size, page_token. Returns: object

manage_drive_accessManage Drive AccessA
Destructive

Consolidated tool for managing Google Drive file and folder access permissions.

Supports granting, batch-granting, updating, revoking permissions, and transferring file ownership -- all through a single entry point.

Inputs: action (required), file_id (required), user_google_email (required), role, +10 more. Returns: result

presentations_batch_updatePresentations Batch UpdateA

Apply a batch of update requests to a Google Slides presentation (presentations.batchUpdate).

Used by the QBR skill to delete chart placeholders and embed LINKED Sheets charts (createSheetsChart, linkingMode=LINKED). Build requests with scripts/google_native/slides_links.build_link_requests(). Pass writeControl {"requiredRevisionId": ...} (from presentations_get) to guard against clobbering concurrent human edits.

Retries transient Drive eventual-consistency failures (a just-converted Sheet not yet visible to Slides) with exponential backoff up to ~30s.

Inputs: requests (required), presentationId (required), user_google_email (required), writeControl. Returns: object

presentations_getPresentations GetA
Read-onlyIdempotent

Read a Google Slides presentation (presentations.get). Use a fields mask:

  • slot resolution: slides(objectId,pageElements(objectId,description,title,size,transform,shape/text,elementGroup))

  • embed verification: slides(pageElements(objectId,sheetsChart))

  • revision guard: revisionId

Inputs: presentationId (required), user_google_email (required), fields. Returns: object

read_file_contentRead File ContentA
Read-onlyIdempotent

Retrieves the content of a specific Google Drive file by ID, supporting files in shared drives.

• Native Google Docs, Sheets, Slides → exported as text / CSV. • Office files (.docx, .xlsx, .pptx) → unzipped & parsed with std-lib to extract readable text. • PDFs → text extracted with pypdf when possible; scanned/image-only PDFs fall back to a download hint. • Images → returned as base64 with MIME metadata for multimodal clients. • Any other file → downloaded; tries UTF-8 decode, else notes binary.

Inputs: fileId (required), user_google_email (required). Returns: result

search_filesSearch FilesB
Read-onlyIdempotent

Searches for files and folders within a user's Google Drive, including shared drives.

Inputs: query (required), user_google_email (required), corpora, detailed, +6 more. Returns: object

set_drive_file_permissionsSet Drive File PermissionsA
Destructive

Sets file-level sharing settings and controls link sharing for a Google Drive file or folder.

This is a high-level tool for the most common permission changes. Use this to toggle "anyone with the link" access or configure file-level sharing behavior. For managing individual user/group permissions, use share_drive_file or update_drive_permission instead.

Inputs: file_id (required), user_google_email (required), link_sharing, writers_can_share, +1 more. Returns: result

spreadsheets_batch_updateSpreadsheets Batch UpdateA

Apply a batch of update requests to a Google Sheet (spreadsheets.batchUpdate).

Used by the QBR skill to create native charts (addChart) and set cell number formats (repeatCell). Build the requests array with scripts/google_native/sheets_charts.build_batch_requests().

Inputs: requests (required), spreadsheetId (required), user_google_email (required). Returns: object

spreadsheets_getSpreadsheets GetA
Read-onlyIdempotent

Read a Google Sheet's metadata (spreadsheets.get). Use a fields mask to resolve sheet ids (sheets(properties(sheetId,title))) or verify charts (sheets(charts(chartId,spec/title))).

Inputs: spreadsheetId (required), user_google_email (required), fields. Returns: object

start_google_authStart Google AuthA

Manually initiate Google OAuth authentication flow.

NOTE: This is a legacy OAuth 2.0 tool and is disabled when OAuth 2.1 is enabled. The authentication system automatically handles credential checks and prompts for authentication when needed. Only use this tool if:

  1. You need to re-authenticate with different credentials

  2. You want to proactively authenticate before using other tools

  3. The automatic authentication flow failed and you need to retry

In most cases, simply try calling the Google Workspace tool you need - it will automatically handle authentication if required.

Inputs: service_name (required), user_google_email. Returns: result

update_drive_fileUpdate Drive FileC
Destructive

Updates metadata and properties of a Google Drive file.

Inputs: file_id (required), user_google_email (required), name, starred, +8 more. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 25 tools

    Disambiguation3/5

    Multiple tools overlap in purpose, especially around permissions: manage_drive_access, set_drive_file_permissions, get_drive_file_permissions, and check_drive_file_public_access have unclear boundaries. Listing tools (search_files, list_recent_files, list_drive_items) are distinguishable but could be confused.

    Naming Consistency3/5

    Naming mixes verb_noun patterns (get_file_metadata, create_drive_folder) with reverse noun_verb patterns (spreadsheets_get, docs_batch_update). Inconsistent use of 'file' vs 'drive_file' and similar operations named differently (read_file_content vs download_file_content).

    Tool Count4/5

    25 tools is on the high end but reasonable for a server covering Google Drive plus Docs, Sheets, and Slides. Some redundancy (permission tools) makes it feel slightly heavy, but most tools serve distinct purposes.

    Completeness2/5

    The tool set includes create, read, and update operations but completely lacks delete or trash functionality, a fundamental gap for a 'CRUD' server. Also missing native creation for Sheets and Slides, relying on import/update only.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers