About mcp-agentic-rag
mcp-agentic-rag provides an MCP server and example client for agentic RAG applications. Its tools support entity extraction, query refinement, and relevance checks for retrieval workflows.
Key features
- 01Extracts entities from queries
- 02Refines text queries
- 03Checks chunk relevance
- 04Includes an MCP client example
Use cases
- 01Identify query entities before document retrieval
- 02Improve queries used for retrieval
- 03Filter irrelevant chunks from results
MCP support
The MCP server exposes time, entity extraction, query refinement, and relevance-check tools. The included client demonstrates connecting, listing tools, and calling them.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEmcp-agentic-rag
Overview
This project implements an MCP (Model Context Protocol) server and client for building agentic RAG (Retrieval-Augmented Generation) applications. The server provides a set of tools that can be used to enhance the performance of RAG systems, such as entity extraction, query refinement, and relevance checking. The client demonstrates how to connect to the server and use its tools.
Server (server.py)
The server is implemented using the FastMCP class from the mcp library. It exposes the following tools:
- get_time_with_prefix: Returns the current date and time.
- extract_entities_tool: Extracts entities from a given text query using OpenAI. This tool can be used to identify key entities in a user's query, which can then be used to improve the retrieval of relevant documents.
- refine_query_tool: Refines a given text query using OpenAI. This tool can be used to improve the quality of a user's query, which can then be used to improve the retrieval of relevant documents.
- check_relevance: Checks the relevance of a text chunk to a given question using an LLM. This tool can be used to filter out irrelevant documents from the retrieval results.
Client (mcp-client.py)
The client demonstrates how to connect to the MCP server and use its tools. It uses the ClientSession class from the mcp library to establish a connection with the server. The client provides examples of how to:
- Connect to the server
- List available tools
- Call a specific tool with arguments
- Process a query using OpenAI and available MCP tools
Requirements
- Python 3.7+
- openai
- mcp
- dotenv
Installation
-
Clone the repository:
git clone https://github.com/rukshanet/mcp-agentic-rag.git -
Install the dependencies:
pip install -r requirements.txt -
Configure the environment variables:
- Create a
.envfile based on the.env.samplefile. - Set the
OPENAI_MODEL_NAMEenvironment variable to the name of the OpenAI model you want to use.
- Create a
Usage
-
Start the MCP server:
python server.py -
Run the MCP client:
python mcp-client.py
License
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.