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.
claude_desktop_config.json{
"mcpServers": {
"google-drive": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gdrive"
]
}
}
}Generate & Test Google Drive MCP Server Config
One-click export with environment variables & path locators for Claude Desktop, Cursor, Windsurf, and OpenAI Codex CLI.
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:
- ▸Go to the Google Cloud Console (opens in a new tab).
- ▸Create a new project or select an existing one.
- ▸Search for and enable the Google Drive API.
- ▸Navigate to APIs & Services → Credentials.
- ▸Click Create Credentials → OAuth client ID.
- ▸Select Desktop App as the application type.
- ▸Download the resulting
credentials.jsonfile or copy the Client ID and Secret.
Configuration Setup
Add the following to your MCP client config file:
{
"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:
- ▸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).
- ▸You must log into your Google Account and grant the application permission to access your Drive.
- ▸The server captures the callback and saves a
refresh_tokenlocally, 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 AppWarning: 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:
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:
npm view versionReference: Configuring MCP servers with OpenAI Codex.
Weekly Protocol Diffs & Verified Drops
New server guides, benchmarks, and security audits. No spam. Unsubscribe anytime.
Zero marketing spam. 1-click unsubscribe anytime.
Build your full agent toolstack in the Visual Generator
Combine Google Drive with databases, search APIs, and memory graphs in a single configuration file.
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.
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.
Related Guides
Cloud Infrastructure Auditor MCP Guide
Run automated cloud configuration security audits. Identify leaky S3 buckets, open security group ports, and loose IAM profiles directly from your IDE.
Cloud ServicesKubernetes and Helm MCP Server Guide
Connect your Kubernetes clusters and Helm releases to AI agents via MCP. Run safe container diagnostics, view cluster logs, and perform rollbacks.
Cloud ServicesNotion MCP Server Setup for Codex & Claude | Search, Create, Update Pages
Integrate Notion with OpenAI Codex & Claude. Query databases, create pages, update content via MCP. Includes Notion API token setup, config.toml example, and tool reference (search_pages, create_page, update_page).