Enterprise Knowledge MCP Server
Enables querying enterprise documents (DOCX, PDF, PPTX) using natural language, with hybrid search and MCP integration for Claude Desktop and other agents.
README
Enterprise Knowledge MCP Server
Unstructured Data Pipeline & Remote MCP Server — a production-ready enterprise document knowledge base. Ingests DOCX / PDF / PPTX, parses with Docling, cleans and chunks with metadata, indexes into a hybrid search store, and exposes a Remote MCP Server for Claude Desktop and other agents.
Status
Built incrementally, one step at a time (see CLAUDE.md for the full plan).
- [x] Step 1 — Project Bootstrap: FastAPI + FastMCP + Docker + Pytest
- [x] Step 2 — Document Upload:
POST/GET /documents+ persistent catalogue (DOCX/PDF/PPTX); upload now auto-runs the full pipeline and indexes immediately (no restart) - [x] Step 3 — Docling Parser: Docling -> structured
ParsedDocument(headings/text/tables/figures, page & slide provenance) - [x] Step 4 — Cleaning Pipeline: strip repeated headers/footers, page numbers, empty/symbol-only noise (structure preserved)
- [x] Step 5 — Metadata-aware Chunking: semantic chunks (section/table/figure) with full metadata; no fixed-width cuts
- [x] Step 6 — Chroma Indexing: BGE dense embeddings into embedded persistent Chroma (
index/search/get/delete) - [x] Step 7 — Hybrid Retrieval: dense (BGE) + sparse (BM25) fused with RRF; mixed CN/EN tokenizer
- [x] Step 8 — MCP Tools:
search_documents/list_documents/get_document/get_chunkon FastMCP - [x] Step 9 — MCP Resources:
documents://allanddocuments://{document_id} - [x] Step 10 — Integration Test: end-to-end MCP protocol test (
Client-> server -> tool/resource) + runnable client demo
Architecture (target)
DOCX / PDF / PPTX
-> Docling Parser
-> Cleaning Pipeline
-> Metadata-aware Chunking
-> Hybrid Search Index (BGE dense + BM25 sparse, Chroma)
-> Remote MCP Server (FastMCP)
-> Claude Desktop
Tech Stack
| Area | Choice |
|---|---|
| Language | Python 3.11 |
| API | FastAPI |
| Parsing | Docling |
| Search | Hybrid Retrieval |
| Dense Retrieval | BGE Embedding |
| Sparse Retrieval | BM25 |
| Vector DB | Chroma (embedded) |
| MCP Framework | FastMCP |
| Deployment | Docker |
| Testing | Pytest |
Quick Start (local)
This repo ships a pre-created virtual environment (kb_mcp_env/, Windows).
# Install dependencies (incl. dev/test extras)
kb_mcp_env\Scripts\python.exe -m pip install -e ".[dev]"
# Run the tests
kb_mcp_env\Scripts\python.exe -m pytest -q
# Run the server
kb_mcp_env\Scripts\python.exe -m uvicorn app.main:app --reload
- Health check: http://localhost:8000/health
- Remote MCP endpoint: http://localhost:8000/mcp
Run with Docker
cp .env.example .env # optional
docker compose up --build
Brings up the app on port 8000. Chroma runs embedded in-process (no separate
service); its data persists in the chroma_storage Docker volume.
Parsing & OCR
提醒:OCR 是在解析時對每張圖跑,26 張圖會增加數十秒解析時間。若某類文件不需要,可在
.env設OCR_IMAGES=false關閉。
提醒:預設 embedding 模型為
BAAI/bge-m3(多語,適合中英混雜,1024 維、約 2.2GB,首次會下載)。若只需英文且要更輕量,可在.env設EMBEDDING_MODEL=BAAI/bge-small-en-v1.5。切換模型若維度不同,需先清空chroma_storage重新索引。
Example Queries (target MCP tools)
What is the yield improvement plan?
Show me the KPI table from Q4 report.
Summarize slide 5.
Add a document (auto-indexed, no restart)
POST /documents saves the file and runs the full pipeline (Docling parse ->
clean -> metadata-aware chunk -> BGE embed -> Chroma index) in the same process,
then refreshes BM25. Because it shares the MCP server's vector-store/retriever
singletons, the document is searchable over MCP immediately — no restart needed.
# server running on :8000
curl.exe -X POST http://127.0.0.1:8000/documents -F "file=@E:\path\to\report.pdf"
# -> 201 {"document_id": "...", "status": "indexed", "num_chunks": 42, ...}
The response carries status (indexed, or failed with HTTP 500 if parsing
errors — the file is still recorded) and num_chunks. The call blocks until
indexing finishes (Docling/OCR/embedding can take tens of seconds for large or
image-heavy files). scripts/ingest_file.py shares the same pipeline for
command-line ingestion.
Verify the MCP Server (client demo + server log)
Start the server, then drive it over the real MCP protocol with the bundled client demo:
# Terminal 1 — run the server
kb_mcp_env\Scripts\python.exe -m uvicorn app.main:app --host 127.0.0.1 --port 8000
# Terminal 2 — connect a remote MCP client and run the example queries
kb_mcp_env\Scripts\python.exe tests\mcp_client_demo.py
# ...or pass your own query:
kb_mcp_env\Scripts\python.exe tests\mcp_client_demo.py "yield improvement plan"
The demo connects (Client -> MCP Server -> search_documents -> Result), lists
the server's tools/resources, reads documents://all, and prints the retrieved
chunks. Meanwhile the server console logs each invocation:
INFO:app.mcp_server:MCP tool invoked: search_documents | query='...' top_k=3
INFO:app.mcp_server:search_documents retrieved 3 chunk(s): [...]
The hermetic equivalent (no running server, isolated temp index) is the pytest integration test:
kb_mcp_env\Scripts\python.exe -m pytest tests\test_mcp_integration.py -q
AI Workflow
This project is developed with an AI-only workflow (Claude Code + MCP). Each
development step follows: plan -> implement -> review -> test, with a dedicated
commit per step. See CLAUDE.md for the step-by-step record.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。