
Doctree Mcp
io.github.joesaby由 GitHub 帳號 joesaby 發布v1.0.1更新於 Oct 24, 2026
BM25 search + tree navigation over markdown docs for AI agents. No embeddings, no LLM calls.
概覽
一個本機 MCP 伺服器,為助理提供對 markdown、CSV 與 JSONL 文件的 BM25 關鍵字搜尋與樹狀導覽,不使用向量嵌入或 LLM 呼叫。
- 可以做什麼
- 對 markdown、CSV 與 JSONL 檔案進行 BM25 關鍵字搜尋,支援 facet 篩選與詞彙表擴展,並可依精確鍵查詢結構化資料中的資料列。瀏覽文件樹以查看標題、字數與摘要,再讀取某個章節的全文,或一次讀取某章節及其所有子節點。啟用寫入工具後,可找出近似重複的條目、為新的 wiki 條目產生建議路徑與 frontmatter 草稿,並在驗證與試執行後寫入。
- 適用情境
- 適合助理需要根據本機文件、操作手冊或筆記資料夾回答問題,且你希望取得可稽核的「先搜尋再導覽」軌跡,而非不透明的相似度分數。也適合在原始素材之上建立由代理維護的 wiki。
- 執行需求
- 透過 stdio 在本機執行,使用 bunx 從 npm 套件 doctree-mcp 啟動,因此需要 Bun 執行環境。需設定 DOCS_ROOT(或使用 DOCS_ROOTS 設定加權多集合);可選 DOCS_GLOB、GLOSSARY_PATH 與 WIKI_WRITE。未宣告任何身分驗證。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Doctree Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
doctree-mcp
Agentic document retrieval over markdown, CSV, and JSONL. BM25 + tree navigation via MCP — no vector DB, no embeddings, no LLM calls at index time.
The pitch: MCP provides the structural primitives (a navigable tree, BM25, glossary, row lookup). The bundled skills provide the procedural knowledge (how to walk that tree). Together the agent behaves like a trained research librarian — not a one-shot searcher. See The Skill + MCP Pattern.
Quick Start
Have docs already? Point a client at them:
Restart the tool → ask "search the docs for X" or invoke the doc-read prompt.
Starting fresh? Scaffold a Karpathy-style LLM wiki:
Creates docs/wiki/ (LLM-maintained) + docs/raw-sources/ (your inputs), writes the MCP config, installs a post-write lint hook, appends wiki conventions to CLAUDE.md / AGENTS.md / .cursor/rules/.
Operation Modes
Full decision tree: Operation Modes.
How It Works — Retrieve · Curate · Add
Core read tools (always on):
Wiki write tools (opt-in with WIKI_WRITE=1):
Safety: path containment · frontmatter validation · duplicate detection · dry-run · overwrite protection.
Deprecated aliases (list_documents, find_files, find_symbol) are superseded by search_documents — still functional, no longer recommended.
The Skill + MCP Pattern
Most retrieval tools hand the agent a search box and hope for the best. doctree-mcp hands it a tree, and the bundled skills teach it how to walk one.
- MCP = structural primitives.
search_documents,get_tree,navigate_tree,get_node_content,lookup_rowreturn tree positions the agent reasons over — not finished answers. - Skills = procedural knowledge.
/doc-read,/doc-write,/doc-lintencode breadcrumb drill-down: search → outline → navigate → retrieve. The agent learns the policy, not just the API.
That pairing doesn't exist cleanly elsewhere:
Why iterative retrieval wins:
- Context rot. Stuffing a 1M-token window with chunks degrades output. Breadcrumb navigation keeps working memory small.
- Auditability.
search_documents → get_tree → navigate_tree → get_node_contentis a replayable trail. A cosine score is not. Regulated domains can ship the former. - Progressive disclosure. Fewer navigable primitives beat tool sprawl (cf. Cloudflare Code Mode).
Multi-instance = client-side federation. Register several doctree servers under different names; the /doc-read skill encodes the routing policy. Add or remove instances without touching the skill. See Client setup → Multi-instance routing.
The LLM Wiki Pattern
Inspired by Karpathy's LLM Wiki. Full walkthrough: docs/LLM-WIKI-GUIDE.md.
Configuration (summary)
All non-reserved frontmatter fields become filter facets:
Common env vars:
Full reference: docs/CONFIGURATION.md.
Glossary — place glossary.json in docs root for bidirectional query expansion:
Acronym definitions like "TLS (Transport Layer Security)" are also auto-extracted.
Structured data — CSV/JSONL files become documents where each row is a tree node. Column roles (id, title, description, facets, URL) are auto-detected from headers. See docs/STRUCTURED-DATA.md.
Running from Source
Performance
Docs
Setup & operation
- Operation Modes — stdio · HTTP · CLI
- Client Setup — Claude Code · Cursor · Windsurf · Codex · OpenCode · Claude Desktop
- Deployment — Railway · Fly.io · Render · Cloudflare Containers · Docker
- Configuration — env vars, frontmatter, ranking tuning
Patterns & concepts
- LLM Wiki Guide — agent-maintained knowledge base walkthrough
- Structured Data — CSV / JSONL indexing
- Architecture & Design — BM25 internals, tree navigation
- Competitive Analysis — PageIndex, QMD, GitMCP, Context7, managed RAG
Source
- Prompts — MCP prompt templates
- Skills:
/doc-read·/doc-write·/doc-lint
Standing on Shoulders
- PageIndex — hierarchical tree navigation
- Pagefind by CloudCannon — BM25 scoring, positional index, facets
- Bun.markdown by Oven — native CommonMark parser
- Karpathy's LLM Wiki — the LLM-maintained wiki pattern
License
MIT
來源:README.md,提交 1755742
工具
0版本歷史
1- v1.0.1最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分