knowledge-base-mcp-server

ckhamitkar/knowledge-base-mcp-server

3.1

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

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. 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"
    
  3. Run the server:

    python app.py
    

    The 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/
      
  • GET /files/: List all files.

    • Example:
      curl http://localhost:8000/files/
      
  • GET /files/<filename>: Read a file.

    • Example:
      curl http://localhost:8000/files/your-file.txt
      

Search

  • POST /index/: Re-index all documents.

    • Example:
      curl -X POST http://localhost:8000/index/
      
  • 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/
      

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/