M

MCP Local RAG

by shinpr · io.github.shinpr/mcp-local-rag

Privacy-first local document search using semantic search. Runs entirely on your machine with no cloud services, supporting PDF, DOCX, TXT, and Markdown files.

npm Local · stdio GlamaOfficial MCP Registry High confidence

Install

Add to ~/Library/Application Support/Claude/claude_desktop_config.json

Windows / Linux path
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "io-github-shinpr-mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "env": {
        "BASE_DIR": ".",
        "BASE_DIRS": "<VALUE>",
        "IGNORE_PATHS": "<VALUE>",
        "DB_PATH": "./lancedb/",
        "CACHE_DIR": "./models/",
        "HF_ENDPOINT": "<VALUE>",
        "MODEL_NAME": "Xenova/all-MiniLM-L6-v2",
        "MAX_FILE_SIZE": "104857600",
        "RAG_MAX_DISTANCE": "<VALUE>",
        "RAG_GROUPING": "<VALUE>",
        "RAG_MAX_FILES": "<VALUE>",
        "CHUNK_MIN_LENGTH": "<VALUE>",
        "STORE_IMAGES": "<VALUE>",
        "EMBED_TITLE_PREFIX": "<VALUE>",
        "EMBED_HEADING_PREFIX": "<VALUE>",
        "RAG_DEVICE": "<VALUE>",
        "RAG_DTYPE": "<VALUE>",
        "RAG_HYBRID_WEIGHT": "<VALUE>",
        "RAG_RERANK_CMD": "<VALUE>",
        "RAG_RERANK_TIMEOUT_MS": "<VALUE>",
        "CHUNK_SIZE": "512",
        "CHUNK_OVERLAP": "100"
      }
    }
  }
}

Restart Claude Desktop to activate the new server.

Add to .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)

Windows / Linux path
Windows: .cursor\mcp.json (project) or %USERPROFILE%\.cursor\mcp.json (global)
Linux: .cursor/mcp.json (project) or ~/.cursor/mcp.json (global)
{
  "mcpServers": {
    "io-github-shinpr-mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "env": {
        "BASE_DIR": ".",
        "BASE_DIRS": "<VALUE>",
        "IGNORE_PATHS": "<VALUE>",
        "DB_PATH": "./lancedb/",
        "CACHE_DIR": "./models/",
        "HF_ENDPOINT": "<VALUE>",
        "MODEL_NAME": "Xenova/all-MiniLM-L6-v2",
        "MAX_FILE_SIZE": "104857600",
        "RAG_MAX_DISTANCE": "<VALUE>",
        "RAG_GROUPING": "<VALUE>",
        "RAG_MAX_FILES": "<VALUE>",
        "CHUNK_MIN_LENGTH": "<VALUE>",
        "STORE_IMAGES": "<VALUE>",
        "EMBED_TITLE_PREFIX": "<VALUE>",
        "EMBED_HEADING_PREFIX": "<VALUE>",
        "RAG_DEVICE": "<VALUE>",
        "RAG_DTYPE": "<VALUE>",
        "RAG_HYBRID_WEIGHT": "<VALUE>",
        "RAG_RERANK_CMD": "<VALUE>",
        "RAG_RERANK_TIMEOUT_MS": "<VALUE>",
        "CHUNK_SIZE": "512",
        "CHUNK_OVERLAP": "100"
      }
    }
  }
}

Cursor usually picks up config changes automatically; if the server does not appear, reload the window.

Add to .mcp.json (project) or ~/.claude.json (global)

Windows / Linux path
Windows: .mcp.json (project) or %USERPROFILE%\.claude.json (global)
Linux: .mcp.json (project) or ~/.claude.json (global)
{
  "mcpServers": {
    "io-github-shinpr-mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "env": {
        "BASE_DIR": ".",
        "BASE_DIRS": "<VALUE>",
        "IGNORE_PATHS": "<VALUE>",
        "DB_PATH": "./lancedb/",
        "CACHE_DIR": "./models/",
        "HF_ENDPOINT": "<VALUE>",
        "MODEL_NAME": "Xenova/all-MiniLM-L6-v2",
        "MAX_FILE_SIZE": "104857600",
        "RAG_MAX_DISTANCE": "<VALUE>",
        "RAG_GROUPING": "<VALUE>",
        "RAG_MAX_FILES": "<VALUE>",
        "CHUNK_MIN_LENGTH": "<VALUE>",
        "STORE_IMAGES": "<VALUE>",
        "EMBED_TITLE_PREFIX": "<VALUE>",
        "EMBED_HEADING_PREFIX": "<VALUE>",
        "RAG_DEVICE": "<VALUE>",
        "RAG_DTYPE": "<VALUE>",
        "RAG_HYBRID_WEIGHT": "<VALUE>",
        "RAG_RERANK_CMD": "<VALUE>",
        "RAG_RERANK_TIMEOUT_MS": "<VALUE>",
        "CHUNK_SIZE": "512",
        "CHUNK_OVERLAP": "100"
      }
    }
  }
}

The server will be available in the next Claude Code session.

Add to .vscode/mcp.json

Windows / Linux path
Windows: .vscode\mcp.json
Linux: .vscode/mcp.json
{
  "servers": {
    "io-github-shinpr-mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "env": {
        "BASE_DIR": ".",
        "BASE_DIRS": "<VALUE>",
        "IGNORE_PATHS": "<VALUE>",
        "DB_PATH": "./lancedb/",
        "CACHE_DIR": "./models/",
        "HF_ENDPOINT": "<VALUE>",
        "MODEL_NAME": "Xenova/all-MiniLM-L6-v2",
        "MAX_FILE_SIZE": "104857600",
        "RAG_MAX_DISTANCE": "<VALUE>",
        "RAG_GROUPING": "<VALUE>",
        "RAG_MAX_FILES": "<VALUE>",
        "CHUNK_MIN_LENGTH": "<VALUE>",
        "STORE_IMAGES": "<VALUE>",
        "EMBED_TITLE_PREFIX": "<VALUE>",
        "EMBED_HEADING_PREFIX": "<VALUE>",
        "RAG_DEVICE": "<VALUE>",
        "RAG_DTYPE": "<VALUE>",
        "RAG_HYBRID_WEIGHT": "<VALUE>",
        "RAG_RERANK_CMD": "<VALUE>",
        "RAG_RERANK_TIMEOUT_MS": "<VALUE>",
        "CHUNK_SIZE": "512",
        "CHUNK_OVERLAP": "100"
      }
    }
  }
}

Reload the VS Code window to activate.

Add to ~/.codeium/windsurf/mcp_config.json

Windows / Linux path
Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json
Linux: ~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "io-github-shinpr-mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "env": {
        "BASE_DIR": ".",
        "BASE_DIRS": "<VALUE>",
        "IGNORE_PATHS": "<VALUE>",
        "DB_PATH": "./lancedb/",
        "CACHE_DIR": "./models/",
        "HF_ENDPOINT": "<VALUE>",
        "MODEL_NAME": "Xenova/all-MiniLM-L6-v2",
        "MAX_FILE_SIZE": "104857600",
        "RAG_MAX_DISTANCE": "<VALUE>",
        "RAG_GROUPING": "<VALUE>",
        "RAG_MAX_FILES": "<VALUE>",
        "CHUNK_MIN_LENGTH": "<VALUE>",
        "STORE_IMAGES": "<VALUE>",
        "EMBED_TITLE_PREFIX": "<VALUE>",
        "EMBED_HEADING_PREFIX": "<VALUE>",
        "RAG_DEVICE": "<VALUE>",
        "RAG_DTYPE": "<VALUE>",
        "RAG_HYBRID_WEIGHT": "<VALUE>",
        "RAG_RERANK_CMD": "<VALUE>",
        "RAG_RERANK_TIMEOUT_MS": "<VALUE>",
        "CHUNK_SIZE": "512",
        "CHUNK_OVERLAP": "100"
      }
    }
  }
}

Restart Windsurf (or refresh its MCP servers panel) to activate the new server.

Windsurf Next uses ~/.codeium/windsurf-next/mcp_config.json. Devin Desktop (the Windsurf rebrand) uses ~/.config/devin/mcp_config.json and imports the Windsurf file.

Add to ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

Windows / Linux path
Windows: %APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json
Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
{
  "mcpServers": {
    "io-github-shinpr-mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "env": {
        "BASE_DIR": ".",
        "BASE_DIRS": "<VALUE>",
        "IGNORE_PATHS": "<VALUE>",
        "DB_PATH": "./lancedb/",
        "CACHE_DIR": "./models/",
        "HF_ENDPOINT": "<VALUE>",
        "MODEL_NAME": "Xenova/all-MiniLM-L6-v2",
        "MAX_FILE_SIZE": "104857600",
        "RAG_MAX_DISTANCE": "<VALUE>",
        "RAG_GROUPING": "<VALUE>",
        "RAG_MAX_FILES": "<VALUE>",
        "CHUNK_MIN_LENGTH": "<VALUE>",
        "STORE_IMAGES": "<VALUE>",
        "EMBED_TITLE_PREFIX": "<VALUE>",
        "EMBED_HEADING_PREFIX": "<VALUE>",
        "RAG_DEVICE": "<VALUE>",
        "RAG_DTYPE": "<VALUE>",
        "RAG_HYBRID_WEIGHT": "<VALUE>",
        "RAG_RERANK_CMD": "<VALUE>",
        "RAG_RERANK_TIMEOUT_MS": "<VALUE>",
        "CHUNK_SIZE": "512",
        "CHUNK_OVERLAP": "100"
      }
    }
  }
}

Cline reloads cline_mcp_settings.json automatically; if the server does not appear, reload the VS Code window.

Open it from Cline's MCP Servers panel → Configure. Roo Code uses a different file and format.

Configuration

Environment variables this server reads. Secrets stay on your machine.

NameRequiredDescription
BASE_DIR No Document root directory. Server only accesses files within this path (prevents accidental system file access). Default: .
BASE_DIRS No JSON array of base directories (e.g. '["/a","/b"]'). Takes precedence over BASE_DIR.
IGNORE_PATHS No JSON 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_PATH No Vector database storage location. Can grow large with many documents. Default: ./lancedb/
CACHE_DIR No Model cache directory. After first download, model stays here for offline use. Default: ./models/
HF_ENDPOINT No Hugging Face model download endpoint. Set this to a mirror URL when direct downloads are blocked (defaults to https://huggingface.co).
MODEL_NAME No HuggingFace model identifier. Must be Transformers.js compatible. Default: Xenova/all-MiniLM-L6-v2
MAX_FILE_SIZE No Maximum file size in bytes. Larger files rejected to prevent memory issues. Valid range: 1MB - 500MB. Default: 104857600
RAG_MAX_DISTANCE No Maximum 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_GROUPING No Grouping 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 filter
RAG_MAX_FILES No Maximum 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_LENGTH No Minimum chunk length in characters (1-10000, defaults to 50). Chunks shorter than this threshold are filtered out during ingestion.
STORE_IMAGES No Store supported PDF and DOCX images during ingestion and return them with matched chunks (defaults to false).
EMBED_TITLE_PREFIX No Embed 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_PREFIX No Add section headings to chunk embeddings when they fit (defaults to false). Independent of EMBED_TITLE_PREFIX. Re-ingest documents after changing it.
RAG_DEVICE No Execution 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_DTYPE No Embedding 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_WEIGHT No Keyword 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_CMD No External reranker command template. Use {query} and {top} for query text and result count; unset disables reranking.
RAG_RERANK_TIMEOUT_MS No Time 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.
CHUNK_SIZE No Characters per chunk. Larger = more context but slower processing. Valid range: 128 - 2048. Default: 512
CHUNK_OVERLAP No Overlap between chunks. Preserves context across boundaries. Valid range: 0 - (CHUNK_SIZE/2). Default: 100

Similar servers