The Knowledge Base MCP Server is a tool designed to list and retrieve content from various knowledge bases. It leverages the Hugging Face Inference API for generating embeddings and uses FAISS for efficient similarity search. This server is particularly useful for managing and querying structured knowledge bases in a scalable manner.
Clone the repository:
shell
git clone <repository_url>
cd knowledge-base-mcp-server
Install dependencies:
shell
npm install
Configure environment variables:
HUGGINGFACE_API_KEY
: API key for Hugging Face Inference API.KNOWLEDGE_BASES_ROOT_DIR
: Directory for knowledge base subdirectories (defaults to $HOME/knowledge_bases
).FAISS_INDEX_PATH
: Path to the FAISS index (defaults to $HOME/knowledge_bases/.faiss
).HUGGINGFACE_MODEL_NAME
: Hugging Face model for embeddings (defaults to sentence-transformers/all-MiniLM-L6-v2
).
Build the server:
shell
npm run build
Add the server to the MCP settings:
Edit cline_mcp_settings.json
and add the following configuration:
json
"knowledge-base-mcp": {
"command": "node",
"args": ["/path/to/knowledge-base-mcp-server/build/index.js"],
"disabled": false,
"autoApprove": [],
"env": {
"KNOWLEDGE_BASES_ROOT_DIR": "/path/to/knowledge_bases",
"HUGGINGFACE_API_KEY": "YOUR_HUGGINGFACE_API_KEY"
},
"description": "Retrieves similar chunks from the knowledge base based on a query."
}
Create knowledge base directories:
KNOWLEDGE_BASES_ROOT_DIR
for each knowledge base (e.g., company
, it_support
, onboarding
)..txt
, .md
) containing the knowledge base content within these subdirectories.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.retrieve_knowledge
:## Semantic Search Results
**Result 1:**
[Content of the most similar chunk]
**Source:**
```json
{
"source": "[Path to the file containing the chunk]"
}
Result 2:
[Content of the second most similar chunk]
Source:
{
"source": "[Path to the file containing the chunk]"
}
Disclaimer: The provided results might not all be relevant. Please cross-check the relevance of the information.
```
This repository is a mirror of https://github.com/jeanibarz/knowledge-base-mcp-server.