How to Set Up Google Drive MCP Server (2026)
Connect Google Drive to AI assistants via the Model Context Protocol
Start Building with Hypereal
Access Kling, Flux, Sora, Veo & more through a single API. Free credits to start, scale to millions.
No credit card required • 100k+ developers • Enterprise ready
How to Set Up Google Drive MCP Server in 2026
If your documentation, specs, or reference materials live in Google Drive, connecting it to your AI coding assistant through MCP means the AI can read those documents directly instead of you copy-pasting content back and forth. This guide covers how to set up the Google Drive MCP server, configure authentication, and connect it to Claude Desktop, Claude Code, Cursor, and other MCP-compatible tools.
What You Can Do with Google Drive MCP
Once connected, your AI assistant can:
- Search across your Google Drive files by name or content
- Read Google Docs, Sheets, Slides, and uploaded files (PDFs, text files, images)
- List files in specific folders
- Read spreadsheet data from Google Sheets for analysis
- Access shared drives and team folders
Practical Use Cases
| Use Case | Example |
|---|---|
| Code from specs | "Read the API spec in our shared drive and generate TypeScript types" |
| Data analysis | "Pull the Q4 metrics from the Google Sheet and summarize trends" |
| Documentation | "Check our style guide in Drive and rewrite this component docs" |
| Meeting notes | "Read yesterday's standup notes and create Jira tickets" |
| Design review | "Read the product requirements doc and compare with my implementation" |
Prerequisites
Before you start, you will need:
- A Google Cloud Platform account (free tier works)
- A Google Workspace or personal Gmail account with Drive access
- Node.js 18+ installed
- An MCP-compatible AI client (Claude Desktop, Claude Code, Cursor, etc.)
Step 1: Create a Google Cloud Project
- Go to the Google Cloud Console
- Click Select a project at the top, then New Project
- Name it something like
mcp-drive-server - Click Create
Step 2: Enable the Google Drive API
- In your new project, go to APIs & Services > Library
- Search for "Google Drive API"
- Click on it and press Enable
- Also search for and enable the "Google Sheets API" if you want spreadsheet access
Step 3: Create OAuth 2.0 Credentials
The MCP server needs OAuth credentials to access your Drive on your behalf.
- Go to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- If prompted, configure the OAuth consent screen first:
- Choose External (or Internal if you have Workspace)
- Fill in the app name:
MCP Drive Server - Add your email as a test user
- No scopes needed on the consent screen (they are requested at runtime)
- Back on Credentials, select Desktop app as the application type
- Name it
MCP Drive Server - Click Create
- Download the JSON file and save it as
gcp-oauth.keys.json
# Move the downloaded file to a safe location
mkdir -p ~/.config/mcp
mv ~/Downloads/client_secret_*.json ~/.config/mcp/gcp-oauth.keys.json
Step 4: Install the Google Drive MCP Server
Install the official Google Drive MCP server:
npm install -g @anthropic/mcp-server-gdrive
Or use it via npx (no install required):
npx -y @anthropic/mcp-server-gdrive
Step 5: Authenticate with Google
The first time you run the server, it needs to complete an OAuth flow to get access to your Google Drive.
# Run the authentication flow
npx -y @anthropic/mcp-server-gdrive auth --keys-file ~/.config/mcp/gcp-oauth.keys.json
This will:
- Open your browser to the Google sign-in page
- Ask you to grant the MCP server access to your Drive
- Save the refresh token locally for future use
The token is stored at ~/.config/mcp/gdrive-credentials.json. Keep this file secure.
# Verify the token was saved
ls -la ~/.config/mcp/gdrive-credentials.json
Step 6: Connect to Your AI Client
Claude Desktop
Edit your Claude Desktop configuration file:
# macOS
code ~/Library/Application\ Support/Claude/claude_desktop_config.json
# Windows
code %APPDATA%\Claude\claude_desktop_config.json
Add the Google Drive server:
{
"mcpServers": {
"gdrive": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-gdrive"],
"env": {
"GDRIVE_OAUTH_KEYS_FILE": "/Users/yourname/.config/mcp/gcp-oauth.keys.json",
"GDRIVE_CREDENTIALS_FILE": "/Users/yourname/.config/mcp/gdrive-credentials.json"
}
}
}
}
Restart Claude Desktop. You should see the Google Drive tools available in the tools menu (hammer icon).
Claude Code (CLI)
Add the MCP server to your Claude Code configuration:
claude mcp add gdrive \
--command "npx" \
--args "-y" "@anthropic/mcp-server-gdrive" \
--env "GDRIVE_OAUTH_KEYS_FILE=/Users/yourname/.config/mcp/gcp-oauth.keys.json" \
--env "GDRIVE_CREDENTIALS_FILE=/Users/yourname/.config/mcp/gdrive-credentials.json"
Or edit the config file directly at ~/.claude/mcp.json:
{
"servers": {
"gdrive": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-gdrive"],
"env": {
"GDRIVE_OAUTH_KEYS_FILE": "/Users/yourname/.config/mcp/gcp-oauth.keys.json",
"GDRIVE_CREDENTIALS_FILE": "/Users/yourname/.config/mcp/gdrive-credentials.json"
}
}
}
}
Cursor
Add the MCP server in Cursor's settings:
- Open Settings (
Cmd+,) - Search for "MCP"
- Click Edit in settings.json or navigate to the MCP configuration
- Add the Google Drive server:
{
"mcpServers": {
"gdrive": {
"command": "npx",
"args": ["-y", "@anthropic/mcp-server-gdrive"],
"env": {
"GDRIVE_OAUTH_KEYS_FILE": "/Users/yourname/.config/mcp/gcp-oauth.keys.json",
"GDRIVE_CREDENTIALS_FILE": "/Users/yourname/.config/mcp/gdrive-credentials.json"
}
}
}
}
Step 7: Using Google Drive MCP
With the server connected, you can now interact with your Google Drive through natural language.
Searching Files
You: Search my Google Drive for "API specification"
AI: [Uses gdrive tool: search_files]
I found 3 matching files:
1. "API Specification v3.2" (Google Doc, shared drive)
2. "API Specification - Draft" (Google Doc, My Drive)
3. "api-spec-old.pdf" (PDF, My Drive)
Would you like me to read any of these?
Reading a Document
You: Read the "API Specification v3.2" document and generate TypeScript interfaces for the user endpoints.
AI: [Uses gdrive tool: read_file]
I've read the document. Here are the TypeScript interfaces based on the spec:
interface User {
id: string;
email: string;
name: string;
role: 'admin' | 'user' | 'viewer';
createdAt: string;
...
}
Reading Spreadsheet Data
You: Read the "Q4 Metrics" spreadsheet and summarize the key trends.
AI: [Uses gdrive tool: read_spreadsheet]
Here's a summary of the Q4 metrics:
- Monthly Active Users grew 23% (45K to 55K)
- Revenue increased 15% ($120K to $138K)
- Churn rate decreased from 4.2% to 3.8%
...
Listing Folder Contents
You: What files are in the "Engineering/Design Docs" folder?
AI: [Uses gdrive tool: list_files]
The Engineering/Design Docs folder contains:
- Architecture Overview.gdoc (updated Jan 15)
- Database Schema.gdoc (updated Jan 22)
- API Design Principles.gdoc (updated Dec 3)
- Deployment Runbook.gdoc (updated Jan 28)
Available MCP Tools
The Google Drive MCP server exposes these tools:
| Tool | Description | Parameters |
|---|---|---|
search_files |
Search for files by name or content | query (string) |
read_file |
Read the contents of a file | fileId (string) |
list_files |
List files in a folder | folderId (string, optional) |
read_spreadsheet |
Read data from a Google Sheet | spreadsheetId, range |
Troubleshooting
"Token has been expired or revoked"
Re-authenticate:
npx -y @anthropic/mcp-server-gdrive auth --keys-file ~/.config/mcp/gcp-oauth.keys.json
"Access Not Configured" Error
Make sure the Google Drive API is enabled in your GCP project:
- Go to console.cloud.google.com/apis/library
- Search for "Google Drive API"
- Ensure it shows Enabled
Server Starts but No Tools Appear
Check the MCP server logs. In Claude Desktop, look in:
# macOS
~/Library/Logs/Claude/mcp-gdrive.log
# Or check the Claude Desktop developer console
# View > Developer > Developer Tools
"App is not verified" Warning in Browser
During the OAuth flow, Google may show a warning because your app is in testing mode. Click Advanced > Go to MCP Drive Server (unsafe) to proceed. This is normal for personal-use OAuth apps.
File Not Found
The MCP server can only access files that the authenticated Google account has permission to view. If you cannot find a file:
- Make sure the file is shared with your Google account
- Check if the file is in a shared drive you have access to
- Try searching by the exact file name
Security Considerations
Token Storage
OAuth tokens are stored locally on your machine. Protect them:
# Set restrictive permissions
chmod 600 ~/.config/mcp/gdrive-credentials.json
chmod 600 ~/.config/mcp/gcp-oauth.keys.json
Scope Limitations
The MCP server requests read-only access to your Drive by default. It cannot modify, delete, or create files unless the server implementation specifically supports those operations.
Shared Drives
If you need access to shared drives (Team Drives), ensure your OAuth consent screen includes the drive.readonly scope and that your Google Workspace admin has not restricted API access to shared drives.
Beyond Document Access
Connecting Google Drive to your AI assistant is one piece of a larger workflow. If you are building AI-powered applications that need to generate visual content, videos, or audio alongside reading specifications from Drive, Hypereal AI provides a unified API for media generation that pairs well with MCP-enhanced development environments.
Summary
Setting up the Google Drive MCP server involves creating a GCP project, enabling the Drive API, generating OAuth credentials, and configuring your AI client. Once connected, your AI assistant can search, read, and analyze any file in your Drive. The biggest setup hurdle is the OAuth configuration, but once authenticated, the token persists and the connection is seamless. Use it to close the gap between your documentation and your code.
Related Articles
Start Building Today
Get 35 free credits on signup. No credit card required. Generate your first image in under 5 minutes.
