·

Google Drive MCP With Claude Code CLI and VS Code

Set up Google Drive MCP in Claude Code CLI and VS Code so your AI agent can search, read, and organize files right from your editor.

Claude Code treats Drive MCP the same way it treats any other MCP server — a set of tools registered against a running process, available in every session once configured at the user or project scope. The interesting part isn't the wiring, it's what you do once Claude can search and read your team's Docs alongside your codebase: pull a spec, extract the parts that matter, and turn them into something a repo actually needs — a ticket, a technical design doc, a test plan.


Installing and Connecting Google Drive MCP to Claude Code

Pick a server implementation first. For a straightforward setup, the archived-but-still-widely-used @modelcontextprotocol/server-gdrive reference server works over stdio and is a reasonable starting point; if you want a hosted option with less local credential management, Zapier's MCP server for Google Drive runs over Streamable HTTP and handles OAuth on their side. This walkthrough uses the local stdio server since it keeps credentials entirely on your machine.

npm install -g @modelcontextprotocol/server-gdrive

Register an OAuth client in Google Cloud Console (APIs & Services → Credentials → Create Credentials → OAuth client ID → Desktop app), enable the Google Drive API for the project, and download the client secret JSON:

mkdir -p ~/.config/gdrive-mcp
mv ~/Downloads/client_secret_*.json ~/.config/gdrive-mcp/gcp-oauth.keys.json

Run the server's auth command once, outside of Claude Code, to complete the OAuth consent flow and cache a refresh token:

npx @modelcontextprotocol/server-gdrive auth

Register the server with Claude Code at user scope so it's available across every project, not just one repo:

claude mcp add gdrive --scope user -- \
  npx -y @modelcontextprotocol/server-gdrive

Or drop it directly into ~/.claude/settings.json if you prefer editing config over the CLI flag form:

{
  "mcpServers": {
    "gdrive": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-gdrive"],
      "env": {
        "GDRIVE_CREDENTIALS_PATH": "/Users/you/.config/gdrive-mcp/.gdrive-server-credentials.json",
        "GDRIVE_OAUTH_PATH": "/Users/you/.config/gdrive-mcp/gcp-oauth.keys.json"
      }
    }
  }
}

Confirm it loaded correctly:

claude mcp list

If it shows failed instead, the most common cause by far is a stale or missing credentials file path — double check the GDRIVE_CREDENTIALS_PATH env var points at the file the auth command actually wrote, since some forks default to a different filename or directory than the docs suggest.

In the VS Code extension, the same ~/.claude/settings.json config applies automatically since the extension shares Claude Code's MCP configuration — there's no separate registration step. Open the MCP panel from the extension sidebar to verify "gdrive" shows a green connected indicator before starting a session that depends on it.

Tips
- Run the server's standalone auth command before ever invoking it through Claude Code — debugging an OAuth browser flow that Claude Code triggers indirectly is much harder than doing it directly in a terminal first.
- Register at --scope user, not project scope, unless the credentials are meant to be project-specific — most people want Drive access available in every repo, not re-authenticated per project.
- If claude mcp list shows the server as failed, run the underlying npx command directly in your terminal first — it usually surfaces the real error (missing env var, expired token, malformed JSON) that Claude Code's wrapper swallows.


Searching Drive and Extracting Requirements from Docs and PDFs

With the server connected, Claude Code exposes the search and read tools directly in conversation — you don't need slash commands or special syntax, just ask in plain language and let the model choose the right tool calls.

Search Google Drive for documents mentioning "webhook retry policy" that
were modified in the last 6 months. List the title, folder, and last
modified date for each match before opening any of them.

Claude will typically call the search tool with a query resembling fullText contains 'webhook retry policy' and modifiedTime > '2026-02-21', then present a results table. Reviewing that list before asking Claude to open anything matters — on a shared drive with years of history, "webhook retry" can surface a 2022 postmortem alongside the current spec, and picking the wrong one wastes the rest of the session.

Once you've confirmed the right document, ask for extraction directly:

Open "Webhook Delivery v2 - Retry Policy" and extract every concrete
numeric parameter mentioned: retry counts, backoff intervals, timeout
values, and max payload sizes. Present as a table with a "source
paragraph" column quoting where each number came from.

That "source paragraph" instruction matters more than it looks. Requirements docs frequently state a number once early on and then contradict it later in an edge-case callout ("retries are capped at 3, except for webhooks tagged high-priority which get 5"). Forcing the model to cite the sentence it pulled each number from makes contradictions visible instead of silently averaged away.

PDFs work through the same read tool but with a caveat: if the PDF lives natively in Drive (uploaded, not a Google Doc), the server typically returns raw extracted text via files.get?alt=media, which strips layout entirely. A PDF with a two-column layout or an embedded table often comes back with columns interleaved line-by-line — readable to a human skimming, but genuinely confusing for an LLM trying to associate labels with values. For PDFs with structured tables, it's worth explicitly telling Claude to treat the extraction with skepticism:

Read the PDF "API Rate Limits - Enterprise Tier.pdf". The source is a
PDF export and table structure may be scrambled in the raw text —
cross-reference any numbers you extract against the surrounding
sentence for plausibility before including them in your summary.

Tips
- Always ask for a results list before opening documents on an ambiguous search term — skipping this step is how you end up extracting requirements from a superseded draft.
- Require source-paragraph citations on any numeric or requirement extraction — it turns silent contradictions in the source document into something you can see and resolve.
- Treat PDF table extraction as unreliable by default; ask Claude to sanity-check extracted numbers against surrounding prose rather than trusting positional layout from raw text extraction.


Converting Business Documents into Structured Technical Specs

The real payoff of Drive MCP inside Claude Code is collapsing the gap between "a stakeholder wrote prose in a Doc" and "engineering has a spec they can implement against." This works best as a two-pass process rather than one giant prompt.

Pass one — extraction and gap-finding:

Read "Checkout Redesign - Product Requirements.gdoc" in full. Produce:
1. A list of every user-facing behavior change described.
2. A list of every API or backend implication implied but not stated
   explicitly (e.g. if the doc says "show saved payment methods,"
   note that this implies a GET endpoint for stored payment methods).
3. A list of open questions — anything a backend engineer would need
   clarified before estimating this work.

That "implied but not stated" instruction is doing real work — product docs are written for a product audience and routinely skip backend implications that are obvious once you name them. Getting the model to surface those explicitly, rather than only restating what's written, is what separates a useful extraction from a glorified summary.

Pass two — structuring into your team's spec format. Point Claude at an existing spec in your repo as a template rather than describing the format from scratch:

Using the structure of docs/specs/TEMPLATE.md in this repo, draft a
technical spec for the checkout redesign based on the requirements and
gaps identified above. Leave the "Open Questions" section populated
with the items from step 3 rather than resolving them yourself — those
need a human answer from product.

Explicitly telling the model not to invent answers to open questions is important. Left unconstrained, an LLM will happily guess a reasonable-sounding answer to "should guest checkout support saved cards?" rather than flagging it as unresolved — and a plausible wrong guess baked silently into a spec is worse than an obvious blank, because it looks decided when it isn't.

Save the output back into the repo, not just as chat output, so it's reviewable through your normal PR process:

git checkout -b spec/checkout-redesign
git add docs/specs/checkout-redesign.md
git commit -m "Add checkout redesign spec drafted from product Doc"

Tips
- Split extraction and structuring into two separate prompts — a single mega-prompt tends to compress the gap-finding step and jump straight to a polished-looking spec that hides unresolved questions.
- Feed Claude an existing spec file from your repo as the format template instead of describing your desired structure in prose — it matches your team's conventions far more reliably.
- Explicitly forbid the model from resolving open questions on its own initiative; a spec with an honest blank is safer than one with a confident, unverified guess.


Prompting Patterns for Multi-Document Synthesis

Real requirements rarely live in one document. A feature might be described across a product brief, a design review deck, and a follow-up Doc capturing decisions from a meeting — and reconciling those by hand is exactly the kind of tedious cross-referencing an agent handles well, provided you structure the prompt to force comparison rather than sequential summarization.

A pattern that works reliably: ask for per-document summaries first, then a separate reconciliation pass.

I'll give you three documents related to the same feature. For each one,
summarize independently first — don't try to merge them yet:

1. "Notification Preferences - Product Brief"
2. "Notification Preferences - Design Review Notes"
3. "Notification Preferences - Eng Sync 2026-07-14"

After summarizing each independently, produce a reconciliation table:
one row per requirement, columns for what each document says, and a
final column flagging any direct contradictions between documents.

The independent-summary-first instruction prevents an effect that shows up often with multi-document prompts: without it, the model tends to blend everything into one narrative on the first pass, silently resolving contradictions in favor of whichever document it read last — which is arbitrary and invisible to you unless you specifically ask for a reconciliation table.

For folder-scale synthesis rather than three named documents, lean on the folder-listing tool to enumerate first:

List every document in the "/Product/Notifications" Drive folder,
sorted by last modified date. Then read the five most recently modified
ones and produce a timeline of how the notification preferences
requirement evolved, noting which document introduced each change.

This produces something genuinely hard to build by hand quickly: a chronological narrative of how a requirement drifted over several weeks of stakeholder discussion — useful both for spec-writing and for settling "wait, when did we decide that?" disputes in a standup.

One limitation worth stating plainly: this synthesis quality degrades once you're feeding in more than roughly 8–10 documents in a single session, simply because of context budget — Claude Code's context window holds it, but recall and cross-referencing accuracy across dozens of documents gets noticeably less reliable than across three or four. For genuinely large document sets, do the synthesis in batches and have a final pass merge the batch summaries, rather than trying it in one shot.

Tips
- Force independent per-document summaries before any reconciliation step — it's the single most effective way to surface contradictions instead of having them silently blended away.
- Use the folder-listing tool plus a modifiedTime sort to build chronological narratives of how a requirement evolved — this is a task that's tedious by hand and genuinely fast for an agent.
- Batch synthesis for anything beyond roughly 8–10 source documents; cross-referencing accuracy degrades past that point even though the context window technically has room.


Tips

Tips
- Authenticate the Drive MCP server standalone before wiring it into Claude Code — it isolates OAuth issues from Claude Code configuration issues when something doesn't connect.
- Build your spec-drafting workflow as two prompts (extract, then structure) rather than one — it produces cleaner output and keeps open questions visible instead of quietly resolved.
- For multi-document work, always request independent summaries before reconciliation, and keep single-session synthesis to a manageable document count rather than trusting recall across dozens of files at once.