Gemini RAG MCP Server
Provides RAG (Retrieval-Augmented Generation) capabilities using Google's Gemini API File Search feature, enabling creation of knowledge bases from uploaded documents and text content for information retrieval.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Gemini RAG MCP Serversearch our product documentation for how to set up two-factor authentication"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Gemini RAG MCP Server
A Model Context Protocol (MCP) server that provides RAG (Retrieval-Augmented Generation) capabilities using Google's Gemini API File Search feature. This server enables AI applications to create knowledge bases and retrieve information from uploaded documents.
Features
✅ File Search RAG: Create and manage knowledge bases using Gemini's File Search API
✅ Document Upload: Upload files and text content to create searchable knowledge bases
✅ Information Retrieval: Query knowledge bases to retrieve relevant information
✅ Configurable Models: Choose Gemini models via environment variable
✅ MCP Protocol: Full compatibility with Model Context Protocol
✅ Type-Safe: Full TypeScript support with strict mode enabled
✅ Dual Transport Support: stdio (default) and HTTP transports
✅ Production-Ready: Logging, error handling, and configuration management
Related MCP server: MCP RAG Server
Prerequisites
Node.js >= 22.10.0
pnpm >= 10.19.0
Google API Key with Gemini API access
Installation
Using with Claude Desktop (Recommended)
Add the following to your Claude Desktop configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"gemini-rag-mcp": {
"command": "npx",
"args": ["-y", "@r_masseater/gemini-rag-mcp"],
"env": {
"GOOGLE_API_KEY": "your_google_api_key_here",
"STORE_DISPLAY_NAME": "your_store_name"
}
}
}
}Required Environment Variables:
GOOGLE_API_KEY: Your Google API key with Gemini API accessSTORE_DISPLAY_NAME: Display name for your vector store/knowledge base
Optional Environment Variables:
GEMINI_MODEL: Gemini model to use for queries (default:gemini-2.5-pro)Options:
gemini-2.5-pro,gemini-2.5-flash
After configuration, restart Claude Desktop to load the server.
Development
1. Clone the repository
git clone https://github.com/masseater/gemini-rag-mcp.git
cd gemini-rag-mcp2. Install dependencies
pnpm install3. Run in development mode
# stdio transport (default)
pnpm run dev
# HTTP transport (with hot reload)
pnpm run dev:httpEnvironment Variables
Required:
GOOGLE_API_KEY: Google API key with Gemini API accessSTORE_DISPLAY_NAME: Display name for vector store/knowledge base
Optional:
GEMINI_MODEL: Gemini model for queries (default: gemini-2.5-pro)LOG_LEVEL: Logging level (error|warn|info|debug, default: info)DEBUG: Enable debug console output (true|false, default: false)PORT: HTTP server port (default: 3000)
Available Tools
Once configured with Claude Desktop, the following tools are available:
upload_file: Upload document files to the knowledge base
upload_content: Upload text content directly to the knowledge base
query: Query the knowledge base using RAG
Resources
License
MIT License
Available Tools
3 toolsqueryB
Query the FileSearchStore using RAG (Retrieval-Augmented Generation) to get answers based on uploaded documents. The AI will search through the documents and provide relevant answers with citations.
| Name | Required | Description | Default |
|---|---|---|---|
| query | Yes | The question or query to search for in the knowledge base |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It discloses the tool uses RAG for searching and provides answers with citations, which adds some behavioral context beyond the input schema. However, it lacks details on permissions, rate limits, error handling, or response format (beyond 'answers with citations'), which are critical for a query tool. The description doesn't contradict annotations (none exist).
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 two sentences, front-loaded with the core purpose and followed by additional detail on how it works. It avoids redundancy and wastes no words, though it could be slightly more structured (e.g., separating usage notes). Every sentence adds value: the first defines the tool, and the second explains the mechanism and output.
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 tool's moderate complexity (RAG-based querying), no annotations, no output schema, and a simple input schema, the description is minimally adequate. It covers the purpose and basic behavior but lacks completeness in areas like output details, error cases, or integration with sibling tools. It meets the minimum viable threshold but has clear gaps for effective agent use.
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 input schema has 100% description coverage, with the single parameter 'query' documented as 'The question or query to search for in the knowledge base.' The description adds no additional parameter semantics beyond this, such as examples or constraints on query format. With high schema coverage, the baseline is 3, as the schema already provides adequate parameter information.
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's purpose: 'Query the FileSearchStore using RAG (Retrieval-Augmented Generation) to get answers based on uploaded documents.' It specifies the verb ('query'), resource ('FileSearchStore'), and method ('RAG'), distinguishing it from sibling tools 'upload_content' and 'upload_file' which are for uploading rather than querying. However, it doesn't explicitly contrast with hypothetical alternative query methods, keeping it at 4 instead of 5.
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 implies usage context: 'to get answers based on uploaded documents,' suggesting this tool should be used after documents are uploaded via sibling tools. It doesn't provide explicit when-not-to-use guidance or name alternatives for different query types, but the implied dependency on uploaded content offers basic context. No misleading information is present.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
upload_contentC
Upload text content to the FileSearchStore for RAG indexing. The content will be processed and made searchable.
| Name | Required | Description | Default |
|---|---|---|---|
| content | Yes | Text content to upload to the knowledge base | |
| displayName | Yes | Display name for the content in the store | |
| metadata | No | Custom metadata as key-value pairs. Values can be strings or numbers. Maximum 20 entries per document. Example: {"category": "guide", "year": 2025} |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but offers minimal behavioral insight. It mentions processing and making content searchable but lacks details about permissions, rate limits, idempotency, error conditions, or what 'processed' entails. For a write operation with zero annotation coverage, this is inadequate.
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 extremely concise with two sentences that directly communicate the core functionality. Every word earns its place, and the information is front-loaded with no wasted verbiage.
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 write operation with no annotations and no output schema, the description is insufficient. It doesn't explain what happens after upload (e.g., success indicators, returned IDs, error responses), nor does it provide behavioral context needed for safe and effective use.
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 description coverage is 100%, providing good documentation for all parameters. The description adds no parameter-specific information beyond what's in the schema, so it meets the baseline of 3 where the schema does the heavy lifting.
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 action ('upload text content') and destination ('to the FileSearchStore for RAG indexing'), with a specific purpose ('made searchable'). It distinguishes from 'upload_file' by specifying text content rather than files, but doesn't explicitly contrast with 'query'.
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 no guidance on when to use this tool versus alternatives like 'upload_file' or 'query'. It mentions the tool's purpose but offers no context about prerequisites, appropriate scenarios, or exclusion criteria.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
upload_fileB
Upload a file to the FileSearchStore for RAG indexing. The file will be processed and made searchable.
| Name | Required | Description | Default |
|---|---|---|---|
| filePath | Yes | Absolute path to the file to upload (e.g., /path/to/document.pdf) | |
| mimeType | No | MIME type of the file (e.g., application/pdf, text/markdown). Auto-detected if not provided. | |
| displayName | No | Display name for the file in the store. Uses filename if not provided. | |
| metadata | No | Custom metadata as key-value pairs. Values can be strings or numbers. Maximum 20 entries per document. Example: {"category": "guide", "year": 2025} |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that the file 'will be processed and made searchable,' but lacks details on permissions, rate limits, error handling, or what 'processed' entails (e.g., indexing time, supported file types). This is inadequate for a mutation tool with zero annotation coverage.
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 front-loaded with the core purpose in the first sentence and adds a second sentence for behavioral context, with no wasted words. It is appropriately sized and efficiently structured.
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 mutation tool with no annotations and no output schema, the description is incomplete. It lacks details on behavioral traits (e.g., auth needs, processing behavior), error cases, and what the tool returns, leaving significant gaps for an AI agent to understand proper 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 description coverage is 100%, so the schema fully documents all parameters. The description does not add any additional meaning or context beyond what the schema provides, such as explaining interactions between parameters or usage examples, resulting in a baseline score of 3.
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 specific action ('Upload a file') and the target resource ('to the FileSearchStore for RAG indexing'), distinguishing it from sibling tools like 'query' and 'upload_content' by specifying the file upload context for search indexing.
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 implies usage for making files searchable via RAG indexing, but it does not explicitly state when to use this tool versus alternatives like 'upload_content' or provide any exclusions or prerequisites for usage.
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.
3 tool updates
- First observed
query - First observed
upload_content - First observed
upload_file
TDQS
Each tool has a clearly distinct purpose: querying for answers, uploading text content, and uploading files. There is no overlap in functionality, and an agent can easily tell them apart based on their specific roles in the RAG workflow.
All tool names follow a consistent verb_noun pattern (query, upload_content, upload_file) with clear, descriptive terms. The naming is uniform and predictable, making it easy for agents to understand and use the tools.
With 3 tools, the server is well-scoped for a RAG system, covering core operations: querying, uploading text, and uploading files. It is slightly lean but reasonable, as it handles the essential workflow without unnecessary complexity.
The tool set covers the main RAG operations: ingestion (uploading content/files) and retrieval (querying). Minor gaps might include tools for managing or deleting uploaded content, but the core functionality is complete for basic RAG use cases.
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
Ingest, manage, and retrieve documents for RAG-powered AI applications
Search your knowledge bases from any AI assistant using hybrid RAG.
Securely search and manage workspace context files for AI agents and teams.
Your private knowledge base: upload documents (.md, .txt, .docx, PDF, images), the platform indexes
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables RAG (Retrieval-Augmented Generation) capabilities with document processing, vector storage, and intelligent Q\&A using OpenAI embeddings and semantic search.-
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to search and retrieve information from your knowledge base using RAG (Retrieval-Augmented Generation) with hybrid search, document indexing, and ChromaDB vector storage.48MIT
- AlicenseNot gradedqualityDmaintenanceEnables uploading, organizing, and semantically searching documents with support for various file types and embedding providers.30MIT
- AlicenseAqualityDmaintenanceEnables document Q&A with grounded citations using the official Gemini File Search API. Upload documents, create stores, and ask questions that return exact passage citations.7172MIT
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/masseater/gemini-rag-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server