jayeshchowdary/Google-Drive-MCP
If you are the rightful owner of Google-Drive-MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Google Drive MCP Server is a comprehensive Model Context Protocol (MCP) server that provides access to Google Drive functionality through a variety of tools for file management, sharing, comments, and more.
Google Drive MCP Server
A comprehensive Model Context Protocol (MCP) server that provides access to Google Drive functionality through 42+ tools for file management, sharing, comments, and more. This server can be used locally, deployed to Vercel, integrated with Claude Desktop, or tested with MCP Inspector.
๐ Live Deployment
Production URL: https://gdrive-mcp.vercel.app/api/mcp
๐ Project Structure
gdrive-mcp/
โโโ api/
โ โโโ mcp.py # Vercel API endpoint
โโโ server.py # Main FastMCP server with Google Drive tools
โโโ vercel.json # Vercel deployment configuration
โโโ requirements.txt # Python dependencies
โโโ pyproject.toml # Project configuration
โโโ local_oauth.py # OAuth setup utility
โโโ test_authenticated.py # Test script for authenticated tools
โโโ README.md # This file
๐ ๏ธ Available Tools
The server provides 42+ Google Drive tools including:
File Management
create_file_or_folder
- Create files and folderscreate_file_from_text
- Create files from text contentdownload_file
- Download files from Driveedit_file
- Edit file contentdelete_folder_or_file
- Delete files/folderscopy_file
- Copy filesfind_file
- Search for fileslist_files
- List files with paginationmove_file
- Move files between folderstrash_file
- Move files to trashuntrash_file
- Restore files from trash
Folder Operations
create_folder
- Create new foldersfind_folder
- Find folders by namelist_file_labels
- List file labels
Sharing & Permissions
add_file_sharing_preference
- Share fileslist_permissions
- List file permissionsdelete_permission
- Remove permissionscheck_file_permissions
- Check file accessupdate_permission
- Update file permissionsget_permission
- Get specific permission details
Comments & Collaboration
create_comment
- Add comments to filesget_file_comments_and_replies
- Get all commentsdelete_comment
- Delete commentsdelete_reply
- Delete comment repliesupdate_comment
- Update existing commentsupdate_reply
- Update comment replieslist_comments
- List file commentsget_comment
- Get specific commentget_reply
- Get specific replylist_replies_to_comment
- List replies to a comment
Google Workspace Integration
edit_google_workspace_file
- Edit Docs, Sheets, Slidescreate_shortcut_to_file
- Create file shortcuts
Drive Management
get_about
- Get account and storage infoempty_trash
- Empty trashget_changes_start_page_token
- Track changeslist_changes
- List file changesget_file_metadata
- Get detailed file informationupdate_file_metadata
- Update file propertieslist_revisions
- List file revisionsgenerate_ids
- Generate unique IDs
Advanced Operations
get_drive
- Get shared drive informationdelete_shared_drive
- Delete shared driveslist_file_labels
- List file labels
And many more! See server.py
for the complete list.
๐ง Prerequisites
Required Software
- Python 3.8+ (3.13+ recommended)
- Google Cloud Console account (for OAuth credentials)
- Vercel account (for deployment)
- Claude Desktop (for Claude integration)
- Node.js (for MCP Inspector)
Required Accounts
- Google Account with Drive access
- Google Cloud Console project with Drive API enabled
- Vercel account (free tier available)
๐ Google Cloud Console Setup
Step 1: Create Google Cloud Project
- Open your web browser
- Navigate to: https://console.cloud.google.com/
- Sign in with your Google account
- Click "Select a project" dropdown at the top
- Click "New Project"
- Enter project name:
Google Drive MCP Server
- Click "Create"
- Wait for project creation (may take a few minutes)
Step 2: Enable Google Drive API
- In the Google Cloud Console, make sure your new project is selected
- Click the hamburger menu (โฐ) in the top-left corner
- Navigate to: APIs & Services โ Library
- Search for: "Google Drive API"
- Click on "Google Drive API"
- Click "Enable"
- Wait for API to be enabled
Step 3: Create OAuth 2.0 Credentials
- In the Google Cloud Console, navigate to: APIs & Services โ Credentials
- Click "Create Credentials"
- Select "OAuth client ID"
- If prompted, click "Configure Consent Screen"
- Choose "External" user type
- Click "Create"
- Fill in the required fields:
- App name:
Google Drive MCP Server
- User support email: Your email
- Developer contact information: Your email
- App name:
- Click "Save and Continue"
- Skip "Scopes" (click "Save and Continue")
- Add test users (your email address)
- Click "Save and Continue"
- Review and click "Back to Dashboard"
Step 4: Create OAuth Client ID
- Back in Credentials page, click "Create Credentials"
- Select "OAuth client ID"
- Application type: Select "Web application"
- Name:
Google Drive MCP Server
- Authorized redirect URIs: Add these URLs:
https://gdrive-mcp.vercel.app/api/mcp/callback
http://localhost:8080/callback
(for local testing)
- Click "Create"
- Copy the Client ID and Client Secret (you'll need these later)
- Click "OK"
๐ฆ Local Development Setup
Step 1: Clone and Setup Project
- Open Terminal/Command Prompt
- Navigate to your desired directory:
cd /path/to/your/projects
- Clone the repository (if not already done):
git clone <repository-url> cd gdrive-mcp
Step 2: Install Dependencies
- Create a virtual environment:
python -m venv venv
- Activate the virtual environment:
- On macOS/Linux:
source venv/bin/activate
- On Windows:
venv\Scripts\activate
- On macOS/Linux:
- Install dependencies:
pip install -r requirements.txt
Step 3: Set Up Environment Variables
- Create a
.env
file in the project root:touch .env
- Open the
.env
file in a text editor - Add your Google OAuth credentials:
GOOGLE_CLIENT_ID=your_client_id_here GOOGLE_CLIENT_SECRET=your_client_secret_here GOOGLE_REDIRECT_URI=http://localhost:8080/callback
- Save the file
Step 4: Run Local OAuth Setup
- In Terminal, make sure you're in the project directory
- Run the OAuth setup script:
python local_oauth.py
- Follow the prompts:
- Copy the OAuth URL that appears
- Open the URL in your browser
- Sign in with your Google account
- Grant permissions to the application
- Copy the authorization code from the redirect URL
- Paste the code back into the terminal
- Wait for credentials to be saved to
.token.json
Step 5: Test Local Server
- Run the test script:
python test_authenticated.py
- Verify output shows successful authentication and tool execution
๐ Vercel Deployment
Step 1: Install Vercel CLI
- Open Terminal/Command Prompt
- Install Vercel CLI globally:
npm install -g vercel
- Verify installation:
vercel --version
Step 2: Deploy to Vercel
- In Terminal, navigate to the project directory
- Login to Vercel:
vercel login
- Follow the browser authentication (Vercel will open a browser window)
- Deploy the project:
vercel --prod
- Follow the prompts:
- Set up and deploy? โ Type
y
and press Enter - Which scope? โ Select your account
- Link to existing project? โ Type
n
and press Enter - What's your project's name? โ Type
gdrive-mcp
and press Enter - In which directory is your code located? โ Press Enter (current directory)
- Want to override the settings? โ Type
n
and press Enter
- Set up and deploy? โ Type
- Wait for deployment to complete
- Note the deployment URL (e.g.,
https://gdrive-mcp.vercel.app
)
Step 3: Set Up Vercel Environment Variables
- Open your web browser
- Navigate to: https://vercel.com/dashboard
- Click on your project (
gdrive-mcp
) - Click "Settings" tab
- Click "Environment Variables" in the left sidebar
- Add the following variables:
- Name:
GOOGLE_CLIENT_ID
- Value: Your Google Client ID
- Environment: Production, Preview, Development
- Name:
GOOGLE_CLIENT_SECRET
- Value: Your Google Client Secret
- Environment: Production, Preview, Development
- Name:
GOOGLE_REDIRECT_URI
- Value:
https://gdrive-mcp.vercel.app/api/mcp/callback
- Environment: Production, Preview, Development
- Value:
- Name:
- Click "Save" for each variable
Step 4: Complete OAuth Setup for Vercel
- In Terminal, run the OAuth setup:
python local_oauth.py
- Follow the prompts to complete OAuth
- Copy the OAuth token from the output
- In Vercel dashboard, add another environment variable:
- Name:
GOOGLE_OAUTH_TOKEN
- Value: The OAuth token from step 3
- Environment: Production, Preview, Development
- Name:
- Click "Save"
- Redeploy the project:
vercel --prod
Step 5: Test Vercel Deployment
- Test the deployment:
python test_authenticated.py
- Verify the server is working:
curl https://gdrive-mcp.vercel.app/api/mcp
๐ค Claude Desktop Integration
Step 1: Install Claude Desktop
- Open your web browser
- Navigate to: https://claude.ai/download
- Download Claude Desktop for your operating system
- Install the application
- Launch Claude Desktop
Step 2: Create MCP Proxy Script
- In your project directory, create a file called
mcp_proxy.py
:touch mcp_proxy.py
- Open the file in a text editor
- Copy and paste this content:
#!/usr/bin/env python3 """ MCP Proxy for Google Drive MCP Server This script acts as a bridge between Claude Desktop and the Vercel MCP server """ import urllib.request import urllib.parse import json import sys import signal # Vercel MCP Server URL SERVER_URL = "https://gdrive-mcp.vercel.app/api/mcp" def handle_request(request_data): """Handle a single MCP request""" try: # Convert request to JSON json_data = json.dumps(request_data).encode('utf-8') # Create HTTP request req = urllib.request.Request( SERVER_URL, data=json_data, headers={'Content-Type': 'application/json'} ) # Send request with urllib.request.urlopen(req, timeout=30) as response: result = response.read().decode('utf-8') return json.loads(result) except Exception as e: return { "jsonrpc": "2.0", "id": request_data.get("id"), "error": { "code": -32603, "message": f"Proxy error: {str(e)}" } } def main(): """Main MCP proxy loop""" print("MCP Proxy starting...", file=sys.stderr) # Handle shutdown gracefully def signal_handler(sig, frame): print("MCP Proxy shutting down...", file=sys.stderr) sys.exit(0) signal.signal(signal.SIGINT, signal_handler) signal.signal(signal.SIGTERM, signal_handler) try: # Read requests from stdin for line in sys.stdin: line = line.strip() if not line: continue try: # Parse JSON-RPC request request_data = json.loads(line) # Handle the request response = handle_request(request_data) # Send response to stdout print(json.dumps(response)) sys.stdout.flush() except json.JSONDecodeError as e: error_response = { "jsonrpc": "2.0", "id": None, "error": { "code": -32700, "message": f"Parse error: {str(e)}" } } print(json.dumps(error_response)) sys.stdout.flush() except KeyboardInterrupt: print("MCP Proxy interrupted", file=sys.stderr) except Exception as e: print(f"MCP Proxy error: {e}", file=sys.stderr) sys.exit(1) if __name__ == "__main__": main()
- Save the file
- Make it executable:
chmod +x mcp_proxy.py
Step 3: Configure Claude Desktop
- Open File Explorer/Finder
- Navigate to the Claude configuration directory:
- macOS:
~/Library/Application Support/Claude/
- Windows:
%APPDATA%\Claude\
- Linux:
~/.config/claude/
- macOS:
- Create the directory if it doesn't exist
- Create or edit
claude_desktop_config.json
- Add this configuration:
Note: Replace the path with your actual project directory path
{ "mcpServers": { "google-drive-mcp": { "command": "python3", "args": ["/Users/jayeshkumarchowdary/Desktop/gdrive-mcp/mcp_proxy.py"], "env": {} } } }
- Save the file
Step 4: Restart Claude Desktop
- Close Claude Desktop completely
- Reopen Claude Desktop
- Wait for it to fully load
Step 5: Test Claude Desktop Integration
- Start a new conversation in Claude Desktop
- Type this test message:
What Google Drive tools are available through the MCP server?
- Claude should respond with a list of available tools
- Try additional commands:
Get my Google Drive account information
List the first 5 files in my Google Drive
Search for files containing "test" in my Google Drive
๐ MCP Inspector Testing
Step 1: Install MCP Inspector
- Open Terminal/Command Prompt
- Install MCP Inspector globally:
npm install -g @modelcontextprotocol/inspector
- Verify installation:
mcp-inspector --version
Step 2: Start MCP Inspector
- In Terminal, run:
mcp-inspector
- Wait for the browser to open automatically (usually
http://localhost:3000
)
Step 3: Connect to Your MCP Server
-
In the MCP Inspector browser window:
- Look for the "Add Server" button or "+" icon
- Click "Add Server"
-
Configure the connection:
- Server Type: Select "HTTP" or "URL"
- Server URL: Enter
https://gdrive-mcp.vercel.app/api/mcp
- Name: Enter
Google Drive MCP
(optional) - Click "Connect" or "Add"
Step 4: Test MCP Methods
-
Initialize the connection:
- Look for "Initialize" button or method
- Click "Initialize"
- You should see a success response with server capabilities
-
List available tools:
- Look for "Tools" section or "List Tools" button
- Click "List Tools" or "tools/list"
- You should see all 42+ Google Drive tools listed
-
Test a tool:
- Find the "get_about" tool in the list
- Click on it to expand
- Click "Call Tool" or "Execute"
- You should see your Google Drive account information
Step 5: Test Additional Tools
-
Try the "list_files" tool:
- Click on "list_files"
- Set page_size to 5
- Click "Call Tool"
- You should see a list of files
-
Try the "find_file" tool:
- Click on "find_file"
- Set q to "test"
- Click "Call Tool"
- You should see search results
๐งช HTTP API Testing
Step 1: Test Basic Connectivity
- Open Terminal/Command Prompt
- Test the server status:
curl https://gdrive-mcp.vercel.app/api/mcp
- You should see:
{ "message": "Google Drive MCP Server is running", "status": "working", "endpoint": "/api/mcp" }
Step 2: Test MCP Protocol
-
Test initialization:
curl -X POST https://gdrive-mcp.vercel.app/api/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {}}'
-
Test tools listing:
curl -X POST https://gdrive-mcp.vercel.app/api/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "id": 2, "method": "tools/list", "params": {}}'
-
Test tool execution:
curl -X POST https://gdrive-mcp.vercel.app/api/mcp \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "get_about", "arguments": {}}}'
Step 3: Test with Python Script
- Run the test script:
python test_authenticated.py
- You should see:
- โ get_about successful!
- โ list_files successful!
๐ง Troubleshooting
Common Issues
MCP Inspector Connection Issues
- Clear browser cache and restart MCP Inspector
- Verify the URL is exactly
https://gdrive-mcp.vercel.app/api/mcp
- Check if the server is running with a simple curl test
Claude Desktop Not Connecting
- Check the file path in
claude_desktop_config.json
- Make sure the proxy script is executable
- Restart Claude Desktop completely
- Check Claude Desktop logs for error messages
Authentication Errors
- Verify OAuth token is set in Vercel environment variables
- Re-run the OAuth setup if token has expired
- Check Google Cloud Console redirect URI configuration
Tool Execution Errors
- Check Vercel logs for server-side errors
- Verify OAuth scopes match Google Cloud Console configuration
- Test with MCP Inspector first to isolate issues
Debug Commands
Check Server Status
curl -I https://gdrive-mcp.vercel.app/api/mcp
Test OAuth Token
curl -X POST https://gdrive-mcp.vercel.app/api/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "get_about", "arguments": {}}}'
Check Vercel Logs
vercel logs https://gdrive-mcp.vercel.app
๐ Usage Examples
Basic File Operations
# List files
curl -X POST https://gdrive-mcp.vercel.app/api/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "list_files", "arguments": {"page_size": 10}}}'
# Search for files
curl -X POST https://gdrive-mcp.vercel.app/api/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "find_file", "arguments": {"q": "test"}}}'
# Get file metadata
curl -X POST https://gdrive-mcp.vercel.app/api/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "get_file_metadata", "arguments": {"file_id": "your_file_id"}}}'
Claude Desktop Commands
List all files in my Google Drive
Search for PDF files
Create a new folder called "MCP Test"
Download the file with ID "1Di1u4M-jra0JzyXuNjfLPvqkEjF1WeOW"
Share the file "testfile01" with read access
Get my Google Drive storage information
๐ Advanced Configuration
Custom OAuth Scopes
To add additional Google APIs, update the SCOPES
list in server.py
:
SCOPES = [
"https://www.googleapis.com/auth/drive",
"https://www.googleapis.com/auth/drive.file",
"https://www.googleapis.com/auth/drive.metadata.readonly",
"https://www.googleapis.com/auth/spreadsheets",
"https://www.googleapis.com/auth/documents",
# Add more scopes as needed
]
Environment-Specific Configuration
For different environments, create separate .env
files:
.env.local
- Local development.env.staging
- Staging environment.env.production
- Production environment
๐ License
This project is open source and available under the MIT License.
๐ค Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
๐ Support
For issues and questions:
- Check the troubleshooting section above
- Review the Vercel logs for server-side errors
- Test with MCP Inspector to isolate client-side issues
- Check Google Cloud Console for OAuth configuration issues
๐ฏ Quick Start Summary
- Set up Google Cloud Console (OAuth credentials)
- Deploy to Vercel (production server)
- Complete OAuth setup (authentication)
- Choose your integration:
- Claude Desktop: Use the proxy script configuration
- MCP Inspector: Connect to the HTTP endpoint
- HTTP API: Use curl or your preferred HTTP client
- Local development: Run the server locally
Your Google Drive MCP server is now ready to use! ๐