home / mcp / knowledge base mcp server
Provides a local knowledge base with MCP tools to add, search, and manage documents using ChromaDB.
Configuration
View docs{
"mcpServers": {
"july090-mcp": {
"command": "python",
"args": [
"mcp_server.py"
],
"env": {
"PYTHONPATH": "."
}
}
}
}You can run a local knowledge base server that uses ChromaDB for fast vector-based search and expose MCP (Model Context Protocol) endpoints so AI assistants can directly add, search, and manage documents in your knowledge base.
Once your MCP client is connected, you can perform practical actions to manage and query your knowledge base. Add documents to the local store, search for relevant topics, and list or inspect the documents you have stored. The MCP tooling enables your AI assistant to call these actions directly without manual file handling, making it easy to keep answers grounded in your own documents.
Prerequisites you need on your system before starting:
- Python 3.10 or newer (3.12 is recommended) and a Unix-like shell or Windows PowerShell
Install the core dependencies for the knowledge base and MCP server:
pip install chromadb PyPDF2 PyMuPDFOptional for better embedding performance (needs initial internet access to download models):
pip install sentence-transformersStart the MCP server component for the knowledge base locally. Use the runtime command shown here to run the MCP server directly:
python mcp_server.pyConfigure the MCP client to connect to your local MCP server. Use the JSON configuration snippet below in your MCP client setup to register the knowledge base service under a logical name like knowledge-base.
{
"mcpServers": {
"knowledge-base": {
"command": "python",
"args": ["mcp_server.py"],
"env": {
"PYTHONPATH": "."
}
}
}
}The MCP setup includes a server config that exposes a set of tools for interacting with the knowledge base. These tools let you add documents, search, list, delete, and obtain statistics about your stored documents.
MCP tools available for this knowledge base:
Security: All data remains in local storage by default for a private, on-premises setup. Ensure the documents and knowledge_base folders are protected by appropriate filesystem permissions.
Maintenance: Regularly back up the knowledge_base directory to preserve index data and stored documents.
Troubleshooting: If PDFs or text files fail to be read, verify you have PyPDF2 or PyMuPDF installed, and ensure documents are UTF-8 encoded.
If the MCP connection fails, confirm Python is on the system path and dependencies are installed. Restart the MCP server after making changes.
Add a document to the knowledge base via MCP tooling, enabling future queries to consider its content.
Query the knowledge base and return relevant passages based on vector similarities.
Provide an overview of all documents currently stored in the local knowledge base.
Remove a document from the knowledge base by name or identifier.
Retrieve statistical information about stored documents, vectors, and storage usage.
Add multiple documents in a single operation to streamline setup.