
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 关键词搜索,支持分面过滤和术语表扩展,并可按精确键查找结构化数据中的行。浏览文档树以查看标题、字数和摘要,然后读取某个章节的全文,或一次读取某章节及其全部子节点。启用写入工具后,可查找近似重复条目、为新 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 分