Skip to main content
Glama
Huajijunbilibili

localrag-mcp

localrag-mcp — Local Document RAG Retrieval Plugin (DeepSeek Harness)

An MCP tool plugin that provides local knowledge retrieval capabilities for agents in DeepSeek Harness: agents can directly call tools such as mcp__localrag__search during conversations, performing semantic retrieval with source citations on local documents.

Ecosystem contribution: This is a practical project following the "Create and share plugins" section in the official DeepSeek Harness contribution guide. After publishing it on GitHub with the dsh-plugin topic, it can be discovered by the community.

Architecture

DeepSeek Harness (dsh web)
   │  --patch localrag.cordis.yml
   ▼
@deepseek-ai/dsh-mcp-client  (官方通用 MCP 客户端)
   │  启动 stdio 子进程
   ▼
server.py  (Python, FastMCP)
   ├── index_documents(path)   # 扫描目录,分块 + 向量化,写入 Chroma
   ├── search(query, k)        # 语义检索,返回文本 + 来源路径 + 分数
   └── list_documents()        # 列出知识库中的文档
   │
   ├── 向量模型:fastembed / BAAI/bge-small-zh-v1.5(本地 ONNX,无需 API key)
   └── 向量库:Chroma(持久化到 ./data/chroma)

Related MCP server: Notebook Library MCP Server

Quick Start

# 1. 安装依赖(Python 3.10+)
cd localrag-mcp
pip install -r requirements.txt

# 2. 独立冒烟测试(不依赖 Harness)
python test-client.py
# 预期输出:tools: [...]; index: indexed 2 files, N chunks; search: 命中结果

# 3. 接入 DeepSeek Harness(在 harness 仓库根目录)
pnpm dsh web --patch D:\programing\python\LangChain\models\localrag-mcp\localrag.cordis.yml
# 首次会下载 bge-small-zh 模型(约 95MB,仅一次)

# 4. 在对话里使用
#    "先索引 D:\...\docs,然后检索:LangGraph 多 agent 是怎么协作的?"
#    agent 会依次调用 index_documents → search,并基于检索结果回答

✅ Verification Results (Actual Run)

Standalone test (python test-client.py):

tools: ['index_documents', 'search', 'list_documents']
index: indexed 2 files, 4 chunks into 'documents'
search: 命中 langgraph-multiagent.md(top score 0.537,带 source 路径)

Harness integration (pnpm dsh web --patch localrag.cordis.yml) actual test: the agent sequentially calls index_documentssearch as prompted, and the final answer includes source and score citations:

Main source: langgraph-multiagent.md (chunks 0, 1, retrieval score 0.4851 / 0.2863) Supplementary background: langchain-basics.md (score 0.1219)

Tool List (agent perspective)

MCP Tool Name

Description

mcp__localrag__index_documents

Index .md/.txt in a directory (recursive), chunk + vectorize and store

mcp__localrag__search

Semantic retrieval top-k, returns text, source path, relevance score

n

mcp__localrag__list_documents

List all source documents in the knowledge base

Design Highlights

  • Retrieval with sources: Each chunk records source (absolute file path), enabling agent answers to be traced back — this is the key capability distinguishing it from ordinary chat

  • Fully local operation: Embedding uses ONNX local inference, no dependency on external embedding API, no keys required

  • Chunking strategy: 512-character sliding window + 64 overlap, friendly for Chinese documents (v2 can upgrade to semantic chunking)

  • Incremental indexing: upsert deduplicates by file, re-indexing the same directory will not produce duplicate vectors

Roadmap (v2)

  • PDF / Word support (pdfplumber + python-docx)

  • Semantic chunking (based on paragraphs/headings, not fixed window)

  • Wrap with LangChain into a standard RAG pipeline (multi-path recall + reranking)

  • Integration with multi-agent deep research system (retrieval worker reuses this plugin)

  • Evaluation: Score retrieval quality with RAGAS

Resume Usage

Developed a dsh-plugin for the DeepSeek Harness ecosystem: a local document RAG retrieval MCP plugin (Python + Chroma + fastembed)

  • Implemented three MCP tools: index, search, list. Agents can call them directly in conversations, with source citations in retrieval results.

  • Fully local vectorization (bge-small-zh, ONNX) and persistent storage, no external API required.

  • Mounted via the official --patch mechanism, and completed standalone smoke testing and Harness integration verification.

A
license - permissive license
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • F
    license
    -
    quality
    D
    maintenance
    Enables AI assistants to search and query PDF documents through a local RAG system with vector embeddings. Provides semantic document search capabilities while keeping all data stored locally without external dependencies.
  • A
    license
    -
    quality
    D
    maintenance
    Provides token-efficient semantic search and document retrieval by indexing PDFs, text, and markdown files into local notebooks using ChromaDB. It enables AI agents to query relevant passages from large documents through local embedding models like Hugging Face or Ollama.
    1
    MIT
  • A
    license
    -
    quality
    D
    maintenance
    Enables AI assistants to perform semantic, hybrid, and filtered search on indexed local documentation with RAG capabilities.
    2
    MIT

View all related MCP servers

Related MCP Connectors

  • Persistent memory and knowledge management for AI agents with semantic search and 50+ tools.

  • Persistent memory for AI agents. Search, store, and recall across sessions.

  • Shared knowledge base for AI agents. Semantic search across agents, no setup required — just a URL.

View all MCP Connectors

Latest Blog Posts

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/Huajijunbilibili/dsh-localrag'

If you have feedback or need assistance with the MCP directory API, please join our Discord server