google-drive-mcp
Click on "Deploy 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 List all files in the folder named 'Projects'"
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
A Model Context Protocol (MCP) server for Google Drive API v3, enabling AI agents like Claude to manage Google Drive files, folders, and sharing.
Provides 26 tools across 9 categories for comprehensive Google Drive management.
Features
Category | Tools | Description |
Files | 10 | List, search, full-text search, read, upload, update, append, export files |
Trash | 3 | Trash, restore, list trash |
Folders | 1 | Create folders |
Organization | 2 | Move, copy files |
Sharing | 5 | Share files, manage permissions, create share links |
Metadata | 2 | Get/update file info |
Revisions | 2 | List revision history, download specific versions |
Shared Drives | 2 | List shared drives, get shared drive info |
Utilities | 1 | Recently accessed files |
Related MCP server: MCP Google Workspace Server
Requirements
Python >= 3.10
uv (recommended) or pip
Google Cloud project with Drive API enabled
OAuth 2.0 credentials (from Google Cloud Console)
Setup
1. Google Cloud Project
Go to Google Cloud Console and create a new project
Enable Google Drive API at APIs & Services > Library
Create credentials at APIs & Services > Credentials:
OAuth 2.0 Client ID (Desktop app)
Download the credentials JSON file
2. Installation
git clone https://github.com/software-engineer-mj/google-drive-mcp.git
cd google-drive-mcp
uv sync3. Configuration
cp .env.example .envVariable | Required | Description |
| Yes | Path to OAuth 2.0 credentials JSON |
| No | OAuth token storage path (default: |
| No | Maximum download size in MB (default: 10) |
Authentication
On first run, a browser will open for Google account authorization. After approval, token.json is created and refreshed automatically.
Note: Never commit
credentials.jsonortoken.jsonto version control. They are already in.gitignore.
Usage
stdio (default)
uv run python -m google_drive_mcpDocker
docker build -t google-drive-mcp .
docker run -v /path/to/credentials.json:/app/credentials.json \
-e GOOGLE_DRIVE_CREDENTIALS_PATH=/app/credentials.json \
google-drive-mcpMCP Client Configuration
Claude Desktop
Add to claude_desktop_config.json:
{
"mcpServers": {
"google-drive": {
"command": "uv",
"args": ["run", "--directory", "/path/to/google-drive-mcp", "python", "-m", "google_drive_mcp"],
"env": {
"GOOGLE_DRIVE_CREDENTIALS_PATH": "/path/to/credentials.json",
"GOOGLE_DRIVE_TOKEN_PATH": "/path/to/token.json"
}
}
}
}Claude Code
Add to .mcp.json:
{
"mcpServers": {
"google-drive": {
"command": "uv",
"args": ["run", "--directory", "/path/to/google-drive-mcp", "python", "-m", "google_drive_mcp"],
"env": {
"GOOGLE_DRIVE_CREDENTIALS_PATH": "/path/to/credentials.json",
"GOOGLE_DRIVE_TOKEN_PATH": "/path/to/token.json"
}
}
}
}Development
# Install with dev dependencies
uv sync --dev
# Run tests
uv run pytest tests/ -v
# Lint
uv run ruff check src/ tests/
# Format
uv run ruff format src/ tests/Tool Reference
Files (10)
Tool | Description |
| List files in Drive, optionally within a folder |
| Search files using Drive query syntax |
| Search files by their text content (full-text search) |
| Read file content (Google Docs/Sheets/Slides auto-exported to text/CSV) |
| Upload a text file |
| Upload a binary file (base64-encoded) |
| Update existing file content |
| Append text to the end of an existing text file |
| Export Google Workspace file to PDF, DOCX, XLSX, etc. |
| Create a new Google Docs, Sheets, or Slides |
Trash (3)
Tool | Description |
| Move file to trash (recoverable) |
| Restore file from trash |
| List files in trash |
Folders (1)
Tool | Description |
| Create a new folder |
Organization (2)
Tool | Description |
| Move file to a different folder |
| Copy a file |
Sharing (5)
Tool | Description |
| Share file by email (reader/writer/commenter/owner) |
| List file permissions |
| Remove a permission |
| Create "anyone with link" share link |
| Update existing permission role |
Metadata (2)
Tool | Description |
| Get detailed file metadata |
| Update file name/description |
Revisions (2)
Tool | Description |
| List file revision history |
| Download specific revision content |
Shared Drives (2)
Tool | Description |
| List all shared drives the user has access to |
| Get metadata for a specific shared drive |
Utilities (1)
Tool | Description |
| List recently accessed files |
Google Docs Auto-Conversion
read_file automatically converts Google Workspace files:
Source Format | Export Format |
Google Docs | Plain Text |
Google Sheets | CSV |
Google Slides | Plain Text |
export_file supports additional formats:
Source Format | Supported Formats |
Google Docs | pdf, docx, odt, txt, html |
Google Sheets | pdf, xlsx, ods, csv, tsv |
Google Slides | pdf, pptx, txt |
Google Drawings | pdf, png, svg |
Project Structure
src/google_drive_mcp/
├── __init__.py # FastMCP server instance
├── __main__.py # Entry point with auto-discovery
├── auth.py # OAuth 2.0 authentication
├── client.py # Google Drive API wrapper
├── exceptions.py # Custom exception hierarchy
├── lifespan.py # Server lifecycle management
├── utils.py # MIME type mapping, helpers
├── validators.py # Input validation utilities
└── tools/
├── __init__.py
├── drives.py # Shared drives management
├── files.py # File CRUD operations
├── folders.py # Folder management
├── metadata.py # File metadata
├── organization.py # Move, copy
├── revisions.py # Revision history
├── sharing.py # Sharing and permissions
├── trash.py # Trash operations
└── utilities.py # Recently accessed files
tests/
├── conftest.py
├── test_auth.py
├── test_client.py
├── test_server.py
├── test_utils.py
└── tools/
├── conftest.py
└── test_<domain>.py # Tests matching each tool moduleLicense
MIT - see LICENSE for details.
Available Tools
25 toolsappend_to_fileA
Append text content to the end of an existing text file. Does not work with Google Docs/Sheets/Slides.
Inputs: content (required), file_id (required), mime_type. Returns: result
create_folderB
Create a new folder in Google Drive.
Inputs: name (required), parent_id. Returns: result
create_google_docC
Create a new blank Google Docs, Sheets, or Slides file.
Inputs: name (required), doc_type, parent_id. Returns: result
get_file_infoB
Get detailed metadata for a file including size, dates, owners, and sharing status.
Inputs: file_id (required). Returns: result
get_revisionA
Download the content of a specific file revision (version).
Inputs: file_id (required), revision_id (required). Returns: result
list_filesB
List files in Google Drive, optionally within a specific folder.
Inputs: corpora, drive_id, order_by, folder_id, +2 more. Returns: result
list_permissionsA
List all permissions (who has access) for a file in Google Drive.
Inputs: file_id (required). Returns: result
list_recentA
List recently accessed files, sorted by last viewed time.
Inputs: page_size, page_token. Returns: result
list_revisionsC
List the revision history (versions) of a file. Shows who modified it and when.
Inputs: file_id (required), page_size, page_token. Returns: result
list_trashB
List files currently in the trash.
Inputs: page_size, page_token. Returns: result
move_fileB
Move a file to a different folder in Google Drive.
Inputs: file_id (required), new_parent_id (required). Returns: result
read_fileB
Read the content of a file from Google Drive. Google Docs/Sheets/Slides are automatically exported to text/CSV format.
Inputs: file_id (required). Returns: result
remove_permissionB
Remove a specific permission from a file, revoking access for that user.
Inputs: file_id (required), permission_id (required). Returns: result
restore_fileA
Restore a file from trash back to its original location.
Inputs: file_id (required). Returns: result
search_file_contentA
Search for files by their text content. Finds files containing the specified text.
Inputs: text (required), corpora, drive_id, file_type, +2 more. Returns: result
search_filesC
Search for files in Google Drive using query syntax.
Inputs: query (required), corpora, drive_id, page_size, +1 more. Returns: result
trash_fileA
Move a file to trash. The file can be restored later with restore_file.
Inputs: file_id (required). Returns: result
update_metadataB
Update a file's metadata (name and/or description).
Inputs: file_id (required), name, description. Returns: result
update_permissionB
Update an existing permission's role on a file.
Inputs: role (required), file_id (required), permission_id (required). Returns: result
upload_binary_fileC
Upload a binary file to Google Drive using base64-encoded content.
Inputs: name (required), mime_type (required), content_base64 (required), parent_id. Returns: result
upload_fileA
Upload a new file to Google Drive with the given text content.
Inputs: name (required), content (required), mime_type, parent_id. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 25 tools
Each tool has a clear and distinct purpose, covering various aspects of Google Drive management without overlap. For example, list_files, search_files, list_recent, and list_trash each target different subsets of files.
All tool names follow a consistent verb_noun pattern in snake_case, such as list_shared_drives, create_folder, or update_metadata. This makes the API predictable and easy to navigate.
With 25 tools, the server covers a broad range of Google Drive operations. While slightly above the typical 3-15 tool range, the count is justified given the domain's complexity and is not excessive.
The tool set provides comprehensive CRUD operations, sharing, revision history, and search. Minor gaps include the lack of a permanent delete tool or a function to restore a file to a previous revision, but the core workflows are well-covered.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Hosted Google Calendar MCP server for AI agents. No self-hosting or Google Cloud setup.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA server that provides a Machine Control Protocol (MCP) interface to search, access, and interact with Google Drive files and folders, enabling AI assistants to work with Google Drive content.8MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that enables AI agents to interact with Google Workspace services including Drive, Docs, and Sheets through natural language commands.8MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that enables AI assistants to interact with Proton Drive files, supporting operations like listing, reading, creating, and deleting files and folders.7777 npm16MIT
- FlicenseBqualityDmaintenanceAn MCP server that enables integration with Google Drive through a service account to list files and retrieve detailed file metadata. It allows users to browse and inspect Drive contents using natural language via the Model Context Protocol.2-