RAG vs MCP: Which One Should Your Agent Use?

OpenRouter ·

RAG vs MCP: Which One Should Your Agent Use?

When you connect an agent to company data, the RAG vs MCP choice comes down to who does the fetching. With retrieval-augmented generation (RAG), your application pulls matching text from an index once, before the model sees the question. With the Model Context Protocol (MCP), the model calls tools during its turn and asks for exactly the records it needs, as many times as it needs.

To see how that difference plays out, we gave vector RAG, hybrid RAG, and an agent with two MCP tools the same product catalog and the same 40 questions, and ran each setup on two models. This article covers how each approach works, what the test showed, and the tool-design bug that broke one of the models, so you can decide when to use RAG, MCP tools, or both.

What is the difference between RAG and MCP?

RAG is a pattern for putting retrieved text into a prompt before you call the model. MCP is a protocol for describing tools so the model can fetch data itself.

In a RAG pipeline, you split documents into chunks and embed them into an index ahead of time with an embeddings API. For each question, you retrieve the most similar chunks, narrow them down with a rerank model, and send what’s left to the LLM. Retrieval happens once. If the chunks miss a detail, the model has no way to ask for more.

With MCP, a server advertises tools, each with a name, a description, and a JSON schema for its arguments. The model picks a tool and fills in the arguments, the client runs the call against a database, API, or search index, and the result goes back to the model. The model can then call another tool or answer. It gets the data at the moment it asks for it.

RAG and MCP don’t compete. RAG decides which text goes into a prompt, and MCP gives the model tools to call. An MCP server can even wrap a RAG index as a search tool.

Our Agent SDK (@openrouter/agent) runs the tool loop for you. The @openrouter/mcp package connects to remote MCP servers over Streamable HTTP, falling back to Server-Sent Events (SSE), and its createMCPTools helper passes their tools to callModel. Local stdio servers aren’t supported.

How we tested RAG vs MCP

We ran all three setups through our API on October 22, 2026, against a generated catalog for a fictional outdoor brand. The catalog comes in two sizes: 3,000 products (about 340K tokens) and 80 products (about 9K tokens). Each product has one short page with its name, SKU, category, price, weight, warranty, and first year sold. Some pages also have a “Compatible with” line naming other products.

We wrote 40 questions with exact answers for the 3,000-product catalog (37 for the smaller one), in three types:

  • 16 single-fact lookups, such as “What is the warranty on product CX-10101?” and “How many grams does the Tundra Ridge Tent weigh?”
  • 12 two-hop lookups, such as “What is the list price of the backpack that the Willow Cedar Trekking Pole lists first under Compatible with?”
  • 12 whole-catalog counts or extremes, such as “How many tents have a warranty of exactly 2 years?” and “What is the SKU of the lightest sleeping bag?”

Every test ran on two answer models with reasoning.effort: “low”: OpenAI GPT-6 Luna (openai/gpt-6-luna) and DeepSeek V4.1 Flash (deepseek/deepseek-v4.1-flash).

For RAG, we embedded the pages with mongodb/voyage-4-lite. Plain vector RAG took the top 30 chunks by vector similarity. Hybrid RAG took the top 15 vector matches plus the top 15 BM25 keyword matches. Both then used mongodb/rerank-3-lite to cut their candidates down to 5 chunks for the model.

For MCP, we wrote a small server over the same catalog, served over Streamable HTTP, with two tools:

  • get_product(sku_or_name) returns one product’s full record, including the names and SKUs of compatible products.
  • find_products(category?, warranty_years?, first_sold_year?, name_contains?, sort_by?, limit) filters and sorts the catalog. It returns the total number of matches and up to limit rows (max 50).

The agent called the Agent SDK’s callModel with those tools, the same answer rule as RAG, and a stop condition of stopWhen: stepCountIs(8). Token and cost figures come from getUsage() across every model call in the loop. RAG totals include the embedding and rerank calls.

Which approach answered more questions?

On the 3,000-product catalog, the agent with two MCP tools, which we built for these three question types, answered all 40 questions on both models. Vector RAG answered 8 or 9, and hybrid RAG answered 16.

ApproachGPT-6 Luna correctDeepSeek V4.1 Flash correctCost per 1,000 questions (Luna / DeepSeek)Input tokens per question (Luna / DeepSeek)Time per question (Luna / DeepSeek)
RAG8/409/40$0.21 / $1.43633 / 6837.8 s / 12.2 s
Hybrid RAG16/4016/40$0.19 / $0.91638 / 6885.6 s / 9.9 s
MCP tools40/4040/40$0.18 / $0.391,479 / 2,1784.1 s / 3.8 s

Splitting the scores by question type shows where RAG fell short (GPT-6 Luna / DeepSeek V4.1 Flash):

Question typeRAGHybrid RAGMCP tools
Single fact (16)8 / 916 / 1616 / 16
Two-hop (12)0 / 00 / 012 / 12
Whole-catalog (12)0 / 00 / 012 / 12

The smaller catalog told the same story. MCP tools scored 37/37 on both models, at $0.11 per 1,000 questions on GPT-6 Luna and $0.29 on DeepSeek V4.1 Flash, while vector RAG scored 26/37 and 27/37.

The agent sent two to three times as many input tokens as RAG. It averaged 2.3 to 2.4 model calls per question, and each call resends the conversation and the tool definitions. Even so, it cost about the same as hybrid RAG on GPT-6 Luna and less on DeepSeek V4.1 Flash, because every RAG question also pays for an embedding call and a rerank call. RAG cost far more on DeepSeek V4.1 Flash than on GPT-6 Luna with similar input tokens. That gap likely comes from output and reasoning tokens, which the table doesn’t show.

The agent was also faster on both models. The RAG timings include the embedding and rerank calls, which may account for part of the gap.

Why RAG missed SKU lookups, two-hop questions, and counts

RAG retrieves five chunks once, before the model runs. Our three question types each ran into a different limit of that design.

Eight of the 16 single-fact questions named a product by SKU, such as CX-10101. A SKU is a string with no meaning for an embedding model to match on. For those questions, the right product page ranked anywhere from 276th to 2,718th of 3,000 by vector similarity, so it never made the top 30 sent to the reranker. GPT-6 Luna missed all 8, and DeepSeek V4.1 Flash missed 7. Adding BM25 keyword search fixed this, and hybrid RAG scored 16/16 on single facts with both models. Our Reranking in RAG article measures the same hybrid search and rerank fix.

Neither RAG setup answered any two-hop or whole-catalog question. Take the trekking pole question. Retrieval runs once, on the question text, so it can find the trekking pole’s page but not the backpack’s, which only becomes relevant after you’ve read the first page. Counts fail for a simpler reason. There are 375 tents in the catalog, and five retrieved chunks can’t tell you how many of them carry a 2-year warranty.

The MCP agent worked through the same questions one step at a time. For the trekking pole question, it called find_products to locate the pole by name, then get_product to read its record and get the compatible backpack’s SKU, then get_product again to read the backpack’s price. For the tent count, it made a single find_products call with category and warranty_years and read total_matches from the response.

That 40/40 depends on the tools fitting the questions. Our catalog is structured, and a question that get_product and find_products can’t express would still fail.

What broke our MCP server on one model

The 40/40 didn’t come on the first run. With the first version of our server, GPT-6 Luna scored 0 of 12 on whole-catalog questions (27 of 39 completed questions; one two-hop request hit a socket error), while DeepSeek V4.1 Flash had no trouble.

The trace showed why. Our original find_products described every filter as optional, and its JSON schema marked none as required. GPT-6 Luna filled them all in anyway, sending 0 or an empty string whenever it meant “no filter”. Here’s its call for “How many tents have a warranty of exactly 2 years?”:

find_products({“category”:“tent”,“warranty_years”:2,“first_sold_year”:0,“name_contains”:"",“sort_by”:“weight_asc”,“limit”:50}) -> {“total_matches”:0,“rows”:[]}

The server treated first_sold_year: 0 and name_contains: "" as real filters and found no matches. GPT-6 Luna read total_matches and answered 0. The true answer is 79.

DeepSeek V4.1 Flash never sent a 0 or empty filter in any of its 117 test questions (40 against each server version, plus 37 on the small catalog), and it scored 40/40 against both versions of the server. The tools and schema were identical, so the difference came down to how each model fills in optional arguments.

We fixed it on the server. It now treats 0, empty strings, and negative numbers as “no filter”, and the tool description says so:

leave out any filter you do not need (0 or an empty string also means no filter)

With that change, GPT-6 Luna went from 0/12 to 12/12 on whole-catalog questions and 40/40 overall.

Tool descriptions and schemas work like prompts, and models read them differently. Test your MCP tools with every model you plan to run, check the arguments each one sends in your logs, and make your server forgiving of default values. We only caught this bug because we ran the same tool set on two models through one OpenRouter API key.

When to use RAG, MCP, or both

Use MCP tools when your data is structured or sits behind an API, such as a database or a product catalog. Tools also fit when questions need exact lookups, counts, or filters, or when the data changes and has to be read live.

Use RAG for unstructured text where the question is about meaning, such as policies, documentation, or support articles. Make it hybrid so exact identifiers like SKUs still get found.

Use both when questions over unstructured text need more than one lookup. Expose your RAG index as an MCP search tool, and the model can search, read the chunks, and search again.

Whichever you choose, measure it on your own questions with exact answers, on each model you plan to run.

Next steps

To expose your own data as tools, start with the Agent SDK MCP tools documentation, which covers connecting remote Streamable HTTP and SSE servers, and the stop conditions page for settings like stepCountIs. If your data is unstructured text, see the API reference for embeddings and rerank, and follow our RAG with Embeddings & Rerank cookbook for the full code. Our RAG vs CAG comparison runs on the same catalog. You can also connect the OpenRouter MCP server to your editor or coding assistant while you build.

Frequently asked questions

Is RAG obsolete with MCP?

No. RAG retrieves unstructured text, while MCP is a protocol for giving a model tools, so they solve different problems. Documentation, policy manuals, and other large bodies of prose still need embeddings, keyword search, and reranking. You can wrap that index in an MCP tool so the model searches it on demand.

Is MCP better than RAG?

MCP tools beat single-pass RAG when questions need exact lookups, counts, or filters over structured data. In our test on a 3,000-product catalog, an agent with two MCP tools built for the test’s question types answered 40 of 40 questions for $0.18 to $0.39 per 1,000 questions. Hybrid RAG answered 16 of 40 for $0.19 to $0.91. When one semantic search over unstructured text finds the right paragraph, hybrid RAG works well on its own.

Do RAG pipelines use MCP?

Not by default. A standard RAG pipeline runs retrieval in your application code before it calls the model. You can, however, expose a RAG retriever as a tool on an MCP server, which turns retrieval from one up-front step into a search tool the model can call as often as it needs.

By subscribing you agree to receive the OpenRouter newsletter: model usage data, product updates, and research reports, about one email a week. Unsubscribe anytime via the link in every email. See our Privacy Policy.