Back to all articles
11 min read

Prompt Caching & MCP Protocol: Production AI Optimization

By Dorian Laurenceau

Updated

πŸ“… Last reviewed: April 24, 2026. Updated with April 2026 findings and community feedback.

Prompt Caching & MCP: Optimizing AI for Production

You have built a powerful AI system. It works beautifully... for $0.15 per query. At 100,000 queries per day, that is $15,000 daily. Production AI is an optimization problem: how do you maintain quality while reducing cost and latency? Prompt caching and the Model Context Protocol (MCP) are two key tools for this challenge.

The part of prompt caching nobody optimises for (until it bites)

The standard pitch is caching = save 80-90% on tokens. True. What gets left out of most write-ups, and what engineers on r/LangChain and r/OpenAI keep learning the hard way, is that caching is only a win when your cache hits. And whether it hits depends on architectural choices that look innocent until you measure them.

Three concrete traps worth naming:

  • β†’TTL asymmetry is real. Anthropic's default TTL is 5 minutes, OpenAI's 1 hour, Google's in between. If your traffic is bursty with 10+ minute quiet periods, Anthropic's cache will evaporate between bursts and your "savings" will quietly vanish. Anthropic's prompt caching docs now offer 1-hour cache tiers at a premium β€” worth the math for quiet-but-steady workloads.
  • β†’Cache boundaries must match change frequency. If you shuffle RAG chunks into a different order between requests, the cache breaks. Sort retrieved chunks by a stable key (document ID) before concatenating; this single change has single-handedly saved teams five-figure monthly bills.
  • β†’Dynamic system prompts are a silent cache killer. Injecting the current timestamp or a user ID into the system prompt seems harmless. It invalidates the cache on every request. Move anything dynamic to the end of your prompt, always.

On the MCP side, the official Model Context Protocol spec is short and readable; if you're still writing bespoke function schemas per vendor in 2026, you're building tech debt. The MCP announcement from Anthropic is worth five minutes to understand why this standard won the race.

Prompt Caching: Stop Paying Twice for the Same Tokens

Every API call sends your system prompt + RAG context + conversation history. If your system prompt is 2,000 tokens and stays the same across all queries, you are paying for those 2,000 tokens every single time. Prompt caching tells the API: "I already sent this prefix, just reuse it."

How Prompt Caching Works

From repeated payment to cached efficiency

Without Caching

Every request sends the full context. For a 10,000-token context window where 8,000 tokens are static (system prompt + knowledge base), you pay for 8,000 repeated tokens on every query.
code
Request 1: [8000 static tokens] + [2000 dynamic tokens] = 10,000 tokens billed
Request 2: [8000 static tokens] + [2000 dynamic tokens] = 10,000 tokens billed
Request 3: [8000 static tokens] + [2000 dynamic tokens] = 10,000 tokens billed

Total: 30,000 tokens billed for 6,000 tokens of unique content

πŸ’‘ 80% of your token spend is WASTED on resending identical content.

1/4
Quick Check

What is the best way to maximize cache hit rates?

MCP: The Model Context Protocol

Before vs After MCP

AspectBefore MCPWith MCP
Tool IntegrationCustom code for every tool and every modelStandard protocol: write once, works with all models
Adding a New ToolDays of custom developmentHours: implement the MCP server spec
Switching ModelsRewrite all tool integrationsJust point MCP at the new model
Tool DiscoveryHardcoded tool listsDynamic: model discovers available tools at runtime
SecurityAd hoc per integrationStandardized auth, permissions, and scoping

← Scroll horizontally β†’

MCP Architecture

How the protocol connects models to tools

MCP Server

Each tool or data source runs an MCP server that describes its capabilities: what tools it offers, what parameters they accept, and what they return.
code
MCP Server: 'Weather Service'
Tools:
  - get_weather(city, units)
  - get_forecast(city, days)
Resources:
  - weather://cities -> list of supported cities
  - weather://alerts -> active weather alerts

πŸ’‘ An MCP server is a standardized wrapper around any API or data source.

1/4
Loading diagram…

Production Optimization Checklist

Click to expand
Click to expand

Test Your Understanding

Question 1 of 5.

Prompt Caching & MCP Knowledge Check

0 / 5 answered

Q1.How much can prompt caching reduce API costs?

5 questions remaining

Congratulations!

You have completed Module 9 and the entire advanced AI curriculum. You now understand:

  • β†’Context engineering, designing the information environment for AI
  • β†’Lost-in-the-middle, position effects and optimization
  • β†’Production optimization, caching, MCP, and cost management

These are the skills that separate prompt hobbyists from production AI engineers.


Return to the Module 9 overview to review your progress and explore next steps.

Go deeper β€” free guide

Module 9 β€” Context Engineering

Master the art of managing context windows for optimal results.

D

Dorian Laurenceau

Full-Stack Developer & Learning Designer

Full-stack web developer and learning designer. I spent 4 years as a freelance full-stack developer and 4 years teaching React, JavaScript, HTML/CSS and WordPress to adult learners. Today I design learning paths in web development and AI, grounded in learning science. I founded learn-prompting.fr to make AI practical and accessible, and built the Bluff app to gamify political transparency.

Prompt EngineeringLLMsFull-Stack DevelopmentLearning DesignReact
Published: March 9, 2026Updated: April 24, 2026

One practical AI workflow in your inbox

Methods, resources and new exercises. Free, unsubscribe at any time.

FAQ

What will I learn in this Advanced Techniques guide?+

Learn prompt caching strategies to reduce AI costs by 90%. Understand the Model Context Protocol (MCP) for standardized tool integration. Master production-grade AI system optimization.