Explain how MCP differs from RAG and when to choose each approach
Explain the difference between MCP and RAG. At what level of abstraction does each operate, and give an example of when you would choose one over the other?
RAG is a retrieval pattern that injects documents into the prompt before generation; MCP is a connection protocol exposing tools, resources, and prompts at runtime. Different layers, not rivals.
Picture a chef cooking dinner. RAG is the prep cook who, before service, reads the order and lays the right ingredients on the counter so the chef can grab them. MCP is the standardized kitchen wiring: the gas line, the power sockets, the fridge handle, that let the chef reach for any appliance mid-cook without rebuilding the kitchen for each brand. RAG happens up front, fetching the right notes into the prompt. MCP happens live, letting the model phone out to tools while it works. A retrieval step can even be one of the appliances MCP plugs in. So they are not competing recipes. One is about staging the right context early. The other is about how the kitchen connects to everything it can touch during the cook.
Detailed answer & concept explanation~7 min readEverything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: RAG as pre-generation retrieval pattern, MCP as runtime connection protocol, the layering, RAG-as-an-MCP-tool, and when to pick each.
| Concern | RAG | MCP |
|---|---|---|
| What it is | Retrieval pattern | Connection protocol |
| When it acts | Before generation, one shot | During generation, runtime |
| Who triggers it | The pipeline, pre-prompt | The model, via tool calls |
| Scope | Fetch documents into context | Tools, resources, and prompts |
| Side effects | None, read-only lookup | Allowed, tools can mutate state |
| Containment | Can be wrapped as one MCP tool | Can host many tools, including RAG |
Real products, models, and research that use this idea.
- Claude Code discovers MCP servers at session start, then the model invokes their tools mid-task over JSON-RPC.
- A vector-search MCP server wrapping a Pinecone or pgvector retriever turns classic RAG into an on-demand tool call.
- Cursor exposes both pre-prompt codebase retrieval and MCP tool servers, showing the two layers running side by side in one product.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhen you wrap a retriever as an MCP tool, what changes about how and when retrieval happens?
QIf a task only needs grounded document lookup, why might adding MCP be the wrong call?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Treating MCP and RAG as alternatives. RAG is a retrieval pattern; MCP is a connection protocol, and an MCP tool can run RAG internally.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.