RAG vs MCP: Where Retrieval Ends and the Tool Protocol Begins
RAG decides which passages a model reads. MCP is how an AI application finds and calls a system's tools. A retriever can become one MCP tool among several, and four decisions follow: where the search lives, who keeps it fresh, whose rows it returns, and who approves the call.
The RAG vs MCP question comes down to this once a team adds MCP to its product: does the RAG pipeline we already built still have a job? Our own matcher answers it with one function.
Its hybrid search is a single Python function with two callers: a plain HTTP endpoint calls it once per request, and a LangGraph agent holds it as a tool and decides how many times to call it. The agentic RAG post in this series walks through that agent's graph. Put that function behind an MCP server and Claude, Cursor or any other MCP client could discover it and call it too, with the ranking exactly as it is today.
Here is the plain version. RAG, retrieval-augmented generation, is a technique: find the passages that answer a question and put them in front of the model, so it answers from your documents. MCP, the Model Context Protocol, is a standard for how an AI application discovers a system's tools and data and calls them, so one integration works in every client that speaks it. RAG shapes what the model reads, while MCP is plumbing between the application and your systems, and a retriever can sit behind that plumbing as one tool among several.
In practice the question comes up in five situations, and only one of them is a true either-or:
- The answers live in documents. A help centre, a policy library, a product manual: you need search over an index you maintain. That is RAG, and MCP is one optional way to reach it.
- The answers live in a system of record. Order status, an open ticket, an account balance: the model should read the current row through a tool call, because an index holds yesterday's copy. That is an MCP tool or a plain API call, and retrieval drops out.
- The agent needs both. The support agent below searches the help centre, reads an order and issues a refund. Your retriever becomes one tool next to live reads and writes, and the four decisions in this post apply.
- A vendor already ships an MCP server with search. This is the true either-or: the vendor's search or your own index of the same data, which trades their freshness and permissions against your control of ranking and cost.
- The agent loads dozens of tools. Now the host needs retrieval to pick the right tool, which the section near the end covers.
The two-column comparison is the easy part. The decisions that cost a team weeks come right after it: where the search lives, who keeps its index fresh, whose rows it may return, and which calls a person approves before they run. The current MCP specification, revision 2026-07-28, says something specific about each of them, and the incidents later in this post show what each one costs when it is left to a default.
A vector index behind an MCP server is still RAG, with a JSON-RPC hop and a permissions question in front of it.
RAG and MCP answer different questions
RAG is the older idea. Patrick Lewis and eleven co-authors named it in a 2020 paper that paired a generator with a dense vector index of Wikipedia, and Lewis later told NVIDIA the team would have put more thought into the name had they known how far it would travel. The technique leaves transport open. Retrieval can be a function call in your code, a query to a vector database or a request to a search service; RAG only asks that the right passages reach the prompt.
MCP is younger. Anthropic open-sourced it on 25 November 2024 as a standard for connecting AI assistants to the systems where data lives, and the Linux Foundation took it into its new Agentic AI Foundation on 9 December 2025, alongside Block's goose and OpenAI's AGENTS.md, citing more than 10,000 published MCP servers.
The protocol is JSON-RPC between three parties: a host (the AI application), a client inside it, and servers that expose a system. Servers offer three kinds of things, and the specification defines them by who is meant to use them: resources are context and data, prompts are templates for users, and tools are functions for the model to execute.
The split that matters for RAG vs MCP is who decides. The spec calls tools model-controlled: the model reads the tool list and decides when to call one. It calls resources application-driven: the host application decides what enters the context. Classic RAG is the second pattern, where your code runs the search before the model sees the question. Wrap the same search in a tool and it becomes the first, where the model decides whether to search at all.
Douwe Kiela, a co-author of the 2020 paper and now CEO of Contextual AI, put the overlap plainly in an interview with Richard MacManus: a vector database that the model uses through MCP, in his words, "that is RAG".
| RAG | MCP | |
|---|---|---|
| What it is | A technique: retrieve passages, then generate from them | A protocol: JSON-RPC between an AI application and the servers that expose your systems |
| The question it answers | Which passages should the model read for this question? | How does an AI application find a system's tools and data, and call them? |
| Who decides when it runs | Your code, before the model, unless you wrap the search as a tool | The model, for tools; the host application, for resources |
| Where freshness lives | In the index: as fresh as the last ingestion run | In the system behind the server, read at call time |
| What fails first | The passage that answers the question sits outside the top results | The model calls the wrong tool, or the right tool returns another tenant's rows |
| How you test it | A golden set with hit rate, recall@k and MRR | Tool-call traces, a permissions test per caller, and a confirmation step on every write |
A retriever can become one tool among several
Take a support agent. It searches the help centre, reads the customer's open order from the order system, and sometimes issues a refund. Only the first of those is retrieval in the RAG sense. The other two are a live read and a write against systems of record, and MCP is a reasonable way to expose all three to the same model through one client.
Our matcher is the small version of this. It runs hybrid search on Qdrant, dense vectors plus SPLADE++ sparse vectors fused with reciprocal rank fusion, inside a LangGraph agent on durable Postgres state, self-hosted. In our build the search is one function: the plain search endpoint calls it once, and inside the agent a sub-agent holds it as its single tool and decides when to call it again. That tool already carries a name, a short description and a typed input model, which is most of what an MCP tool definition is.
Exposing it over MCP would add three things and leave the retrieval as it is. A transport: stdio for a client-launched subprocess, or Streamable HTTP for a service. Authorization, which the spec makes optional and builds on OAuth 2.1 for HTTP, with the MCP server acting as the resource server that validates each token. And discovery: a tools/list response that tells any client the tool's name, description and input schema. The index, the fusion and the ranking stay where they are, which is why the RAG work a team already did carries over intact.
Here is what that looks like on the wire, as one entry in a tools/list response. The shape follows the Tool and ToolAnnotations types in the 2026-07-28 schema; the tool itself is an illustration.
Hacker News has Show HN posts that wrap retrieval as an MCP server: a personal RAG MCP server, codebase RAG for coding agents, the MDN web docs as an offline RAG-MCP server. Each one puts a retriever where an MCP client can call it.
But a search that any authorized client can call raises four questions that a pipeline inside your own code answers implicitly.
Decision 1: where the search lives
There are five places to put a retriever, and each one moves the search a step further from your code.
| Placement | Who decides when it runs | Who owns ranking quality | Who can call it |
|---|---|---|---|
| In your code, before the model | Your code, on every turn | You | Your application |
| A tool inside your agent | The model, inside your agent | You | Your agent |
| A plain HTTP API or CLI | The model, through a tool or shell you gave it | You | Anything holding the credentials |
| Your own MCP server | The model, in any connected client | You | Every client you authorize |
| A vendor's MCP server | The model, in any connected client | The vendor | Whoever the vendor's auth admits |
Run the search in code when every answer has to be grounded. A policy bot that must quote the current policy should search on every turn, and making that a tool hands the model a choice you wanted to keep. Make it a tool inside your agent when retrieval is one of several things the agent might need, which is how our matcher does it.
The plain option is no protocol at all. With one client, a CLI or HTTP call can be enough: one Hacker News commenter finds them "waaay cheaper and faster", another reports long MCP round trips, and an r/mcp user reports switching to playwright-cli and a skill to save context.
Put it behind your own MCP server once more than one client needs the same search: an internal agent, Claude for the support team, an IDE for engineers, all reading one index with one ranking behind one authorization boundary. Use a vendor's MCP server when the data lives in the vendor's product and the vendor's search is the one that sees it.
The ownership column decides how you test it. For the first four placements you own the ranking, so you can build a golden set and measure recall before and after every change. For the fifth, the vendor owns it, so run your own questions through it and read what comes back before you route answers through it.
Every MCP tool costs context, though. Most MCP clients load all tool definitions into context up front, and in Anthropic's own five-server example, 58 tools take about 55K tokens before a conversation starts. The bill shows up in accuracy too: LongFuncEval, a 2025 benchmark of several long-context models, measured a drop of 7% to 85% in tool-calling performance as the number of tools grew.
Results cost context too: in a plain tool loop every intermediate result passes through the model. One Hacker News commenter returns a truncated result plus a handle to query later, which suits a retriever.
Names collide as well: the spec's own example is two servers each exposing a search tool, and it asks clients that aggregate tools to tell them apart, for instance by prefixing a server identifier, because the name a server reports for itself is not guaranteed to be unique. A retriever called search next to three other tools called search turns tool choice into a coin toss. Give the retriever a specific name and a description that names the corpus and the return shape, because the description is what the model reads when it chooses.
Tool choice can drift silently too. One r/mcp report describes a model update that changed tool selection, unnoticed for about two weeks because "nothing throws an error". Alert on the retriever's call rate per client, because a model that skips it still answers.
Decision 2: who keeps the index fresh
An index is a copy. It is as fresh as the last ingestion run, and the gap between a document changing and the index knowing about it is a number the team owns from the day the search ships. A live MCP tool reads the system of record at call time, so the order status it returns is the status right now.
The protocol leaves that gap to the server. The 2026-07-28 revision added a ttlMs freshness hint, in milliseconds, to the results of list calls and resource reads, so a client knows how long it may cache them. Tool call results sit outside that interface, so the age of a search tool's index reaches the model only when the server's author writes it into each result.
Two habits close the gap. Return an indexed-at time with every passage, next to its source URL, so the model can date its answer and a reviewer can spot a stale one. And split finding from confirming: let the index find the right record by meaning or by exact terms, then call a live tool to read its current state before the agent acts on it. Search the help centre for the refund policy, then read the order from the order system, because the policy changes once a quarter and the order may have changed a minute ago.
Name the owner while you are at it: the job that re-indexes, what triggers it, and who is paged when it stalls, all settled before the tool reaches a second client. A shared tool carries a shared promise about freshness.
Once more than one client can call the search, the next question is whose data it may return.
Decision 3: whose rows come back
Inside your own application, the retriever runs with the application's credentials and filters by the signed-in user. Behind an MCP server, the caller is a client you authorized at some point, acting for a user you know only through a token. Authorization is optional in the MCP specification; when a server uses it over HTTP, it acts as an OAuth 2.1 resource server, checks that each token was issued for it, and accepts only tokens meant for its own resources.
That token is where the tenant filter belongs. A search tool's arguments are chosen by the model, so a tenant id in the input schema is a value the model can get wrong or be talked into changing. Read the tenant and the user's permissions from the token on the server, and apply them inside the search as a filter on the vector query, before ranking, so the candidate list holds only that tenant's chunks.
The spec lets tools/list vary by the caller's granted scopes, which is the same idea one level up: a caller sees only the tools it may use. Our post on row-level security for agents covers the database side of the same rule in LangGraph.
The spec's security guidance backs the rule from two more sides. A server that keeps state across calls should key that state by a user ID derived from the verified token. And a server accepts only tokens issued to it, so a retriever that fronts a vendor's search API calls that API with a token of its own, issued for that API, and the caller's token stops at the MCP server.
The same page recommends a small starting scope for low-risk reads, with a step-up when a privileged operation is first attempted. That puts a read-only search tool in the starting set and a refund behind the step-up.
Log each retrieval too, with caller, query and chunk ids: Simon Willison lists strong audit logging among his reasons to use MCP.
One hosted connector has already shown what a cross-tenant mistake costs. Asana rolled out its MCP server on 1 May 2025, found a vulnerability on 4 June and kept the feature offline from 5 to 17 June. Its notice to customers said the bug "could have potentially exposed" information from their Asana domain to other Asana MCP users, as The Register reported, and Asana reset every connection to the server.
Decision 4: which calls a person approves
A correct tenant filter still leaves the question of what the agent does next with what it read. The specification is direct about approval. For trust and safety it says there should always be a human in the loop with the ability to deny tool invocations, and that applications should show which tools are exposed and ask for confirmation on operations.
Tools carry annotations such as readOnlyHint and destructiveHint, and the schema's defaults are pessimistic: an unannotated tool counts as one that may change its environment, destructively. The same schema calls every annotation a hint and tells clients to base tool-use decisions only on annotations from servers they trust.
So mark the retriever read-only and still treat the label as a claim. Writes are the easy half of the policy: anything that sends, pays, deletes or publishes gets a confirmation the user can refuse.
The read is the harder half, because what the model reads can steer what it calls next. In Invariant Labs' GitHub MCP disclosure of 26 May 2025, a malicious issue in a public repository steered the agent, through the official GitHub MCP server and the user's own tools, into the user's private repositories, and the data came out in a pull request on the public one. Invariant places the flaw at the agent system level and reports it even with fully trusted tools. The injection arrived as ordinary content, the kind a retriever returns all day.
Tool poisoning, which Invariant described the month before, moves the instruction into the tool description itself: their demo add tool told Cursor to read ~/.ssh/id_rsa and pass it in an argument hidden from the user. A retrieval tool adds one more channel, since a planted document in the index is text the model reads as context, with whatever instructions it carries.
The rule we would write into an agent is short. Confirm every write. Confirm any call that sends data across a trust boundary once untrusted text has entered the context in that session, whether the text came from an issue, an email or a retrieved chunk. Pin server versions and re-read tool descriptions when they change, since a description is an instruction the model follows by reading it.
Enforce it outside the prompt too: an r/ClaudeAI commenter reports a database role that "literally can't write". Another in that thread says approvals turn to theater by the thirtieth ping of the day, so keep reads out of the queue.
When the tool list grows, the host needs retrieval too
The composition also runs in the other direction. Once an agent holds dozens of tools, picking the right one is itself a retrieval problem. Anthropic's answer, the Tool Search Tool on the Claude Developer Platform, keeps most tool definitions out of the prompt and searches them on demand, with regex and BM25 variants built in and room for a custom search, embeddings included. Anthropic puts the token saving at 85%, and in its internal MCP evaluations with large tool libraries, accuracy for Opus 4.5 rose from 79.5% to 88.1% with the tool search switched on.
The research version of the idea carries this post's search phrase as its name. In RAG-MCP, Gan and Sun indexed MCP server descriptions in a vector store and put only the retrieved server's schema in the prompt. On a web-search subset of MCPBench with a single model, tool-selection accuracy rose from 13.62% to 43.13% and average prompt tokens fell from about 2,134 to 1,084. That is one model on one task family, so read the size of the gain as indicative; the authors also report that retrieval precision degrades as the registry grows into the thousands.
So the host ends up running a small RAG system over its own tool catalog: an index of tool descriptions, a query drawn from the conversation, and the top few definitions placed in the context. Write tool descriptions the way you would write chunks you want retrieved, with specific nouns, the corpus named and the return shape stated.
How to choose, in five questions
- Does every answer need grounding in your documents? Run retrieval in code, before the model.
- Is retrieval one of several things the agent might need? Make it a tool with a specific name and description.
- Do two or more clients need the same search? Put it behind your own MCP server, with OAuth on HTTP and the tenant read from the token. With one client, a plain API call or CLI can be enough.
- Does the answer depend on state that changed in the last hour? Find with the index, confirm with a live tool, and return an indexed-at time with every passage.
- Can the call write, pay, send or delete? Put a person in front of it, and treat everything the agent read in that session as untrusted.
FAQ
Does MCP replace RAG? MCP and RAG sit at different layers, so a team adding MCP keeps its retrieval. RAG decides which passages the model reads, and MCP is the protocol an AI application uses to discover and call a system's tools and data. A retriever can become one MCP tool among several, next to live reads and writes against systems of record, and the index, the chunking and the ranking carry over as they are.
Is RAG over MCP still RAG? Yes. Retrieval-augmented generation describes what happens to the prompt: passages are retrieved and the model answers from them. Douwe Kiela, a co-author of the 2020 RAG paper, said of a vector database the model uses through MCP, in an interview with Richard MacManus, "that is RAG". MCP changes who can call the search and how, which brings authorization, discovery and approval into scope.
When should I use RAG instead of a live MCP tool? Use an index when the content is mostly text, changes slowly and has to be found by meaning or by exact terms across many documents: policies, manuals, contracts, past tickets. Use a live tool when the answer is current state in a system of record: an order, a ticket status, a calendar. An agent can use both in sequence, searching the index to find the right record and then reading that record live before acting on it.
Is data from an MCP server fresher than RAG? A live MCP tool reads the system at call time, so its result is current. A search tool served over MCP is as fresh as the index behind it. The 2026-07-28 MCP revision added a ttlMs freshness hint to list results and resource reads, and tool call results sit outside it, so return an indexed-at time with every passage and name the owner of the re-indexing job.
How do I keep a shared retrieval tool from returning another tenant's data? Take the tenant and the user's permissions from the caller's access token on the server and apply them as a filter inside the vector query, before ranking. Keep tenant ids out of the tool's input schema, since the model fills in those arguments. The MCP authorization spec is optional, and when a server adopts it over HTTP the server becomes an OAuth 2.1 resource server that checks each token was issued for it; the tools spec also lets the tool list vary by the caller's scopes.
How do I expose an existing retriever as an MCP tool? Wrap the search function in a tool with a specific name, a description that names the corpus and the return shape, and a JSON Schema input that holds only the query and the limit. Serve it over stdio for a local client or Streamable HTTP for a shared service, add OAuth on HTTP, read the tenant from the token, mark it read-only, and return the source and an indexed-at time with every passage. Then measure it on the same golden set you used before it moved.
Do I need a vector database if I use MCP? If the agent has to find passages by meaning across a document collection, yes: MCP gives the model a way to call a search, and the search still needs an index behind it. A vendor's MCP server that offers search runs a search engine of its own on the vendor's side, an index or a query layer. A small corpus that fits in the context window, or data the agent only ever looks up by id, can skip the index.
What 2muchcoffee covers
We build production RAG systems and AI agents, grounded and evaluated. The four decisions in this post are the first architecture questions we work through when we scope a tool-using, RAG-grounded agent. The plain way in is the AI work we do.
One concrete action
Open the tool list your agent loads today and write three things next to each tool: who decides when it runs, how old its data can be, and who approves the call. A blank cell is a decision your system is already making by default, and the tool with the most blanks is the one to settle first.