docs-mcp
Local documentation search server for AI models using hybrid retrieval (phrase, keyword, vector). Provides MCP tools to search and fetch documentation from bundled or custom doc sets without any external API keys.
README
docs-mcp
Documentation search over MCP for an AI model. Hybrid retrieval (exact phrase + keyword + vector), one container, no API keys, nothing leaves the machine.
Commands
docker compose up -d --build # build + start the server on :8765
docker compose run --rm indexer # index new/changed docs (run after adding docs)
docker compose run --rm indexer index --force # re-embed everything from scratch
docker compose run --rm indexer index --source fastapi # index one source only
docker compose run --rm indexer search "per-message ttl" # query from the shell, no client needed
docker compose logs -f server # follow logs
docker compose restart server # restart
docker compose down # stop
curl localhost:8765/health # {"status":"ok"} | {"status":"empty-index"}
Add docs
cp -r ~/mydocs docs/mydocs-docs # any folder under docs/ is a source
docker compose run --rm indexer # only new/changed files get embedded
Reads .md, .mdx, .rst, .txt. Source name = folder name minus a trailing -docs.
Delete a folder and re-run the indexer to drop it. No restart needed — the running server picks up
a new index immediately.
Refresh the bundled upstream doc sets:
python3 docs/get_docs.py # re-pulls celery, rabbitmq, velociraptor, fastapi from GitHub
docker compose run --rm indexer # embeds only what changed
Connect a client
On the VM, set the address to serve on, then restart:
cp .env.example .env
echo 'BIND_ADDR=100.x.x.x' >> .env # Tailscale/WireGuard/LAN IP. 0.0.0.0 only if firewalled.
docker compose up -d
From your machine:
claude mcp add --transport http docs http://100.x.x.x:8765/mcp
claude mcp list # -> docs: ... ✔ Connected
With a token: put AUTH_TOKEN=… in .env, restart, then add
--header "Authorization: Bearer …".
Tools the model gets
| tool | does |
|---|---|
list_sources |
which doc sets exist, file/chunk counts, last indexed |
search_docs |
hybrid search — query, optional sources, limit |
fetch_chunk |
a hit plus its neighbouring passages |
fetch_doc |
a whole page, paginated |
Also exposed as resources: docs://<source>/<path>.
Settings
.env, all optional — see .env.example:
BIND_ADDR=127.0.0.1 # address the port is published on
PORT=8765
AUTH_TOKEN= # empty = no auth
ALLOWED_ORIGINS= # browser origins allowed; requests with no Origin always pass
RERANK=0 # 1 = add a cross-encoder rerank pass (see Notes)
DEFAULT_LIMIT=8 # hits per search
THREADS= # ONNX threads; blank = all cores
Verify by hand
curl -s localhost:8765/mcp \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2026-07-28' \
-H 'Mcp-Method: tools/list' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{
"io.modelcontextprotocol/protocolVersion":"2026-07-28",
"io.modelcontextprotocol/clientCapabilities":{}}}}'
One POST, no initialize handshake — MCP 2026-07-28 is stateless. Both _meta keys are required.
uv run pytest -q # 40 tests: chunking + retrieval quality gate
Numbers
Measured on this corpus (1809 files, 4068 chunks, 4 sources):
| full index | ~2 min native, ~8 min under Docker Desktop on macOS |
| re-index, nothing changed | <1 s |
| re-index, one file edited | ~1 s |
| search | ~6 ms median |
| image | 1.13 GB (both ONNX models baked in) |
| index file | index.db, 43 MB, in the docs-mcp_index volume |
Notes
- Retrieval is three legs fused with weighted Reciprocal Rank Fusion: an exact-phrase leg for
identifiers, BM25 for keywords, and vectors for meaning. The phrase leg is why
acks_lateandworker_concurrencywork — SQLite's tokenizer splits them into common words, so keyword-only search buries them. RERANK=0by default on purpose. A cross-encoder pass was measured on this corpus and gave no improvement on prose queries (fusion already ranks 6 of 7 first) while costing ~740 ms per search instead of 6 ms. It also hurts identifier queries — MRR 0.79 vs 0.92 — because cross-encoders score bare config keys as uniformly irrelevant. Identifier queries bypass it even when enabled. TryRERANK=1if your corpus is more prose-heavy.- Search returns ranked candidates, not a relevance guarantee. A vector search always has nearest neighbours, and on this corpus the best-match distance for a real paraphrase (0.80) overlaps that of an invented word (0.83) — too close to threshold without losing real recall. A query with no searchable token at all returns nothing.
- The index is a named volume (
docs-mcp_index), not a bind mount — the container runs as the non-rootappuser (uid 999), and a bind-mounted host directory arrives with the host's ownership, so/datais unwritable on a fresh Linux clone. Back up withdocker compose cp server:/data/index.db ./index.db; restore with the same in reverse.docker compose down -vdeletes it and starts over. - The server mounts only the index volume. The docs tree goes to the indexer only, and
fetch_docserves from the index, so the server has no filesystem path to traverse. - Embeddings run on CPU in the container (
bge-small-en-v1.5, 384-dim), models baked into the image,HF_HUB_OFFLINE=1. No network at runtime. - Changing
DENSE_MODELforces a full rebuild automatically — vectors from two models aren't comparable. - The SDK also serves pre-2026 MCP revisions, so
GET /mcpopens a legacy SSE stream instead of returning 405, and a request omittingMCP-Protocol-Versionis treated as2025-03-26. Both are the spec's backward-compatibility allowances, not strict-2026-only behaviour.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。