Google Drive Rag
БесплатноНе проверенA local MCP server that enables LLMs to securely search and read files within designated Google Drive folders. Supports Google Docs, Google Sheets, PDFs, and pl
Описание
A local MCP server that enables LLMs to securely search and read files within designated Google Drive folders. Supports Google Docs, Google Sheets, PDFs, and plain text with strict folder-scoping via service account authentication.
README
google-drive-rag-mcp MCP server
A local MCP server that lets LLMs (Claude, etc.) securely search and read files within a single, designated Google Drive folder.
Overview
- Scoped to specified folders — never accesses files outside
TARGET_FOLDER_IDS - Authenticated via Google Service Account (no personal OAuth required)
- Read-only access (
drive.readonly,documents.readonly) - Built with FastMCP on Python 3.11+
Use Cases
- Research: Ask Claude to find and summarize documents stored in a shared Google Drive folder
- Team knowledge base: Search internal documents, reports, or meeting notes by keyword
- Study notes: Retrieve lecture notes or course materials from a Drive folder and ask questions about them
- Document Q&A: "What does the report from last month say about X?" — Claude reads and answers
MCP Tools
| Tool | Description |
|---|---|
list_files(query) |
List files in the target folder, optionally filtered by name |
read_file(file_id) |
Read text content of a supported file |
search_content(query) |
Search inside file contents; returns matching files with context snippets |
Supported File Formats
| Format | MIME Type | How it's read |
|---|---|---|
| Google Docs | application/vnd.google-apps.document |
Exported as plain text |
| Google Sheets | application/vnd.google-apps.spreadsheet |
Exported as CSV |
application/pdf |
Text extracted via PyMuPDF | |
| Plain text | text/* |
Read directly |
MCP Setup
Step 1 — Create a GCP Project and Enable APIs
- Open Google Cloud Console
- Create a new project (or select an existing one)
- Navigate to APIs & Services > Library
- Search for and enable the following APIs:
- Google Drive API
- Google Docs API
Step 2 — Create a Service Account and Download the JSON Key
- Navigate to APIs & Services > Credentials
- Click Create Credentials > Service Account
- Enter a name (e.g.,
drive-rag-reader) and click Done - Click the created service account, go to the Keys tab
- Click Add Key > Create new key, select JSON, and download the file
- Save the file to a secure location (e.g.,
~/.config/gcp/drive-rag-key.json)
Note: Never commit this file to Git. It is excluded by
.gitignore.
Step 3 — Share the Target Google Drive Folder
- Open Google Drive
- Right-click the target folder and select Share
- Enter the service account email address (e.g.,
[email protected])- Found in GCP Console > IAM & Admin > Service Accounts
- Set the role to Viewer and click Send
The folder ID is the last part of the folder URL:
https://drive.google.com/drive/folders/THIS_IS_THE_FOLDER_ID
Tip — Multiple folders: You can share a parent folder with the service account and set individual subfolders in
TARGET_FOLDER_IDS. Access to subfolders is inherited from the parent.Parent Folder ← Share with the service account (Viewer) ├── Project A ← Add this folder ID to TARGET_FOLDER_IDS └── Project B ← Add this folder ID to TARGET_FOLDER_IDS
.envexample:TARGET_FOLDER_IDS=project_a_folder_id,project_b_folder_id
Step 4 — Local Setup and Launch
# 1. Clone the repository
git clone https://github.com/your-username/google-drive-rag-mcp.git
cd google-drive-rag-mcp
# 2. Install dependencies
uv sync
# 3. Configure environment variables
cp .env.example .env
Edit .env:
GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account-key.json
TARGET_FOLDER_IDS=folder_id_1,folder_id_2
Step 5 — Connect to Claude
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"google-drive-rag": {
"command": "uv",
"args": ["run", "python", "main.py"],
"cwd": "/path/to/google-drive-rag-mcp",
"env": {
"GOOGLE_APPLICATION_CREDENTIALS": "/path/to/your/service-account-key.json",
"TARGET_FOLDER_IDS": "folder_id_1,folder_id_2"
}
}
}
}
Restart Claude Desktop to apply the changes.
Claude Code
claude mcp add google-drive-rag \
-e GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account-key.json \
-e TARGET_FOLDER_IDS=folder_id_1,folder_id_2 \
-- uv run python /path/to/google-drive-rag-mcp/main.py
To make it available across all projects, add --scope user:
claude mcp add --scope user google-drive-rag \
-e GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account-key.json \
-e TARGET_FOLDER_IDS=folder_id_1,folder_id_2 \
-- uv run python /path/to/google-drive-rag-mcp/main.py
Verify the registration:
claude mcp list
This command only needs to be run once. The configuration is saved and loaded automatically on every Claude Code startup.
Re-run it only if you:
- Change environment variables (folder IDs or credentials path)
- Move
main.pyto a different path - Need to reset the registration (
claude mcp remove google-drive-rag)
Team Deployment
This server uses a Google Service Account for authentication. For team deployments, issue a separate service account per member rather than sharing a single key.
Why separate accounts?
- Auditability: Google Drive audit logs identify each service account individually.
- Access revocation: Remove a member's access by deleting their service account only — no need to rotate a shared key or update everyone's configuration.
- Least privilege: Each account can be scoped to only the folders that member needs.
Setup
- Create one service account per team member in GCP
(e.g.
[email protected]) - Share the target Google Drive folder with each service account (Viewer)
- Each member configures their own
.envwith their personal JSON key path
Note: The
.envfile alone is not sufficient for access — the service account JSON key file is the actual credential and must be kept secret by each individual.
Development
- Run the server
uv run python main.py
- Start the MCP server
uv run python main.py
License
Support
If you find this helpful, consider supporting the work:
Author
Установка Google Drive Rag
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/asamiile/google-drive-rag-mcpFAQ
Google Drive Rag MCP бесплатный?
Да, Google Drive Rag MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Google Drive Rag?
Нет, Google Drive Rag работает без API-ключей и переменных окружения.
Google Drive Rag — hosted или self-hosted?
Доступен hosted-вариант: Unyly запускает сервер в облаке, локальная установка не обязательна.
Как установить Google Drive Rag в Claude Desktop, Claude Code или Cursor?
Открой Google Drive Rag на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Notion
Read and write pages in your workspace
автор: NotionLinear
Issues, cycles, triage — from Claude
автор: LinearGoogle Drive
Search and read your Drive files
автор: Googlemindsdb/mindsdb
Connect and unify data across various platforms and databases with [MindsDB as a single MCP server](https://docs.mindsdb.com/mcp/overview).
автор: mindsdbCompare Google Drive Rag with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории productivity
