MCP Knowledge Base Server
MCP 知识库服务器
一个 MCP(模型上下文协议) 服务器,为 AI 助手——Claude Desktop、Cursor 或任何 MCP 客户端——提供对公司内部知识库中 Markdown 文档的可搜索、结构化访问。
向你的助手提问 "如何部署到生产环境?" 或 "我有多少天年假?",它会搜索知识库、阅读相关文章,并附上引用作答——而不是凭空捏造你的内部流程。
功能特性
6 个工具 — 带摘要的关键词搜索、全文获取、过滤列表、标签浏览、热重载和统计
2 种资源类型 — 直接浏览整个索引或任意文档(
kb://index、kb://documents/{doc_id})1 个提示模板 —
answer_from_knowledge_base将回答锚定在搜索结果中并强制引用零基础设施 — 知识库就是一个包含可选 frontmatter 的
.md文件文件夹;配合 Git 仓库使用效果极佳两种传输方式 — stdio 用于本地客户端,HTTP 用于共享/远程部署
依赖精简 — FastMCP + 内置的小型 TF-IDF 风格索引;无需数据库,无需嵌入服务
Related MCP server: MCP Docs Server
架构
┌─────────────────┐ stdio / HTTP (JSON-RPC) ┌──────────────────────────┐
│ MCP client │ ───────────────────────────▶ │ FastMCP server │
│ (Claude, …) │ ◀─────────────────────────── │ ├─ tools (search, get…) │
└─────────────────┘ │ ├─ resources (kb://…) │
│ └─ prompts (answer…) │
│ │ │
│ KnowledgeBaseIndex │
│ (tokenize → TF-IDF) │
└──────────┬─────────────┘
│ scans
┌──────────▼─────────────┐
│ knowledge_base/ │
│ engineering/*.md │
│ hr/*.md product/*.md │
└────────────────────────┘快速开始
git clone <your-repo-url> mcp-knowledge-base-server
cd mcp-knowledge-base-server
pip install .将服务器指向你自己的文档(或使用附带的示例语料库):
export KB_DIR=/path/to/your/markdown/docs运行演示
pip install fastmcp # only dependency the demo needs
python examples/demo_client.py演示通过 stdio 启动服务器并演练所有能力——搜索、文档获取、列表、资源和基于引用的回答提示——打印真实客户端会看到的完整 JSON-RPC 载荷。
连接 Claude Desktop
在 claude_desktop_config.json 中添加:
{
"mcpServers": {
"knowledge-base": {
"command": "python",
"args": ["-m", "mcp_knowledge_base.server"],
"env": {
"PYTHONPATH": "/absolute/path/to/mcp-knowledge-base-server/src",
"KB_DIR": "/absolute/path/to/mcp-knowledge-base-server/knowledge_base"
}
}
}
}重启 Claude Desktop,然后提问:"搜索我们的知识库——如果部署出错,回滚流程是什么?"
通过 HTTP 运行(共享/远程部署)
KB_DIR=/path/to/docs mcp-knowledge-base --transport http --port 8000
# → streamable HTTP endpoint at http://127.0.0.1:8000/mcp文档格式
任何包含 .md 文件的文件夹都可以。可选的 frontmatter 可丰富结果:
---
title: Deploying to Production
tags: [deploy, production, runbook]
department: engineering
updated: 2025-11-02
---
# Deploying to Production
…文档的 doc_id 是其相对于 KB_DIR 的路径(不含扩展名)(例如 engineering/deploy-guide)。标题回退到第一个 # 标题,然后是文件名。
API 参考
工具
工具 | 描述 |
| 排序关键词搜索;返回 doc_id、标题、标签、摘要、得分 |
| 单篇文章的完整 Markdown 内容 + 元数据 |
| 列出所有文章,可选过滤 |
| 所有标签及其文档数量 |
| 重新扫描 |
| 文档数量、标签数量、索引年龄 |
资源
URI | 描述 |
| 每篇文档的可读索引 |
| 单篇文档的完整内容 |
提示
提示 | 描述 |
| 搜索知识库,然后指示模型仅根据摘录作答并引用 doc_ids |
环境变量
变量 | 默认值 | 描述 |
|
| Markdown 文档的根文件夹 |
|
| 向 MCP 客户端显示的服务器名称 |
项目结构
├── knowledge_base/ # sample corpus (replace with your own)
│ ├── engineering/*.md
│ ├── hr/*.md
│ └── product/*.md
├── src/mcp_knowledge_base/
│ ├── server.py # FastMCP server: tools, resources, prompts
│ └── index.py # document loading + TF-IDF-style search
├── examples/
│ └── demo_client.py # end-to-end demo over stdio
└── pyproject.toml扩展它
更好的搜索:将
KnowledgeBaseIndex替换为嵌入 + 向量数据库(工具接口保持不变)。其他来源:索引 Confluence/Notion 导出——任何最终成为 Markdown 的内容都可以原样使用。
新鲜度:按计划运行
reload_knowledge_base,或使用文件系统监视器监视KB_DIR。
许可证
MIT — 参见 LICENSE。
Maintenance
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
- AlicenseNot gradedqualityDmaintenanceEnables AI models to seamlessly access and query local markdown technical documentation files, providing automatic documentation context without explicit prompting.175ISC
- AlicenseNot gradedqualityDmaintenanceProvides direct access to local documentation files through simple search and overview tools, enabling LLMs to query project-specific markdown documentation without requiring vector databases or RAG pipelines.MIT
- AlicenseAqualityAmaintenanceEnables AI agents to search local Markdown documents using natural language, with automatic indexing and section-level retrieval.921MIT
- AlicenseNot gradedqualityDmaintenanceGives AI agents full-text search over any Markdown/MDX documentation folder.14MIT
Related MCP Connectors
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
Serve a folder of Markdown notes as an MCP server: hybrid search, reading, and sourced answers.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/Sachin-wish/mcp-knowledge-base-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server