ckhamitkar/knowledge-base-mcp-server
If you are the rightful owner of knowledge-base-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The Knowledge Base MCP Server is designed to facilitate seamless communication and data exchange between various applications using the Model Context Protocol (MCP).
Knowledge Base MCP Server
This is a knowledge base server that allows you to upload files, search them using semantic search, and ask questions about them using a LangChain agent.
Features
- File Management: Add, list, and read files in the knowledge base.
- Semantic Search: Search for documents using semantic similarity.
- LangChain Agent: Ask questions about the documents in the knowledge base.
Setup
-
Install dependencies:
pip install -r requirements.txt -
Set Hugging Face API Token: To use the LangChain agent, you need to set your Hugging Face API token as an environment variable:
export HUGGINGFACEHUB_API_TOKEN="your-token-here" -
Run the server:
python app.pyThe server will be running at
http://localhost:8000.
API
Files
-
POST /files/: Upload a file.- Form Data:
file - Example:
curl -X POST -F "file=@/path/to/your/file.txt" http://localhost:8000/files/
- Form Data:
-
GET /files/: List all files.- Example:
curl http://localhost:8000/files/
- Example:
-
GET /files/<filename>: Read a file.- Example:
curl http://localhost:8000/files/your-file.txt
- Example:
Search
-
POST /index/: Re-index all documents.- Example:
curl -X POST http://localhost:8000/index/
- Example:
-
POST /search/: Search for documents.- Body:
{"query": "your search query"} - Example:
curl -X POST -H "Content-Type: application/json" -d '{"query": "your search query"}' http://localhost:8000/search/
- Body:
Agent
POST /agent/: Ask a question to the agent.- Body:
{"query": "your question"} - Example:
curl -X POST -H "Content-Type: application/json" -d '{"query": "your question"}' http://localhost:8000/agent/
- Body: