RAG for your documents

io.github.DevilsDev由 GitHub 账号 DevilsDev 发布v3.8.1更新于 Nov 7, 2026

Search a folder of documents and check answers against them. Offline: no API key or database.

已验证STDIO仅桌面文件与存储知识与记忆

概览

AI 生成的概览

本地 MCP 服务器,为指定文件夹中的文档建立索引,让助手离线检索文档并核对答案是否有据可依。

可以做什么
  • 用自然语言查询检索已索引文档,返回按相关度排序的段落及其来源文件与分块编号。
  • 用检索到的或指定的段落核对候选答案,返回有据比例、无依据句子和引用来源。
  • 索引文件夹及子文件夹中的 Markdown、HTML、CSV 和文本文件,跳过 node_modules 与 .git。
  • 通过 topK 参数或启动选项调整每次返回的段落数量。
适用场景
适合让助手基于本地或私有文档回答问题,而不把内容发送给嵌入 API 或数据库;也适合快速以词面方式检查某个答案是否得到这些文档支持。
运行要求
需要 Node.js 22 或更高版本,通过 npx 运行并传入文档文件夹的绝对路径。无需 API 密钥、数据库或网络。索引保存在内存中并在启动时重建,修改文档后需重启服务器。
安装前请注意
两个工具都是只读的,但段落文本来自你的文件,可能含有试图操纵助手的文字,因此只索引你信任的文件夹。核对基于词面匹配且不调用模型,正确的改写也可能被判为无依据,应视为提示而非结论。

安装

在 SourceWeft 中

  1. 打开 控制台中的 RAG for your documents,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@devilsdev/rag-mcp-server

An MCP server for your documents. Point it at a folder and Claude, or any other MCP client, can search the documents and check answers against them:

bash
npx @devilsdev/rag-mcp-server ./docs

It indexes the folder when it starts, with the offline TF-IDF embedder and an in-memory retriever from @devilsdev/rag-pipeline-utils. It needs no API key, no database and no network. The assistant is the language model, so the server never calls one.

Requires Node.js 22 or later.

Connect a client

The server speaks MCP over stdio, so the client starts it. Use an absolute path to your folder.

Claude Code:

bash
claude mcp add docs -- npx -y @devilsdev/rag-mcp-server /absolute/path/to/docs

Claude Desktop, Cursor and other clients that use an mcpServers config (for Claude Desktop: Settings → Developer → Edit Config, then restart):

json
{  "mcpServers": {    "docs": {      "command": "npx",      "args": ["-y", "@devilsdev/rag-mcp-server", "/absolute/path/to/docs"]    }  }}

Then ask something your documents answer, such as "How many vacation days do employees get?".

Tools

search_documents

InputTypeDescription
querystring, requiredWhat to look for, in natural language
topKinteger, 1–20Passages to return (default 4, or --top-k)

Returns { passages: [{ id, source, score, text }] }, best first, as structured content and as JSON text. source is the file relative to the folder and id is <source>#<chunk number>. Passages that share no terms with the query are left out.

check_answer

InputTypeDescription
answerstring, requiredThe answer to check
questionstringThe question it answers; improves retrieval when sources is omitted
sourcesarray of strings or { id, text }Passages to check against; omit to search the indexed documents
topKinteger, 1–20Passages to retrieve when sources is omitted

Runs the library's checkAnswer and returns { grounded, groundedness, unsupported, citations, sources }: whether every sentence is supported, the share of supported sentences (0 to 1), the unsupported sentences, the ids of the sources supporting each sentence, and the sources that were checked. The check is lexical and makes no model calls, so a correct paraphrase can come back unsupported; treat it as a flag to look again, not a verdict.

Both tools are read-only. Passage text is content from your files, and the tool descriptions tell the client to treat it as data, not instructions. A file can still contain text written to manipulate an assistant, so index folders you trust.

Files

Markdown (.md, .markdown), HTML (.html, .htm, visible text only), CSV (.csv, one passage per row) and text (.txt) files, in the folder and its subfolders, handled the way the library's loaders handle them; prose is split into sentence chunks of up to 500 characters. Other files, node_modules and .git are skipped. The index lives in memory and is rebuilt each time the server starts, so restart the client's server after changing the documents.

Options

bash
rag-mcp-server <folder> [--top-k <n>] [--embedder local]
OptionDefaultMeaning
--top-k <n>4Passages per call when the client doesn't pass topK
--embedder <name>localThe embedder; local (TF-IDF, offline) is the only one

Everything the server logs goes to stderr; stdout carries the protocol.

Build your own

For other embedders (OpenAI, Ollama), a persistent index or a vector database, start from the MCP server example, which builds the same kind of server from the library in about 100 lines.

Documentation: https://devilsdev.github.io/rag-pipeline-utils/

来源:packages/rag-mcp-server/README.md,提交 5cdc1eb

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

3
  1. v3.8.1最新Nov 7, 2026
  2. v3.7.1Nov 6, 2026
  3. v3.6.0Nov 5, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分