MCP Local Rag
Local document search for PDF, DOCX, Markdown and text files with no embedding API
MCP Local Rag is an open-source MCP server for knowledge and memory. It runs locally on your machine and is started by your AI client.
- Pricing
- Open source
- Platforms
- CLI, Self-hosted
- Runs
- Locally
- What it can do
- Can delete data (1 tool)
- Version
- 0.23.3
Similar MCP servers
Install
Add with the CLI
Run in a terminal
claude mcp add mcp-local-rag -- npx -y mcp-local-ragAdd --scope user to use it in every project, or --scope project to share it in .mcp.json.
Or share it with your project
Add to .mcp.json
{
"mcpServers": {
"mcp-local-rag": {
"command": "npx",
"args": [
"-y",
"mcp-local-rag"
]
}
}
}Add to claude_desktop_config.json
{
"mcpServers": {
"mcp-local-rag": {
"command": "npx",
"args": [
"-y",
"mcp-local-rag"
]
}
}
}Settings → Developer → Edit Config, then quit and reopen Claude Desktop.
Add to ~/.cursor/mcp.json
{
"mcpServers": {
"mcp-local-rag": {
"command": "npx",
"args": [
"-y",
"mcp-local-rag"
]
}
}
}Use .cursor/mcp.json in a project to share it with the project.
Add to ~/.copilot/mcp-config.json
{
"mcpServers": {
"mcp-local-rag": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"mcp-local-rag"
]
}
}
}Or put the same entry in .mcp.json at your workspace root to share it.
Add with the CLI
Run in a terminal
codex mcp add mcp-local-rag -- npx -y mcp-local-ragOr add to config.toml
Add to ~/.codex/config.toml
[mcp_servers.mcp-local-rag]
command = "npx"
args = ["-y", "mcp-local-rag"]Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"mcp-local-rag": {
"command": "npx",
"args": [
"-y",
"mcp-local-rag"
]
}
}
}Gemini CLI and Antigravity
Gemini CLI
Add to ~/.gemini/settings.json
{ "mcpServers": { "mcp-local-rag": { "command": "npx", "args": [ "-y", "mcp-local-rag" ] } } }Or run: gemini mcp add -s user mcp-local-rag npx -- -y mcp-local-rag
Antigravity
Add to ~/.gemini/config/mcp_config.json
{ "mcpServers": { "mcp-local-rag": { "command": "npx", "args": [ "-y", "mcp-local-rag" ] } } }Use .agents/mcp_config.json to add it to one workspace only.
Devin Desktop (formerly Windsurf)
Add to ~/.config/devin/mcp_config.json
{ "mcpServers": { "mcp-local-rag": { "command": "npx", "args": [ "-y", "mcp-local-rag" ] } } }On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.
Cline
Add to cline_mcp_settings.json
{ "mcpServers": { "mcp-local-rag": { "command": "npx", "args": [ "-y", "mcp-local-rag" ] } } }Open it from the MCP Servers icon → Configure → Configure MCP Servers.
Zed
Add to Zed settings.json
{ "context_servers": { "mcp-local-rag": { "command": "npx", "args": [ "-y", "mcp-local-rag" ] } } }Open it with zed: open settings file. Merge context_servers into the settings you already have.
JetBrains AI Assistant and Junie
AI Assistant
Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add
{ "mcpServers": { "mcp-local-rag": { "command": "npx", "args": [ "-y", "mcp-local-rag" ] } } }Junie
Add to ~/.junie/mcp/mcp.json
{ "mcpServers": { "mcp-local-rag": { "command": "npx", "args": [ "-y", "mcp-local-rag" ] } } }Use .junie/mcp/mcp.json to share it with a project.
Kiro
Add to ~/.kiro/settings/mcp.json
{ "mcpServers": { "mcp-local-rag": { "command": "npx", "args": [ "-y", "mcp-local-rag" ] } } }Use .kiro/settings/mcp.json to add it to one workspace only.
Using several servers? Build one config file with the MCP config generator.
Configuration
BASE_DIRBase directory for document storage (defaults to current working directory). Ignored when BASE_DIRS is set.BASE_DIRSJSON array of base directories (e.g. '["/a","/b"]'). Takes precedence over BASE_DIR.IGNORE_PATHSJSON array of glob patterns for files to keep out of the index, each matched against the file's path relative to its root (e.g. '["plugs/**","**/*.draft.md"]').DB_PATHPath to LanceDB database directory (defaults to ./lancedb/)CACHE_DIRDirectory where Transformers.js models are cached (defaults to ./models/)HF_ENDPOINTHugging Face model download endpoint. Set this to a mirror URL when direct downloads are blocked (defaults to https://huggingface.co).MODEL_NAMEEmbedding model name (defaults to Xenova/all-MiniLM-L6-v2)MAX_FILE_SIZEMaximum file size in bytes (defaults to 104857600 / 100MB)RAG_MAX_DISTANCEMaximum distance threshold for filtering search results. Results with distance greater than this value will be excluded. Lower values mean stricter filtering (e.g., 0.5 for high relevance only)RAG_GROUPINGGrouping mode for quality filtering. 'similar' returns only the most similar group (stops at first distance jump). 'related' includes related groups (stops at second distance jump). Unset means no grouping filterRAG_MAX_FILESMaximum number of files to keep in search results. Results are filtered to include only chunks from the top N best-scoring files. For example, 1 returns only the single best-matching file's chunks. Unset means no file filtering.CHUNK_MIN_LENGTHMinimum chunk length in characters (1-10000, defaults to 50). Chunks shorter than this threshold are filtered out during ingestion.STORE_IMAGESStore supported PDF and DOCX images during ingestion and return them with matched chunks (defaults to false).EMBED_TITLE_PREFIXEmbed each chunk together with its document title, which can help when passages don't restate the topic the title names (defaults to false). After changing it, use a new DB_PATH or delete the index and re-ingest.EMBED_HEADING_PREFIXAdd section headings to chunk embeddings when they fit (defaults to false). Independent of EMBED_TITLE_PREFIX. Re-ingest documents after changing it.RAG_DEVICEExecution device for the embedder (defaults to cpu). Passed straight to ONNX Runtime; see the Transformers.js device source for the supported backend names. If the requested device fails to initialize, the server throws an error.RAG_DTYPEEmbedding quantization dtype for the embedder (defaults to fp32). Opt-in and pass-through; accepts any dtype the chosen model provides (fp32, fp16, q8, int8, ...). If the model has no variant for the requested dtype, the server throws an error. Changing this changes the embedding space — re-ingest existing data.RAG_HYBRID_WEIGHTKeyword boost factor for hybrid search (0.0-1.0, defaults to 0.6). 0 means semantic similarity only; higher values increase the keyword-match contribution to the final score.RAG_RERANK_CMDExternal reranker command template. Use {query} and {top} for query text and result count; unset disables reranking.RAG_RERANK_TIMEOUT_MSTime budget per rerank call in milliseconds (100-600000, defaults to 10000). On timeout the spawned command is killed and the pre-rerank ordering is returned.
About MCP Local Rag
Everything stays on your machine. The server indexes files from a directory you choose, uses a local embedding model (Xenova/all-MiniLM-L6-v2 by default, about 90 MB downloaded on first run) and stores vectors in LanceDB. After that initial download, ingestion and search work offline, and no API key, Docker, Python or external database is needed.
Search blends semantic similarity with keyword matching, so a query can hit both a concept and an exact term such as an API name or error code. Results return source passages with headings, line numbers or page numbers where available, and a neighbours tool reads the chunks around a hit. HTML fetched by the client can be ingested through ingest_data, though the server does not fetch pages itself. Excel, PowerPoint, images and source-code files are not supported, and PDF headings may be inaccurate.
The same engine has a CLI (ingest, sync, query, list, delete, relocate) that outputs JSON, and optional Agent Skills for Claude Code and Codex. Environment variables tune roots, ignore patterns, chunk size, model and result filtering.
Tools this server provides (9)
Taken from the project documentation; the running server may differ.
From the tool list in its README, going by the names, 1 of 9 tools deletes data and 1 changes data; 2 names don't say.
From the server's own tool labels and tool names; not verified by us.
- sync_startName suggests: changes
- Reconcile the index with all configured roots or one path
- sync_statusName suggests: reads
- Poll a running sync job
- ingest_file
- Ingest or replace one file
- ingest_data
- Ingest text, Markdown or HTML already held by the client
- query_documentsName suggests: reads
- Search with semantic matching and keyword boost
- read_chunk_neighborsName suggests: reads
- Read surrounding chunks from a search result
- list_filesName suggests: reads
- Show supported files and their ingestion state
- delete_fileName suggests: deletes
- Delete an indexed file or an ingest_data item
- statusName suggests: reads
- Show index and search status
What it does
- Fully local indexing
- Embeddings and the LanceDB store run on your machine, with offline use after the model download.
- Hybrid search
- Semantic similarity combined with keyword boost for exact technical terms.
- Cited results
- Passages carry headings, line or page numbers for checking the source.
- Directory sync
- Skips unchanged files and removes entries for deleted ones.
- Command-line mode
- Ingest and query from a terminal with JSON output.
- Agent skills
- Installable guidance for query formulation and HTML ingestion.
Good for
- Search private PDFs and Word files from an AI client
- Look up an error code in internal documentation
- Index project docs and ask what they say about authentication
- Pipe JSON query results into another tool
- Keep confidential material off third-party embedding services
Pricing
Open source
MIT licence
MCP Local Rag FAQ
Do I need an API key?
No. It needs no API key, Docker, Python or external database; Node.js 22.20 or later is required.
Which files can MCP Local Rag index?
PDF, DOCX, plain text and Markdown, plus HTML or text passed in through ingest_data.
Does MCP Local Rag work offline?
Yes, once the embedding model has been downloaded on first use.
How do I limit which folders MCP Local Rag reads?
Set BASE_DIR or BASE_DIRS; the base directory is also the security boundary for file operations.
What licence is MCP Local Rag under?
The README badge shows MIT.
Is MCP Local Rag free?
Yes. MCP Local Rag is open source, so you can use and self-host it for free.
How do I add MCP Local Rag to Claude Code?
Run this command in your terminal: claude mcp add mcp-local-rag -- npx -y mcp-local-rag
What are the best alternatives to MCP Local Rag?
The closest alternatives to MCP Local Rag are Codebase Memory, XERJ, Claude Code Ultimate Guide, Nautilus Compass Memory and Myco: Agent-First Cognitive Substrate.
Where this comes from
- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.



