Skip to main content
Glama

BDC Doc RAG

bdc-assist 的文档 RAG MCP

bdc_doc_mcp/config.py      env-driven embeddings/LLM/Chroma (replaces utils/__init__.set_emb_llm)
bdc_doc_mcp/ingest.py      .pkl/.md/.mdx/.txt/.pdf → embeddings → Chroma (replaces utils/chroma/utils.py)
bdc_doc_mcp/api.py         FastAPI: /health /search
bdc_doc_mcp/mcp_server.py  search_docs MCP tool for AI agents — self-contained, same search as the API
bdc_doc_mcp/preproc/       source-specific preprocessing pipeline
tests/                     self-checks + API / agent notebooks
data/                      preproc output (*.pkl), ingest input

设置

uv sync
cp .env.example .env    # then fill in keys/URLs

源仓库

仅预处理(--sources all)时需要;API/MCP 服务器和摄取现有 .pkl 文件无需它们。克隆到本仓库旁边(或将环境变量指向它们):

git clone https://github.com/stagecc/interim-bdc-website ../interim-bdc-website   # BDC_WEBSITE_DIR
git clone https://github.com/stagecc/bdc-gitbook ../bdc-gitbook                   # BDC_GITBOOK_DIR

模型

补全使用 Azure 上的 OpenAI API(默认为 gpt-4o-mini

嵌入使用 Sterling 上的 Ollama(通过 RENCI VPN 连接)

kubectl -n ner port-forward svc/ollama 11434:11434

或使用本地 Ollama 搭配 groonga/bge-m3-Q4_K_M-GGUF 模型。

Related MCP server: okfy

摄取

从每个源完整重建(需要克隆两个源仓库 — 见设置;写入 data/*.pkl,然后加载它们):

uv run python -m bdc_doc_mcp.preproc.pipeline --sources all --ingest --reset

单个文件或目录:

uv run python -m bdc_doc_mcp.ingest ./data/docs.pkl --doc-type docs   # BDC_Chatbot preproc .pkl
uv run python -m bdc_doc_mcp.ingest ../interim-bdc-website/src/pages --doc-type page --reset

嵌入模型在集合内不可互换 — bge-m3 是 1024 维,text-embedding-3-small 是 1536 维。切换模型意味着 --reset 并完全重新摄取。

API

uv run uvicorn bdc_doc_mcp.api:app --port 8000     # docs at /docs

端点

请求体

返回

GET /health

{status, documents}

POST /search

{query, k, mode?, doc_type?, date_from?, date_to?}

排序后的分块 + 元数据 + 分数

modeembedding(默认;语义相似度,分数 = 距离,越低越好)或 keyword(模糊字面词匹配 — 忽略大小写/标点并容忍小拼写错误,因此 picsure 能找到 "PIC-SURE";分数 = 出现次数,越高越好 — 用于精确名称/缩写)。 doc_type 是要搜索的类型 CSV(例如 page,faq)。省略时,仅搜索 docspagefaqvideo — 显式指定 fellowupdateevent 才能搜索它们。 date_from/date_toYYYY-MM-DD,含端点)按日期过滤;只有 event 和 update 文档带有日期,因此日期过滤器会隐式缩小到这些类型。

该服务在设计上仅用于搜索;摄取通过 CLI 离线进行(见摄取),回答是调用方的职责 — 代理自带 LLM。

MCP

uv run python -m bdc_doc_mcp.mcp_server           # stdio
uv run python -m bdc_doc_mcp.mcp_server --http    # streamable HTTP, port MCP_PORT (default 8001)

暴露一个工具 search_docs — 与 API 相同的搜索,但直接查询 Chroma,因此无需运行 API 服务。需要已摄取的 .chroma_db + 嵌入。

Stdio 客户端(Claude Desktop/Code、Cursor)自行启动服务器 — 注册它:

{"mcpServers": {"bdc-doc-mcp": {
  "command": "uv",
  "args": ["--directory", "/path/to/bdc-doc-mcp", "run", "python", "-m", "bdc_doc_mcp.mcp_server"]
}}}

网络客户端:改为运行 --http 并将它们指向 http://host:8001/mcp

冒烟测试:uv run python tests/test_mcp.py

预处理

bdc_doc_mcp/preproc/ 是 BDC_Chatbot 流水线的移植:

模块

来源

移植自 (BDC_Chatbot)

说明

bdc_repo.py

interim-bdc-website MDX

utils/preproc/proc_BDC_repo.py(基本逐字)

fellows、events、latest-updates、pages

bdc_docs.py

bdc-gitbook markdown

utils/preproc/proc_BDC_docs.py(移除了模块级 LLM 初始化)

按标题层级分块;需要克隆仓库

freshdesk.py

bdcatalyst.freshdesk.com

utils/preproc/proc_freshdesk.py

实时抓取

vids.py

Google Sheet + Drive SRT

utils/preproc/proc_BDC_vids.py(GoogleSheetsReader 类已扁平化)

带时间戳 URL 的视频转录

utils.py

LLM 分块上下文化 + 摘要器

pipeline.py

utils/preproc_doc.py

编排器

--no-contextualize 跳过每个分块的 LLM 调用(更快,检索效果较弱)。 源路径来自 BDC_WEBSITE_DIR / BDC_GITBOOK_DIR

测试

uv run python tests/test_ingest.py                             # batching + chunk-id logic, no network
uv run python tests/test_keyword.py                            # keyword ranking, pure function, no DB or API
uv run python tests/test_mcp.py                                # starts the server over stdio and exercises its tools; needs .chroma_db + embeddings

笔记本(每个在空闲端口上启动 API 并在结束时关闭;两者都需要已摄取的 .chroma_db):

  • tests/api_test.ipynb — 纯 API 演练:/health/searchdoc_type 过滤器。只需要本地嵌入。

  • tests/agent_test.ipynb — 一个工具调用代理(deepagents):配置的 LLM 将 search_docs 作为 LangChain 工具,并决定何时调用它。还需要补全提供方可访问。

Install Server
F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides semantic search over markdown documentation using RAG, allowing natural language queries and integration with MCP clients.
    1
    MIT
  • A
    license
    Not graded
    quality
    B
    maintenance
    Enables AI agents to search, read, and traverse documentation bundles in Open Knowledge Format via MCP tools.
    733
    66
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides RAG (Retrieval Augmented Generation) access to technical documentation through MCP, enabling LLMs to search and retrieve relevant documentation on-demand.
    4
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    Crawl documentation sites, index them with hybrid search, and expose them as MCP tools so LLM agents can search and retrieve current docs.
    MIT

View all related MCP servers

Related MCP Connectors

  • Agentic search over your Dewey document collections from any MCP-compatible client.

  • Turn a GitHub repo or docs site into agent-ready context: pack it or search it, over MCP.

  • Query any docs site via MCP. Submit a URL, ask questions, get cited answers.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bdc-assist/bdc-doc-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server