ShankarSomu/gdrive_mcp_server
If you are the rightful owner of gdrive_mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Google Drive MCP Server provides secure, folder-scoped access to Google Drive files for AI assistants, enabling them to read, process, and analyze files from a selected folder with comprehensive file format support.
Google Drive MCP Server
A Model Context Protocol (MCP) server that provides secure, folder-scoped access to Google Drive files for Claude and other AI assistants. This server allows AI assistants to read, process, and analyze files from a selected Google Drive folder with comprehensive file format support.
Features
- Folder-Scoped Security: Access limited to a single selected Google Drive folder
- Comprehensive File Processing: Supports PDF, Word, Excel, PowerPoint, CSV, HTML, XML, ZIP archives, and more
- Smart Content Handling: Intelligent chunking and summarization for large files
- Interactive Setup: Easy folder selection with browser integration
- Archive Processing: Extract and analyze ZIP file contents
- Document Overview: Get structured summaries of large documents
Supported File Formats
| Format | Extension | Processing |
|---|---|---|
.pdf | Text extraction | |
| Word Documents | .docx, .doc | Full text content |
| Excel Spreadsheets | .xlsx, .xls | JSON structured data |
| PowerPoint | .pptx, .ppt | Slide text extraction |
| Text Files | .txt, .csv | Direct content |
| HTML | .html, .htm | Text extraction |
| XML | .xml | Structured JSON |
| JSON | .json | Formatted output |
| ZIP Archives | .zip | Content extraction and analysis |
| MS Project | .mpp | Limited text extraction |
Prerequisites
- Python 3.8+
- Google Cloud Project with Drive API enabled
- Claude Desktop or compatible MCP client
Setup Instructions
Step 1: Google Cloud Setup
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable the Google Drive API:
- Navigate to "APIs & Services" > "Library"
- Search for "Google Drive API"
- Click "Enable"
Step 2: Create OAuth Credentials
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth client ID"
- Choose "Desktop application"
- Name it "Google Drive MCP Server"
- Download the credentials JSON file
- Rename it to
credentials.jsonand place it in the project directory
Step 3: Install Dependencies
# Clone or download the project
cd gdrive_mcp_server
# Install basic requirements
pip install google-auth google-auth-oauthlib google-auth-httplib2 google-api-python-client
# Install optional file processing libraries (recommended)
pip install -r requirements_optional.txt
Step 4: Initial Setup and Authentication
# Run initial setup to authenticate and select folder
python gdrive_mcp_server.py --setup
This will:
- Open your browser for Google authentication
- Allow you to select which Google Drive folder to access
- Save the configuration for future use
Step 5: Configure Claude Desktop
Add the server to your Claude Desktop configuration file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"gdrive": {
"command": "python",
"args": ["c:\\Users\\shank\\projects\\github\\gdrive_mcp_server\\gdrive_mcp_server.py"],
"env": {
"GOOGLE_CREDENTIALS_FILE": "c:\\Users\\shank\\projects\\github\\gdrive_mcp_server\\credentials.json",
"GOOGLE_TOKEN_FILE": "c:\\Users\\shank\\projects\\github\\gdrive_mcp_server\\token.json"
}
}
}
}
Important: Update the paths to match your actual project location.
Step 6: Restart Claude Desktop
Close and restart Claude Desktop to load the new MCP server.
Usage
Once configured, you can use these commands in Claude:
List Files
List all files in my Google Drive folder
Analyze Documents
Get the content of file ID: [file_id]
Process Archives
Extract and analyze the ZIP file with ID: [file_id]
Get Document Overview
Give me an overview of the large document with ID: [file_id]
Search and Filter
List files containing "budget" in the name
Available Tools
| Tool | Description |
|---|---|
list_gdrive_files | List files in selected folder |
get_gdrive_file | Download and process file content |
get_gdrive_file_metadata | Get file information |
get_current_folder_info | Show selected folder details |
extract_and_analyze_archive | Process ZIP archives |
get_file_chunk | Get specific sections of large files |
get_document_overview | Get structured document summary |
get_file_processing_info | Check file format support |
Security Features
- Folder Scoping: Access limited to pre-selected folder only
- No Write Access: Read-only operations for safety
- File Validation: Ensures files are within allowed scope
- OAuth Authentication: Secure Google authentication flow
Troubleshooting
Authentication Issues
# Re-run setup to re-authenticate
python gdrive_mcp_server.py --setup
Missing Dependencies
# Install all optional dependencies
pip install -r requirements_optional.txt
File Processing Errors
- Check if file format is supported
- Ensure file is not corrupted
- Try with a smaller file first
Claude Connection Issues
- Verify paths in
claude_desktop_config.json - Check that Python is in your system PATH
- Restart Claude Desktop after configuration changes
Testing
Test the server functionality:
# Run comprehensive tests
python test_server.py
# Choose option 1 for full test or option 2 for specific file testing
File Structure
gdrive_mcp_server/
├── gdrive_mcp_server.py # Main MCP server
├── file_processor.py # File format processing
├── rag_processor.py # Document chunking and search
├── test_server.py # Testing utilities
├── requirements_optional.txt # Optional dependencies
├── test_requirements.txt # Basic requirements
├── credentials.json # Your Google OAuth credentials
├── token.json # Generated auth token
└── gdrive_folder_config.json # Folder selection config
Advanced Configuration
Change Selected Folder
python gdrive_mcp_server.py --setup
Environment Variables
GOOGLE_CREDENTIALS_FILE: Path to credentials.jsonGOOGLE_TOKEN_FILE: Path to token.json
Custom File Processing
Edit file_processor.py to add support for additional file formats.
Support
For issues:
- Check the debug log:
gdrive_mcp_debug.log - Verify Google Drive API quotas
- Ensure proper folder permissions
- Test with
test_server.pyfirst
License
This project is provided as-is for educational and development purposes.