mcp-agentic-rag

by rukshannet

4 stars
412 downloads
Not rated
GitHub

About

mcp-agentic-rag is an MCP server and client implementation for building agentic Retrieval-Augmented Generation (RAG) applications. It exposes tools that enhance RAG performance, such as entity extraction, query refinement, and relevance checking.

Details

Author
rukshannet
GitHub stars
4
Downloads
412
Categories
Other

- Exposes tools for entity extraction, query refinement, and relevance checking.
- Uses OpenAI models for LLM-based operations.
- Built with FastMCP from the mcp library.
- Client demonstrates connection, tool listing, and tool invocation.
- Supports environment-based configuration via .env file.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name mcp-agentic-rag
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, install dependencies (pip install -r requirements.txt), configure the OPENAI_MODEL_NAME environment variable in a .env file, then start the server with python server.py and run the client with python mcp-client.py.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp-agentic-rag": {
            "mcp-agentic-rag": {
                "command": "python",
                "args": [
                    "server.py"
                ]
            }
        }
    }
}

McpServers

{
    "mcp-agentic-rag": {
        "command": "python",
        "args": [
            "server.py"
        ]
    }
}

mcp-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

1. Clone the repository:

    git clone https://github.com/rukshanet/mcp-agentic-rag.git
    
2. Install the dependencies:
    pip install -r requirements.txt
    
3. Configure the environment variables:

Create a .env file based on the .env.sample file.
Set the OPENAI_MODEL_NAME environment variable to the name of the OpenAI model you want to use.

Usage

1. Start the MCP server:

    python server.py
    
2. Run the MCP client:
    python mcp-client.py
    

License

MIT

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.