
Documentation Search
io.github.alyiox由 GitHub 账号 alyiox 发布v0.4.0更新于 Oct 24, 2026
Local RAG MCP for markdown documentation. Retrieval only; host synthesizes answers.
概览
本地 RAG 服务器,为 Markdown 文档仓库建立索引,返回带引用的原文片段,供宿主助手据此作答。
- 可以做什么
- 列出已配置的文档集合、分层过滤条件与索引状态
- 从指定集合或分层检索带标题路径和编号引用的原文片段
- 按需同步 git 源并重建向量索引
- 支持本地路径或 git URL 作为来源,文件、配置或嵌入模型变化时自动重建索引
- 适用场景
- 适合让助手基于某个特定的 Markdown 文档仓库(例如产品指南或 API 参考)回答问题,并引用来源片段,而不是依赖通用知识。
- 运行要求
- 通过 uvx 以 stdio 在本地运行,需要 Python 3.13+ 和 uv。仅当来源为 git URL 时需要 PATH 中有 git,私有仓库还需机器上已有的 git 凭据。需在 ~/.config/mcp-docs-ask/config.json 配置文档集合。首次运行会下载 sentence-transformers 嵌入模型权重;Linux 上 torch 轮子会拉取体积较大的 CUDA 包。
安装
在 SourceWeft 中
- 打开 控制台中的 Documentation Search,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
mcp-docs-ask
[CI] [PyPI] [Python 3.13+] [License: MIT]
Local RAG MCP for documentation. Point source at any markdown repository
(local path or git URL).
The server does retrieval only (no answer LLM). ask_docs returns grounded
passages and citations; the MCP host (Cursor / Claude) synthesizes the answer.
Features
- Any markdown repo as a source: a local path, or a git URL fetched on
reindex - Runs locally: sentence-transformers embeddings, no API keys, no answer LLM
- Path-based layers to narrow a search (e.g. guides vs. API reference)
- Full passages with heading paths and
[n]citations, capped by a character budget - No manual rebuilds: the index refreshes itself when local files, config, or the embedding model change
Requirements
- Python 3.13+
uvgiton PATH (only ifsourceis a git URL)- Git credentials on the machine when
sourceis a private git URL (gh auth login, HTTPS credential helper, or SSH). No tokens in config. - First run downloads the embedding model weights once (sentence-transformers)
Quick start
Configuration
Config path: ~/.config/mcp-docs-ask/config.json
Windows:
%USERPROFILE%\.config\mcp-docs-ask\config.json
product is a git URL (ref applies). team-notes is a filesystem path (ref unused).
Optional desc on each docs collection and layer helps agents pick the right target.
embedding_model, top_k, chunk_max_chars, and max_context_chars resolve as:
docs.<id>.X → default.X → built-in. Omit per-docs keys to inherit.
Embedding model recommendation
Any Hugging Face id loadable by sentence-transformers works. Pick by language mix:
Changing embedding_model rebuilds the index on the next call; no reindex needed.
Layers partition indexed files by path glob. First match wins. Names are
case-insensitive; all is reserved (cannot be configured as a layer name).
Paths that match no named-layer glob are still indexed and only appear under
layer=all. Omit layers (or set "layers": {}) for flat repos — use
layer=all.
Cache layout:
- Repos (git URL):
~/.cache/mcp-docs-ask/repos/<docs-id>/ - Indexes:
~/.cache/mcp-docs-ask/indexes/<docs-id>/
Tools
list_docs returns a default block with the same keys as the config default
block (docs, embedding_model, top_k, chunk_max_chars,
max_context_chars), plus a docs list where each entry carries its resolved
values, a default flag, and an index block (null when the collection has
never been indexed). Valid layer values are all plus the named layer ids —
see Layers above.
Index block
list_docs and reindex return the same index keys: origin, root, rev,
files, chunks, layers.
origin mirrors the configured source: file for a filesystem path, git for
a URL the server clones into ~/.cache/mcp-docs-ask/repos/<docs-id>/ and
fetches on reindex. root is where the files actually are — null only when
a built index outlived its source directory. rev is the checkout HEAD when
there is one, so a file source that is itself a git clone still reports one;
its working tree may hold uncommitted edits, so rev labels the checkout, not
the exact indexed content.
ask_docs carries only the two answer-scoped keys, root and rev: the
checkout that produced the passages, and the revision they came from.
Passages
ask_docs retrieves up to top_k chunks, then assembles them into passages:
- Each passage is the full chunk text, with line breaks kept, labeled with its
heading path (
Guide > Configuration > Layers). - Retrieved parts of one oversized section are joined back in file order;
…marks parts in between that did not rank. - Passages fill
max_context_charsbest-first. The one that overflows is trimmed at a line break and ends with…; the first passage is always kept.
So citations can hold fewer entries than top_k.
Reading a full source file
citations[].path is repo-relative and stable; answer_context holds the
passage text once, keyed by the [n] markers that match citations[].n. To read
a whole source file, join index.root from the same ask_docs response with a
citation path:
Take root from the response that produced the citations rather than an earlier
reindex — ask_docs rebuilds a stale index itself, so its rev is the one
that matches the passages in hand.
MCP host examples
The examples below launch the server with uvx, which installs the package on first
use. Run it once in a terminal beforehand so your host does not block on that install:
The server then starts on stdio and waits for input — press Ctrl-C once you see the
install line. Embedding model weights are fetched separately, on the first ask_docs
or reindex call. uvx mcp-docs-ask --version prints the build uvx resolved.
Linux (including WSL, containers, and CI): the PyPI
torchwheel for Linux is the CUDA build. It pulls ~15nvidia-*packages whether or not the machine has an NVIDIA GPU — about 2.7 GB of wheels and ~4 GB on disk. Windows and macOS resolve to a CPU-only wheel (~1 GB) and never download CUDA. Pre-warming matters most here: expect the firstuvxrun to take minutes, not milliseconds.
Cursor
Add to .cursor/mcp.json:
Claude Code
Add to your Claude Code MCP config:
Codex
OpenCode
GitHub Copilot
Development
Notes
- Local path:
ask_docsrebuilds the index automatically when file mtimes/sizes change (fingerprint check). You do not needreindexafter editing local docs. - Git URL:
ask_docsnever fetches. Callreindextogit fetchthe configuredrefand rebuild. - The fingerprint also covers
embedding_model,chunk_max_chars, layer globs, and the on-disk index format, so changing any of them rebuilds on the next call.
来源:README.md,提交 379ea60
工具
0版本历史
2- v0.4.0最新Oct 13, 2026
- v0.3.0Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分