mcp-local-rag
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-local-ragWhat do my documents say about handling PDF uploads?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Local RAG
本地文档检索服务:在本机完成文档解析、向量化、LanceDB 存储和混合检索,不上传文档。 可通过 MCP 客户端或命令行使用。
快速开始
要求:Node.js 22+。首次运行需要网络下载 npm 依赖和 embedding 模型;模型缓存后可离线运行。
pnpm install
pnpm build
$env:BASE_DIR = 'D:\Rag\documents'
npx mcp-local-rag sync
npx mcp-local-rag query '查询内容'默认索引为当前工作目录下的 lancedb。本项目 Windows 脚本统一使用 D:\Rag,目录结构为:
D:\Rag\documents
D:\Rag\models
D:\Rag\indexes\lancedb
D:\Rag\indexes\lancedb-intel-npu使用 npm CLI 时,建议显式设置绝对路径:
$env:BASE_DIR = 'D:\Rag\documents'
$env:DB_PATH = 'D:\Rag\indexes\lancedb'
npx mcp-local-rag sync
npx mcp-local-rag query '查询内容' --scope 'D:\Rag\documents\gmsl'也可以直接运行 npx -y mcp-local-rag 作为 MCP server,并在 MCP 客户端配置同样的
BASE_DIR、DB_PATH 等环境变量。
Related MCP server: ragi
支持内容
文件:PDF、DOCX、Markdown、TXT。
HTML:由 MCP 客户端抓取后通过
ingest_data传入。检索:语义相似度与关键词匹配结合。
工具:
sync_start、sync_status、ingest_file、ingest_data、query_documents、read_chunk_neighbors、list_files、delete_file、status。
文件操作只能访问配置的文档根目录。修改模型、设备、精度或分块规则后,必须使用新的索引目录或重新建库。
Windows 后端
全局安装后可直接使用以下命令:
npm install -g mcp-local-rag项目内安装时,在命令前加 npx,例如 npx mcp-local-rag-onnx sync。npm 包内部仍包含
tools/ 与 requirements-openvino.txt,无需手动定位它们。
以下脚本需要 Python 3.10+;标准 npm CLI 不需要 Python。默认文档根目录为
D:\Rag\documents,模型缓存为 D:\Rag\models。
ONNX Runtime(CPU / WebGPU / DirectML)
与 NPU 脚本一样,通过子命令区分建库和查询。默认索引为
D:\Rag\indexes\lancedb:
mcp-local-rag-onnx sync
mcp-local-rag-onnx query '查询内容' `
--scope 'D:\Rag\documents\gmsl'sync 默认 webgpu,query 默认 cpu;两者均可通过 --device cpu|webgpu|dml
显式覆盖。例如使用 DirectML 建库:
mcp-local-rag-onnx sync --device dml。
建库批次默认是 8,可通过 sync --batch-size <数量> 调整;查询一次只嵌入一个问题,
批次固定为 1。
Intel NPU(OpenVINO)
首次使用、删除 .openvino-venv 或更新 OpenVINO/NPU 驱动后执行一次。脚本会准备 FP32
模型并编译四个固定形状 [1,128]、[1,256]、[1,512]、[1,1024] 的 NPU blob:
mcp-local-rag-npu-setup在单独终端启动服务,并在建库或查询期间保持运行:
mcp-local-rag-npu-start健康检查只在排查问题时执行,不需要每次运行:
Invoke-RestMethod http://127.0.0.1:8765/health返回的 device 应为 NPU。服务不会自动回退 CPU,关闭服务进程或终端后服务才会停止。
在另一个终端建库或查询。默认 NPU 索引为 D:\Rag\indexes\lancedb-intel-npu:
mcp-local-rag-npu sync
mcp-local-rag-npu query '查询内容' `
--scope 'D:\Rag\documents\gmsl'可用 --database-path、--documents-root、--models-path 和 --endpoint 覆盖默认值。
NPU 服务按文本 token 数选择最小可容纳的固定长度,batch 固定为 1。
常用配置
环境变量 | 默认值 | 作用 |
| 当前目录 | 文档根目录 |
|
| LanceDB 索引目录 |
|
| 模型缓存目录 |
|
| embedding 模型 |
|
| Transformers.js 设备,如 |
|
| embedding 精度 |
|
|
|
|
| OpenVINO 服务地址 |
RAG_EMBEDDER_BACKEND=openvino 时,必须先启动 OpenVINO 服务。不同模型或后端生成的向量
不可混用,应分别使用不同的 DB_PATH。
开发
pnpm build
pnpm test
pnpm run check:all项目许可证为 MIT。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceAn MCP server that enables AI assistants to perform semantic searches over local document collections using multi-context organization and automatic OCR. It supports various file formats including PDF, DOCX, and images, ensuring all data processing remains local and private.6MIT
- AlicenseAqualityDmaintenanceLocal-first RAG indexing and semantic search MCP server. Enables document retrieval and context-aware queries using local embedding models.314MIT
- AlicenseAqualityCmaintenanceA local-first document retrieval MCP server that enables AI coding tools like Codex to search private local documents via semantic search and keyword boost, supporting ingestion of PDF, DOCX, TXT, Markdown, and HTML files.7MIT
- AlicenseNot gradedqualityBmaintenanceA local-first semantic search server for documents, supporting PDFs, Office files, and text/markdown, enabling natural language search via the Model Context Protocol (MCP).1MIT
Related MCP Connectors
Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
Multi-engine search for AI agents. Trust scoring, local corpus, MCP-native. Self-hostable, BYOK.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/xiuxiansk/mcp-local-rag'
If you have feedback or need assistance with the MCP directory API, please join our Discord server