
Docsonar
io.github.ribhav-jain由 GitHub 账号 ribhav-jain 发布v0.1.1更新于 Oct 27, 2026
Local document search over your folders: hybrid keyword+semantic, fully offline, read-only
概览
Docsonar 是一个本地离线 MCP 服务器,把文件夹中的文档索引到 SQLite,让助手对它们进行关键词加语义的混合检索。
- 可以做什么
- 注册、列出和移除文档文件夹,索引在后台进行并可查看状态
- 以混合、纯关键词或纯语义模式检索已注册文件夹,返回带文件路径、标题或页码位置和摘要的排序片段
- 读取 txt、md、pdf、docx、html 文件的提取文本,可按行范围读取
- 查找与指定文件语义相似的文档
- 增量重建索引,纳入新增或修改的文件并清除已删除文件
- 适用场景
- 适合让助手基于本机上的个人或项目文档集回答问题,并给出文件和页码引用,同时不把文件发送到云端服务。适用于 PDF、Word、Markdown 和 HTML 形式的笔记、报告与制度文件,而非实时网页或数据库内容。
- 运行要求
- 作为本地 stdio 进程运行,通过 uvx 启动(uv 会自动安装所需的 Python)。无需账号、API 密钥或环境变量。首次索引会下载约 130 MB 的本地嵌入模型,下载期间关键词检索已可用。可选 config.toml 及命令行参数用于设置传输方式、端口、数据库路径和模型。
安装
在 SourceWeft 中
- 打开 控制台中的 Docsonar,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
docsonar
[PyPI] [CI] [Python] [License: MIT]
Chat with your folders. A local document search MCP server — your files never leave your machine.
docsonar indexes folders of documents into a single SQLite database and gives any MCP client (Claude Desktop, Claude Code, and others) hybrid keyword + semantic search over them. Fully offline, zero configuration, read-only by design.
Quickstart
Claude Code
Add to your project's .mcp.json (or ~/.claude.json for all projects):
Claude Desktop
Add to claude_desktop_config.json (Settings → Developer → Edit Config):
Running from a source checkout instead: "command": "uv", "args": ["run", "--directory", "/path/to/docsonar", "docsonar"].
Then just talk to it: "Add my ~/Documents/notes folder and find everything about quarterly planning." The first index downloads the embedding model (~130 MB, one time); keyword search works immediately while that happens.
For HTTP instead of stdio: uvx docsonar --transport http --port 8365.
Tools
Supported formats: txt, md, pdf (page-aware, cites p. 12), docx, html.
Architecture
Every chunk stores its location (heading path like Setup > Windows, or PDF page range), so search results can cite report.pdf, p. 12.
Design decisions
- Read-only by design. There are no write, move, or delete tools, and there never will be. The server only reads files inside folders you explicitly register — with symlink-escape protection and strict path resolution — so the blast radius of a misbehaving client is zero.
- SQLite as the single store. FTS5 gives production-grade BM25 keyword search in the standard library, and sqlite-vec puts vectors in the same file. One database file, no services to run, trivial to back up or delete.
- Hybrid search by default. BM25 and cosine-KNN rankings are fused with reciprocal-rank fusion (k=60). Exact identifiers and rare terms win on the keyword side; paraphrased questions win on the semantic side; RRF needs no score calibration between them.
modelets the caller force either side. - Local embeddings. BAAI/bge-small-en-v1.5 (384-dim) — same size class as the classic all-MiniLM-L6-v2 but stronger on retrieval benchmarks. Downloads on first index, runs on CPU, lazy-loaded so server startup stays instant. If the model can't load, everything degrades gracefully to keyword search and tool responses say so.
- A tool surface built for an LLM caller.
searchreturns enough per hit (path, location, score, snippet) to decide what to read next without another round trip; results carry stablechunk_ids; every degradation is reported in-band vianote/embedding_notefields instead of failing. There's no "answer the question" tool on purpose — the calling model does the reasoning; docsonar does retrieval. - Incremental by content, not just mtime. Reindexing checks mtime+size first, then falls back to a SHA-256 content hash — touched-but-identical files are skipped, and deleted files are purged from both the FTS and vector indexes.
- Scanned PDFs fail loudly. A PDF with no extractable text is reported as failed with a clear reason rather than silently indexed as empty. OCR is out of scope.
Benchmarks
Synthetic corpus of 200 markdown files (600 chunks); Intel Core Ultra 5 125U (laptop, CPU-only), Windows 11, Python 3.12. Reproduce with uv run python scripts/benchmark.py.
Configuration
Zero config needed. To customize, create config.toml in the platform config directory (Windows: %LOCALAPPDATA%\docsonar\, macOS: ~/Library/Application Support/docsonar/, Linux: ~/.config/docsonar/):
CLI flags: --transport stdio|http, --host, --port, --db-path, --config.
The index database lives in the platform data directory (Windows: %LOCALAPPDATA%\docsonar\, macOS: ~/Library/Application Support/docsonar/, Linux: ~/.local/share/docsonar/).
Running from source
Requires uv (it installs the right Python automatically):
Run the tests
Run the server
VS Code: press F5 — launch configs for the HTTP server and the test suite are in .vscode/launch.json.
Try the tools without an MCP client
With the HTTP server running, the endpoint is http://127.0.0.1:8365/mcp. Recent Postman versions can connect directly (New → MCP Request, transport HTTP) and show all 8 tools as forms. For raw HTTP, MCP is JSON-RPC over POST with two setup calls, then tool calls. Send every request with headers Content-Type: application/json and Accept: application/json, text/event-stream:
Then call tools — the repo ships a sample corpus in examples/sample-docs to play with (use forward slashes in JSON to avoid escaping; they work on Windows too):
Security check worth trying: read_file with any path outside a registered folder (e.g. C:/Windows/System32/drivers/etc/hosts) returns a refusal, not file content.
CI runs lint, typecheck, and the test suite on Linux, macOS, and Windows.
License
MIT
来源:README.md,提交 2b8da82
工具
0版本历史
1- v0.1.1最新Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分

