Labsco
MCP SERVER

Gdrive Cloudflare worker

by brianmoney

Google Drive and Sheets over a remote MCP endpoint, with a full OAuth 2.0 server in front.

Office Suites & Cloud File Storage
Summary
Remote changes who has to hold the credentials.

Because the Worker is the authorization server, each user signs in as themselves and the tokens live in Cloudflare KV rather than in a config file on a laptop — that is the difference from the stdio Drive servers this was adapted from. Check the ceilings before you commit: uploads cap at 5 MB, exports at 10 MB, and a request has 30 seconds before Workers cuts it off. The version is marked alpha.

What it is

A Google Drive and Sheets server that runs on Cloudflare Workers rather than as a local process. It is a complete OAuth 2.0 authorization server with PKCE and dynamic client registration, so an MCP client discovers the endpoints, registers itself, and sends the user through Google sign-in — no key files on anyone's laptop.

What you get
  • Finding files — `gdrive_search` for basic search, `gdrive_search_advanced` for filters on MIME type, owner, dates and shared drives
  • `gdrive_read_file` reads a file, with 22+ export formats including PDF, DOCX, XLSX and Markdown
  • Writing — `gdrive_create_folder`, `gdrive_upload_file`, `gdrive_delete_file` (to trash), `gdrive_move_file`
  • `gdrive_add_permission` shares a file or folder as reader, writer, commenter or owner
  • Sheets — `gsheets_read` batch-reads multiple ranges, `gsheets_update_cell` writes one cell, `gsheets_append_row` adds rows
  • Token handling is automatic: Google tokens refresh behind the scenes, access tokens expire in 1 hour, stored tokens are cleaned up after 30 days
Requirements

You deploy this yourself. It needs a Cloudflare account with Workers (the free tier works), Node.js LTS (v18+), the Wrangler CLI, and a Google Cloud project with the Drive and Sheets APIs enabled. Two KV namespaces — `KV_TOKENS` and `KV_CLIENTS` — are created with Wrangler and their IDs written into `wrangler.toml`; `GOOGLE_CLIENT_ID` goes in `[vars]` and `GOOGLE_CLIENT_SECRET` is set with `wrangler secret put`. The OAuth client is a Web application with `https://your-worker.workers.dev/google/callback` as redirect URI and the `drive` and `spreadsheets` scopes. Clients connect to the `/sse` endpoint. Published as mcp-gdrive-cf version 0.4.0-alpha.1.

Setup effort

One command plus a key — npx -y mcp-remote https://your-worker.workers.dev/sse, then supply credentials