Skip to main content
Glama
matty-v

Google Drive MCP Server

by matty-v

Google Drive MCP Server

An MCP (Model Context Protocol) server that enables searching, retrieving, and managing files in Google Drive. Designed to run as a Google Cloud Function.

Features

  • search_files - Search for files using Google Drive query syntax

  • get_file_metadata - Get detailed metadata for a specific file

  • list_folder - List files in a folder

  • move_file - Move a file to a different folder

  • create_folder - Create a new folder

Prerequisites

  1. A Google Cloud project with the Drive API enabled

  2. A service account with access to the files you want to query

  3. Google Cloud CLI (gcloud) installed and configured

Setup

1. Create a Service Account

# Create the service account gcloud iam service-accounts create drive-mcp \ --display-name="Google Drive MCP Server" # Create and download the key gcloud iam service-accounts keys create service-account-key.json \ --iam-account=drive-mcp@YOUR_PROJECT_ID.iam.gserviceaccount.com

2. Share Files/Folders

Share your Google Drive files or folders with the service account email:

drive-mcp@YOUR_PROJECT_ID.iam.gserviceaccount.com

Grant "Editor" permission to allow moving files, or "Viewer" for read-only access.

3. Install Dependencies

npm install

4. Build

npm run build

Deploy to Google Cloud Functions

gcloud functions deploy google-drive-mcp \ --gen2 \ --runtime=nodejs20 \ --region=us-central1 \ --source=. \ --entry-point=googleDriveMcp \ --trigger-http \ --allow-unauthenticated \ --set-secrets="GOOGLE_SERVICE_ACCOUNT_KEY=drive-mcp-credentials:latest"

MCP Client Configuration

{ "mcpServers": { "google-drive": { "url": "https://REGION-PROJECT_ID.cloudfunctions.net/google-drive-mcp" } } }

Tool Usage

search_files

Search for files using Google Drive query syntax:

{ "query": "name contains 'report'", "pageSize": 10 }

Common query examples:

  • name contains 'budget' - Files with "budget" in the name

  • mimeType = 'application/pdf' - PDF files only

  • fullText contains 'quarterly' - Files containing "quarterly" in content

  • modifiedTime > '2024-01-01' - Files modified after Jan 1, 2024

  • 'folder_id' in parents - Files in a specific folder

get_file_metadata

Get detailed metadata for a file:

{ "fileId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms" }

list_folder

List files in a folder:

{ "folderId": "root", "pageSize": 20 }

Use "root" for the root folder, or a specific folder ID.

move_file

Move a file to a different folder:

{ "fileId": "1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgvE2upms", "newParentId": "0B1234567890abcdef" }

This removes the file from its current parent folder(s) and places it in the specified destination folder.

create_folder

Create a new folder:

{ "name": "My New Folder", "parentId": "0B1234567890abcdef" }

The parentId is optional. If not specified, the folder is created in the root of the shared drive or the service account's root.

License

MIT

-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/matty-v/google-drive-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server