Illustration: an AI chat bubble pulls documents from a filing cabinet before answering the mascot's question

Ideafex saves posts, articles and videos from any app to one searchable wall. Free on the App Store and Google Play.

Download on the App StoreGet it on Google Play

What is RAG?

A language model learns from a fixed snapshot of text. It does not know what happened after its training, and it has never seen your private documents. RAG fixes that by looking things up first. Before the model answers, a retriever finds the passages most likely to help, and those passages are pasted into the prompt as context. The model then writes an answer grounded in them, and can often say where each point came from.

A robot assistant with a magnifying glass pulls two paragraph cards from a filing cabinet before answering
Illustration: RAG looks up the most useful passages before the model answers.

The term comes from a 2020 paper by Patrick Lewis and colleagues, "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks" (arXiv:2005.11401). They paired a model's built-in, or parametric, memory with a non-parametric memory: a dense vector index of Wikipedia searched by a neural retriever. The paper notes that this also helps with two open problems, showing where an answer came from and updating the model's knowledge without retraining it.

How does RAG work?

  1. Index. Documents are split into chunks, and each chunk is turned into an embedding, a list of numbers that captures its meaning. These go into a vector database or search index.
  2. Retrieve. When a question comes in, it is embedded too, and the index returns the chunks closest in meaning. Many systems also use keyword search.
  3. Augment. The best chunks are added to the prompt along with the question.
  4. Generate. The model answers using that context.

An example

A company puts its HR handbook behind a chatbot. An employee asks, "How many days of parental leave do I get?" The retriever finds the two paragraphs on parental leave, the model reads them and replies with the right number, quoting the policy. Without retrieval the model would guess from general knowledge, and likely get the company's figure wrong.

A chatbot on a laptop opens a handbook to the parental leave page and points at the paragraph
Illustration: An HR chatbot answers from the handbook passage it retrieved.

RAG vs MCP: what is the difference?

They solve related problems at different layers. RAG is a pattern for getting the right text into a prompt. The Model Context Protocol is a standard for connecting an AI application to outside tools and data (MCP docs).

  • What it is. RAG is a technique. MCP is a protocol.
  • Who decides to fetch. In a classic RAG pipeline, retrieval runs on every question, set up by the developer. With MCP, the model decides when to call a tool, and which one.
  • What it can do. RAG retrieves text. An MCP server can offer search, but also other actions, such as listing folders, reading a single record or creating a calendar event.
  • Where the data lives. RAG usually needs a prepared index. MCP can wrap a live system and query it directly.

They also work together. An MCP server can expose a search tool backed by a vector index, which turns RAG into something any MCP client can use. OpenAI's guide to building MCP servers walks through exactly that: a remote MCP server that reads from a vector store (OpenAI docs). So the useful question is usually less "RAG or MCP?" and more "should retrieval happen on every question, or only when the assistant asks for it?"

When should you use which?

  • Choose a RAG pipeline when one app answers questions over a fixed body of documents and every answer should be grounded in them.
  • Choose MCP when you want a general assistant such as Claude or ChatGPT to reach several systems and decide for itself when to look something up.

How Ideafex relates

Ideafex gives AI assistants retrieval through MCP. With Pro and Connect your AI, Claude, ChatGPT or Cursor can call search_ideas to find ideas that match your question, then get_idea to read one in full, including article text or transcripts where Ideafex could fetch them. The assistant chooses when to look, and the access is read-only, so it can never change what you saved. That is the idea behind using Ideafex as an AI second brain.

Sources

Quick answers

  • Retrieval-augmented generation. The system retrieves relevant text from an outside source and adds it to the prompt before the model generates its answer.

Save it once, find it later

Save posts, articles and videos from any app to one searchable wall. Ideafex is free on the App Store, Google Play and the web at app.ideafex.si.

Download on the App StoreGet it on Google Play