Cloud Services·
intermediate
·11 min read·Apr 4, 2026·Updated Oct 10, 2026
By Rad Tome·Lead AI Systems Architect·How we verify this

How to Use the Google Drive MCP Server for Document Access

Connect Google Drive to your AI agent for searching, reading, and managing documents, spreadsheets, and files stored in your Drive.

Google Drivecloud storagedocumentsGoogle Workspacefiles
Config Target: claude_desktop_config.json
{
  "mcpServers": {
    "google-drive": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-gdrive"
      ]
    }
  }
}
Interactive Tool
1-Click Export

Generate & Test Google Drive MCP Server Config

One-click export with environment variables & path locators for Claude Desktop, Cursor, Windsurf, and OpenAI Codex CLI.

Open in Generator

Use the Google Drive MCP Server

The Google Drive MCP server enables AI agents to search your Google Workspace environment and read files stored in your Drive, including Google Docs, Google Sheets, PDFs, and standard text files.

Prerequisites

  • ▸A Google Cloud Platform (GCP) account.
  • ▸OAuth 2.0 credentials configured for a Desktop Application.
  • ▸Node.js 18+ installed on your host machine.

Setting Up Google Cloud Credentials

To authenticate the MCP server securely, you must provision an OAuth application:

  1. ▸Go to the Google Cloud Console (opens in a new tab).
  2. ▸Create a new project or select an existing one.
  3. ▸Search for and enable the Google Drive API.
  4. ▸Navigate to APIs & Services → Credentials.
  5. ▸Click Create Credentials → OAuth client ID.
  6. ▸Select Desktop App as the application type.
  7. ▸Download the resulting credentials.json file or copy the Client ID and Secret.

Configuration Setup

Add the following to your MCP client config file:

json
{
  "mcpServers": {
    "gdrive": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-gdrive"],
      "env": {
        "GOOGLE_CLIENT_ID": "your-client-id.apps.googleusercontent.com",
        "GOOGLE_CLIENT_SECRET": "your-client-secret",
        "GOOGLE_REDIRECT_URI": "/callback"
      }
    }
  }
}

First-Time Authentication Flow

Because this MCP server uses OAuth 2.0, it requires human interaction on its first run:

  1. ▸When the agent first attempts to use a tool, the MCP server will output a Google OAuth URL to the console (or try to pop open your browser).
  2. ▸You must log into your Google Account and grant the application permission to access your Drive.
  3. ▸The server captures the callback and saves a refresh_token locally, allowing the agent to run autonomously in the future.

Supported File Types & Conversions

The read_file tool automatically parses proprietary Google formats so your LLM can read them:

  • ▸Google Docs: Converted to clean Markdown.
  • ▸Google Sheets: Converted to CSV format.
  • ▸PDF files: Raw text extraction.
  • ▸Images: Metadata reading only.

Example Workflows

  • ▸Research Assistant: "Search my Drive for all documents containing 'Q4 planning' and summarize the key objectives."
  • ▸Document Analysis: "Read the 'Product Roadmap' Google Doc and create a timeline of milestones."
  • ▸Cross-Reference: "Compare the data in the 'Sales Report Q3' spreadsheet with the 'Q3 Targets' document."

Troubleshooting

  • ▸Unverified App Warning: When logging into Google during the OAuth flow, Google will show a stark warning saying the app is unverified. Since you created the GCP project yourself, it is perfectly safe to click Advanced → Go to app (unsafe).
  • ▸Payload Too Large: If you ask the agent to read a 100-page PDF or a Sheet with 50,000 rows, the resulting text extraction will exceed the JSON-RPC maximum payload limits and crash the connection. Use targeted searches instead.

Using with OpenAI Codex

Add this server to the OpenAI Codex CLI:

bash
codex mcp add --name google-drive-mcp-server --command "npx" --args "-y @modelcontextprotocol/server-gdrive"

The version above is pinned to the release this guide was verified against. Check for a newer one before upgrading:

bash
npm view  version

Reference: Configuring MCP servers with OpenAI Codex.

Technical Changelog

Weekly Protocol Diffs & Verified Drops

New server guides, benchmarks, and security audits. No spam. Unsubscribe anytime.

Zero marketing spam. 1-click unsubscribe anytime.

Ready to Deploy?

Build your full agent toolstack in the Visual Generator

Combine Google Drive with databases, search APIs, and memory graphs in a single configuration file.

Customize in Generator
Developer Verification & Feedback
0 reports

Did this setup guide work with your AI host?

Help test this configuration across Claude, Cursor, and Codex CLI. Be the first to report:

How to Use the Google Drive MCP Server for Document Access FAQ

What is the How to Use the Google Drive MCP Server for Document Access?

Connect Google Drive to your AI agent for searching, reading, and managing documents, spreadsheets, and files stored in your Drive.

How do I configure How to Use the Google Drive MCP Server for Document Access in Claude Desktop or Cursor?

You can copy the configuration JSON from our guide or launch the interactive MCP Codex Config Generator at https://mcp-codex.com/generator to export valid configs in 1 click.

Can I use How to Use the Google Drive MCP Server for Document Access with the OpenAI Codex CLI?

Yes, OpenAI Codex CLI supports Model Context Protocol. You can add it directly to ~/.codex/config.toml or pass arguments to codex mcp add.

RT

Written by Rad Tome

Lead AI Systems Architect & Maintainer, MCP Codex

@RadTome

Specializing in Model Context Protocol (MCP) integrations, autonomous AI agent orchestration, and distributed developer toolchains. Researches and benchmarks production MCP client-server architectures across OpenAI Codex, Claude, and Cursor.

Editorial Integrity: Package names are checked against the npm registry and repositories against the GitHub API. Where a package could not be verified, the guide says so instead of giving you a command to run.

Related Guides