SM

shinpr/mcp-local-rag

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

426 stars 82 forks 质量 86 趋势 41MIT

shinpr/mcp-local-rag 是从 https://github.com/shinpr/mcp-local-rag. 导入的 MCP 服务器候选

概览

shinpr/mcp-local-rag 是从 https://github.com/shinpr/mcp-local-rag. 导入的 MCP 服务器候选

概述(AI 翻译)

英文 | 简体中文 | 德语 | 西班牙语 | 葡萄牙(巴西)| 法国人

在不发送 MCP 客户端或终端的私人文档的情况下,搜索 嵌入API。

mcp-local-rag 在你的机器上索引 PDF、DOCX、Markdown 和文本文件。搜索合并 与关键词匹配的语义相似性,因此查询可以同时匹配意图和精确技术 术语如 API 名称、类名和错误代码。结果包括源代码和, 如有,请标注标题、行号或页码,以便核对和引用原文 记录。

无需API密钥、Docker、Python或外部数据库。初始模型下载完成后, 文本摄取和搜索离线可行。

快速启动

要求

  • Node.js 22:20或更晚
  • 首次使用时的互联网接入,下载 NPM 软件包和嵌入模型
  • 包含你想搜索的文档目录

将BASE_DIR设置为该目录。它也是文件操作的安全边界。替换 /absolute/path/to/your/documents 下文,显示目录的绝对路径。

请使用下面的例子,或者注册 npx -y mcp-local-rag,并用你的 T3] 设置 BASE_DIR

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Local RAG

English | 简体中文 | Deutsch | Español | Português (Brasil) | Français

Search private documents from an MCP client or the terminal without sending them to an embedding API.

mcp-local-rag indexes PDF, DOCX, Markdown, and text files on your machine. Search combines semantic similarity with keyword matching, so queries can match both intent and exact technical terms such as API names, class names, and error codes. Results include source passages and, where available, headings, line numbers, or page numbers so you can check and cite the original document.

No API key, Docker, Python, or external database is required. After the initial model download, text ingestion and search work offline.

Quick Start

Requirements

  • Node.js 22.20 or later
  • Internet access on first use to download the npm package and embedding model
  • A directory containing the documents you want to search

Set BASE_DIR to that directory. It is also the security boundary for file operations. Replace /absolute/path/to/your/documents below with the directory’s absolute path.

Use one of the examples below, or register npx -y mcp-local-rag and set BASE_DIR using your client’s MCP configuration format.

Set DB_PATH and CACHE_DIR to absolute paths as well. Relative paths resolve from the server’s working directory, so starting the server from different projects creates a separate index and model cache in each.

Add to ~/.config/opencode/opencode.json (or opencode.jsonc):

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "local-rag": {
      "type": "local",
      "command": ["npx", "-y", "mcp-local-rag"],
      "environment": {
        "BASE_DIR": "/absolute/path/to/your/documents"
      }
    }
  }
在 GitHub 查看完整 README

安装

npx -y mcp-local-rag
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "local-rag": { "command": "npx", "args": ["-y", "mcp-local-rag"], "env": { "BASE_DIR": "/absolute/path/to/your/documents" } } } }