RAG
- python
3
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"luxter77-mcp-kbdb": {
"command": "uv",
"args": [
"run",
"--with",
"fastmcp",
"fastmcp",
"run",
"/location/of/the/script/rag_mcp_server.py:mcp"
],
"env": {
"RM_DB_HOST": "localhost",
"RM_DB_NAME": "your_db_name",
"RM_DB_PORT": "5432",
"RM_DB_USER": "your_db_user",
"RM_DB_PASSWORD": "your_super_secret_password",
"RM_OPENAI_API_KEY": "your_api_key",
"RM_OPENAI_ENDPOINT": "your_model_endpoint_url"
}
}
}
}rag-mcp is a Python-based MCP server that stores text and embeddings in PostgreSQL with pgvector and exposes multiple retrieval modalities you can call from MCP clients. It enables semantic search, QA-style lookup, and style-based matching across a knowledge base, making it easier to plug intelligent search into agents and applications.
How to use
You interact with the rag-mcp server through an MCP client or any tool that speaks MCP. Once the server is running, you can invoke its three search modalities to retrieve or reason over your knowledge base: semantic similarity, question/answer style search, and style-based matching. Use the modality that fits your goal: semantic search for related context, QA to fetch direct answer-like results, and style search to find items with a similar tone or structure.
How to install
Prerequisites you need to have locally before starting:
- Python 3.x
- PostgreSQL with the pgvector extension enabled
- A running OpenAI-compatible embedding endpoint or compatible API
- Git to clone the project
Install and run steps you should follow exactly as written here:
# 1) Prepare your environment
python3 -m venv venv
source venv/bin/activate
# 2) Install dependencies
pip install -r requirements.txt
# 3) Set up the database (execute this against your PostgreSQL instance)
# Run the provided script to create tables and indexes
psql -h <host> -p <port> -d <dbname> -f create_tables.pgsql
# 4) Configure environment variables (examples; replace with real values)
export RM_DB_HOST=localhost
export RM_DB_PORT=5432
export RM_DB_NAME=your_db_name
export RM_DB_USER=your_db_user
export RM_DB_PASSWORD=your_super_secret_password
export RM_OPENAI_API_KEY=your_api_key
export RM_OPENAI_ENDPOINT=your_model_endpoint_url
# 5) Run the MCP server
python rag_mcp_server.py
Additional setup notes
The server is designed to be started locally and then consumed by MCP clients. It communicates with PostgreSQL where you store documents, document chunks, and embeddings, and relies on an embedding service to convert text into vectors.
Available tools
search_semantic_similarity
Execute a semantic similarity search to find documents or chunks that best match the meaning of the query.
search_qa
Run a question/answer style search to retrieve answer-like results from the knowledge base.
search_style
Perform a style-based search to locate items that share tonal or stylistic characteristics.