Back to Codex
Cloud Services·
intermediate
·9 min read·Apr 4, 2026

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

Use the Google Drive MCP Server

The Google Drive MCP server enables AI agents to search and access files stored in Google Drive, including Docs, Sheets, and other file types.

Prerequisites

  • Google Cloud Platform account
  • OAuth 2.0 credentials
  • Node.js 18+

Setting Up Google Cloud Credentials

  1. Go to the Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Google Drive API
  4. Create OAuth 2.0 credentials (Desktop application type)
  5. Download the
    code
    credentials.json
    file

Configuration

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

First-Time Authentication

On first run, the server will:

  1. Open a browser window for Google OAuth consent
  2. Ask you to grant Drive access permissions
  3. Store the refresh token for subsequent use

Available Tools

ToolDescription
code
search_files
Search Drive files by name or content
code
read_file
Read file contents (supports Docs, Sheets, PDF)
code
list_files
List files in a folder

Supported File Types

  • Google Docs → Converted to Markdown
  • Google Sheets → Converted to CSV
  • PDF files → Text extraction
  • Plain text files → Direct reading
  • Images → Metadata only

Use Cases

Research Assistant

code
"Search my Drive for all documents about Q4 planning and summarize the key objectives"

Document Analysis

code
"Read the 'Product Roadmap' doc and create a timeline of milestones"

Cross-Reference

code
"Compare the data in 'Sales Report Q3' spreadsheet with 'Q3 Targets' document"

Security Notes

  • The server uses OAuth 2.0 with minimal scopes
  • Tokens are stored locally and encrypted
  • You can revoke access at any time from Google Account settings