Token导航 LogoToken导航TokenDH.com
Doc Hub logo
搜索检索stdio官方级别未说明来源级核验

Doc Hub

MCP Server

doc-hub是一个多语料库文档搜索引擎,支持混合向量和全文检索,通过MCP协议为LLM代理提供服务。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
文档检索PythonClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

kingfly55

提供方

kingfly55

最后核验

2026/5/17 20:20

运行时

Docker

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

docker run -d --name vchord-postgres \

详细介绍

doc中心

具有混合矢量+全文检索的多语料库文档搜索引擎,通过MCP(模型上下文协议)公开,供LLM代理使用。

它做什么

doc-hub从各种来源获取文档,将其解析为语义上有意义的块,用可插拔的嵌入器嵌入它们,用VectorChord在PostgreSQL中对它们进行索引,并通过MCP服务器或CLI提供混合搜索(矢量KNN+BM25全文,通过RRF融合)。

插件系统允许您添加新的获取器、解析器和嵌入器,而无需修改dochub本身。

安装

doc-hub是从GitHub安装的(未发布到PyPI)。

# Install globally from GitHub (recommended)
uv tool install --force git+https://github.com/kingfly55/doc-hub.git

# Or install globally from a local clone while developing
uv tool install --force /path/to/doc-hub

# Or run from a local clone without a global install
git clone https://github.com/kingfly55/doc-hub.git && cd doc-hub
uv sync
source .venv/bin/activate

验证:

doc-hub --help
man doc-hub
# fallback if your shell has not picked up the installed manpath yet
doc-hub man

man doc-hub 是已安装CLI的简明本地参考。 doc-hub man 是直接打印捆绑的手册页文本的内置回退。

支持的命令界面是统一的 doc-hub CLI。统一前的旧包装,如 doc-hub-search, doc-hub-pipeline, doc-hub-eval, doc-hub-sync-all,以及 doc-hub-mcp 不应该留在你的路径上。

需求

  • Python>=3.11
  • PostgreSQL与 VectorChord 扩展
  • Gemini API密钥(免费层工作)-或自定义嵌入式插件

快速启动

1.使用VectorChord启动PostgreSQL

docker run -d --name vchord-postgres \
  -e POSTGRES_PASSWORD=mypassword \
  -p 5432:5432 \
  tensorchord/vchord-postgres:latest

2.设置环境变量

对于全球 doc-hub 安装时,最持久的设置是doc-hub的XDG数据目录下的一个机器范围的env文件:

mkdir -p ~/.local/share/doc-hub
cat > ~/.local/share/doc-hub/env " }
    }
  }
}

上海证券交易所 (连接到正在运行的服务):

{
  "mcpServers": {
    "doc-hub": {
      "type": "sse",
      "url": "http://localhost:8340/sse"
    }
  }
}

docs/user/mcp-server.md 有关传输详细信息和systemd服务设置。

作为systemd服务运行

cat > ~/.config/systemd/user/doc-hub-serve-mcp.service << 'EOF'
[Unit]
Description=doc-hub MCP Server (SSE on :8340)
After=network.target postgresql.service

[Service]
Type=simple
WorkingDirectory=%h
ExecStart=%h/.local/bin/doc-hub serve mcp --transport sse --port 8340
Restart=always
RestartSec=10
Environment=HOME=%h
EnvironmentFile=%h/.local/share/doc-hub/env

[Install]
WantedBy=default.target
EOF

systemctl --user daemon-reload
systemctl --user enable --now doc-hub-serve-mcp.service

插件系统

doc-hub使用基于Python入口点的插件架构。三种插件类型:

插件类型入口点组协议
费彻doc_hub.fetchersdoc_hub.protocols.Fetcher
解析器doc_hub.parsersdoc_hub.protocols.Parser
嵌入器doc_hub.embeddersdoc_hub.protocols.Embedder

内置取料机: llms_txt, sitemap, git_repo, local_dir, direct_url. 内置解析器: markdown. 内置嵌入器: gemini.

docs/dev/plugin-authorization.md 获取编写插件的完整指南。

作为一个图书馆

import asyncio
from doc_hub.search import search_docs
from doc_hub.db import create_pool

async def main():
    pool = await create_pool()
    results = await search_docs("how do I define a tool?", pool=pool, corpora=["pydantic-ai"])
    for r in results:
        print(f"{r.heading} (sim={r.similarity:.3f})")
    await pool.close()

asyncio.run(main())

数据存储

doc-hub将本地数据(原始下载、块缓存、嵌入缓存)存储在XDG兼容目录中:

  1. DOC_HUB_DATA_DIR env-var(显式重写)
  2. $XDG_DATA_HOME/doc-hub 如果 XDG_DATA_HOME 已设置
  3. ~/.local/share/doc-hub (默认)
~/.local/share/doc-hub/
├── {corpus-slug}/
│   ├── raw/                       # downloaded .md files + manifest.json
│   └── chunks/
│       ├── chunks.jsonl           # parsed chunks
│       ├── embedded_chunks.jsonl  # chunks with embedding vectors
│       └── embeddings_cache.jsonl # embedding cache (keyed by content hash)
└── plugins/                       # local plugin files (alternative to entry points)
    ├── fetchers/
    ├── parsers/
    └── embedders/

环境变量

变量默认值描述
GEMINI_API_KEY--内置Gemini嵌入器需要
JINA_API_KEY--必需 sitemap fetcher和 llms_txt--use-jina/--try-md
DOC_HUB_DATABASE_URL--完整连接字符串(覆盖PG\*vars)
PGHOSTlocalhostPostgreSQL主机
PGPORT5432PostgreSQL端口
PGDATABASEpostgres数据库名称
PGUSERpostgres数据库用户
PGPASSWORD--数据库密码(必填)
DOC_HUB_DATA_DIR~/.local/share/doc-hub覆盖数据目录
DOC_HUB_EVAL_DIR{data_root}/eval/覆盖eval目录
LOGLEVEL--设置为 DEBUG 用于详细输出

测试

# Unit tests (no DB or API key needed)
pytest tests/

# Integration tests (requires live DB + GEMINI_API_KEY)
pytest tests/ -m integration

文档

目录标签

目录标签

文档检索PythonClaude本地部署向量搜索全文检索LLM工具插件系统

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

api-key

运行时(runtime,运行环境)

Docker

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdioapi-key部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP