bdc-doc-mcp

bdc-doc-mcp

Provides a documentation search MCP tool (search_docs) that enables AI agents to retrieve relevant chunks from BDC documentation using semantic embeddings and keyword search, with filtering by document type and date.

Category
访问服务器

README

BDC Doc RAG

The documentation RAG MCP of bdc-assist

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

Setup

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

Source repos

Only needed for preprocessing (--sources all); the API/MCP server and ingesting existing .pkl files work without them. Clone next to this repo (or point the env vars at them):

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

Models

For completion, use the OpenAI API on Azure (gpt-4o-mini by default)

For embeddings, use Ollama on Sterling (connect via RENCI VPN)

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

Or using local Ollama with groonga/bge-m3-Q4_K_M-GGUF model.

Ingest

Full rebuild from every source (needs the two source repos cloned — see Setup; writes data/*.pkl, then loads them):

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

Individual files or directories:

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

Embedding models are not interchangeable within a collection — bge-m3 is 1024-dim, text-embedding-3-small 1536. Switching models means --reset and a full re-ingest.

API

uv run uvicorn bdc_doc_mcp.api:app --port 8000     # docs at /docs
Endpoint Body Returns
GET /health — {status, documents}
POST /search {query, k, mode?, doc_type?, date_from?, date_to?} ranked chunks + metadata + score

mode is embedding (default; semantic similarity, score = distance, lower is better) or keyword (fuzzy literal word matching — ignores case/punctuation and tolerates small typos, so picsure finds "PIC-SURE"; score = occurrence count, higher is better — use for exact names/acronyms). doc_type is a CSV of types to search (e.g. page,faq). When omitted, only docs, page, faq, and video are searched — name fellow, update, or event explicitly to search them. date_from/date_to (YYYY-MM-DD, inclusive) filter by date; only event and update docs carry a date, so a date filter implicitly narrows to those types.

The service is search-only by design; ingestion happens offline via the CLI (see Ingest) and answering is the caller's job — an agent brings its own 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)

Exposes one tool, search_docs — same search as the API but queries Chroma directly, so the API service doesn't need to run. Needs an ingested .chroma_db + embeddings.

Stdio clients (Claude Desktop/Code, Cursor) launch the server themselves — register it:

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

Network clients: run --http and point them at http://host:8001/mcp instead.

Smoke test: uv run python tests/test_mcp.py

Preprocessing

bdc_doc_mcp/preproc/ is the BDC_Chatbot pipeline, ported:

Module Source Ported from (BDC_Chatbot) Notes
bdc_repo.py interim-bdc-website MDX utils/preproc/proc_BDC_repo.py (verbatim-ish) fellows, events, latest-updates, pages
bdc_docs.py bdc-gitbook markdown utils/preproc/proc_BDC_docs.py (module-level LLM init removed) chunked by header hierarchy; needs the repo cloned
freshdesk.py bdcatalyst.freshdesk.com utils/preproc/proc_freshdesk.py live scrape
vids.py Google Sheet + Drive SRT utils/preproc/proc_BDC_vids.py (GoogleSheetsReader class flattened) video transcripts with timestamp URLs
utils.py — — LLM chunk contextualizer + summarizer
pipeline.py — utils/preproc_doc.py orchestrator

--no-contextualize skips the per-chunk LLM call (much faster, weaker retrieval). Source paths come from BDC_WEBSITE_DIR / BDC_GITBOOK_DIR.

Tests

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

Notebooks (each starts the API on a free port and shuts it down at the end; both need an ingested .chroma_db):

  • tests/api_test.ipynb — plain API walkthrough: /health, /search, doc_type filter. Only needs the local embeddings.
  • tests/agent_test.ipynb — a tool-calling agent (deepagents): the configured LLM gets search_docs as a LangChain tool and decides when to call it. Also needs the completion provider reachable.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选