
ashishpatel26/agentic-rag-with-mcp-server
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
Агентный RAG с MCP-сервером
Обзор
это мощный проект, объединяющий сервер MCP (Model Context Protocol) и клиент для создания приложений (Retrieval-Augmented Generation). Эта настройка расширяет возможности вашей системы RAG с помощью передовых инструментов, таких как: Сервер размещает эти интеллектуальные инструменты, в то время как клиент показывает, как легко подключаться и использовать их. Работая на классе FastMCP из библиотеки mcp, сервер предоставляет эти удобные инструменты: Клиент демонстрирует, как подключаться и взаимодействовать с сервером MCP: * Установите соединение с ClientSession из библиотеки mcp * Перечислите все доступные серверные инструменты * Вызовите любой инструмент с пользовательскими аргументами * Обработка запросов с использованием инструментов MCP в тандеме * Python 3.9 или выше * openai Python package * mcp library *python-dotenv для управления переменными среды 1. Создайте файл .env (используйте .env.sample в качестве шаблона) 2. Установите модель OpenAI в .env:
Обзор (машинный перевод)
Обзор
Agentic RAG с MCP Server — это мощный проект, объединяющий сервер MCP (Model Context Protocol) и клиент для создания приложений Agentic RAG (Retrieval-Augmented Generation).
Эта настройка расширяет возможности вашей системы RAG с помощью передовых инструментов, таких как:
- ️ ️ * * Выдача объекта** Уточнение запросов *** Проверка актуальности*
Сервер размещает эти интеллектуальные инструменты, в то время как клиент показывает, как легко подключаться и использовать их.
]️ Сервер — server.py
Используя класс FastMCP из библиотеки mcp, сервер предоставляет эти удобные инструменты:
Имя инструмента | Описание | Икона
[[Т3]] Возвращает текущую дату и время**
| extract_entities_tool | Использует OpenAI для извлечения объектов из запроса — повышение релевантности поиска документа | |
| refine_query_tool | Улучшает качество пользовательских запросов с помощью **OpenAI-мощности ** | the |
check_relevance | Фильтры нерелевантного контента, проверяя релевантность куска с LLM | ✅ |
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
README
🚀 Agentic RAG with MCP Server 
✨ Overview
Agentic RAG with MCP Server is a powerful project that brings together an MCP (Model Context Protocol) server and client for building Agentic RAG (Retrieval-Augmented Generation) applications.
This setup empowers your RAG system with advanced tools such as:
- 🕵️♂️ Entity Extraction
- 🔍 Query Refinement
- ✅ Relevance Checking
The server hosts these intelligent tools, while the client shows how to seamlessly connect and utilize them.
🖥️ Server — server.py
Powered by the FastMCP class from the mcp library, the server exposes these handy tools:
| Tool Name | Description | Icon |
|---|---|---|
get_time_with_prefix |
Returns the current date & time | ⏰ |
extract_entities_tool |
Uses OpenAI to extract entities from a query — enhancing document retrieval relevance | 🧠 |
refine_query_tool |
Improves the quality of user queries with OpenAI-powered refinement | ✨ |
check_relevance |
Filters out irrelevant content by checking chunk relevance with an LLM | ✅ |
🤝 Client — mcp-client.py
The client demonstrates how to connect and interact with the MCP server:
- Establish a connection with
ClientSessionfrom themcplibrary - List all available server tools
- Call any tool with custom arguments
- Process queries leveraging OpenAI or Gemini and MCP tools in tandem
⚙️ Requirements
- Python 3.9 or higher
openaiPython packagemcplibrarypython-dotenvfor environment variable management
🛠️ Installation Guide
# Step 1: Clone the repository
git clone https://github.com/ashishpatel26/Agentic-RAG-with-MCP-Server.git
# Step 2: Navigate into the project directory
cd Agentic-RAG-with-MCP-Serve
# Step 3: Install dependencies
pip install -r requirements.txt
🔐 Configuration
- Create a
.envfile (use.env.sampleas a template) - Set your OpenAI model in
.env:
OPENAI_MODEL_NAME="your-model-name-here"
GEMINI_API_KEY="your-model-name-here"
🚀 How to Use
- Start the MCP server:
python server.py
- Run the MCP client:
python mcp-client.py
📜 License
This project is licensed under the MIT License.
Thanks for Reading 🙏
Установка
This server does not publish a one-line install command.
Open the repository installation guide Новичок в MCP? Начните с руководства на mcpskill.org →