{"id":273837,"date":"2025-06-05T01:00:49","date_gmt":"2025-06-05T01:00:49","guid":{"rendered":"https:\/\/peraltafinancing.com\/analytics\/how-to-perform-rag-using-mcp\/"},"modified":"2025-06-05T01:00:49","modified_gmt":"2025-06-05T01:00:49","slug":"how-to-perform-rag-using-mcp","status":"publish","type":"post","link":"https:\/\/fivemor.com\/?p=273837","title":{"rendered":"How to Perform RAG using MCP?"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div id=\"article-start\">\n<p>Tired of seeing AI giving vague answers when it doesn\u2019t have access to live data? Bored of writing code for performing <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2023\/09\/retrieval-augmented-generation-rag-in-ai\/\" target=\"_blank\" rel=\"noreferrer noopener\">RAG<\/a> on local data again and again? These two big problems can be solved easily by integrating RAG with <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2025\/03\/how-to-use-mcp\/\" target=\"_blank\" rel=\"noreferrer noopener\">MCP<\/a> (Model Context Protocol). With MCP, you can connect your AI assistant to external tools and APIs to perform true RAG seamlessly. MCP is a game changer in how AI models communicate with live data. On the other hand, RAG acts as a boon for AI models, providing them with external knowledge that the AI model is unaware of. In this article, we\u2019ll deep dive into the integration of RAG with MCP, what they look like when operating together, and walk you through a working example.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-what-is-rag\">What is RAG?<\/h2>\n<p>RAG is an AI framework that combines the strengths of traditional information retrieval systems (such as search and database) with the capabilities of AI models that are outstanding at natural language generation. Its benefits include real-time and factual responses, reduced hallucinations, and context-aware answers. RAG is like asking a librarian about the information before writing a detailed report.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"872\" height=\"581\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_3-1.webp\" alt=\"RAG\" class=\"wp-image-236736\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_3-1.webp 872w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_3-1-300x200.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_3-1-768x512.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_3-1-150x100.webp 150w\" sizes=\"(max-width: 872px) 100vw, 872px\"\/><\/figure>\n<\/div>\n<p>Learn more about RAG in <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2023\/09\/retrieval-augmented-generation-rag-in-ai\/\" target=\"_blank\" rel=\"noreferrer noopener\">this<\/a> article.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-what-is-mcp\">What is MCP?<\/h2>\n<p>MCP acts as a bridge between your AI assistant and external tools. It\u2019s an open protocol that lets LLMs access real-world tools, APIs, or datasets accurately and efficiently. Traditional APIs and tools require custom code for integrating them with AI models, but MCP provides a generic way to connect tools to LLMs in the simplest way possible. It provides plug-and-play tools.<\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"872\" height=\"581\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_6.webp\" alt=\"MCP\" class=\"wp-image-236733\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_6.webp 872w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_6-300x200.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_6-768x512.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_6-150x100.webp 150w\" sizes=\"auto, (max-width: 872px) 100vw, 872px\"\/><\/figure>\n<\/div>\n<p>Learn more about MCP in <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2025\/02\/model-context-protocol\/\" target=\"_blank\" rel=\"noreferrer noopener\">this<\/a> article. <\/p>\n<h3 class=\"wp-block-heading\" id=\"h-how-does-it-enable-rag\">How does it enable RAG?<\/h3>\n<p>In RAG, MCP acts as a retrieval layer that retrieves the important chunks of information from your database based on your query. It completely standardized how you interact with your databases. Now, you don\u2019t have to write custom code for every RAG that you are building. It enables dynamic tool use based on the AI\u2019s reasoning.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-use-cases-for-rag-with-mcp\">Use Cases for RAG with MCP<\/h2>\n<p>There are many use cases for RAG with MCP. Some of which are:<\/p>\n<ul class=\"wp-block-list\">\n<li>Search news articles for summarization<\/li>\n<li>Query financial APIs for market updates<\/li>\n<li>Load private documents for context-aware answers<\/li>\n<li>Fetch weather or location-based info before answering<\/li>\n<li>Use PDFs or database connectors to power enterprise search<\/li>\n<\/ul>\n<h2 class=\"wp-block-heading\" id=\"h-steps-for-performing-rag-with-mcp\">Steps for Performing RAG with MCP<\/h2>\n<p>Now, we are going to implement RAG with MCP in a detailed manner. Follow these steps to create your first MCP server performing RAG. Let\u2019s dive into implementation now:<\/p>\n<p>Firstly, we will set up our RAG MCP server.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-step-1-installing-the-dependencies\">Step 1: Installing the dependencies<\/h3>\n<pre class=\"wp-block-code\"><code>pip install langchain&gt;=0.1.0 \\\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0langchain-community&gt;=0.0.5 \\\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0langchain-groq&gt;=0.0.2 \\\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0mcp&gt;=1.9.1 \\\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0chromadb&gt;=0.4.22 \\\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0huggingface-hub&gt;=0.20.3 \\\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0transformers&gt;=4.38.0 \\\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0sentence-transformers&gt;=2.2.2<\/code><\/pre>\n<p>This step will install all the required libraries in your system.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-step-2-creating-server-py\">Step 2: Creating server.py<\/h3>\n<p>Now, we are defining the RAG MCP server in the server.py file. Following is the code for it. It contains a simple RAG code with an MCP connection to it.\u00a0<\/p>\n<pre class=\"wp-block-code\"><code>from mcp.server.fastmcp import FastMCP\nfrom langchain.chains import RetrievalQA\nfrom langchain.document_loaders import TextLoader\nfrom langchain.text_splitter import CharacterTextSplitter\nfrom langchain_community.vectorstores import Chroma\nfrom langchain_community.embeddings import HuggingFaceEmbeddings\nfrom langchain_groq import ChatGroq  # Groq LLM\n\n\n# Create an MCP server\nmcp = FastMCP(\"RAG\")\n\n\n# Set up embeddings (You can pick a different Hugging Face model if preferred)\nembeddings = HuggingFaceEmbeddings(model_name=\"sentence-transformers\/all-MiniLM-L6-v2\")\n\n\n# Set up Groq LLM\nmodel = ChatGroq(\n   model_name=\"llama3-8b-8192\",  # or another Groq-supported model\n   groq_api_key=\"YOUR_GROQ_API\"  # Required if not set via environment variable\n)\n\n\n# Load documents\nloader = TextLoader(\"dummy.txt\")\ndata = loader.load()\n\n\n# Document splitting\ntext_splitter = CharacterTextSplitter(chunk_size=1000, chunk_overlap=0)\ntexts = text_splitter.split_documents(data)\n\n\n# Vector DB\ndocsearch = Chroma.from_documents(texts, embeddings)\n\n\n# Retriever chain\nqa = RetrievalQA.from_chain_type(llm=model, retriever=docsearch.as_retriever())\n\n\n@mcp.tool()\ndef retrieve(prompt: str) -&gt; str:\n   \"\"\"Get information using RAG\"\"\"\n   return qa.invoke(prompt)\n\n\nif __name__ == \"__main__\":\n   mcp.run()<\/code><\/pre>\n<p>Here, we are using the Groq API for accessing <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2023\/03\/an-introduction-to-large-language-models-llms\/\" target=\"_blank\" rel=\"noreferrer noopener\">LLM<\/a>. Make sure you have to <a href=\"https:\/\/console.groq.com\/keys\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Groq API<\/a>. <em>Dummy.txt<\/em> used here is any data that you have, the contents of which you can change according to your use case.<\/p>\n<p>Now, we have successfully created the RAG MCP server. Now, to check it, run it using Python in the terminal.<\/p>\n<pre class=\"wp-block-code\"><code>python server.py<\/code><\/pre>\n<h3 class=\"wp-block-heading\" id=\"h-step-3-configuring-cursor-for-mcp\">Step 3: Configuring Cursor for MCP<\/h3>\n<p>Let\u2019s configure the Cursor IDE for testing our server.<\/p>\n<ol class=\"wp-block-list\">\n<li>Download Cursor from the official website <a href=\"https:\/\/www.cursor.com\/downloads\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">https:\/\/www.cursor.com\/downloads<\/a>.<\/li>\n<li>Install it, sign up, and get to the home screen.<\/li>\n<\/ol>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"535\" height=\"306\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_7.webp\" alt=\"IDE\" class=\"wp-image-236732\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_7.webp 535w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_7-300x172.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_7-150x86.webp 150w\" sizes=\"auto, (max-width: 535px) 100vw, 535px\"\/><\/figure>\n<\/div>\n<ol start=\"3\" class=\"wp-block-list\">\n<li>Now go to the <strong>File<\/strong> from the header toolbar. and click on <strong>Preferences<\/strong> and then on <strong>Cursor Settings<\/strong>.<\/li>\n<\/ol>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"765\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_5.webp\" alt=\"Cursor\" class=\"wp-image-236734\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_5.webp 680w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_5-267x300.webp 267w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_5-150x169.webp 150w\" sizes=\"auto, (max-width: 680px) 100vw, 680px\"\/><\/figure>\n<\/div>\n<ol start=\"4\" class=\"wp-block-list\">\n<li>From the cursor settings, click on <strong>MCP<\/strong>.<\/li>\n<\/ol>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"564\" height=\"408\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_2-1.webp\" alt=\"Cursor Settings\" class=\"wp-image-236737\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_2-1.webp 564w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_2-1-300x217.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_2-1-150x109.webp 150w\" sizes=\"auto, (max-width: 564px) 100vw, 564px\"\/><\/figure>\n<\/div>\n<ol start=\"5\" class=\"wp-block-list\">\n<li>On the MCP tab, click on <strong>Add new global MCP Server<\/strong>. <\/li>\n<\/ol>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"943\" height=\"173\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_9.webp\" alt=\"MCP Servers\" class=\"wp-image-236730\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_9.webp 943w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_9-300x55.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_9-768x141.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_9-150x28.webp 150w\" sizes=\"auto, (max-width: 943px) 100vw, 943px\"\/><\/figure>\n<\/div>\n<p>It will open a <em>mcp.json<\/em> file. Paste the following code into it and save the file.<\/p>\n<p>Replace\u00a0 <code>\/path\/to\/python<\/code> with the path to your Python executable and <code>\/path\/to\/server.py<\/code> with your <a href=\"http:\/\/server.py\">server.py<\/a> path.<\/p>\n<pre class=\"wp-block-code\"><code>{\n\n\u00a0\"mcpServers\": {\n\n\u00a0\u00a0\u00a0\"rag-server\": {\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\"command\": \"\/path\/to\/python\",\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\"args\": [\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\"path\/to\/server.py\"\n\n\u00a0\u00a0\u00a0\u00a0\u00a0]\n\n\u00a0\u00a0\u00a0}\n\n\u00a0}\n\n}<\/code><\/pre>\n<ol start=\"6\" class=\"wp-block-list\">\n<li>Go back to the Cursor Settings, you should see the following:<\/li>\n<\/ol>\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"941\" height=\"162\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_4-1.webp\" alt=\"MCP with RAG\" class=\"wp-image-236735\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_4-1.webp 941w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_4-1-300x52.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_4-1-768x132.webp 768w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_4-1-150x26.webp 150w\" sizes=\"auto, (max-width: 941px) 100vw, 941px\"\/><\/figure>\n<p>If you see the previous screen, it means your server is running successfully and is connected to the Cursor IDE. If it\u2019s showing some errors, try using the <strong>restart<\/strong> button in the top right corner.<\/p>\n<p>We have successfully set up the MCP server in the <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/2024\/08\/cursor-ai\/\" target=\"_blank\" rel=\"noreferrer noopener\">Cursor IDE<\/a>. Now, let\u2019s test the server.<\/p>\n<h3 class=\"wp-block-heading\" id=\"h-step-4-testing-the-mcp-server\">Step 4: Testing the MCP Server<\/h3>\n<p>Our RAG MCP server can now perform RAG and successfully retrieve the best chunks based on our query. Let\u2019s test them.<\/p>\n<p><strong>Query:<\/strong> <em>\u201cWhat is Zephyria, Answer using rag-server\u201d<\/em><\/p>\n<p><strong>Output:<\/strong><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"526\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_10.webp\" alt=\"testing the server\" class=\"wp-image-236729\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_10.webp 696w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_10-300x227.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_10-150x113.webp 150w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\"\/><\/figure>\n<\/div>\n<p><strong>Query:<\/strong> <em>\u201cWhat was the conflict in the planet?\u201d<\/em><\/p>\n<p><strong>Output:<\/strong><strong\/><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"523\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_1-1.webp\" alt=\"testing the server 2\" class=\"wp-image-236738\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_1-1.webp 696w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_1-1-300x225.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_1-1-150x113.webp 150w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\"\/><\/figure>\n<\/div>\n<p><strong>Query:<\/strong> <em>\u201cWhat is the capital of Zephyria?\u201d<\/em><\/p>\n<p><strong>Output:<\/strong><strong\/><\/p>\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"696\" height=\"483\" src=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_8.webp\" alt=\"testing server 3\" class=\"wp-image-236731\" srcset=\"https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_8.webp 696w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_8-300x208.webp 300w, https:\/\/cdn.analyticsvidhya.com\/wp-content\/uploads\/2025\/06\/image_8-150x104.webp 150w\" sizes=\"auto, (max-width: 696px) 100vw, 696px\"\/><\/figure>\n<\/div>\n<h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2>\n<p>RAG, when powered with MCP, can completely change the way you talk to your AI assistant. It can transform your AI from a simple text generator into a live assistant that thinks and processes information just like a human would. Integrating both can increase your productivity and improve your efficiency over time. With just a few previously mentioned steps, anyone can build AI applications connected to the real world using RAG with MCP. Now it\u2019s time for you to give your LLM superpowers by setting up your own MCP tools.<\/p>\n<h2 class=\"wp-block-heading\" id=\"h-frequently-asked-questions\"><strong>Frequently Asked Questions<\/strong><\/h2>\n<div class=\"schema-faq wp-block-yoast-faq-block\">\n<div class=\"schema-faq-section\" id=\"faq-question-1749017881306\"><strong class=\"schema-faq-question\">Q1. What is the difference between RAG and traditional LLM responses?<\/strong> <\/p>\n<p class=\"schema-faq-answer\">A.<strong> <\/strong>Traditional LLMs generate responses based solely on their pre-trained knowledge, which may be outdated or incomplete. RAG enhances this by retrieving real-time or external data (documents, APIs) before answering, ensuring more accurate and up-to-date responses.<\/p>\n<\/p><\/div>\n<div class=\"schema-faq-section\" id=\"faq-question-1749017899087\"><strong class=\"schema-faq-question\">Q2. Why should I use MCP for RAG instead of writing custom code?<\/strong> <\/p>\n<p class=\"schema-faq-answer\">A. MCP eliminates the need to hardcode every API or database integration manually. It provides a plug-and-play mechanism to expose tools that AI models can dynamically use based on context, making RAG implementation faster, scalable, and more maintainable.<\/p>\n<\/p><\/div>\n<div class=\"schema-faq-section\" id=\"faq-question-1749017941602\"><strong class=\"schema-faq-question\">Q3. Do I need to be an expert in AI or LangChain to use RAG with MCP?<\/strong> <\/p>\n<p class=\"schema-faq-answer\">A.<strong> <\/strong>Not at all. With basic Python knowledge and following the step-by-step setup, you can create your own RAG-powered MCP server. Tools like LangChain and Cursor IDE make the integration straightforward.<\/p>\n<\/p><\/div>\n<\/p><\/div>\n<div class=\"border-top py-3 author-info my-4\">\n<div class=\"author-card d-flex align-items-center\">\n<div class=\"flex-shrink-0 overflow-hidden\">\n                                    <a href=\"https:\/\/www.analyticsvidhya.com\/blog\/author\/harsh9480979\/\" class=\"text-decoration-none active-avatar\"><br \/>\n                                                                       <img decoding=\"async\" src=\"https:\/\/av-eks-lekhak.s3.amazonaws.com\/media\/lekhak-profile-images\/converted_image_0fBqNLi.webp\" width=\"48\" height=\"48\" alt=\"Harsh Mishra\" loading=\"lazy\" class=\"rounded-circle\"\/><\/p>\n<p>                                <\/a>\n                                <\/div>\n<\/p><\/div>\n<p>Harsh Mishra is an AI\/ML Engineer who spends more time talking to Large Language Models than actual humans. Passionate about GenAI, NLP, and making machines smarter (so they don\u2019t replace him just yet). When not optimizing models, he\u2019s probably optimizing his coffee intake. \ud83d\ude80\u2615<\/p>\n<\/p><\/div>\n<\/p><\/div>\n<p><h4 class=\"fs-24 text-dark\">Login to continue reading and enjoy expert-curated content.<\/h4>\n<p>                        <button class=\"btn btn-primary mx-auto d-table\" data-bs-toggle=\"modal\" data-bs-target=\"#loginModal\" id=\"readMoreBtn\">Keep Reading for Free<\/button>\n                    <\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Tired of seeing AI giving vague answers when it doesn\u2019t have access to live data? Bored of writing code for performing RAG on local data again and again? These two big problems can be solved easily by integrating RAG with MCP (Model Context Protocol). With MCP, you can connect your AI assistant to external tools [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":273838,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12033],"tags":[49787,18535,32726],"dealstore":[],"offerexpiration":[],"class_list":["post-273837","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-analytics","tag-mcp","tag-perform","tag-rag"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.4 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Perform RAG using MCP? - Som2ny Network<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/fivemor.com\/?p=273837\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Perform RAG using MCP? - Som2ny Network\" \/>\n<meta property=\"og:description\" content=\"Tired of seeing AI giving vague answers when it doesn\u2019t have access to live data? Bored of writing code for performing RAG on local data again and again? These two big problems can be solved easily by integrating RAG with MCP (Model Context Protocol). With MCP, you can connect your AI assistant to external tools [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/fivemor.com\/?p=273837\" \/>\n<meta property=\"og:site_name\" content=\"Som2ny Network\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-05T01:00:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/06\/How-to-perform-RAG-using-MCP.webp.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"872\" \/>\n\t<meta property=\"og:image:height\" content=\"473\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/fivemor.com\/?p=273837#article\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/?p=273837\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\"},\"headline\":\"How to Perform RAG using MCP?\",\"datePublished\":\"2025-06-05T01:00:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=273837\"},\"wordCount\":1064,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=273837#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/06\/How-to-perform-RAG-using-MCP.webp.webp\",\"keywords\":[\"MCP\",\"Perform\",\"RAG\"],\"articleSection\":[\"Analytics\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/fivemor.com\/?p=273837#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/fivemor.com\/?p=273837\",\"url\":\"https:\/\/fivemor.com\/?p=273837\",\"name\":\"How to Perform RAG using MCP? - Som2ny Network\",\"isPartOf\":{\"@id\":\"https:\/\/fivemor.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/fivemor.com\/?p=273837#primaryimage\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/?p=273837#primaryimage\"},\"thumbnailUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/06\/How-to-perform-RAG-using-MCP.webp.webp\",\"datePublished\":\"2025-06-05T01:00:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/fivemor.com\/?p=273837#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/fivemor.com\/?p=273837\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/?p=273837#primaryimage\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/06\/How-to-perform-RAG-using-MCP.webp.webp\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/06\/How-to-perform-RAG-using-MCP.webp.webp\",\"width\":872,\"height\":473},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/fivemor.com\/?p=273837#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/fivemor.com\/?bp_activities=1\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Perform RAG using MCP?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/fivemor.com\/#website\",\"url\":\"https:\/\/fivemor.com\/\",\"name\":\"Som2ny Network\",\"description\":\"Daily Deals\",\"publisher\":{\"@id\":\"https:\/\/fivemor.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/fivemor.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/fivemor.com\/#organization\",\"name\":\"Som2ny Network\",\"url\":\"https:\/\/fivemor.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"contentUrl\":\"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png\",\"width\":300,\"height\":86,\"caption\":\"Som2ny Network\"},\"image\":{\"@id\":\"https:\/\/fivemor.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/fivemor.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png\",\"caption\":\"admin\"},\"sameAs\":[\"https:\/\/fivemor.com\"],\"url\":\"https:\/\/fivemor.com\/?author=1\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Perform RAG using MCP? - Som2ny Network","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/fivemor.com\/?p=273837","og_locale":"en_US","og_type":"article","og_title":"How to Perform RAG using MCP? - Som2ny Network","og_description":"Tired of seeing AI giving vague answers when it doesn\u2019t have access to live data? Bored of writing code for performing RAG on local data again and again? These two big problems can be solved easily by integrating RAG with MCP (Model Context Protocol). With MCP, you can connect your AI assistant to external tools [&hellip;]","og_url":"https:\/\/fivemor.com\/?p=273837","og_site_name":"Som2ny Network","article_published_time":"2025-06-05T01:00:49+00:00","og_image":[{"width":872,"height":473,"url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/06\/How-to-perform-RAG-using-MCP.webp.webp","type":"image\/webp"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"Written by":"admin","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/fivemor.com\/?p=273837#article","isPartOf":{"@id":"https:\/\/fivemor.com\/?p=273837"},"author":{"name":"admin","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371"},"headline":"How to Perform RAG using MCP?","datePublished":"2025-06-05T01:00:49+00:00","mainEntityOfPage":{"@id":"https:\/\/fivemor.com\/?p=273837"},"wordCount":1064,"commentCount":0,"publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"image":{"@id":"https:\/\/fivemor.com\/?p=273837#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/06\/How-to-perform-RAG-using-MCP.webp.webp","keywords":["MCP","Perform","RAG"],"articleSection":["Analytics"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/fivemor.com\/?p=273837#respond"]}]},{"@type":"WebPage","@id":"https:\/\/fivemor.com\/?p=273837","url":"https:\/\/fivemor.com\/?p=273837","name":"How to Perform RAG using MCP? - Som2ny Network","isPartOf":{"@id":"https:\/\/fivemor.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/fivemor.com\/?p=273837#primaryimage"},"image":{"@id":"https:\/\/fivemor.com\/?p=273837#primaryimage"},"thumbnailUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/06\/How-to-perform-RAG-using-MCP.webp.webp","datePublished":"2025-06-05T01:00:49+00:00","breadcrumb":{"@id":"https:\/\/fivemor.com\/?p=273837#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/fivemor.com\/?p=273837"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/?p=273837#primaryimage","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/06\/How-to-perform-RAG-using-MCP.webp.webp","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2025\/06\/How-to-perform-RAG-using-MCP.webp.webp","width":872,"height":473},{"@type":"BreadcrumbList","@id":"https:\/\/fivemor.com\/?p=273837#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/fivemor.com\/?bp_activities=1"},{"@type":"ListItem","position":2,"name":"How to Perform RAG using MCP?"}]},{"@type":"WebSite","@id":"https:\/\/fivemor.com\/#website","url":"https:\/\/fivemor.com\/","name":"Som2ny Network","description":"Daily Deals","publisher":{"@id":"https:\/\/fivemor.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/fivemor.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/fivemor.com\/#organization","name":"Som2ny Network","url":"https:\/\/fivemor.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/","url":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","contentUrl":"https:\/\/fivemor.com\/wp-content\/uploads\/2026\/07\/4a0953c4-logo-300x86-1.png","width":300,"height":86,"caption":"Som2ny Network"},"image":{"@id":"https:\/\/fivemor.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/fivemor.com\/#\/schema\/person\/b85e3c3dc0e1daea076524dc8810c371","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/fivemor.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/729ae85bf62b9917e93538db2f2688ca?s=96&r=g&default=https%3A%2F%2Ffivemor.com%2Fwp-content%2Fplugins%2Fbuddypress-first-letter-avatar%2Fimages%2Fdefault%2F96%2Flatin_a.png","caption":"admin"},"sameAs":["https:\/\/fivemor.com"],"url":"https:\/\/fivemor.com\/?author=1"}]}},"_links":{"self":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/273837","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=273837"}],"version-history":[{"count":0,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/posts\/273837\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=\/wp\/v2\/media\/273838"}],"wp:attachment":[{"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=273837"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=273837"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=273837"},{"taxonomy":"dealstore","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fdealstore&post=273837"},{"taxonomy":"offerexpiration","embeddable":true,"href":"https:\/\/fivemor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fofferexpiration&post=273837"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}