Google Drive

by felores

17 stars
Not rated
GitHub

About

Integrates with Google Drive API to enable file listing, searching, and reading for document retrieval and content analysis tasks.

Details

Author
felores
Repository
felores/gdrive-mcp-server
GitHub stars
17
License
MIT License
Categories
File Management, Other, Productivity, Developer Tools, Design, Workplace, AI, Search, Security, Frontend, API
Tags
#integration

Setting up with Highlight

Follow these steps to add this server as a custom Highlight plugin:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Google Drive
    Command (node, npx, python, etc.) node
    Arguments
    • Argument 1 path/to/gdrive-mcp-server/dist/index.js
    Environment
    • MCP_GDRIVE_CREDENTIALS path/to/gdrive-mcp-server/credentials/.gdrive-server-credentials.json
    • GOOGLE_APPLICATION_CREDENTIALS path/to/gdrive-mcp-server/credentials/gcp-oauth.keys.json

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository


1. Create a Google Cloud Project
   - Visit the Google Cloud Console
   - Click "New Project"
   - Enter a project name (e.g., "MCP GDrive Server")
   - Click "Create"
   - Wait for the project to be created and select it

2. Enable the Google Drive API
- Go to the API Library
- Search for "Google Drive API"
- Click on "Google Drive API"
- Click "Enable"
- Wait for the API to be enabled

3. Configure OAuth Consent Screen
- Navigate to OAuth consent screen
- Select User Type:
- "Internal" if you're using Google Workspace
- "External" for personal Google accounts
- Click "Create"
- Fill in the required fields:
- App name: "MCP GDrive Server"
- User support email: your email
- Developer contact email: your email
- Click "Save and Continue"
- On the "Scopes" page:
- Click "Add or Remove Scopes"
- Add https://www.googleapis.com/auth/drive.readonly
- Click "Update"
- Click "Save and Continue"
- Review the summary and click "Back to Dashboard"

4. Create OAuth Client ID
- Go to Credentials
- Click "Create Credentials" at the top
- Select "OAuth client ID"
- Choose Application type: "Desktop app"
- Name: "MCP GDrive Server Desktop Client"
- Click "Create"
- In the popup:
- Click "Download JSON"
- Save the file
- Click "OK"

5. Set Up Credentials in Project

bash

npm install

1. Create a credentials directory and place your OAuth keys:

   mkdir credentials

1. Search for files:

typescript
// Search for documents containing "quarterly report"
const result = await gdrive_search({ query: "quarterly report" });

2. Read file contents:
typescript
// Read a specific file using its ID
const contents = await gdrive_read_file({ file_id: "your-file-id" });
```

gdrive_search

Search for files in your Google Drive with powerful full-text search capabilities. Parameters: query (string - your search query)

gdrive_read_file

Read file contents directly using a Google Drive file ID. Parameters: file_id (string - Google Drive file ID)

1. gdrive_search

Search for files in your Google Drive with powerful full-text search capabilities. - Input:
  {
    "query": "string (your search query)"
  }
  
- Output: List of files with: - File name - MIME type - File ID - Last modified time - File size

2. gdrive_read_file

Read file contents directly using a Google Drive file ID. - Input:
  {
    "file_id": "string (Google Drive file ID)"
  }
  
- Output: File contents with appropriate format conversion

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

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

Linux

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

Macos

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

Windows

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

Google Drive MCP Server

A powerful Model Context Protocol (MCP) server that provides seamless integration with Google Drive, allowing AI models to search, list, and read files from Google Drive.

πŸš€ Features

Tools

1. gdrive_search

Search for files in your Google Drive with powerful full-text search capabilities. - Input:
  {
    "query": "string (your search query)"
  }
  
- Output: List of files with: - File name - MIME type - File ID - Last modified time - File size

2. gdrive_read_file

Read file contents directly using a Google Drive file ID. - Input:
  {
    "file_id": "string (Google Drive file ID)"
  }
  
- Output: File contents with appropriate format conversion

Automatic File Format Handling

The server intelligently handles different Google Workspace file types:
- πŸ“ Google Docs β†’ Markdown
- πŸ“Š Google Sheets β†’ CSV
- πŸ“Š Google Presentations β†’ Plain text
- 🎨 Google Drawings β†’ PNG
- πŸ“„ Text/JSON files β†’ UTF-8 text
- πŸ“¦ Other files β†’ Base64 encoded

πŸ› οΈ Getting Started

Prerequisites

- Node.js (v16 or higher) - npm or yarn - A Google Cloud Project - A Google Workspace or personal Google account

Detailed Google Cloud Setup

1. Create a Google Cloud Project
- Visit the Google Cloud Console
- Click "New Project"
- Enter a project name (e.g., "MCP GDrive Server")
- Click "Create"
- Wait for the project to be created and select it

2. Enable the Google Drive API
- Go to the API Library
- Search for "Google Drive API"
- Click on "Google Drive API"
- Click "Enable"
- Wait for the API to be enabled

3. Configure OAuth Consent Screen
- Navigate to OAuth consent screen
- Select User Type:
- "Internal" if you're using Google Workspace
- "External" for personal Google accounts
- Click "Create"
- Fill in the required fields:
- App name: "MCP GDrive Server"
- User support email: your email
- Developer contact email: your email
- Click "Save and Continue"
- On the "Scopes" page:
- Click "Add or Remove Scopes"
- Add https://www.googleapis.com/auth/drive.readonly
- Click "Update"
- Click "Save and Continue"
- Review the summary and click "Back to Dashboard"

4. Create OAuth Client ID
- Go to Credentials
- Click "Create Credentials" at the top
- Select "OAuth client ID"
- Choose Application type: "Desktop app"
- Name: "MCP GDrive Server Desktop Client"
- Click "Create"
- In the popup:
- Click "Download JSON"
- Save the file
- Click "OK"

5. Set Up Credentials in Project

   # Create credentials directory
mkdir credentials

# Move and rename the downloaded JSON file
mv path/to/downloaded/client_secret_*.json credentials/gcp-oauth.keys.json

Installation

```bash

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.