google-drive-mcp-readonly
v1.3.0
Published
Google Drive MCP Server - Model Context Protocol server providing secure access to Google Drive, Docs, Sheets, and Slides through MCP clients e.g. Claude Desktop
Maintainers
Readme
Google Drive MCP Server - Read-Only Edition
🔒 Safe and Read-Only - No data modifications possible
A Model Context Protocol (MCP) server that provides secure, read-only integration with Google Drive, Docs, Sheets, and Slides. It allows Claude Desktop and other MCP clients to safely access and search your files without any risk of modification.
✨ Features
- 🔍 Advanced Search: Search across your entire Google Drive
- 📁 Folder Navigation: List and browse folder hierarchies
- 📄 Read Google Docs: Access and display document content with text indices
- 📊 Read Google Sheets: Retrieve spreadsheet data from specific ranges
- 🎯 Read Google Slides: View presentation content and element structure
- 🔐 Secure Authentication: OAuth 2.0 with automatic token refresh
- ✅ Completely Read-Only: Zero risk of accidental data modification
🚀 Quick Start
Installation
npm install google-drive-mcp-readonlyUsage with Claude Desktop
Add to your Claude Desktop config (~/.config/claude/claude_desktop_config.json):
{
"mcpServers": {
"google-drive-readonly": {
"command": "npx",
"args": ["google-drive-mcp-readonly"],
"env": {
"GOOGLE_DRIVE_OAUTH_CREDENTIALS": "/path/to/gcp-oauth.keys.json"
}
}
}
}CLI Commands
# Show version
npx google-drive-mcp-readonly --version
# Show help
npx google-drive-mcp-readonly help
# Run authentication
npx google-drive-mcp-readonly auth
# Start the MCP server
npx google-drive-mcp-readonly start📋 Available Tools (5 Read-Only Tools)
1. search - Search Google Drive
Find files across your entire Google Drive using search queries.
Input: { query: "budget 2024" }
Output: List of matching files with names, IDs, and MIME types2. listFolder - Browse Folder Contents
List all files and subfolders within a specific folder with pagination support.
Input: { folderId: "folder_id", pageSize: 50 }
Output: Files with details, folder structure information3. getGoogleSheetContent - Read Spreadsheet Data
Retrieve content from specific ranges in Google Sheets.
Input: { spreadsheetId: "sheet_id", range: "Sheet1!A1:C10" }
Output: Cell values formatted by row4. getGoogleDocContent - Read Google Docs
Get document content with character indices for reference.
Input: { documentId: "doc_id" }
Output: Full document text with position markers5. getGoogleSlidesContent - Read Presentations
View presentation structure and content with element IDs.
Input: { presentationId: "presentation_id" }
Output: Slide content, text, shapes, and element structure📖 Usage Examples
Example 1: Search for Budget Documents
User: "Search for all budget-related files in my Drive"
Tool Call:
search({ query: "budget" })
Result:
Found 5 files:
- budget_2024.xlsx (ID: abc123)
- Q1_budget_plan.docx (ID: def456)
- team_budget_notes.txt (ID: ghi789)
...Example 2: List Files in a Folder
User: "Show me all files in my Projects folder"
Tool Call:
listFolder({ folderId: "projects_folder_id" })
Result:
📁 Q1 Planning
📁 Q2 Planning
📄 Project Timeline.docx
📊 Budget Analysis.xlsxExample 3: Read Spreadsheet Data
User: "Get the sales data from my spreadsheet"
Tool Call:
getGoogleSheetContent({
spreadsheetId: "sheet_id",
range: "Sales!A1:D100"
})
Result:
Row 1: Date, Product, Quantity, Revenue
Row 2: 2024-01-01, Widget A, 100, $5000
...🔐 Security & Permissions
This version is completely read-only and safe to use:
✅ Enabled Permissions:
- Read Google Drive files and folders
- Read Google Docs content
- Read Google Sheets data
- Read Google Slides presentations
- Search across your Drive
❌ Disabled Operations:
- ❌ No file creation
- ❌ No file modification
- ❌ No file deletion
- ❌ No folder creation
- ❌ No renaming or moving
- ❌ No document editing
- ❌ No spreadsheet updates
- ❌ No presentation changes
📋 Requirements
- Node.js: Version 18 or higher (LTS recommended)
- Google Cloud Project: With the following APIs enabled:
- Google Drive API (read-only)
- Google Docs API (read-only)
- Google Sheets API (read-only)
- Google Slides API (read-only)
- OAuth 2.0 Credentials: Desktop application type
🔧 Google Cloud Setup
1. Create a Google Cloud Project
- Go to the Google Cloud Console
- Click "Select a project" > "New Project"
- Name your project (e.g., "Google Drive MCP Read-Only")
- Note the Project ID
2. Enable Required APIs
In your project, go to "APIs & Services" > "Library" and enable:
- Google Drive API
- Google Docs API
- Google Sheets API
- Google Slides API
3. Configure OAuth Consent Screen
- Go to "APIs & Services" > "OAuth consent screen"
- Fill in app name, support email, and developer contact
- Choose "External" or "Internal" based on your needs
- Add your email as a test user
- Scopes to request (read-only):
https://www.googleapis.com/auth/drive.readonlyhttps://www.googleapis.com/auth/documents.readonlyhttps://www.googleapis.com/auth/spreadsheets.readonlyhttps://www.googleapis.com/auth/presentations.readonly
4. Create OAuth 2.0 Credentials
- Go to "APIs & Services" > "Credentials"
- Click "+ CREATE CREDENTIALS" > "OAuth client ID"
- Application type: Desktop app
- Download the JSON file and save as
gcp-oauth.keys.json
📦 Installation Options
Option 1: NPX (Recommended - No Installation)
npx google-drive-mcp-readonly --version
npx google-drive-mcp-readonly helpOption 2: NPM Install
npm install google-drive-mcp-readonlyThen use:
npx google-drive-mcp-readonly start
google-drive-mcp --version # if installed globally with -g🔑 Configuration
Environment Variables
# Path to your OAuth credentials JSON file (required)
export GOOGLE_DRIVE_OAUTH_CREDENTIALS="/path/to/gcp-oauth.keys.json"
# Optional: Custom token storage location
export GOOGLE_DRIVE_MCP_TOKEN_PATH="/custom/path/tokens.json"
# Optional: Debug logging
export DEBUG="google-drive-mcp:*"Token Storage
Authentication tokens are stored securely at:
$GOOGLE_DRIVE_MCP_TOKEN_PATH(if set)$XDG_CONFIG_HOME/google-drive-mcp/tokens.json~/.config/google-drive-mcp/tokens.json(default)
🎯 Use Cases
✅ Perfect For:
- Accessing Google Drive files programmatically
- Searching and discovering files
- Reading documents, sheets, and presentations
- Browsing folder structures
- Creating summaries from your files
- Safe information retrieval
❌ Not Suitable For:
- Modifying or creating files
- Deleting files
- Automating file creation workflows
- Data modification tasks
🐛 Troubleshooting
"OAuth credentials not found"
Ensure your gcp-oauth.keys.json exists or GOOGLE_DRIVE_OAUTH_CREDENTIALS env var is set.
"API not enabled"
Go to Google Cloud Console > APIs & Services > Library and enable the required APIs.
"Authentication failed"
Make sure:
- OAuth credential type is "Desktop app"
- Your email is added as a test user
- You have Read-only scopes configured
Debug Mode
Enable detailed logging:
export DEBUG=google-drive-mcp:*
npx google-drive-mcp-readonly start📄 License
MIT - See LICENSE file for details
