MCP Knowledge Base Server
MCP сервер базы знаний
Сервер MCP (Model Context Protocol), который предоставляет AI-ассистентам — Claude Desktop, Cursor или любому MCP-клиенту — доступ к поиску по внутренней базе знаний компании из Markdown-документов.
Спросите своего ассистента «как мне развернуть приложение в продакшн?» или «сколько отпускных дней мне положено?» — и он найдёт информацию в базе знаний, прочитает соответствующие статьи и ответит со ссылками на источники, вместо того чтобы выдумывать ваши внутренние процессы.
Возможности
6 инструментов — поиск по ключевым словам с фрагментами, получение полного документа, фильтрованный список, просмотр тегов, горячая перезагрузка и статистика
2 типа ресурсов — просмотр всего индекса или любого документа напрямую (
kb://index,kb://documents/{doc_id})1 шаблон промпта —
answer_from_knowledge_baseобосновывает ответы результатами поиска и требует цитированияНоль инфраструктуры — база знаний — это просто папка с
.md-файлами с опциональным frontmatter; отлично работает на базе Git-репозиторияДва транспорта — stdio для локальных клиентов, HTTP для общих/удалённых конфигураций
Лёгкий по зависимостям — FastMCP + небольшой встроенный индекс в стиле TF-IDF; не требуется ни базы данных, ни сервиса эмбеддингов
Related MCP server: search-docs
Архитектура
┌─────────────────┐ 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
{
"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_config.json:
KB_DIR=/path/to/docs mcp-knowledge-base --transport http --port 8000
# → streamable HTTP endpoint at http://127.0.0.1:8000/mcpПерезапустите Claude Desktop и спросите: «Найди в нашей базе знаний — какова процедура отката, если развёртывание пошло не так?»
Запуск через HTTP (общие/удалённые конфигурации)
---
title: Deploying to Production
tags: [deploy, production, runbook]
department: engineering
updated: 2025-11-02
---
# Deploying to Production
…Формат документов
├── 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Подойдёт любая папка с .md-файлами. Опциональный frontmatter обогащает результаты:
GXP9
doc_id документа — это его путь относительно KB_DIR без расширения (например, engineering/deploy-guide). Заголовок берётся из первого заголовка #, а если его нет — из имени файла.
Справочник API
Инструменты
Инструмент | Описание |
| Ранжированный поиск по ключевым словам; возвращает doc_id, title, tags, snippet, score |
| Полное Markdown-содержимое + метаданные одной статьи |
| Список всех статей, с возможной фильтрацией |
| Все теги с количеством документов |
| Повторное сканирование |
| Количество документов, количество тегов, возраст индекса |
Ресурсы
URI | Описание |
| Человекочитаемый индекс всех документов |
| Полное содержимое одного документа |
Промпты
Промпт | Описание |
| Ищет в базе знаний, затем инструктирует модель отвечать только на основе фрагментов и цитировать doc_ids |
Переменные окружения
Переменная | По умолчанию | Описание |
|
| Корневая папка с Markdown-документами |
|
| Имя сервера, отображаемое MCP-клиентам |
Структура проекта
GXP10
Расширение
Лучший поиск: замените
KnowledgeBaseIndexна эмбеддинги + векторную БД (интерфейс инструментов останется прежним).Другие источники: индексируйте экспорт Confluence/Notion — всё, что превращается в Markdown, работает без изменений.
Актуальность: запускайте
reload_knowledge_baseпо расписанию или следите заKB_DIRс помощью файлового watcher'а.
Лицензия
MIT — см. LICENSE.
Available Tools
6 toolsget_documentA
Fetch the full Markdown content of one knowledge-base article.
Inputs: doc_id (required). Returns: object
list_documentsA
List every article in the knowledge base, optionally filtered.
Inputs: tag, department. Returns: result
list_tagsA
List all tags used across the knowledge base, with document counts.
Inputs: no named parameters. Returns: object
reload_knowledge_baseA
Re-scan the knowledge-base directory to pick up new or edited articles.
Returns: Number of documents now indexed.
Inputs: no named parameters. Returns: object
search_knowledge_baseA
Search the company knowledge base with natural language or keywords.
Use this FIRST whenever a question might be answered by internal documentation (processes, runbooks, policies, architecture, onboarding…).
Inputs: query (required), tag, limit. Returns: result
statsB
Basic knowledge-base statistics (document count, tags, index age).
Inputs: no named parameters. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose: searching, fetching full documents, listing documents, listing tags, reloading the index, and showing stats. There is no overlap that would cause an agent to select the wrong tool.
All tool names follow a consistent verb_noun pattern (search_, get_, list_, reload_, etc.). The pattern is predictable and easy to infer for additional tools.
Six tools is well within the ideal range for a knowledge base server. Each tool serves a distinct function, and the count feels neither too sparse nor bloated.
The tool set covers all core operations: search, read, list, and maintenance. Minor gaps exist (e.g., no tool to add or delete documents via the API, but that may be intentionally managed filesystem-side). Reload and stats provide necessary lifecycle support.
Related MCP Connectors
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
Convert PDFs, Office docs, websites and audio into AI-ready Markdown, then search and ask your docs.
Shared markdown docs for people and AI agents, kept as plain files in your team's GitHub repo.
- Very Simple NotesDeprecatedcom.verysimplenotes
Markdown notes in folders, with files, that your AI assistant can read, write and organise.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI models to seamlessly access and query local markdown technical documentation files, providing automatic documentation context without explicit prompting.5ISC
- AlicenseAqualityBmaintenanceEnables AI agents to search local Markdown documents using natural language, with automatic indexing and section-level retrieval.101MIT
- AlicenseNot gradedqualityDmaintenanceProvides AI assistants with direct access to local Markdown documentation libraries, enabling them to list, read, and search through docs on demand.MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to search, read, and navigate a folder of Markdown notes as a knowledge base, with full-text search, backlinks, tags, metadata, and note resources for conversation attachment.1MIT