google-drive-rag-mcp
This server enables LLMs to securely search, browse, and read files within designated Google Drive folders via read-only access, acting as a knowledge base or research assistant.
Key Capabilities:
List Files (
list_files): Discover files in target folders, with optional filtering by filename substring (case-insensitive), file type (document,spreadsheet,pdf,image,text), specific subfolder ID, or recursive search through nested subfolders.List Folders (
list_folders): Browse subfolders within target Google Drive folders, optionally recursively, to help scope subsequent file searches.Read File (
read_file): Retrieve the full text content of a specific file by its Drive ID.Search Content (
search_content): Search inside file contents (not just filenames) for keywords or phrases, returning matching files with context snippets. Supports filtering by file type, recursive subfolder search, and a configurable result limit.
Supported File Types: Google Docs (exported as plain text), Google Sheets (exported as CSV), PDFs (text extracted), and plain text files.
Access Control: Scoped to specific folders (TARGET_FOLDER_IDS) with read-only permissions, authenticated via a Google Service Account.
Use Cases: Research, team knowledge bases, study note organization, and Q&A over documents stored in Google Drive.
Allows searching and reading files within a designated Google Drive folder. Supports text content extraction from Google Docs, Google Sheets (exported as CSV), PDF, and plain text files.
google-drive-rag-mcp
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_IDSAuthenticated via Google Service Account (no personal OAuth required)
Read-only access (
drive.readonly,documents.readonly)Built with FastMCP on Python 3.11+
Related MCP server: Google Drive MCP Server
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 in the target folder, optionally filtered by name |
| Read text content of a supported file |
| Search inside file contents; returns matching files with context snippets |
Supported File Formats
Format | MIME Type | How it's read |
Google Docs |
| Exported as plain text |
Google Sheets |
| Exported as CSV |
| Text extracted via PyMuPDF | |
Plain 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 DoneClick 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.,
drive-rag-reader@your-project.iam.gserviceaccount.com)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 .envEdit .env:
GOOGLE_APPLICATION_CREDENTIALS=/path/to/your/service-account-key.json
TARGET_FOLDER_IDS=folder_id_1,folder_id_2Step 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.pyTo 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.pyVerify the registration:
claude mcp listThis 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 pathNeed 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.
alice-drive-rag@your-project.iam.gserviceaccount.com)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.pyStart the MCP server
uv run python main.pyLicense
Support
If you find this helpful, consider supporting the work:
Author
Available Tools
4 toolslist_filesARead-only
List files in the target Google Drive folders. Use this to discover files before reading them.
Returns a JSON array of objects with 'id', 'name', and 'mimeType'. Pass the 'id' to read_file to retrieve file contents.
| Name | Required | Description | Default |
|---|---|---|---|
| query | No | Filter by filename substring (case-insensitive). Empty string returns all files. | |
| file_type | No | Filter by type — 'document', 'spreadsheet', 'pdf', 'image', or 'text'. | |
| folder_id | No | Scope to a specific subfolder ID (obtain from list_folders). Defaults to all target folders. | |
| recursive | No | If True, searches nested subfolders. Recommended when folder_id is set. Defaults to False. |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Description discloses that the tool is read-only (consistent with annotations), returns a JSON array with specific fields (id, name, mimeType), and guides the agent to pass the id to read_file. This adds valuable behavioral context beyond the readOnlyHint annotation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise with two main sentences plus a sentence about return format. It is front-loaded with purpose and usage, with no extraneous words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 4 parameters (none required), an output schema, and annotations, the description covers purpose, return format, and usage guidance. It does not delve into edge cases, but the schema and output schema provide the rest. It is complete enough for agent selection and invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. However, the description adds extra context: folder_id comes from list_folders, and recursive is recommended when folder_id is set. This adds meaning beyond the schema descriptions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states 'List files in the target Google Drive folders' with a specific verb and resource. It distinguishes from siblings by saying 'Use this to discover files before reading them' and mentions read_file, which is a sibling. This provides clear differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description says 'Use this to discover files before reading them,' which gives a clear use case. It does not explicitly state when not to use or provide alternatives to sibling tools like search_content, but the context is adequate for selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_foldersARead-only
List subfolders within the target Google Drive folders.
Use this before list_files when you need to scope a search to a specific subfolder. Returns a JSON array of objects with 'id' and 'name'. Pass a folder 'id' to list_files as folder_id to narrow the search scope.
| Name | Required | Description | Default |
|---|---|---|---|
| recursive | No | If True, includes nested subfolders. Defaults to False (top-level only). |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already indicate readOnlyHint=true. The description adds that it returns a JSON array with 'id' and 'name', and explains how to pass the folder id to list_files. This provides helpful behavioral context beyond the annotation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three sentences, front-loaded with the main action, and includes usage guidance and output format without unnecessary words. Highly efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple list tool with one parameter, the description covers what the tool does, when to use it (before list_files), and what it returns. No important gaps remain.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with a well-described 'recursive' parameter. The description doesn't add extra parameter details beyond the schema, so it meets the baseline but doesn't exceed it.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool lists subfolders in Google Drive, uses a specific verb ('list') and resource ('subfolders'), and distinguishes from siblings like list_files, read_file, and search_content by mentioning its use for scoping searches.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly advises using this tool before list_files to scope a search, providing clear context. It doesn't cover when not to use it, but the guidance is sufficient for the intended use.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
read_fileARead-only
Read and return the full text content of a file in the target Google Drive folder.
Typical workflow: call list_files to find the file and obtain its 'id', then pass that id here.
| Name | Required | Description | Default |
|---|---|---|---|
| file_id | Yes | The Google Drive file ID (obtained from list_files). |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Annotations already include readOnlyHint=true, indicating this is a safe read operation. The description adds that it returns the full text content, which is helpful. No hidden behavioral traits are disclosed, but the combination is sufficient.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is only two sentences long, with no unnecessary words. The first sentence states the purpose, the second gives the workflow. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the output schema exists, the description does not need to detail return values. It mentions 'full text content' and the prerequisite workflow. However, it could mention potential limitations like file size or encoding, but overall it's complete enough.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The schema has 100% coverage with a clear description for file_id ('The Google Drive file ID (obtained from list_files)'). The description reinforces this by referencing the workflow, but adds little beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb 'read' and the resource 'file', specifying it returns 'full text content'. This distinguishes it from siblings like list_files (which lists files) and search_content (which searches content).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides a typical workflow: call list_files first to get the file id, then use this tool. It gives clear context for usage but does not explicitly state when not to use it or mention alternatives.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
search_contentARead-only
Search for a keyword or phrase within the content of files in the target Google Drive folders.
Unlike list_files (which filters by filename), this tool searches inside file contents and returns matching files with a surrounding context snippet.
Typical workflow: use this to find which files mention a topic, then call read_file on specific files for the full content.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The keyword or phrase to search for (case-insensitive). | |
| file_type | No | Narrow the scope before searching — 'document', 'spreadsheet', 'pdf', or 'text'. Omit to search all supported types. | |
| recursive | No | If True, searches nested subfolders. Defaults to False. | |
| max_results | No | Maximum number of matching files to return. Defaults to 10. |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Consistent with readOnlyHint annotation; adds context that it returns matching files with a surrounding snippet. No contradictions.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Very concise: two short paragraphs. Purpose stated first, then differentiation, then workflow. No fluff.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given an output schema exists, the description adequately explains what the tool does and when to use it. No missing critical information.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% and each parameter already has a clear description. The tool description does not add significant new meaning beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description uses a specific verb ('Search') and resource ('content of files'), and explicitly distinguishes itself from sibling tool list_files by stating it searches inside file contents rather than filenames.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides a clear typical workflow (search then read_file) and contrasts with list_files. However, it does not explicitly state when not to use this tool or any prerequisites.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v0.1.0- First observed
list_files - First observed
list_folders - First observed
read_file - First observed
search_content
TDQS
Scored across 4 tools
Each tool has a distinct, non-overlapping purpose: listing files vs. folders vs. reading content vs. searching within content. Descriptions clarify when to use each.
All tool names follow a consistent verb_noun snake_case pattern (list_files, list_folders, read_file, search_content), making them predictable.
With 4 tools, the set is well-scoped for a RAG server focused on a specific Google Drive folder. Each tool serves a necessary function without redundancy.
The tool set covers the full workflow for content retrieval: navigate folders, list files, read content, and search within content. No obvious gaps for the intended use case.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
An MCP server that provides an API to LLMs to manage their JumpCloud resources.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Read-only MCP server exposing a user ORANO library to their own AI agent.
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
- AlicenseAqualityAmaintenanceMCP server for interacting with Google Drive using a service account, restricted to a specific root folder. Supports file operations like search, list, create, update, and read.4161MIT
- FlicenseNot gradedqualityBmaintenanceMCP server for semantic search over Google Drive documents, enabling AI tools to search, list, and retrieve document content.-
- AlicenseAqualityBmaintenanceAn MCP server that enables LLMs to search, fetch, and act on Google Workspace (Drive, Gmail, Docs, Sheets, etc.) with rich, one-call results and file deposits to disk, reducing context usage.3MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/asamiile/google-drive-rag-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server