Google Drive MCP Server

Google Drive MCP servers enable AI models to interact with Google Drive, providing capabilities for file search, content retrieval, and seamless integration with cloud storage.

GitHub starsnpm versionnpm downloads

Overview

The MCP Google Drive Server provides seamless integration with Google Drive, allowing AI models to search, list, and read files from Google Drive. It intelligently handles different Google Workspace file types, converting them to appropriate formats for AI consumption.

Created by:

Developed by felores

Key Features

🔍

Powerful File Search

Search for files in your Google Drive with full-text search capabilities.

📄

Direct File Content Access

Read file contents directly using a Google Drive file ID.

🔄

Automatic Format Handling

Intelligently converts Google Docs to Markdown, Sheets to CSV, and more.

🔒

Secure Authentication

Secure OAuth 2.0 authentication flow with read-only access.

Available Tools

Quick Reference

ToolPurposeCategory
gdrive_searchSearch for files in Google DriveDiscovery
gdrive_read_fileRead file contents by IDRead

Detailed Usage

gdrive_search

Search for files in your Google Drive with powerful full-text search capabilities.

use_mcp_tool({
  server_name: "gdrive",
  tool_name: "gdrive_search",
  arguments: {
    query: "quarterly report"
  }
});

Returns a list of files with name, MIME type, ID, last modified time, and size.

gdrive_read_file

Read file contents directly using a Google Drive file ID.

use_mcp_tool({
  server_name: "gdrive",
  tool_name: "gdrive_read_file",
  arguments: {
    file_id: "your-file-id"
  }
});

Returns the file contents with appropriate format conversion (e.g., Docs to Markdown).

Installation

{
  "mcpServers": {
    "gdrive": {
      "command": "node",
      "args": [
        "path/to/gdrive-mcp-server/dist/index.js"
      ],
      "env": {
        "GOOGLE_APPLICATION_CREDENTIALS": "path/to/gdrive-mcp-server/credentials/gcp-oauth.keys.json",
        "MCP_GDRIVE_CREDENTIALS": "path/to/gdrive-mcp-server/credentials/.gdrive-server-credentials.json"
      }
    }
  }
}

Local Installation:

Replace path/to/gdrive-mcp-server with the actual path to your installation directory.

Authentication

To set up authentication for the Google Drive MCP Server, you need to:

  1. Create a Google Cloud Project and enable the Google Drive API.
  2. Configure the OAuth Consent Screen.
  3. Create OAuth Client ID for a "Desktop app" and download the JSON file (e.g., client_secret_*.json).
  4. Create a credentials directory in your gdrive-mcp-server installation.
  5. Move and rename the downloaded JSON file to credentials/gcp-oauth.keys.json.
  6. Run the authentication command: node dist/index.js auth from the server's directory and complete the OAuth flow in your browser. This will generate .gdrive-server-credentials.json.

Common Use Cases

1. Searching for Documents

Find specific documents based on keywords:

use_mcp_tool({
  server_name: "gdrive",
  tool_name: "gdrive_search",
  arguments: {
    query: "meeting minutes Q3 2023"
  }
});

2. Retrieving File Content

Get the content of a Google Doc or other file by its ID:

use_mcp_tool({
  server_name: "gdrive",
  tool_name: "gdrive_read_file",
  arguments: {
    file_id: "1AbCdEfGhIjKlMnOpQrStUvWxYz"
  }
});

3. Processing Google Sheets Data

Read a Google Sheet and process its CSV content:

// Assuming gdrive_read_file returns CSV for Sheets
use_mcp_tool({
  server_name: "gdrive",
  tool_name: "gdrive_read_file",
  arguments: {
    file_id: "your-spreadsheet-id"
  }
});

Sources