knowledge base retrieval.com
knowledge base retrieval.com logo

Knowledge Base Retrieval

Integrates with knowledge bases to enable efficient content retrieval and vectorization for question answering and infor...

Created byApr 23, 2025

Knowledge Base MCP Server

This MCP server provides tools for listing and retrieving content from different knowledge bases.

Setup Instructions

These instructions assume you have Node.js and npm installed on your system.
Prerequisites
  • npm (Node Package Manager)
  1. Clone the repository:
  1. Install dependencies:
  1. Configure environment variables:
  1. Build the server:
  1. Add the server to the MCP settings:
  1. Create knowledge base directories:
  • The server recursively reads all text files (e.g., .txt, .md) within the specified knowledge base subdirectories.
  • The server skips hidden files and directories (those starting with a .).
  • For each file, the server calculates the SHA256 hash and stores it in a file with the same name in a hidden .index subdirectory. This hash is used to determine if the file has been modified since the last indexing.
  • The file content is splitted into chunks using the MarkdownTextSplitter from langchain/text_splitter.
  • The content of each chunk is then added to a FAISS index, which is used for similarity search.
  • The FAISS index is automatically initialized when the server starts. It checks for changes in the knowledge base files and updates the index accordingly.

Usage

The server exposes two tools:
  • list_knowledge_bases: Lists the available knowledge bases.
  • retrieve_knowledge: Retrieves similar chunks from the knowledge base based on a query. Optionally, if a knowledge base is specified, only that one is searched; otherwise, all available knowledge bases are considered. By default, at most 10 document chunks are returned with a score below a threshold of 2. A different threshold can optionally be provided using the threshold parameter.
You can use these tools through the MCP interface.
The retrieve_knowledge tool performs a semantic search using a FAISS index. The index is automatically updated when the server starts or when a file in a knowledge base is modified.
The output of the retrieve_knowledge tool is a markdown formatted string with the following structure:
Each result includes the content of the most similar chunk, the source file, and a similarity score.

Knowledge Base MCP Server

This MCP server provides tools for listing and retrieving content from different knowledge bases.

Setup Instructions

These instructions assume you have Node.js and npm installed on your system.
Prerequisites
  • npm (Node Package Manager)
  1. Clone the repository:
  1. Install dependencies:
  1. Configure environment variables:
  1. Build the server:
  1. Add the server to the MCP settings:
  1. Create knowledge base directories:
  • The server recursively reads all text files (e.g., .txt, .md) within the specified knowledge base subdirectories.
  • The server skips hidden files and directories (those starting with a .).
  • For each file, the server calculates the SHA256 hash and stores it in a file with the same name in a hidden .index subdirectory. This hash is used to determine if the file has been modified since the last indexing.
  • The file content is splitted into chunks using the MarkdownTextSplitter from langchain/text_splitter.
  • The content of each chunk is then added to a FAISS index, which is used for similarity search.
  • The FAISS index is automatically initialized when the server starts. It checks for changes in the knowledge base files and updates the index accordingly.

Usage

The server exposes two tools:
  • list_knowledge_bases: Lists the available knowledge bases.
  • retrieve_knowledge: Retrieves similar chunks from the knowledge base based on a query. Optionally, if a knowledge base is specified, only that one is searched; otherwise, all available knowledge bases are considered. By default, at most 10 document chunks are returned with a score below a threshold of 2. A different threshold can optionally be provided using the threshold parameter.
You can use these tools through the MCP interface.
The retrieve_knowledge tool performs a semantic search using a FAISS index. The index is automatically updated when the server starts or when a file in a knowledge base is modified.
The output of the retrieve_knowledge tool is a markdown formatted string with the following structure:
Each result includes the content of the most similar chunk, the source file, and a similarity score.