/ Каталог / Песочница / mcp-local-rag
● Сообщество shinpr ⚡ Сразу

mcp-local-rag

автор shinpr · shinpr/mcp-local-rag

Private, local-first RAG — index your PDFs, docs, and code once, then search semantically from any MCP client. No API keys, no cloud, no data leaving your machine.

mcp-local-rag runs entirely offline after a ~90MB model download. Ingest PDF/DOCX/TXT/MD/HTML files or raw HTML strings, then query with combined semantic + keyword search. Ideal for personal knowledge bases, confidential documents, and working on flights.

Зачем использовать

Ключевые функции

Живое демо

Как выглядит на практике

local-rag.replay ▶ готово
0/0

Установка

Выберите клиент

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "_inferred": true
    }
  }
}

Откройте Claude Desktop → Settings → Developer → Edit Config. Перезапустите после сохранения.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "_inferred": true
    }
  }
}

Cursor использует ту же схему mcpServers, что и Claude Desktop. Конфиг проекта приоритетнее глобального.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "_inferred": true
    }
  }
}

Щёлкните значок MCP Servers на боковой панели Cline, затем "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "local-rag": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ],
      "_inferred": true
    }
  }
}

Тот же формат, что и Claude Desktop. Перезапустите Windsurf для применения.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "local-rag",
      "command": "npx",
      "args": [
        "-y",
        "mcp-local-rag"
      ]
    }
  ]
}

Continue использует массив объектов серверов, а не map.

~/.config/zed/settings.json
{
  "context_servers": {
    "local-rag": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "mcp-local-rag"
        ]
      }
    }
  }
}

Добавьте в context_servers. Zed перезагружается автоматически.

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

Однострочная команда. Проверить: claude mcp list. Удалить: claude mcp remove.

Сценарии использования

Реальные сценарии: mcp-local-rag

Build a private RAG over your downloaded research papers and PDFs

👤 Researchers, students, knowledge workers ⏱ ~30 min beginner

Когда использовать: You've hoarded hundreds of PDFs in ~/Documents/papers and want to actually use them — 'what did that paper say about attention decay?'

Предварительные требования
  • PDFs or docs on disk — Any folder of files — recursive ingest supported
Поток
  1. Ingest the folder
    Ingest everything under ~/Documents/papers into local-rag. Skip files larger than 50MB.✓ Скопировано
    → Per-file ingest log + 'indexed N files' summary
  2. Ask questions
    Across my papers, what do they say about positional encoding in long-context transformers? Cite the source file and page if possible.✓ Скопировано
    → Synthesized answer with source file citations
  3. Refine search
    Just give me the top 5 passages most relevant to 'ring attention', raw — don't summarize.✓ Скопировано
    → Ranked passage list

Итог: Every paper you've ever downloaded is now queryable by topic — permanent upgrade to your reading life.

Подводные камни
  • Scanned PDFs have no extractable text — Run an OCR pass first (ocrmypdf) before ingesting
  • First index of 1000+ files is slow (CPU embeddings) — Leave it running overnight; incremental re-ingest is fast
Сочетать с: filesystem

Query confidential contracts / HR docs without leaking to any cloud

👤 Legal ops, HR, compliance ⏱ ~20 min intermediate

Когда использовать: Documents are too sensitive for OpenAI/Claude cloud embeddings. You need search but can't send content anywhere.

Поток
  1. Ingest
    Ingest /secure/contracts/*.pdf into local-rag.✓ Скопировано
    → Files indexed locally; confirm no network call was made
  2. Query
    Which contracts have an auto-renewal clause longer than 12 months?✓ Скопировано
    → List of candidate contracts with the clause quoted

Итог: Searchable private corpus with nothing leaving the machine.

Подводные камни
  • Claude answers still go to Anthropic — the embeddings are local but conversation isn't — If answers must also be local, run with a local LLM via Ollama or LM Studio instead of cloud Claude
Сочетать с: filesystem

Комбинации

Сочетайте с другими MCP — эффект x10

local-rag + filesystem

Watch a folder, re-ingest files when they change

Every time a file under ~/Notes changes, re-ingest it into local-rag.✓ Скопировано
local-rag + firecrawl

Scrape a docs site then feed to local-rag for offline querying

Crawl docs.example.com, save each page as Markdown, then ingest all of them into local-rag.✓ Скопировано
local-rag + playwright

Capture JS-rendered pages and ingest their extracted text

Open this SPA, grab the rendered HTML, ingest_data it into local-rag with the URL as source.✓ Скопировано

Инструменты

Что предоставляет этот MCP

ИнструментВходные данныеКогда вызыватьСтоимость
ingest_file path: str | path[] Add one or more files to the index CPU only
ingest_data html: str, source_url?: str Add a raw HTML blob — useful after scraping CPU only
query_documents query: str, top_k?: int Main retrieval call — use before answering user questions free
list_files See what's indexed free
delete_file path: str Remove a stale/irrelevant file from the index free
status Sanity check index size free

Стоимость и лимиты

Во что обходится

Квота API
None — all local
Токенов на вызов
Query results 500-3000 tokens depending on top_k
Деньги
Free. One-time ~90MB model download.
Совет
Set top_k to 5-8 for most questions; going higher wastes tokens without improving answers.

Безопасность

Права, секреты, радиус поражения

Хранение учётных данных: None — no API keys
Исходящий трафик: Zero after model download. Your docs never leave the machine.

Устранение неполадок

Частые ошибки и исправления

First query is slow / seems to hang

Embedding model is downloading on first run (~90MB). Subsequent calls are fast.

Проверить: Check ~/.cache/mcp-local-rag for the model file
PDF ingest returns 0 chunks

PDF is likely scanned (image-only). Run ocrmypdf input.pdf output.pdf first.

Проверить: pdftotext input.pdf -
Results feel irrelevant

Pure semantic search struggles with short queries. Add more keywords. The hybrid search boosts them already.

Out of memory on large PDFs

Split the PDF first, or raise Node heap: NODE_OPTIONS=--max-old-space-size=8192

Альтернативы

mcp-local-rag в сравнении

АльтернативаКогда использоватьКомпромисс
Chroma MCP / Qdrant MCPYou want a real vector DB with multi-user, scaling, metadata filtersMore setup, usually requires a running server
OpenAI Assistants file_searchYou're OK sending documents to OpenAI's cloudNot local, costs per token, but zero setup and more accurate
ChatGPT Projects / Claude Projects file uploadSmall document set (<20 files) and you use the hosted chatNot an MCP; can't be scripted

Ещё

Ресурсы

📖 Читать официальный README на GitHub

🐙 Открытые задачи

🔍 Все 400+ MCP-серверов и Skills