Knowledge Base MCP Server logo

Knowledge Base MCP Server

by MCP-Mirror

This MCP server provides tools for listing and retrieving content from different knowledge bases. It leverages semantic search to find relevant information within specified knowledge domains.

View on GitHub

Last updated: N/A

What is Knowledge Base MCP Server?

The Knowledge Base MCP Server is a tool designed to list and retrieve content from various knowledge bases. It utilizes a FAISS index and Hugging Face embeddings to perform semantic searches, allowing users to find relevant information based on a query.

How to use Knowledge Base MCP Server?

To use the server, you need to clone the repository, install dependencies, configure environment variables (including the Hugging Face API key and the knowledge base directory), build the server, and add it to the MCP settings. After setup, you can use the list_knowledge_bases and retrieve_knowledge tools through the MCP interface to list available knowledge bases and retrieve similar chunks based on a query.

Key features of Knowledge Base MCP Server

  • Lists available knowledge bases

  • Retrieves similar chunks from knowledge bases based on a query

  • Performs semantic search using a FAISS index

  • Automatically updates the FAISS index when knowledge base files are modified

  • Supports specifying a knowledge base to search within, or searching all available knowledge bases

  • Uses Hugging Face embeddings for semantic similarity calculations

Use cases of Knowledge Base MCP Server

  • Quickly finding relevant information within a company's documentation

  • Providing support agents with relevant knowledge base articles based on customer queries

  • Onboarding new employees by providing access to relevant training materials

  • Building a chatbot that can answer questions based on a knowledge base

FAQ from Knowledge Base MCP Server

What is the purpose of the HUGGINGFACE_API_KEY environment variable?

The HUGGINGFACE_API_KEY is required to use the Hugging Face Inference API, which generates embeddings for the knowledge base content, enabling semantic search.

What happens if I don't set the KNOWLEDGE_BASES_ROOT_DIR environment variable?

If you don't set KNOWLEDGE_BASES_ROOT_DIR, it will default to $HOME/knowledge_bases, where $HOME is the current user's home directory.

How does the server determine if a knowledge base file has been modified?

The server calculates the SHA256 hash of each file and stores it in a hidden .index subdirectory. This hash is used to determine if the file has been modified since the last indexing.

What file types are supported for knowledge base content?

The server recursively reads all text files (e.g., .txt, .md) within the specified knowledge base subdirectories.

What is the output format of the retrieve_knowledge tool?

The output is a markdown formatted string with the content of the most similar chunk, the source file, and a similarity score.