Allows cloning and pulling from Git repositories to store them as local documents for RAG queries
Enables retrieving repositories from GitHub to be used as document sources for RAG queries
Uses Google's Gemini API for document indexing and embedding generation for RAG functionality
Implemented as a TypeScript-based MCP server with specific capabilities for document processing and RAG
mcp-docs-rag MCP Server
RAG (Retrieval-Augmented Generation) for documents in a local directory
This is a TypeScript-based MCP server that implements a RAG system for documents stored in a local directory. It allows users to query documents using LLMs with context from locally stored repositories and text files.
Features
Resources
- List and access documents via
docs://
URIs - Documents can be Git repositories or text files
- Plain text mime type for content access
Tools
list_documents
- List all available documents in the DOCS_PATH directory- Returns a formatted list of all documents
- Shows total number of available documents
rag_query
- Query documents using RAG- Takes document_id and query as parameters
- Returns AI-generated responses with context from documents
add_git_repository
- Clone a Git repository to the docs directory with optional sparse checkout- Takes repository_url as parameter
- Optional document_name parameter to customize the name of the document (use simple descriptive names without '-docs' suffix)
- Optional subdirectory parameter for sparse checkout of specific directories
- Automatically pulls latest changes if repository already exists
add_text_file
- Download a text file to the docs directory- Takes file_url as parameter
- Uses wget to download file
Prompts
guide_documents_usage
- Guide on how to use documents and RAG functionality- Includes list of available documents
- Provides usage hints for RAG functionality
Development
Install dependencies:
Build the server:
For development with auto-rebuild:
Setup
This server requires a local directory for storing documents. By default, it uses ~/docs
but you can configure a different location with the DOCS_PATH
environment variable.
Document Structure
The documents directory can contain:
- Git repositories (cloned directories)
- Plain text files (with .txt extension)
Each document is indexed separately using llama-index.ts with Google's Gemini embeddings.
API Keys
This server uses Google's Gemini API for document indexing and querying. You need to set your Gemini API key as an environment variable:
You can obtain a Gemini API key from the Google AI Studio website. Add this key to your shell profile or include it in the environment configuration for Claude Desktop.
Installation
To use with Claude Desktop, add the server config:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
On Linux: ~/.config/Claude/claude_desktop_config.json
Make sure to replace /Users/username/docs
with the actual path to your documents directory.
Debugging
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:
The Inspector will provide a URL to access debugging tools in your browser.
Usage
Once configured, you can use the server with Claude to:
- Add documents:or with a custom document name:or with sparse checkout of a specific directory:or combine custom name and sparse checkout:or add a text file:
- Query documents:
- List available documents:
The server will automatically handle indexing of documents for efficient retrieval.
local-only server
The server can only run on the client's local machine because it depends on local resources.
A TypeScript MCP server that allows querying documents using LLMs with context from locally stored repositories and text files through a RAG (Retrieval-Augmented Generation) system.
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol (MCP) server that enables LLMs to interact directly the documents that they have on-disk through agentic RAG and hybrid search in LanceDB. Ask LLMs questions about the dataset as a whole or about specific documents.Last updated -766TypeScriptMIT License
- AsecurityFlicenseAqualityA template for creating Model Context Protocol (MCP) servers in TypeScript, offering features like container-based dependency injection, a service-based architecture, and integration with the LLM CLI for architectural design feedback through natural language.Last updated -126TypeScript
- -securityFlicense-qualityA TypeScript-based MCP server that enables users to manage text notes and generate summaries, showcasing key MCP concepts like resource representation and LLM integration.Last updated -2,704JavaScript
- -securityFlicense-qualityA customized MCP server that enables integration between LLM applications and documentation sources, providing AI-assisted access to LangGraph and Model Context Protocol documentation.Last updated -1Python