mcp-gdrive-cf implementation-plan.instructions.md

mcp-gdrive-cf implementation-plan.instructions.md is an instructions file for GitHub Copilot from brianmoney/mcp-gdrive-cf. It costs 2,661 tokens per session, scanned B, a copy of mcp-gdrive-cf agent.instructions.md, MIT.

An implementation plan for running a Google Drive and Sheets MCP server remotely on Cloudflare Workers, a platform for running code at the network edge.

In plain words
What is it for?
Use it as a build plan for searching and reading Drive files, reading or updating spreadsheet cells, and providing remote MCP access through Cloudflare. It specifies an SSE endpoint and OAuth endpoints.
Why use it?
It describes how to expose Drive and Sheets operations to remote MCP clients while addressing OAuth login, token storage, and access to Google APIs.

Instructions file for GitHub Copilot

Written for GitHub Copilot: a Copilot chat mode or prompt.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/brianmoney/mcp-gdrive-cf/implementation-plan
Clone the repo
git clone --depth 1 https://github.com/brianmoney/mcp-gdrive-cf

Made for: GitHub Copilot.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for mcp-gdrive-cf implementation-plan.instructions.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/brianmoney/mcp-gdrive-cf/implementation-plan.svg)](https://agentmods.dev/instructions/brianmoney/mcp-gdrive-cf/implementation-plan)
Your own site
<a href="https://agentmods.dev/instructions/brianmoney/mcp-gdrive-cf/implementation-plan"><img src="https://agentmods.dev/badge/instructions/brianmoney/mcp-gdrive-cf/implementation-plan.svg" alt="Measured on agentmods" height="20"></a>
Per session 2,661 This file is loaded in full into every session.
When invoked 2,661 The same file — it is already loaded in full.
Security scan B 1 finding. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.02661 $0.02661
Opus 5 $0.01331 $0.01331
Sonnet 5 $0.00532 $0.00532
Haiku 4.5 $0.00266 $0.00266

Measured 5d ago against content hash 4a87fdae3498, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade B, and why

mcp-gdrive-cf implementation-plan.instructions.md scanned grade B with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Sends data to an external URLmediumData exfiltration

A POST to an outside endpoint may be telemetry or may be exfiltration; either way the mod talks to somewhere, and you should know where.

const r = await fetch("https://oauth2.googleapis.com/token", { method: "POST",
Origin

This is a copy

100% identical to mcp-gdrive-cf agent.instructions.md — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.github/instructions/implementation-plan.instructions.md · 296 lines

How it starts

The opening of the file, as written. The whole thing — 296 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Implementation Plan — Run mcp-gdrive as a Remote MCP Server on Cloudflare (via MCP proxy)

Objective

Adapt the functionality of isaacphi/mcp-gdrive to run as a remote MCP server on Cloudflare Workers, reachable by any MCP client through the Cloudflare remote MCP pattern (direct, or bridged via mcp-remote). This plan directly addresses the auth / dynamic registration concerns raised in issue #19 by exposing proper OAuth endpoints and remote transport.

  1. Architecture

Runtime: Cloudflare Worker exposing an MCP Server‑Sent Events (SSE) endpoint at /sse.

MCP tools (parity with mcp-gdrive):

gdrive_search → Drive files.list (query, pageToken, pageSize)

gdrive_read_file → Drive files.get?alt=media and files.export for Docs/Sheets/Slides

gsheets_read → Sheets spreadsheets.values.batchGet (or spreadsheets.get when needed)

gsheets_update_cell → Sheets spreadsheets.values.update (valueInputOption=USER_ENTERED)

Auth layers:

Client → MCP server: optional OAuth (server acts as OAuth provider for remote MCP clients). Endpoints: /authorize, /token, /register.

MCP server → Google APIs: OAuth 2.0 “Web application” flow. Tokens stored per user.

State: user token blobs in Workers KV (namespace KV_TOKENS).

Compatibility: Remote‑capable clients connect directly; local‑only clients (e.g., Claude Desktop) use mcp-remote:

{ "mcpServers": { "gdrive": { "command": "npx", "args": ["mcp-remote", "https://..workers.dev/sse"] } } }

  1. Prerequisites

Cloudflare account with Workers enabled; node LTS; wrangler CLI.

Google Cloud project with Drive API and Sheets API enabled; OAuth consent configured.

OAuth scopes: https://www.googleapis.com/auth/drive.readonly, https://www.googleapis.com/auth/spreadsheets.

  1. Scaffold the Remote MCP Server

Start from Cloudflare’s remote MCP template (authless)

npm create cloudflare@latest -- my-mcp-server
--template=cloudflare/ai/demos/remote-mcp-authless cd my-mcp-server npm start # local dev at http://localhost:8788/sse npx wrangler@latest deploy

(Optional but recommended) Spin a second project using the GitHub OAuth template to see a working auth’d remote MCP, then port the auth pattern to your gdrive server:

npm create cloudflare@latest -- my-mcp-server-github-auth
--template=cloudflare/ai/demos/remote-mcp-github-oauth

This shows how the server wires OAuth + Dynamic Client Registration with SSE at /sse and auth endpoints (/authorize, /token, /register).

  1. Project Layout

/src index.ts # routes: /sse, /google/authorize, /google/callback; wires OAuth provider mcp.ts # tool registry + router (gdrive + gsheets) google.ts # Google REST helpers (Drive/Sheets) auth-google.ts # OAuth URL builder, token exchange, refresh storage.ts # KV helpers (get/set user tokens) wrangler.toml # KV bindings, vars, routes bindings.d.ts # Env types for KV + secrets README.md # quickstart + client config (mcp-remote)

  1. Google OAuth (server → Google)

Create OAuth Client: type Web application. Redirect URI: https://..workers.dev/google/callback (plus a localhost variant for dev if needed).

Server endpoints:

GET /google/authorize → redirect user to Google with Drive/Sheets scopes.

GET /google/callback → exchange code for {access_token, refresh_token, expiry}; persist to KV under the authenticated user.

Token storage: KV key user:: -> { google: { refresh_token, access_token, expiry, scopes } }.

Refresh: On 401 from Google APIs, auto‑refresh using the stored refresh_token and update KV.

For early iterations, you can skip client OAuth entirely and only run the Google OAuth flow the first time a user calls a tool; maintain a signed session cookie or URL parameter to correlate the token set with the client identity.

  1. Client Authentication (optional now, recommended soon)

Enable OAuth for clients connecting to your MCP server, so remote clients can discover /authorize, perform dynamic client registration at /register, and obtain access tokens from /token. Use the pattern from the Cloudflare OAuth template:

Read the full file on GitHub · 296 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 296 lines · 2,661 tokens per session scan B 4a87fdae3498

Subscribe to this mod's changes

mcp-gdrive-cf implementation-plan.instructions.md is an instructions file published in the GitHub repository brianmoney/mcp-gdrive-cf (4 stars, last pushed 11mo ago), licensed MIT. It adds 2,661 tokens to every session, about $0.0133 per session on Opus 5. A static security scan graded it B with 1 finding (sends data to an external url). It is 100% identical to mcp-gdrive-cf agent.instructions.md, differing in 0 lines, and is treated as a copy.