OK

olafgeibig/knowledge-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

59 stars 10 forks 质量 71 趋势 13MIT

这是一个本地运行的知识库MCP服务器,采用了使用LightRAG的向量和图混合RAG引擎

概览

是一款MCP服务器,旨在弥合专业知识领域与AI助手之间的差距。它允许用户创建、管理和查询专用知识库,使AI代理通过MCP(模型上下文协议)服务器接口访问这些信息。 核心理念是赋能作为MCP客户端的AI助手(如Claude Desktop或IDE如Windsurf)在推理过程(Chain of Thought)中主动咨询这些专业知识库,而不仅仅是依赖通用语义搜索来对应用户提示或广泛的网络搜索。这使得在处理特定领域时能够做出更准确、更具上下文感知的响应。 * 提供用户友好的命令行界面,用于管理知识库(创建、删除、添加/删除文档、配置、搜索)。* 利用该功能处理文档处理、嵌入、知识图谱创建和复杂查询。

概述(AI 翻译)

1.概述与概念

knowledge-mcp 是一个 MCP 服务器,旨在弥合专业知识领域与 AI 助手之间的桥梁。它允许用户创建、管理和查询专用知识库,使 AI 代理通过 MCP(模型上下文协议)服务器接口访问这些信息。

核心理念是赋能作为MCP客户端的AI助手(如Claude Desktop或IDE如Windsurf)在推理过程(Chain of Thought)中主动咨询这些专业知识库,而不仅仅是依赖通用语义搜索来对应用户提示或广泛的网络搜索。这使得在处理特定领域时能够做出更准确、更具上下文感知的响应。

关键组成部分:

  • CLI 工具: 提供用户友好的命令行界面,用于管理知识库(创建、删除、添加/删除文档、配置、搜索)。
  • 知识库引擎: 利用 LightRAG 处理文档处理、嵌入、知识图谱创建和复杂查询。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

knowledge-mcp: Specialized Knowledge Bases for AI Agents

1. Overview and Concept

knowledge-mcp is a MCP server designed to bridge the gap between specialized knowledge domains and AI assistants. It allows users to create, manage, and query dedicated knowledge bases, making this information accessible to AI agents through an MCP (Model Context Protocol) server interface.

The core idea is to empower AI assistants that are MCP clients (like Claude Desktop or IDEs like Windsurf) to proactively consult these specialized knowledge bases during their reasoning process (Chain of Thought), rather than relying solely on general semantic search against user prompts or broad web searches. This enables more accurate, context-aware responses when dealing with specific domains.

Key components:

  • CLI Tool: Provides a user-friendly command-line interface for managing knowledge bases (creating, deleting, adding/removing documents, configuring, searching).
  • Knowledge Base Engine: Leverages LightRAG to handle document processing, embedding, knowledge graph creation, and complex querying.
  • MCP Server: Exposes the search functionality of the knowledge bases via the FastMCP protocol, allowing compatible AI agents to query them directly.

2. About LightRAG

This project utilizes LightRAG (HKUDS/LightRAG) as its core engine for knowledge base creation and querying. LightRAG is a powerful framework designed to enhance Large Language Models (LLMs) by integrating Retrieval-Augmented Generation (RAG) with knowledge graph techniques.

Key features of LightRAG relevant to this project:

  • Document Processing Pipeline: Ingests documents (PDF, Text, Markdown, DOCX), chunks them, extracts entities and relationships using an LLM, and builds both a knowledge graph and vector embeddings.
  • Multiple Query Modes: Supports various retrieval strategies (e.g., vector similarity, entity-centric, relationship-focused, hybrid) to find the most relevant context for a given query.
  • Flexible Storage: Can use different backends for storing key-value data, vectors, graph information, and document status (this project uses the default file-based storage).
  • LLM/Embedding Integration: Supports various providers like OpenAI (used in this project), Ollama, Hugging Face, etc.

By using LightRAG, knowledge-mcp benefits from advanced RAG capabilities that go beyond simple vector search.

3. Installation

Ensure you have Python 3.12 and uv installed.

  1. Running the Tool: After installing the package (e.g., using uv pip install -e .), you can run the CLI using uvx:
    # General command structure (use either --config or --base)
    uvx knowledge-mcp --config   [arguments...]
    uvx knowledge-mcp --base   [arguments...]
    
    # Example: Start interactive shell
在 GitHub 查看完整 README

安装

uvx knowledge-mcp --config <absolute-path-to-your-config.yaml> mcp
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "knowledge-mcp": { "command": "uvx", "args": [ "knowledge-mcp", "--config", "<absolute-path-to-your-config.yaml>", "mcp" ] } } }