Borrowing it
Nothing to install: this file belongs to brianmoney/mcp-gdrive-cf. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/brianmoney/mcp-gdrive-cf/master/.github/instructions/implementation-plan.instructions.mdgit clone --depth 1 https://github.com/brianmoney/mcp-gdrive-cfWrote 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.
[](https://agentmods.dev/instructions/brianmoney/mcp-gdrive-cf/implementation-plan)<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/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<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="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.02661 | $0.02661 |
| Opus 5.5 | $0.01064 | $0.01064 |
| Sonnet 5.5 | $0.00532 | $0.00532 |
| Haiku 4.5 | $0.00266 | $0.00266 |
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 2mo 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", 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.
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.
- 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"] } } }
- 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.
- 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).
- 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)
- 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.
- 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:
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.
- 2mo ago First seen · 296 lines · 2,661 tokens per session scan B 4a87fdae3498
mcp-gdrive-cf implementation-plan.instructions.md is an instructions file published in the GitHub repository brianmoney/mcp-gdrive-cf (4 stars, last pushed 1y ago), licensed MIT. It adds 2,661 tokens to every session, about $0.0106 per session on Opus 5.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.
mcp-gdrive-cf implementation-plan.instructions.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| mcp-gdrive-cf implementation-plan.instructions.mdbrianmoney/mcp-gdrive-cf | Instructions file | 4 | 1y ago | MIT | B | 2,661 | GitHub Copilot |
| plan-forge naming.instructions.mdsrnichols/plan-forge | Instructions file | 6 | 2d ago | MIT | A | 1,453 | GitHub Copilot |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | today | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |