MCP server for Google Drive — list, search, read, upload, share, and manage files via Google OAuth2.
Project description
Google Drive MCP Server
An independent MCP (Model Context Protocol) server for Google Drive operations. List, search, read, upload, share, and manage files and folders in Google Drive via OAuth2.
Features
- 📁 List Files — Browse files in any folder with sorting and pagination
- 🔍 Search Files — Full-text search or advanced Drive query syntax
- 📄 Read Files — Read Google Docs, Sheets, Slides as text/CSV, or any text file
- ⬆️ Upload Files — Upload files to any folder
- 📂 Create Folders — Organize files with new folders
- 🔗 Share Files — Share with users as reader, commenter, or writer
- 📦 Move Files — Move between folders
- 🗑️ Delete Files — Move files to trash (recoverable)
Installation
pip install workos-gdrive-mcp-server
Prerequisites
You need Google OAuth2 credentials with the Google Drive API scope enabled.
Getting Credentials
- Go to Google Cloud Console
- Create/select a project → Enable the Google Drive API
- Create OAuth 2.0 credentials (Desktop app type)
- Generate a refresh token using the helper script or OAuth Playground
The refresh token must include the scope:
https://www.googleapis.com/auth/drive
Tip: If you already have tokens for Gmail/GMeet with the same Google project, you can generate a new refresh token that includes Drive scope along with your existing scopes.
Quick Start
GOOGLE_CLIENT_ID=your-client-id \
GOOGLE_CLIENT_SECRET=your-client-secret \
GOOGLE_REFRESH_TOKEN=your-refresh-token \
gdrive-mcp-server
Environment Variables
| Variable | Required | Description |
|---|---|---|
GOOGLE_CLIENT_ID |
✅ | Google OAuth2 client ID |
GOOGLE_CLIENT_SECRET |
✅ | Google OAuth2 client secret |
GOOGLE_REFRESH_TOKEN |
✅ | OAuth2 refresh token with Drive scope |
GDRIVE_LOG_LEVEL |
❌ | Log level (default: INFO) |
Available Tools
Read Operations
gdrive_list_files
List files in Google Drive, optionally within a specific folder.
| Parameter | Type | Default | Description |
|---|---|---|---|
folder_id |
string | "" |
Folder ID (empty = all files) |
max_results |
int | 20 |
Results per page (1-100) |
page_token |
string | "" |
Pagination token |
order_by |
string | "modifiedTime desc" |
Sort order |
gdrive_search_files
Search for files by name, content, or advanced query.
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
string | — | Search keywords or Drive query syntax |
max_results |
int | 20 |
Results per page (1-100) |
page_token |
string | "" |
Pagination token |
gdrive_get_file_info
Get detailed metadata for a specific file.
| Parameter | Type | Description |
|---|---|---|
file_id |
string | Google Drive file ID |
gdrive_read_file
Read the text content of a file. Google Workspace files are auto-exported.
| Parameter | Type | Default | Description |
|---|---|---|---|
file_id |
string | — | Google Drive file ID |
max_chars |
int | 50000 |
Max characters to return |
Write Operations
gdrive_create_folder
Create a new folder.
| Parameter | Type | Default | Description |
|---|---|---|---|
name |
string | — | Folder name |
parent_id |
string | "" |
Parent folder (empty = root) |
gdrive_upload_file
Upload a file (content as base64).
| Parameter | Type | Default | Description |
|---|---|---|---|
name |
string | — | File name |
content_base64 |
string | — | Base64-encoded content |
mime_type |
string | "application/octet-stream" |
MIME type |
parent_id |
string | "" |
Parent folder (empty = root) |
gdrive_share_file
Share a file with a user.
| Parameter | Type | Default | Description |
|---|---|---|---|
file_id |
string | — | File to share |
email |
string | — | User email |
role |
string | "reader" |
reader, commenter, or writer |
notify |
bool | true |
Send notification email |
gdrive_move_file
Move a file to a different folder.
| Parameter | Type | Description |
|---|---|---|
file_id |
string | File to move |
new_parent_id |
string | Destination folder ID |
gdrive_delete_file
Move a file to trash (recoverable).
| Parameter | Type | Description |
|---|---|---|
file_id |
string | File to trash |
Adding to AI Applications
Claude Desktop / Cursor / Windsurf
{
"mcpServers": {
"gdrive": {
"command": "gdrive-mcp-server",
"env": {
"GOOGLE_CLIENT_ID": "your-client-id",
"GOOGLE_CLIENT_SECRET": "your-client-secret",
"GOOGLE_REFRESH_TOKEN": "your-refresh-token"
}
}
}
}
WorkOS
Add via Settings → MCP Servers → Add Server:
- Name:
gdrive - Command:
gdrive-mcp-server - Environment Variables: GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET, GOOGLE_REFRESH_TOKEN
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file workos_gdrive_mcp_server-1.0.0.tar.gz.
File metadata
- Download URL: workos_gdrive_mcp_server-1.0.0.tar.gz
- Upload date:
- Size: 11.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
38fdb8f4cd6033a6f1c807ca0f9e70a0939784b1af4c922fbe46b441b17803e7
|
|
| MD5 |
230e907e7d388f32727ba23a3df053c7
|
|
| BLAKE2b-256 |
8cdecc550ee35f7c9dbdfa07f545e146a23bac8a90b3f53178ccb7543452c7d8
|
File details
Details for the file workos_gdrive_mcp_server-1.0.0-py3-none-any.whl.
File metadata
- Download URL: workos_gdrive_mcp_server-1.0.0-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2523783a53678faf69ec7d73e7eb6aa8c6c24d51222f6b0c9e2ca529cd3c0743
|
|
| MD5 |
2b8cf2b51f90cf65270ee2e89e4fbb21
|
|
| BLAKE2b-256 |
d507f62a08219750f56552845fdeb6dd88555eace8e0fb2caf01139d4fc9e2ea
|