Skip to main content
Glama
asamiile

google-drive-rag-mcp

by asamiile

google-drive-rag-mcp

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+

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(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

PDF

application/pdf

Text extracted via PyMuPDF

Plain text

text/*

Read directly

MCP Setup

Step 1 — Create a GCP Project and Enable APIs

  1. Open Google Cloud Console

  2. Create a new project (or select an existing one)

  3. Navigate to APIs & Services > Library

  4. Search for and enable the following APIs:

    • Google Drive API

    • Google Docs API

Step 2 — Create a Service Account and Download the JSON Key

  1. Navigate to APIs & Services > Credentials

  2. Click Create Credentials > Service Account

  3. Enter a name (e.g., drive-rag-reader) and click Done

  4. Click the created service account, go to the Keys tab

  5. Click Add Key > Create new key, select JSON, and download the file

  6. 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

  1. Open Google Drive

  2. Right-click the target folder and select Share

  3. Enter the service account email address (e.g., drive-rag-reader@your-project.iam.gserviceaccount.com)

    • Found in GCP Console > IAM & Admin > Service Accounts

  4. 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

.env example:

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.py to 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

  1. Create one service account per team member in GCP (e.g. alice-drive-rag@your-project.iam.gserviceaccount.com)

  2. Share the target Google Drive folder with each service account (Viewer)

  3. Each member configures their own .env with their personal JSON key path

Note: The .env file 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

License: MIT

Support

If you find this helpful, consider supporting the work:

BuyMeACoffee

Author

Asami.K

Available Tools

4 tools
list_filesA
Read-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.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryNoFilter by filename substring (case-insensitive). Empty string returns all files.
file_typeNoFilter by type — 'document', 'spreadsheet', 'pdf', 'image', or 'text'.
folder_idNoScope to a specific subfolder ID (obtain from list_folders). Defaults to all target folders.
recursiveNoIf True, searches nested subfolders. Recommended when folder_id is set. Defaults to False.

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.6/5.0
Behavior5/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters4/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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_foldersA
Read-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.

ParametersJSON Schema
NameRequiredDescriptionDefault
recursiveNoIf True, includes nested subfolders. Defaults to False (top-level only).

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

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.

Conciseness5/5

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.

Completeness5/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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_fileA
Read-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.

ParametersJSON Schema
NameRequiredDescriptionDefault
file_idYesThe Google Drive file ID (obtained from list_files).

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.2/5.0
Behavior4/5

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.

Conciseness5/5

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.

Completeness4/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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_contentA
Read-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.

ParametersJSON Schema
NameRequiredDescriptionDefault
queryYesThe keyword or phrase to search for (case-insensitive).
file_typeNoNarrow the scope before searching — 'document', 'spreadsheet', 'pdf', or 'text'. Omit to search all supported types.
recursiveNoIf True, searches nested subfolders. Defaults to False.
max_resultsNoMaximum number of matching files to return. Defaults to 10.

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

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.

Conciseness5/5

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.

Completeness5/5

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.

Parameters3/5

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.

Purpose5/5

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.

Usage Guidelines4/5

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.

  1. 4 tool updatesv0.1.0
    • First observedlist_files
    • First observedlist_folders
    • First observedread_file
    • First observedsearch_content

TDQS

A4.5/5.0

Scored across 4 tools

Disambiguation5/5

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.

Naming Consistency5/5

All tool names follow a consistent verb_noun snake_case pattern (list_files, list_folders, read_file, search_content), making them predictable.

Tool Count5/5

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.

Completeness5/5

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

ActivityStale
ResponsivenessNo issues

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

Related MCP Servers

Latest Blog Posts

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