dsh-local-rag
Click on "Deploy 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., "@dsh-local-rag 帮我翻一下之前的会话,看看上周定的索引重建方案是怎么说的"
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.
dsh-local-rag
给 DSH 一个能翻旧账的本地记忆。纯 Node 内置 node:sqlite + FTS5,零外部依赖、不联网、不要 API key。
它解决什么
DSH 的会话是散落在磁盘上的 zstd 文件。会话一关,模型就看不见了 —— 上周讨论过的方案、三天前定下的结论,都得你重新讲一遍。
这个 MCP 服务把这些文件(加上你的工作区文档、技能库、人设文件)切成块建全文索引,让模型能用一句话把旧事翻出来。
中文能搜到是这里最花心思的地方:SQLite 自带的 unicode61 分词器不切中文,检索 和 记忆 这种词进去等于没索引。所以入库前先切成 bigram(双字),检索时同样切,再按来源加权。
Related MCP server: workspace-search
它提供 4 个工具
工具 | 干什么 |
| 全文检索,返回带来源、标题、片段的条目。 |
| 取某条结果的相邻片段(前后各 N 块),用来看完整上下文 |
| 增量重建(只处理改动过的文件);可只重建某一类来源 |
| 索引状态:总块数、文本量、各类来源分布、上次构建时间 |
语料来源
id | 内容 | 默认 |
|
| 开 |
| 你自己指定的工作区目录 | 要配 |
|
| 开 |
|
| 开 |
doc 源这样配(二选一):
# 环境变量,多个用系统路径分隔符(Windows 是 ;,Linux/macOS 是 :)
export DSH_RAG_DOCS="D:/proj;D:/notes"// ~/.dsh/rag/config.json
{ "docs": ["D:/proj", "D:/notes"] }不配也不会报错,只是不索引工作区文档。
检索权重
命中分数按来源加权 —— 记住"她说过什么"比记住某段代码更值钱:
source | 权重 |
persona | 1.6 |
session | 1.45 |
doc | 0.75 |
skill | 0.6 |
装
把仓库放进
~/.dsh/rag(或者任何地方,路径写进下面的配置):
git clone https://github.com/fanfan14543/dsh-local-rag.git ~/.dsh/rag建索引(全量第一次会慢一点,之后都是增量的):
cd ~/.dsh/rag
node --no-warnings build.js在 DSH 的 profile 的
cordis.patch.yml里挂成 MCP server:
- id: mcp-rag
name: "@deepseek-ai/dsh-mcp-client"
config:
servers:
rag:
command: node
args:
- "--no-warnings"
- "C:/Users/<你>/.dsh/rag/server.js"改完重启 DSH,MCP 页里就会出现 rag_search / rag_open / rag_index / rag_stats。
实测规模
一台用了两个多月的机器上:133 个会话 + 若干工作区文档 → 39,121 块 / 33MB 文本 / 165MB 库,全量重建 4.5 秒,增量重建通常几百毫秒。
几个实话
只用 Node 自带的
node:sqlite,所以要 Node 22+(DSH 自带的就是)。不联网,也不调模型。纯 FTS5 + BM25,检索质量靠分词和权重,不靠 embedding。想要语义检索得自己接向量库。
索引是本地文件,别提交进 git(
.gitignore里已经排掉了)。会话文件里的思考过程、工具调用参数会被过滤掉,只留正文,不然索引里全是噪音。
License
MIT
Available Tools
4 toolsrag_indexA
增量更新索引:只重建有改动的内容,没变的文件跳过。首次建库或改动很多时用命令行跑全量更快。不传 source 则更新全部四类来源。
Inputs: source.
rag_openA
取某一条检索结果的相邻片段(前后各若干块),用于看完整上下文。id 来自 rag_search 的返回。
Inputs: id (required), span.
rag_searchA
在本地资料库里做全文检索(中文按二字组切分,SQLite FTS5 + BM25 排序)。资料库包含:历史会话记录、工作区文档、技能库、人设与记忆文件。当需要回忆以前聊过什么、翻某个项目的旧决定、查文档里的细节时用它。返回按相关度排序的片段,带来源和 id,可用 rag_open 取上下文。
Inputs: query (required), top_k, source.
rag_statsA
查看索引状态:总块数、文本量、各类来源的块数、上次构建时间。
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 4 tools
Each tool maps to a distinct operation in the RAG lifecycle: rag_search retrieves, rag_open expands context around a hit, rag_index rebuilds, and rag_stats reports status. Descriptions explicitly cross-reference each other (rag_open consumes ids from rag_search; rag_index notes the full-rebuild CLI alternative), leaving no overlap.
All four tools use the same rag_ prefix plus a short lowercase verb (open, index, stats, search), fully consistent snake_case with no stray styles. The namespace prefix also makes the tools instantly recognizable as belonging to one server.
Four tools is on the thin side, but each covers a genuinely needed verb (search, fetch-context, build, inspect) with no filler. It is well-scoped for a local index server, though one or two more operations (e.g. source listing or pruning) would not feel redundant.
The read path (search → open for context) and the maintenance path (index → stats) are both covered, which handles the core recall and rebuild workflows. Minor gaps remain: no way to remove or exclude stale content, and no listing of which sources exist beyond the aggregate counts in rag_stats.
Maintenance
Related MCP Connectors
Ingest and search LogsLoom logs from coding agents.
Securely search and manage workspace context files for AI agents and teams.
Search your AI chat history (ChatGPT, Claude, Codex) from any MCP client. Remote, private, read-only
Read and search folders on your own computer with explicit consent. Files are never uploaded.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceEnables agents to search a local, fully offline personal document library (Markdown/txt/PDF/docx) via SQLite FTS5 trigram search with subject-terminology expansion, returning every hit with its domain, document title, section path, and page or offset provenance. It also exposes domain statistics, incremental ingestion, and document deprecation as tools, alongside a read-only, runtime-persona-scoped ask/coverage mode.-
- AlicenseNot gradedqualityBmaintenanceEnables AI assistants to run incremental SQLite FTS5 full-text search over explicitly configured local workspace roots, covering Markdown, code, PDF, DOCX, XLSX, CSV and HTML with BM25 ranking, Chinese bigrams, and phrase, prefix, path, type and date filters. Exposes search, safe root-confined reads with line/page/sheet locations, recent-file listing, and reindexing as MCP tools so assistants can locate and quote source content without network or account access.MIT
- AlicenseAqualityCmaintenanceEnables AI agents to search a local folder of Markdown, AsciiDoc, and text files through a SQLite FTS5 keyword index, returning the most relevant sections with file paths, line ranges, and heading breadcrumbs instead of grepping through a repo. It also exposes tools to list indexed documents and refresh the index incrementally, all offline with no dependencies, network calls, or embeddings.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables agents to run full-text search inside Word, PowerPoint, Excel, PDF, and plain-text files by extracting their contents into a single local SQLite FTS5 index. Exposes tools to search documents with ranked highlighted snippets and human-readable locators, list indexed files, and incrementally build or refresh the index.MIT