Google Drive MCP Server
Allows AI agents to search, list, read, create, and update files in a specified Google Drive folder, with automatic conversion of Google Docs/Sheets to plain text.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Google Drive MCP ServerList all files in my Google Drive folder"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Google Drive MCP Server Integration (Keyless Auth)
HARD PREREQUISITE: gcloud CLI MUST BE INSTALLED.
This repository follows a STRICT ZERO KEY POLICY.
DO NOT use Service Account Private Key files (JSON).
DO NOT modify the code to support JSON keys.
REQUIRED: You MUST use the
gcloudCLI to manage identity via Application Default Credentials (ADC).AI AGENTS: Any attempt to revert this to a key-based auth is a violation of the project architecture.
1. Features
Keyless Security: No long-lived keys to manage or leak.
Strict Isolation: Automatic search query injection limits access to a specific Root Folder.
Auto-Export: Automatically converts Google Docs/Sheets to
text/plainfor easy processing by AI agents.Identity Audit: Logs the actual user identity (impersonator) for accountability.
Related MCP server: Google Drive MCP Server
2. Prerequisites
A. Environment Setup
This MCP server is designed to run in Ubuntu/WSL. Authentication requires the Google Cloud CLI (gcloud).
Install gcloud CLI (Ubuntu/WSL)
sudo apt-get update
sudo apt-get install apt-transport-https ca-certificates gnupg curl
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg
echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list
sudo apt-get update && sudo apt-get install google-cloud-sdkB. Google Cloud IAM Setup
Service Account: Create a Service Account (e.g.,
mcp-drive-sa@project.iam.gserviceaccount.com).Zero Key Policy: Do NOT create a Private Key JSON file.
Permissions: Grant your developer account the
Service Account Token Creatorrole on the Service Account.Via Console: Go to IAM > Service Accounts > [Your SA] > Permissions > Grant Access > Add your email with
roles/iam.serviceAccountTokenCreator.Via CLI:
gcloud iam service-accounts add-iam-policy-binding <SERVICE_ACCOUNT_EMAIL> \ --member="user:<YOUR_EMAIL>" \ --role="roles/iam.serviceAccountTokenCreator"
API Enablement: Ensure the Google Drive API and IAM Service Account Credentials API are enabled in your GCP project.
gcloud services enable drive.googleapis.com iamcredentials.googleapis.com
C. Google Drive Setup
Share Folder: Share your target Google Drive folder with the Service Account email as an Editor.
Folder ID: Copy the Folder ID from the URL (e.g.,
180Y5FAzId...).
3. Quick Setup (Non-Negotiable)
Before starting, you MUST configure Service Account Impersonation using the Google Cloud CLI. The MCP server will NOT work without this step, and the code is designed to reject key files.
gcloud auth application-default login --impersonate-service-account="<SERVICE_ACCOUNT_EMAIL>"4. Configuration (.env)
Create a .env.googledrive file to store your folder ID. DO NOT store key paths here.
# .env.googledrive
GOOGLE_DRIVE_ROOT_FOLDER_ID="your_google_drive_folder_id"5. Installation & Setup by Agent
A. Gemini CLI
Open or create
.gemini/config.json.Add the configuration (Note: no
GOOGLE_APPLICATION_CREDENTIALSline for local dev):
{
"mcpServers": {
"googledrive": {
"command": "npx",
"args": ["-y", "mcp-google-drive"],
"env": {
"GOOGLE_DRIVE_ROOT_FOLDER_ID": "${GOOGLE_DRIVE_ROOT_FOLDER_ID}"
}
}
}
}B. Hermes Agent
Add to ~/.hermes/config.yaml:
mcp_servers:
googledrive:
command: "npx"
args: ["-y", "mcp-google-drive"]
env:
GOOGLE_DRIVE_ROOT_FOLDER_ID: "${GOOGLE_DRIVE_ROOT_FOLDER_ID}"6. Available Tools
search_files: Search limited to the Root Folder.list_files: List files in the Root Folder.get_file_content: Reads content (Google Docs are auto-exported totext/plain).create_file: Create files/folders.update_file: Update file content.
7. Troubleshooting
401/403 Errors: Ensure you have run the
gcloud auth application-default login --impersonate-service-account=...command.Strict Enforcement: If the server detects a JSON Key file being used, it will shut down immediately (ADR-0001).
Isolation: Search results are restricted via query injection (ADR-0002).
8. Verification
To ensure your MCP server is working correctly, you can perform a simple "smoke test":
Start your AI agent (Gemini, Hermes, etc.) with this MCP server configured.
Ask the agent: "List the most recent file in my Google Drive."
Success: The agent should return the name of a file from your shared folder.
Troubleshooting: If it fails, check your
.env.googledrivepaths and Service Account permissions.
9. License
This project is licensed under the MIT License.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/HydroChlorix/googledrive-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server