- Home
- MCP servers
- MCP RAG
MCP RAG
- python
61
GitHub Stars
python
Language
5 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": {
"karaage0703-mcp-rag-server": {
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/mcp-rag-server",
"python",
"-m",
"src.main"
],
"env": {
"SOURCE_DIR": "./data/source",
"POSTGRES_DB": "ragdb",
"EMBEDDING_DIM": "1024",
"POSTGRES_HOST": "localhost",
"POSTGRES_PORT": "5432",
"POSTGRES_USER": "postgres",
"PROCESSED_DIR": "./data/processed",
"EMBEDDING_MODEL": "intfloat/multilingual-e5-large",
"POSTGRES_PASSWORD": "password",
"EMBEDDING_PREFIX_QUERY": "query: ",
"EMBEDDING_PREFIX_EMBEDDING": "passage: "
}
}
}
}You can run an MCP-based Retrieval-Augmented Generation server that indexes multilingual document formats, stores embeddings in a vector database, and serves answers by querying the indexed data. This guide shows practical steps to install, configure, and operate the server so you can power intelligent, context-aware document search and retrieval workflows.
How to use
Start the MCP server locally and connect with an MCP client to index your documents, run embeddings, and perform vector search. You can index multiple formats (Markdown, text, slides, PDFs) from a hierarchical source directory, then query with natural language to retrieve relevant chunks and full documents for richer context. Use the provided CLI tools to manage the index and inspect the number of documents stored. When you query, the search results can include surrounding context and full documents to improve accuracy and readability.
How to install
Prerequisites you need before installation are Python 3.10 or newer and PostgreSQL 14 or newer with the pgvector extension.
# If uv is not installed yet, install it (the runtime used to run the server)
pip install uv
# Install server dependencies (the package manager will resolve these)
uv sync
Additional sections
Environment setup and server configuration help you tailor the MCP RAG server to your environment.
Configure your environment by creating a .env file with the following variables to connect to PostgreSQL and to set indexing behavior and embedding models.
# PostgreSQL connection
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_DB=ragdb
# Document sources
SOURCE_DIR=./data/source
PROCESSED_DIR=./data/processed
# Embedding model configuration
EMBEDDING_MODEL=intfloat/multilingual-e5-large
EMBEDDING_DIM=1024
EMBEDDING_PREFIX_QUERY="query: "
EMBEDDING_PREFIX_EMBEDDING="passage: "
RAG server tools and workflows
You can use built-in tools to search, count documents in the index, and manage the index lifecycle via the CLI.
Available tools
search
Performs vector search on the indexed embeddings and returns top results with optional context and full documents.
get_document_count
Returns the number of documents currently stored in the index.
index
Indexes documents from the source directory, with options for chunk size, chunk overlap, and incremental indexing.