This MCP server enables retrieval-augmented generation (RAG) for documents stored locally, allowing you to query your documents using LLMs with context from locally stored repositories and text files.
By default, the server uses ~/docs
for document storage, but you can configure a different location:
export DOCS_PATH=/path/to/your/docs
Set your Gemini API key as an environment variable:
export GEMINI_API_KEY=your-api-key-here
Add the server configuration to your Claude Desktop config file:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"docs-rag": {
"command": "npx",
"args": ["-y", "@kazuph/mcp-docs-rag"],
"env": {
"DOCS_PATH": "/Users/username/docs",
"GEMINI_API_KEY": "your-api-key-here"
}
}
}
}
Make sure to replace /Users/username/docs
with your actual documents directory path and add your Gemini API key.
Once installed, you can interact with the server through Claude to manage and query your documents.
Basic usage:
Add a new document from GitHub: https://github.com/username/repository
With custom document name:
Add GitHub repository https://github.com/username/repository-name and name it 'framework'
With sparse checkout (specific directories only):
Add only the 'src/components' directory from https://github.com/username/repository
Combining custom name and sparse checkout:
Add the 'examples/demo' directory from https://github.com/username/large-repo and name it 'demo-app'
Add this text file: https://example.com/document.txt
Ask questions about your documents:
What does the documentation say about X in the Y repository?
The server will use RAG to retrieve relevant information from your documents and generate accurate responses with appropriate context.
To see what documents are available:
What documents do you have access to?
The documents directory can contain:
Each document is indexed separately using llama-index.ts with Google's Gemini embeddings for efficient retrieval.
The server provides several tools:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.