404human Projects Writing Build logs Learning Books Progress
Rust · Zola
zsh · 404human@dev:~ Tab complete · ↑↓ history · type help

MCP vs API vs RAG: how to pick for AI apps

When to use a plain REST API, RAG retrieval, or an MCP server—decided by failure modes, latency, auth boundaries, and how real apps combine them.

Published
Read time
5 min read
Kind
guide
Topics

Teams building AI features keep asking MCP vs API and MCP vs RAG as if they are three rival ways to do the same job. They aren’t. Treating them as substitutes is how you end up wrapping a fast, cacheable HTTP endpoint in an unnecessary agent protocol—or stuffing a live database query into a stale vector index.

Here is the clean way to separate them:

  • A REST/HTTP API is how deterministic code talks to a service.
  • RAG (Retrieval-Augmented Generation) is how you search large corpora and inject the top relevant chunks into a prompt.
  • MCP (Model Context Protocol) is a standard tool-discovery and execution protocol so AI clients can inspect schemas and take live, permission-checked actions against your app.

Most serious production systems use all three together—each in the one place where the other two fail.

Quick decision table (decided by failure modes)

DimensionPlain REST / GraphQL APIRAG (Search + Prompt Context)MCP Server (Tools + Resources)
CallerYour backend, frontend, CLI, or cron jobYour retrieval pipeline before calling the LLMAn AI client or agent loop (Claude, Codex, custom harness)
Best jobHigh-throughput reads, CRUD, webhooks, CDN-cached deliverySearching thousands of docs, tickets, or manuals semantically/lexicallyLive, multi-step lookups and approval-gated write actions across external AI clients
Schema discoveryStatic docs / OpenAPI written for human devsNone—returns text chunksDynamic runtime discovery (tools/list JSON Schema)
Latency & costMilliseconds, zero LLM tokensRetrieval latency + prompt tokens for chunksExtra LLM turns + tool schema tokens on every request
CachingTrivial (CDN, HTTP ETag, edge cache)Cacheable per query/corpus snapshotMostly uncached, user-scoped, interactive
Primary failure modeEvery new AI client needs bespoke glue codeStale index, bad chunk boundaries, cannot act or verify live stateToken bloat from large tool catalogs, prompt injection into write tools, proxy/auth friction

MCP vs REST API: why MCP sits on top of your API

A common mistake in 2026 is trying to replace internal REST APIs with MCP servers. That breaks down quickly for three reasons:

  1. Deterministic software doesn’t need runtime schema discovery. If your checkout service needs to create an invoice, calling POST /v1/invoices directly is faster, statically typed, and testable without an LLM in the middle.
  2. HTTP caching disappears. Public content APIs and static builds can serve millions of reads from an edge CDN in milliseconds. Routing ordinary website reads through an MCP JSON-RPC session throws away caching and adds session overhead.
  3. Every MCP tool costs prompt tokens. Sending 40 tool schemas on every turn consumes context window budget before the user even finishes typing.

Where MCP beats a plain REST API: when external AI clients you don’t control (Claude, Codex, IDE agents, enterprise assistants) need to connect to your app safely without writing a custom plugin per client. You build one MCP adapter over your existing domain logic—with user-scoped OAuth and draft-only guardrails—and every MCP client can immediately discover and use it (see how to build an MCP server).

MCP vs RAG: live actions vs. searching big corpora

Comparing RAG vs MCP usually exposes a confusion between transport and retrieval:

  • RAG is a retrieval strategy. When you have 50,000 support articles, legal PDFs, or documentation pages, an LLM cannot read them all into context. RAG indexes them (BM25 full-text search, embeddings, or hybrid search) and pulls the top k snippets into the prompt.
  • MCP is a connection protocol. An MCP server can expose a RAG search tool (search_docs(query)) alongside live action tools (create_draft, get_order_status).

Look at where each one fails if used alone:

ScenarioWhat happens with RAG aloneWhat happens with MCP alone (no search index)
“What is our refund policy across 10,000 help docs?”Works well: hybrid search finds the right 3 chunks fast.Fails or burns tokens: listing and reading files one by one blows the context window.
“What is the live status of order #4821, and draft a refund?”Fails: vector indexes lag live transactional state and cannot execute writes.Works well: calls live DB query + creates a draft refund for human approval.
“Fix a typo in post #14 on our live CMS.”Impossible: RAG is read-only retrieval.Works well: targeted patch tool with optimistic locking + approval gate.

Rule of thumb: Use RAG to narrow a huge unstructured corpus down to a few candidate passages. Use MCP to give an AI client structured, permissioned access to live state and actions—including calling your search index as a tool.

How a real production system combines all three

In Colophon CMS, each layer stays in its own lane instead of forcing one protocol to do everything:

Public readers ──► Static HTML / CDN / REST delivery (fast, cached, zero LLM cost)
                         ▲
                         │ (publishes numbered release receipts)
                         │
Core CMS domain ◄──► PostgreSQL (RLS tenant isolation + full-text search)
                         ▲
                         │ (OAuth 2.1 + role-scoped draft/edit tools)
                         │
AI clients (Claude) ──► Remote MCP Server (/mcp)
                         ├─ read / search tools (retrieval over entries)
                         ├─ targeted edit_entry (optimistic locking)
                         └─ publish / delete gated behind human approval
  1. Public delivery uses static builds and HTTP—not MCP—so readers get fast, cacheable HTML carrying its release receipt.
  2. Search/retrieval narrows down entries before returning bounded slices, avoiding dumping full tables or 85 KB bodies into context.
  3. Remote MCP (colophonapp.404human.dev/mcp) handles authenticated AI workflows, letting a signed-in editor draft and patch posts while enforcing role permissions, rate limits, and human approval on publishes (see securing MCP servers for AI agents).

How to decide in 30 seconds

  • Choose a plain REST / HTTP API if deterministic code is the caller, you need CDN/HTTP caching, or latency and strict SLAs matter.
  • Choose RAG (full-text or hybrid search) if your main problem is finding relevant passages inside a large document corpus before answering a question.
  • Choose an MCP server if multiple AI clients or agent loops need standardized, live access to your app’s tools—especially when calls must be user-authenticated, bounded, and audited.
  • Combine them when an AI client needs both knowledge and action: keep your domain logic behind your core service/API, expose a small, focused set of MCP tools (including a search tool backed by your retrieval index), and keep destructive actions behind explicit human approval.

Frequently asked questions

Does MCP replace RAG? No. MCP is a protocol for connecting AI clients to tools and data sources; RAG is a technique for searching large text corpora and feeding relevant snippets to a model. In practice, many MCP servers expose a RAG-backed search tool so an agent can retrieve context on demand.

Is MCP slower than a REST API? Yes, because MCP adds JSON-RPC session overhead and—more importantly—lives inside an LLM reasoning loop where every tool call requires another model inference round-trip. Keep app-to-app and user-facing reads on plain HTTP/REST, and reserve MCP for AI-driven workflows.

When should I build my own agent loop vs. an MCP server? Build an agent loop when you own the user interface and want full control over prompts, budgets, and retries (see how to build an AI agent without a framework). Build an MCP server when you want existing AI clients like Claude or Codex to plug into your product cleanly.

Related reading