Skip to main content
Glama
Huajijunbilibili

localrag-mcp

localrag-mcp — ローカルドキュメントRAG検索プラグイン(DeepSeek Harness)

DeepSeek Harness の agent にローカル知識検索機能を提供する MCP ツールプラグイン: agent は会話中に直接 mcp__localrag__search などのツールを呼び出し、ローカルドキュメントに対して意味検索を行い、出典付きの回答を得ることができます。

エコシステムへの貢献:これは DeepSeek Harness 公式コントリビューションガイドの「プラグインを作成して共有する」の実践プロジェクトであり、GitHub に公開後 dsh-plugin トピックを付けることでコミュニティに発見されます。

アーキテクチャ

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

クイックスタート

# 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,并基于检索结果回答

✅ 検証結果(実動作)

単体テスト(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 統合(pnpm dsh web --patch localrag.cordis.yml)実測:agent はプロンプトに従って順次 index_documentssearch を呼び出し、最終的な回答には出典とスコアの引用が含まれます:

主な出典:langgraph-multiagent.md(chunk 0、1、検索スコア 0.4851 / 0.2863) 補足背景:langchain-basics.md(スコア 0.1219)

ツール一覧(agent 視点)

MCP ツール名

説明

mcp__localrag__index_documents

ディレクトリ内の .md/.txt をインデックス化(再帰的)、分割 + ベクトル化して保存

mcp__localrag__search

意味検索 top-k、テキスト、ソースパス、関連性スコアを返す

mcp__localrag__list_documents

ナレッジベース内の全ソースドキュメントを一覧表示

設計のポイント

  • 検索に出典付き:各 chunk に source(ファイルの絶対パス)を記録、agent の回答をトレース可能——これは通常のチャットと異なる重要な機能です

  • 完全ローカル実行:embedding は ONNX でローカル推論、外部 embedding API に依存せず、キーは不要

  • 分割戦略:512 文字のスライディングウィンドウ + 64 のオーバーラップ、中国語ドキュメントに最適化(v2 では意味分割にアップグレード可能)

  • インクリメンタルインデックスupsert でファイルごとに重複排除、同じディレクトリを再インデックスしても重複ベクトルは生成されません

ロードマップ(v2)

  • PDF / Word 対応(pdfplumber + python-docx)

  • 意味分割(段落/見出しベース、固定ウィンドウではない)

  • LangChain で標準 RAG パイプラインとしてラップ(マルチパス検索 + リランク)

  • マルチエージェント深層研究システムとの統合(検索ワーカーが本プラグインを再利用)

  • 評価:RAGAS で検索品質をスコアリング

履歴書での使用例

DeepSeek Harness エコシステム向け dsh-plugin 開発:ローカルドキュメント RAG 検索 MCP プラグイン(Python + Chroma + fastembed)

  • index/search/list の 3 つの MCP ツールを実装、agent 会話中に直接呼び出し可能、検索結果に出典引用付き

  • 完全ローカルベクトル化(bge-small-zh、ONNX)と永続ストレージ、外部 API 不要

  • 公式 --patch メカニズムでマウントし、単体スモークテストと Harness 統合検証を完了

関連リンク

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