Documentation Search

io.github.alyiox由 GitHub 帳號 alyiox 發布v0.4.0更新於 Oct 24, 2026

Local RAG MCP for markdown documentation. Retrieval only; host synthesizes answers.

已驗證STDIO僅桌面檔案與儲存知識與記憶

概覽

AI 產生的概覽

本機 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 套件。
安裝前請注意
僅做擷取:伺服器回傳片段,由宿主模型產生答案,答案品質取決於宿主。私有 git 來源依賴機器上既有的憑證。索引會把倉庫內容複製到本機快取,並以本機嵌入處理文字,不使用 API 金鑰。Linux 上首次執行下載量較大。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Documentation Search,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

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+
  • uv
  • git on PATH (only if source is a git URL)
  • Git credentials on the machine when source is 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

bash
git clone [email protected]:alyiox/mcp-docs-ask.gitcd mcp-docs-askuv syncmkdir -p ~/.config/mcp-docs-askcp config.example.json ~/.config/mcp-docs-ask/config.json# Prefer a local checkout while developing:#   set docs.<id>.source to your docs repo pathnpx -y @modelcontextprotocol/inspector@latest uv run mcp-docs-ask

Configuration

Config path: ~/.config/mcp-docs-ask/config.json

Windows: %USERPROFILE%\.config\mcp-docs-ask\config.json

json
{  "docs": {    "product": {      "source": "https://github.com/example/docs.git",      "desc": "Product guides and API reference",      "ref": "main",      "include": ["**/*.md"],      "exclude": ["archive/**"],      "layers": {        "guides": {          "desc": "How-to and onboarding guides",          "include": ["docs/guides/**"]        },        "api": {          "desc": "HTTP API reference",          "include": ["docs/api/**"]        }      },      "embedding_model": "sentence-transformers/all-MiniLM-L6-v2"    },    "team-notes": {      "source": "/path/to/docs",      "desc": "Internal team notes (local path; ref unused)",      "include": ["**/*.md"],      "exclude": ["archive/**"]    }  },  "default": {    "docs": "product",    "embedding_model": "sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2",    "top_k": 8,    "chunk_max_chars": 1500,    "max_context_chars": 8000  }}

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:

Docs / queriesRecommended embedding_model
English-only (built-in when omitted)sentence-transformers/all-MiniLM-L6-v2
Chinese-onlyBAAI/bge-small-zh-v1.5
Multilingual (~50 langs)sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2

Changing embedding_model rebuilds the index on the next call; no reindex needed.

FieldDescription
docs.<id>.sourceDocs repo root: local path or git URL
docs.<id>.descShort description for discovery (list_docs)
docs.<id>.refBranch / tag / SHA for git URL sources only (default main; ignored for local paths)
docs.<id>.includeGlobs relative to repo root (default **/*.md)
docs.<id>.excludeGlobs to skip
docs.<id>.layers.<name>.includePath globs for that layer (first match wins)
docs.<id>.layers.<name>.descShort layer description for discovery
docs.<id>.embedding_modelOptional override (see recommendation above)
docs.<id>.top_kOptional override for default retrieval count
docs.<id>.chunk_max_charsOptional override for max body chars per heading chunk
docs.<id>.max_context_charsOptional override for the answer_context passage budget
default.docsDefault docs collection id
default.embedding_modelDefault sentence-transformers model id
default.top_kDefault retrieval count
default.chunk_max_charsDefault max body chars per heading chunk
default.max_context_charsDefault total passage chars in answer_context (min 500)

Layers partition indexed files by path glob. First match wins. Names are case-insensitive; all is reserved (cannot be configured as a layer name).

ask_docs layerMeaning
all (default)Every indexed chunk (named layers and paths outside them)
<named>Only chunks whose path matched that named layer’s include globs

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

ToolDescription
list_docsList configured docs collections, layer filters, and index state
ask_docsRetrieve grounded passages + citations (layer: all or a named layer)
reindexSync git source (if URL) and rebuild the vector index

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_chars best-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:

/home/you/docs-repo  +  product/features/budget.md

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:

bash
$ uvx mcp-docs-askInstalled 84 packages in 275ms

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 torch wheel for Linux is the CUDA build. It pulls ~15 nvidia-* 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 first uvx run to take minutes, not milliseconds.

Cursor

Add to .cursor/mcp.json:

json
{  "mcpServers": {    "docs-ask": {      "command": "uvx",      "args": ["mcp-docs-ask"]    }  }}

Claude Code

Add to your Claude Code MCP config:

json
{  "mcpServers": {    "docs-ask": {      "command": "uvx",      "args": ["mcp-docs-ask"]    }  }}

Codex

toml
[mcp_servers.docs-ask]command = "uvx"args = ["mcp-docs-ask"]

OpenCode

json
{  "$schema": "https://opencode.ai/config.json",  "mcp": {    "docs-ask": {      "type": "local",      "enabled": true,      "command": ["uvx", "mcp-docs-ask"]    }  }}

GitHub Copilot

json
{  "inputs": [],  "servers": {    "docs-ask": {      "type": "stdio",      "command": "uvx",      "args": ["mcp-docs-ask"]    }  }}

Development

bash
uv syncuv run ruff check src/ tests/uv run ruff format --check src/ tests/uv run pyrightuv run pytest

Notes

  • Local path: ask_docs rebuilds the index automatically when file mtimes/sizes change (fingerprint check). You do not need reindex after editing local docs.
  • Git URL: ask_docs never fetches. Call reindex to git fetch the configured ref and 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
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

2
  1. v0.4.0最新Oct 13, 2026
  2. v0.3.0Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分