mcp-knowledge-server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-knowledge-server search the knowledge base for 'climate change impacts'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Knowledge Server
Production-grade Retrieval-Augmented Generation (RAG) server with centralized knowledge base backed by Qdrant. Exposes identical functionality through Model Context Protocol (MCP) and FastAPI REST API.
Designed for enterprise scale: clean architecture, SOLID principles, dependency injection, and fully env-configurable providers.
Architecture
Cursor IDE (MCP Client)
↓
MCP Server (stdio / streamable-HTTP)
↓
Application Services
↓
RAG Pipeline → Embedding → Qdrant
↓
PostgreSQL (metadata) + Knowledge BaseKey Components
Layer | Responsibility |
| FastAPI REST endpoints |
| MCP tool registration (12 tools) |
| Use case orchestration |
| Retrieval pipeline, prompts, compression |
| Entities, ports, exceptions |
| LLM, embeddings, Qdrant, persistence |
| Loaders, chunkers, cleaning |
Related MCP server: vector-mcp
Quick Start
Prerequisites
Python 3.12+
uv package manager
Qdrant (local or Docker)
Ollama (optional, for local LLM)
Local Development
# Clone and setup
git clone <repo-url> mcp-knowledge-server
cd mcp-knowledge-server
cp .env.example .env
# Install dependencies
./scripts/setup.sh
# Start Qdrant (Docker)
docker run -p 6333:6333 qdrant/qdrant:v1.12.5
# Start REST API
uv run mcp-knowledge-server-api
# Start MCP server (stdio for Cursor)
uv run mcp-knowledge-server-mcp-stdioDocker Compose (Full Stack)
cp .env.example .env
docker compose -f docker/docker-compose.yml upServices:
MCP HTTP: http://localhost:8001/mcp
Qdrant: http://localhost:6333
PostgreSQL: localhost:5432
Configuration
All settings via .env — never modify source code to change providers.
LLM Providers
# Local (macOS)
LLM_PROVIDER=ollama
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=qwen3:8b
# Cloud
LLM_PROVIDER=openai
OPENAI_API_KEY=sk-...
OPENAI_MODEL=gpt-4.1Supported LLM providers: openai, anthropic, gemini, groq, together, openrouter, ollama, lmstudio, llamacpp, openai_compatible
Embedding Providers
EMBEDDING_PROVIDER=sentence_transformers
EMBEDDING_MODEL=all-MiniLM-L6-v2Supported: sentence_transformers, openai, ollama, voyage, cohere
Chunking Strategies
CHUNK_STRATEGY=recursive # recursive | token | markdown | semantic
CHUNK_SIZE=1000
CHUNK_OVERLAP=200macOS + Ollama Setup
# Install Ollama
brew install ollama
# Start Ollama
ollama serve
# Pull recommended models
ollama pull qwen3:8b
ollama pull nomic-embed-text
# Configure .env
LLM_PROVIDER=ollama
OLLAMA_MODEL=qwen3:8b
EMBEDDING_PROVIDER=ollama
OLLAMA_EMBEDDING_MODEL=nomic-embed-textRecommended models: qwen3, qwen2.5, llama3.2, mistral, gemma3, deepseek, phi
Cursor MCP Configuration
Copy .cursor/mcp.json.example to your Cursor MCP settings:
{
"mcpServers": {
"knowledge-server": {
"command": "uv",
"args": ["run", "python", "-m", "app.mcp.main"],
"cwd": "/path/to/mcp-knowledge-server",
"env": {
"LLM_PROVIDER": "ollama",
"OLLAMA_BASE_URL": "http://localhost:11434",
"OLLAMA_MODEL": "qwen3:8b"
}
}
}
}MCP Tools
Tool | Description |
| Semantic search over knowledge base |
| Generate RAG answer with citations |
| Ingest a document file |
| Re-ingest an existing document |
| Remove document and vectors |
| List indexed documents |
| Get document metadata |
| Find similar chunks |
| Create a new collection |
| Delete a collection |
| List all collections |
| Server health status |
REST API
OpenAPI docs: http://localhost:8000/docs
Examples
# Health check
curl http://localhost:8000/health
# Upload document
curl -X POST http://localhost:8000/documents/upload \
-F "file=@documents/sample.txt" \
-F "collection=knowledge_base"
# Search
curl -X POST http://localhost:8000/search \
-H "Content-Type: application/json" \
-d '{"query": "What is this about?", "top_k": 5}'
# RAG answer
curl -X POST http://localhost:8000/rag \
-H "Content-Type: application/json" \
-d '{"query": "Summarize the knowledge base"}'
# List collections
curl http://localhost:8000/collections
# Create collection
curl -X POST http://localhost:8000/collections \
-H "Content-Type: application/json" \
-d '{"name": "my_docs", "description": "My documents"}'Supported Document Formats
PDF, DOCX, TXT, Markdown, HTML, CSV
Adding New Providers
LLM Provider
If OpenAI-compatible: add config to
OpenAICompatibleLLMProvider.from_settings()inapp/infrastructure/llm/openai_compatible.pyIf custom API: implement
BaseLLMProviderinapp/infrastructure/llm/Register in
LLMProviderFactoryinapp/infrastructure/llm/factory.pyAdd env vars to
.env.example
Document Loader
Implement
BaseDocumentLoaderinapp/ingestion/loaders/Register in
LoaderRegistryinapp/ingestion/loaders/registry.py
Embedding Provider
Implement
BaseEmbeddingProviderinapp/infrastructure/embeddings/Register in
EmbeddingProviderFactory
Development
# Install with dev dependencies
uv sync --all-extras
# Lint
uv run ruff check app tests
uv run black --check app tests
# Type check
uv run mypy app
# Tests
uv run pytest
# Pre-commit
uv run pre-commit install
uv run pre-commit run --all-filesProject Structure
app/
├── api/ # FastAPI REST API
├── mcp/ # MCP server tools
├── services/ # Application use cases
├── rag/ # RAG pipeline stages
├── domain/ # Entities, ports, exceptions
├── infrastructure/# External adapters
├── ingestion/ # Loaders, chunkers, cleaning
├── config/ # Pydantic settings
├── logging/ # Structured logging
└── container.py # Composition root (DI)
tests/
docker/
scripts/
alembic/Deployment
Production Checklist
Set
APP_ENV=productionUse PostgreSQL:
DATABASE_URL=postgresql+asyncpg://...Configure Qdrant with API key and HTTPS
Enable auth:
ENABLE_AUTH=true, setAPI_KEYUse cloud LLM or dedicated Ollama instance
Run behind reverse proxy (nginx/traefik)
Set resource limits in Docker Compose
Environment Variables
See .env.example for the complete list.
License
MIT
Available Tools
12 toolsadd_documentA
Add a document to the knowledge base.
Args:
file_path: Absolute path to the document file.
collection: Target collection name.
author: Optional document author.
tags: Comma-separated tags.
Inputs: file_path (required), tags, author, collection. Returns: result
create_collectionA
Create a new document collection.
Args:
name: Collection name (alphanumeric, hyphens, underscores).
description: Optional collection description.
Inputs: name (required), description. Returns: result
delete_collectionA
Delete a collection and all its vectors.
Args:
name: Collection name to delete.
Inputs: name (required). Returns: result
delete_documentA
Delete a document from the knowledge base.
Args:
document_id: UUID of the document to delete.
Inputs: document_id (required). Returns: result
get_documentA
Get a document by ID.
Args:
document_id: UUID of the document.
Inputs: document_id (required). Returns: result
health_checkA
Check the health status of the knowledge server.
Inputs: no named parameters. Returns: result
list_collectionsA
List all document collections.
Inputs: no named parameters. Returns: result
list_documentsC
List documents in the knowledge base.
Args:
collection: Optional collection filter.
limit: Maximum number of documents to return.
Inputs: limit, collection. Returns: result
rag_answerA
Generate a RAG answer with citations from the knowledge base.
Args:
query: The question to answer.
collection: Optional collection to search in.
top_k: Number of context chunks to retrieve.
Inputs: query (required), top_k, collection. Returns: result
search_documentsA
Search documents by semantic similarity.
Args:
query: The search query text.
collection: Optional collection name to search in.
top_k: Number of results to return (default 10).
Inputs: query (required), top_k, collection. Returns: result
similar_documentsA
Find documents similar to a given chunk.
Args:
chunk_id: The chunk ID to find similar documents for.
collection: Optional collection to search in.
top_k: Number of similar results to return.
Inputs: chunk_id (required), top_k, collection. Returns: result
update_documentA
Update an existing document by re-ingesting it.
Args:
document_id: UUID of the document to update.
file_path: Absolute path to the new document file.
Inputs: file_path (required), document_id (required). Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 12 tools
Each tool targets a distinct action on either documents or collections. search_documents and similar_documents are differentiated by input (query text vs. chunk ID), and rag_answer is clearly for answer generation, so there is no ambiguity.
Most tools follow a verb_noun pattern with snake_case (add_document, delete_document, list_collections). However, 'add' and 'create' are used interchangeably for creation, and 'similar_documents' uses an adjective instead of a verb, creating minor inconsistencies.
With 12 tools, the server covers document CRUD, collection management, search/retrieval, and health monitoring. This is well-scoped for a knowledge server and each tool earns its place without redundancy.
The tool surface provides full document lifecycle (add, get, update, delete, list), collection management (create, delete, list), semantic search, similar-document lookup, and RAG. Minor gaps such as missing get_collection or update_collection exist, but core workflows are fully covered.
Maintenance
Related MCP Connectors
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Cloud or self-hosted knowledge for AI agents: hybrid search, reranking, GraphRAG, scoped MCP tools.
The CustomGPT.ai MCP server is a fully managed, RAG-powered endpoint that connects large language models with private knowledge bases and external data sources. It provides tools for retrieval-augmented generation queries (send_message), data ingestion (upload_file), and source listing, enabling AI agents to query private documents like PDFs with high accuracy and real-time citations.
The Needle MCP server enables semantic search on documents stored in files like PDFs, DOCX, and XLSX by connecting AI applications to external data sources. It provides capabilities to create and manage document collections, perform natural language searches on stored content, and retrieve relevant information without requiring exact keyword matches.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn advanced MCP server providing RAG-enabled memory through a knowledge graph with vector search capabilities, enabling intelligent information storage, semantic retrieval, and document processing.44 npm47MIT
- AlicenseBqualityBmaintenanceA production-grade MCP server for integrating RAG into AI agents, supporting multiple vector databases with enterprise security and dynamic tool selection.716MIT
- FlicenseNot gradedqualityDmaintenanceA Retrieval Augmented Generation MCP server that ingests documents into a local vector database and enables semantic search queries.9-
- FlicenseNot gradedqualityCmaintenanceMCP server for a modular RAG system that enables natural language question answering over enterprise documents with intent-aware routing, adaptive retrieval, and citation-backed responses.-