VarnithChordia/GoogleDrive-mcp-server
If you are the rightful owner of GoogleDrive-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 henry@mcphub.com.
Google Drive MCP Server is a protocol server designed to facilitate seamless integration and interaction with Google Drive using the Model Context Protocol (MCP).
Google Drive MCP Server
A Model Context Protocol (MCP) server for Google Drive that makes it easier to search, read, and extract information from documentsβfor example, quickly retrieving details needed when filling out forms. It is built with FastMCP, uses Google OAuth for authentication, and supports OCR to handle scanned PDFs and images
β¨ Features
- π Search: Query files in Google Drive by name, type, or content.
- π Read: Fetch and display file contents (text, PDFs, images).
- π Secure Auth: Uses Google OAuth 2.0 for authentication.
- β‘ MCP Ready: Easily integrates into MCP clients.
Project Structure
.
βββ src/
β βββ server.py # Entry point, starts the FastMCP server
β βββ tools.py # MCP tools (gdrive_search, read_file, etc.)
β βββ auth.py # Google OAuth / service account handling
β βββ file_utils.py # Helpers for reading Drive files, PDFs, images
β βββ config.py # Config (scopes, constants)
βββ pyproject.toml / requirements.txt
βββ README.md
βββ .gitignore
Authentication
There are two auth modes:
-
OAuth Client (Interactive)
- Recommended for local testing / personal use.
- Requires
credentials.json
from Google Cloud Console. Store them in the ~/credentials folder. - On first run, youβll be prompted to log in via browser.
-
Service Account (Server-to-Server)
- For automated deployments.
- Requires a service account key JSON.
- The service account must have access to the Drive files (share files/folders with its email).
Sensitive documents: No file content is stored locally;
π MCP Tools
Currently implemented:
-
gdrive_search(query: str)
Search files in Google Drive. Returns metadata (id, name, mimeType). -
read_file(file_id: str)
Download and return file content.- Text β returned as string.
- PDFs β extracted text (if text-based) or OCR (if scanned).
- Images β OCR text extraction.
Running Locally
With Poetry
poetry install
poetry run python src/server.py
## Configuring MCP Desktop Claude
To connect this server with **MCP Desktop (Claude)**, update your Claude config file (usually located at `~/.mcp/config.json`) to include the `gdrive` server.
Example config snippet:
```json
{
"mcpServers": {
"gdrive": {
"command": "poetry",
"args": [
"run",
"python",
"src/server.py"
],
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "credentials.json"
}
}
}
}