gdrive-org
gdrive-org
AI-Powered Digital Minimalist Google Drive CLI & MCP Server
gdrive-org helps you declutter, organize, and regain control over your Google Drive. It features AI-assisted semantic deduplication, three-tier duplication removal, macOS Drive File Stream cache monitoring, config-driven folder cleaning, and a native Model Context Protocol (MCP) server for AI agents (Claude Desktop, Cursor, Antigravity, etc.).
Features
๐งน Clean Empty Folders: Identify and prune empty folder hierarchies recursively.
๐ฆ Storage & Cache Analysis: Inspect cloud quota usage and macOS local DriveFS cache footprint.
๐ File Audit: Detect oversized items, root directory clutter, orphaned files, and shortcuts.
๐ฏ Byte-Exact Deduplication: Safely identify duplicate files by MD5 hash and batch-trash duplicates while preserving the oldest original.
๐ง Smart AI Deduplication: Cluster semantically similar documents with Gemini AI and consolidate them into a Single Source of Truth doc.
๐ Config-Driven Folder Cleaner: Classify, flatten, and clean specific folders according to customized YAML rules.
๐ค Native MCP Server: Expose Drive management tools directly to LLMs and agentic IDEs via Model Context Protocol.
๐ macOS Sync Health: Monitor local Google Drive for Desktop sync health and cache size.
๐ก๏ธ Safe by Default: All destructive operations default to dry-run mode, respect a 30-day Drive Trash recovery window, and support resuming interrupted batch jobs.
Installation
Standalone CLI (Recommended)
Using uv or pipx:
uv tool install gdrive-org
# or
pipx install gdrive-orgOr run directly without permanent installation via uvx:
uvx gdrive-org --helpFrom Source (Development)
git clone https://github.com/yourusername/google-drive-organization.git
cd google-drive-organization
python -m venv .venv
source .venv/bin/activate
pip install -e .Configuration & Credentials
1. Google Drive API (OAuth 2.0)
Open the Google Cloud Console.
Create a new project (e.g.
gdrive-org).Under APIs & Services > Library, enable the Google Drive API.
Under APIs & Services > Credentials, click Create Credentials > OAuth client ID.
Select Desktop app as the application type.
Download the resulting credentials JSON file.
Save it to
~/.config/gdrive-org/credentials.json(or place it in your local directory ascredentials.json):mkdir -p ~/.config/gdrive-org cp /path/to/downloaded-credentials.json ~/.config/gdrive-org/credentials.json
2. Gemini API Key (for Smart Dedupe & Cluster Merge)
Obtain an API key from Google AI Studio.
Add it to
~/.config/gdrive-org/.env:GOOGLE_API_KEY=your_gemini_api_key_here(Alternatively, export
GOOGLE_API_KEYin your shell environment).
CLI Usage
Authentication
Test and authorize your Google Drive credentials (opens a browser window for first-time login):
gdrive-org authStorage & Sync Audit
gdrive-org storage # View cloud quota and local cache footprint
gdrive-org audit --min-size 50 # List items >= 50MB and audit root clutter
gdrive-org sync-health # Check macOS Drive File Stream cache and health
gdrive-org explain-sync # Guide for Stream vs Mirror sync modesDeduplication
Find exact byte-identical duplicates (dry-run):
gdrive-org dedupeExecute deduplication (moves duplicates to Trash, keeps oldest original):
gdrive-org dedupe --no-dry-runExclude specific directories:
gdrive-org dedupe --exclude-folder "Archive" --exclude-folder "Backups"Smart AI Deduplication
Scan for semantic duplicates and manage proposed merge clusters:
gdrive-org smart-dedupe # Cluster related docs and propose merges
gdrive-org merge approve <cluster-id> # Finalize merged Google Doc & trash originals
gdrive-org merge reject <cluster-id> # Discard proposed mergeFolder Cleaning & Empty Folder Pruning
Remove empty directories:
gdrive-org clean-empty # Dry-run
gdrive-org clean-empty --no-dry-run # Delete empty foldersClean a specific folder using a custom YAML rule set:
gdrive-org clean-folder <folder-id> --config /path/to/rules.yaml
gdrive-org clean-folder <folder-id> --config /path/to/rules.yaml --no-dry-runArchiving & Recovery
Archive unorganized old root files to Archive/<Year>:
gdrive-org archive --months 6 # Dry-run files unaccessed for 6 months
gdrive-org archive --months 6 --no-dry-runResume interrupted batch operations:
gdrive-org resumeModel Context Protocol (MCP) Integration
gdrive-org can run as an MCP server, allowing agents like Claude Desktop, Cursor, or Antigravity to safely analyze, deduplicate, and organize your Google Drive.
Start the Server Directly
gdrive-org mcp
# or with uvx:
uvx gdrive-org mcpClient Configuration
Add gdrive-org to your MCP client config (e.g. claude_desktop_config.json, Antigravity mcp_config.json, or Cursor):
{
"mcpServers": {
"gdrive-org": {
"command": "uvx",
"args": ["gdrive-org", "mcp"]
}
}
}(During local development before PyPI installation, point command to your local .venv/bin/gdrive-org and args to ["mcp"]).
Available MCP Tools
Tool | Description |
| Quota audit and macOS cache footprint |
| Drive categories, root clutter, and orphaned files |
| macOS DriveFS status and cache size |
| Streaming vs Mirroring guidance |
| Find exact byte-identical duplicates (dry-run) |
| Move duplicate files to Trash (keeps oldest) |
| AI cluster scan for near-duplicate documents |
| Consolidate cluster into a merged Google Doc |
| Finalize or discard staged merge drafts |
| Prune empty directory trees |
| Organize old root files into year-based archives |
| Recover from interrupted batch operations |
Safety Guidelines
Dry-Run by Default: All bulk modifications and deletions run in dry-run mode until
--no-dry-runor an explicit execute action is triggered.30-Day Trash Recovery: Deletions move files to Google Drive's native Trash. Files can be restored within 30 days.
Audit Trail: Every destructive action is logged to enable state recovery and rollback analysis.
Local Cache Safety: Never manually delete files inside
~/Library/Application Support/Google/DriveFS. Usegdrive-org sync-healthand Google Drive preferences to clear streaming cache safely.
License
MIT License โ see LICENSE for details.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/jlewis54-star/google-drive-organization'
If you have feedback or need assistance with the MCP directory API, please join our Discord server