knowledge-mcp
语义搜索知识库,支持文档获取和索引刷新,使AI Agent能够检索团队知识。
README
知识库 (Knowledge Base) & MCP Server
这是一个双用途的知识库项目:它既是一个美观的 VitePress 文档站点,也是一个功能强大的 MCP (Model Context Protocol) 资料库。你可以通过它来沉淀团队知识,并无缝接入 AI Agent(如 Codex、Claude、Cursor)来辅助开发。
🚀 核心特性
- 双向使用:支持人工在线查阅(VitePress)与 AI Agent 语义检索(MCP RAG)。
- 语义搜索:集成 ChromaDB 向量数据库,支持基于语义而非关键词的知识召回。
- 通用接入:支持 stdio、HTTP、SSE 三种传输协议,兼容所有主流 MCP 客户端。
- 增量索引:自动追踪文件变更,仅对更新内容进行索引,高效稳定。
- 安全加固:内置路径校验,防止路径穿越风险。
📂 项目结构
.
├── bin/
│ └── knowledge-mcp # MCP 服务启动脚本 (推荐入口)
├── docs/
│ ├── 业务场景/ # 业务规则、流程文档
│ ├── UI组件/ # 前端组件 API 与用法
│ ├── 编码规范/ # 团队代码风格指南
│ └── .vitepress/ # VitePress 站点配置与构建产物
├── mcp-server/
│ ├── server.py # MCP RAG 服务核心逻辑
│ ├── requirements.txt # Python 依赖声明
│ └── examples/ # 客户端配置示例
├── MAINTENANCE.md # 详细的知识库维护手册
└── README.md # 项目主说明文档
🛠️ 快速上手
1. 环境准备
确保你的系统中安装了 Node.js 和 Python 3.10+。
2. 安装依赖
# 安装前端文档站依赖
npm install
# 安装 MCP Server 依赖
cd mcp-server
pip install -r requirements.txt
3. 运行文档站 (人工查阅)
npm run docs:dev
访问 http://localhost:5173 即可实时预览文档。
4. 启动 MCP 服务 (Agent 接入)
使用根目录的脚本启动:
# 默认 stdio 模式启动
./bin/knowledge-mcp
# 以 HTTP 模式启动并开启安全验证
./bin/knowledge-mcp --transport http --port 8000 --token my-secret-token
🤖 Agent 接入指南
接入 Codex / Claude Desktop
在你的 MCP 配置文件中添加如下片段:
{
"mcpServers": {
"frontend-knowledge": {
"command": "bash",
"args": ["-lc", "cd /path/to/project && ./bin/knowledge-mcp --transport stdio"],
"env": {
"KB_DIR": "./docs"
}
}
}
}
可用工具 (Tools)
search_knowledge: 语义搜索最相关的知识片段。get_document: 获取指定路径的完整 Markdown 文档。refresh_index: 触发知识库增量同步。
📝 维护说明
为了保证 Agent 检索的准确性,请在编写文档时遵循以下规范:
- 二级标题分块:MCP Server 按
##标题切分内容,请确保每个二级标题下的内容完整且独立。 - 刷新索引:新增或修改文档后,需重启服务或让 Agent 调用
refresh_index。
更多细节请参阅:[MAINTENANCE.md](file:///Users/caitao/work/knowledge/MAINTENANCE.md)。
📜 许可证
本项目基于 ISC License 开源。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.