
本地优先的 Rag MCP 服务器,采用 Python 语言:基于您自己的文档实现混合搜索(语义搜索 + BM25 关键词提升)。11 个 MCP 工具 + CLI,12 种格式的标记下载,多语言嵌入,LanceDB。
概览
一个本地优先的RAG(检索增强生成)MCP服务器。指向一个文档文件夹,它会为你的MCP客户端(Claude代码、光标、Codex等)提供混合搜索——语义向量相似度加上关键词提升以获取精确词汇——覆盖该内容。 除了两件事:首次使用时一次性嵌入模型下载,以及当你要求它获取网页时的显式ingest_url调用,其他信息都不会离开你的机器。本地文件的导入、索引和查询都不涉及网络。 它是一个基于 Python、MCP 原生的 shinpr/mcp-local-rag(TypeScript)对应工具,基于 fastmcp、fastembed 和 LanceDB 构建。 - — 向量相似度(fastembed/ONNX)与关键词排名(LanceDB BM25全文检索)通过加权互易秩融合结合,使精确标识符和错误代码与语义相似的段落并列显示。
概述(AI 翻译)
一个本地优先的RAG(检索增强生成)MCP服务器。指向 文档文件夹,它给你的MCP客户端(Claude代码、光标、Codex, …)混合搜索——语义向量相似性加上关键词提升 确切的条款——基于该内容。
除了两样东西:一次性嵌入模型,没有任何东西会离开你的机器
首次使用时下载,以及当你要求时的显式ingest_url调用
获取网页。本地文件的导入、索引和查询永远不会被动用
网络。
它是 Python 的 MCP 原生版本 shinpr/mcp-local-rag (TypeScript), 基于FastMCP构建, fastembed,以及 LanceDB。
特色
- 混合搜索 — 向量相似度(fastembed/ONNX)与关键词的融合 通过加权互惠排名融合排序(LanceDB BM25全文检索), 因此,精确的标识符和错误代码会同时出现,同时语义上也相似 通道。
- 文件名可搜索 — 关键词搜索还涵盖文档标题 作为正文,且当文档标题为信息文件名时 文档本身的标题是样板式。在许多真实文档集合中 文件名是文档代码和主题唯一出现的地方。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
minirag-mcp
A local-first RAG (retrieval-augmented generation) MCP server. Point it at a folder of documents and it gives your MCP client (Claude Code, Cursor, Codex, …) hybrid search — semantic vector similarity plus a keyword boost for exact terms — over that content.
Nothing leaves your machine except two things: the one-time embedding-model
download on first use, and the explicit ingest_url call when you ask it to
fetch a web page. Ingesting local files, indexing, and querying never touch
the network.
It is a Python, MCP-native analog of shinpr/mcp-local-rag (TypeScript), built on fastmcp, fastembed, and LanceDB.
Features
- Hybrid search — vector similarity (fastembed/ONNX) fused with keyword ranking (LanceDB BM25 full-text search) by weighted Reciprocal Rank Fusion, so exact identifiers and error codes surface alongside semantically similar passages.
- Every mention, counted —
find_mentionslists every document that contains a word or phrase, not the top few, and says how many documents it searched, so “list all”, “how many” and “it is not there” get a complete answer. See Finding every mention. - Look-alike documents named — a result whose document shares most of its text with other indexed documents, such as another version of it or a sibling from the same template, names them and how much text they share. See Look-alike documents.
- Filenames are searchable — keyword search covers document titles as well as body text, and an informative filename becomes the document’s title when the document’s own heading is boilerplate. In many real document sets the filename is the only place the document code and subject appear at all. See Titles and filenames.
- Multilingual by default — the default embedding model covers 50+ languages, so English and Russian corpora both work out of the box.
- Converted once, not re-read every chat — a PDF handed to an assistant is read again, page by page, in every new conversation, and scanned pages cost the most. Here each document is converted (and OCRed) once at ingest, and a question brings back only the sections that answer it, so it costs those sections rather than the whole file.
安装
uvx minirag-mcp配置
{
"mcpServers": {
"minirag": {
"command": "/absolute/path/to/uvx",
"args": ["minirag-mcp"],
"env": {
"BASE_DIR": "/absolute/path/to/docs"
}
}
}
}