MCP-RAG Server
Manages environment variables and sensitive configuration through .env files for secure API key storage.
Enables version control for contributing features through forking, branching, committing, and pull requests.
Supports Jupyter notebook functionality through ipykernel, allowing interactive development and testing.
Integrates with OpenAI API for generating completions, enabling RAG capabilities with various models including GPT-4.
Provides type-safety and validation through Pydantic models for robust data handling and configuration.
Built on Python 3.12+ with support for virtual environments and package management.
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-RAG Server search for information about RAG implementation best practices"
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-RAG: Model Context Protocol with RAG 🚀
A powerful and efficient RAG (Retrieval-Augmented Generation) implementation using GroundX and OpenAI, built with Modern Context Processing (MCP).
🌟 Features
Advanced RAG Implementation: Utilizes GroundX for high-accuracy document retrieval
Model Context Protocol: Seamless integration with MCP for enhanced context handling
Type-Safe: Built with Pydantic for robust type checking and validation
Flexible Configuration: Easy-to-customize settings through environment variables
Document Ingestion: Support for PDF document ingestion and processing
Intelligent Search: Semantic search capabilities with scoring
Related MCP server: PDF Knowledgebase MCP Server
🛠️ Prerequisites
Python 3.12 or higher
OpenAI API key
GroundX API key
MCP CLI tools
📦 Installation
Clone the repository:
git clone <repository-url>
cd mcp-ragCreate and activate a virtual environment:
uv sync
source .venv/bin/activate # On Windows, use `.venv\Scripts\activate`⚙️ Configuration
Copy the example environment file:
cp .env.example .envConfigure your environment variables in
.env:
GROUNDX_API_KEY="your-groundx-api-key"
OPENAI_API_KEY="your-openai-api-key"
BUCKET_ID="your-bucket-id"🚀 Usage
Starting the Server
Run the inspect server using:
mcp dev server.pyDocument Ingestion
To ingest new documents:
from server import ingest_documents
result = ingest_documents("path/to/your/document.pdf")
print(result)Performing Searches
Basic search query:
from server import process_search_query
response = process_search_query("your search query here")
print(f"Query: {response.query}")
print(f"Score: {response.score}")
print(f"Result: {response.result}")With custom configuration:
from server import process_search_query, SearchConfig
config = SearchConfig(
completion_model="gpt-4",
bucket_id="custom-bucket-id"
)
response = process_search_query("your query", config)📚 Dependencies
groundx(≥2.3.0): Core RAG functionalityopenai(≥1.75.0): OpenAI API integrationmcp[cli](≥1.6.0): Modern Context Processing toolsipykernel(≥6.29.5): Jupyter notebook support
🔒 Security
Never commit your
.envfile containing API keysUse environment variables for all sensitive information
Regularly rotate your API keys
Monitor API usage for any unauthorized access
🤝 Contributing
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
Available Tools
3 toolsingest_documentsB
Ingest documents from a local file into the knowledge base.
Args:
local_file_path: The path to the local file containing the documents to ingest.
Returns:
str: A message indicating the documents have been ingested.
Inputs: local_file_path (required).
process_search_queryB
Process a search query using GroundX and OpenAI.
Args:
query: The search query string
config: Optional SearchConfig object for customization
Returns:
SearchResponse object containing the query, score, and result
Inputs: query (required), config.
search_doc_for_rag_contextC
Searches and retrieves relevant context from a knowledge base,
based on the user's query.
Args:
query: The search query supplied by the user.
Returns:
str: Relevant text content that can be used by the LLM to answer the query.
Inputs: query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
The tools have significant overlap and unclear boundaries. Both 'process_search_query' and 'search_doc_for_rag_context' appear to handle search queries with similar inputs (query strings) and similar purposes (retrieving relevant information). While 'process_search_query' mentions GroundX and OpenAI integration and returns a structured SearchResponse, while 'search_doc_for_rag_context' returns plain text for RAG context, their core functionality is too similar, likely causing agent confusion about which to use for search tasks.
The naming is mostly consistent with a verb_noun pattern ('ingest_documents', 'process_search_query', 'search_doc_for_rag_context'), though 'search_doc_for_rag_context' is slightly verbose and includes an abbreviation (RAG). All use snake_case, and the verbs ('ingest', 'process', 'search') are appropriate for their actions, with only minor deviations from perfect consistency.
With only 3 tools, the count feels thin for a RAG server's scope, which typically involves more operations like document management (e.g., delete, list), query customization, or knowledge base maintenance. While the tools cover basic ingestion and search, the limited number may restrict agent workflows and indicate an incomplete surface, though it's not extreme.
There are significant gaps in the tool surface for a RAG server. Core operations are missing: no tools to list, update, or delete documents from the knowledge base, and no way to manage the knowledge base itself (e.g., clear or reset). The search functionality is duplicated rather than expanded, and there's no support for advanced RAG features like chunking or metadata handling, which will likely cause agent failures in complex tasks.
Related MCP Connectors
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.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
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.
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceImplements Retrieval-Augmented Generation (RAG) using GroundX and OpenAI, allowing users to ingest documents and perform semantic searches with advanced context handling through Modern Context Processing (MCP).5-
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables intelligent document search and retrieval from PDF collections, providing semantic search capabilities powered by OpenAI embeddings and ChromaDB vector storage.13MIT
- AlicenseNot gradedqualityNot gradedmaintenanceA Python server that enables retrieval-augmented generation through semantic, question/answer, and style search modalities using PostgreSQL and pgvector for embedding storage and retrieval.2Apache 2.0
- AlicenseNot gradedqualityDmaintenanceA local RAG server that enables document indexing and sentence window retrieval across multiple file formats like PDF, MD, and DOCX. It supports both local Hugging Face models and OpenAI embeddings for efficient context-aware querying through the Model Context Protocol.GPL 3.0