# MCP Local Rag

> MCP Local Rag is an open-source MCP server for knowledge and memory. Local document search for PDF, DOCX, Markdown and text files with no embedding API. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Self-hosted
- **Repository:** https://github.com/shinpr/mcp-local-rag
- **MCP Registry name:** io.github.shinpr/mcp-local-rag
- **Categories:** [knowledge and memory](https://ai-powered.com/categories/knowledge-and-memory), [files and documents](https://ai-powered.com/categories/files-and-documents)
- **Listing updated:** 2026-11-23

## About

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.

## Features

- **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

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add mcp-local-rag -- npx -y mcp-local-rag
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ]
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```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.

### VS Code (~/.copilot/mcp-config.json)

```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.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add mcp-local-rag -- npx -y mcp-local-rag
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.mcp-local-rag]
command = "npx"
args = ["-y", "mcp-local-rag"]
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```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

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```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 (~/.config/devin/mcp_config.json)

```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 (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ]
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```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 (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ]
    }
  }
}
```

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ]
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ]
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "mcp-local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ]
    }
  }
}
```

## Tools

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_start` (name suggests: changes): Reconcile the index with all configured roots or one path
- `sync_status` (name 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_documents` (name suggests: reads): Search with semantic matching and keyword boost
- `read_chunk_neighbors` (name suggests: reads): Read surrounding chunks from a search result
- `list_files` (name suggests: reads): Show supported files and their ingestion state
- `delete_file` (name suggests: deletes): Delete an indexed file or an ingest_data item
- `status` (name suggests: reads): Show index and search status

## 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.

## Alternatives

- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [Claude Code Ultimate Guide](https://ai-powered.com/mcp/claude-code-ultimate-guide): Claude Code Ultimate Guide is an open-source MCP server for ai models and llm tooling.
- [Nautilus Compass Memory](https://ai-powered.com/mcp/nautilus-compass-memory): Nautilus Compass Memory is an open-source MCP server for knowledge and memory.
- [Myco: Agent-First Cognitive Substrate](https://ai-powered.com/mcp/myco-agent-first-cognitive-substrate): Myco: Agent-First Cognitive Substrate is an open-source MCP server for knowledge and memory.
- [Source Library](https://ai-powered.com/mcp/source-library): Source Library is an open-source MCP server for knowledge and memory.
- [keepplain-plugin](https://ai-powered.com/mcp/keepplain-plugin): keepplain-plugin is a freemium MCP server for knowledge and memory.
- [Second Brain](https://ai-powered.com/mcp/second-brain-2): Second Brain is a freemium MCP server for knowledge and memory.

---
Source: https://ai-powered.com/mcp/mcp-local-rag-2
